blob: 3c1c8f66888195452b1038703c833ed08a2c10a0 [file] [log] [blame]
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
[DartPackage="mojo_services"]
module keyboard;
import "native_viewport/interfaces/native_viewport.mojom";
struct CompletionData {
int64 id;
int32 position;
string text;
string label;
};
struct CorrectionData {
int32 offset;
string old_text;
string new_text;
};
enum SubmitAction {
DONE,
};
interface KeyboardClient {
CommitCompletion(CompletionData completion);
CommitCorrection(CorrectionData correction);
CommitText(string text, int32 newCursorPosition);
DeleteSurroundingText(int32 beforeLength, int32 afterLength);
SetComposingRegion(int32 start, int32 end);
SetComposingText(string text, int32 newCursorPosition);
SetSelection(int32 start, int32 end);
Submit(SubmitAction action);
};
// Loosely modeled on Android InputType:
// http://developer.android.com/reference/android/text/InputType.html
enum KeyboardType {
TEXT,
NUMBER,
PHONE,
DATETIME,
};
[ServiceName="keyboard::KeyboardService"]
interface KeyboardService {
Show(KeyboardClient client, KeyboardType type);
ShowByRequest();
Hide();
SetText(string text);
SetSelection(int32 start, int32 end);
};
[ServiceName="keyboard::KeyboardServiceFactory"]
interface KeyboardServiceFactory {
CreateKeyboardService(
mojo.NativeViewportEventDispatcher& keyEventDispatcher,
KeyboardService& serviceRequest);
};