| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 [DartPackage="mojo_services"] | 5 [DartPackage="mojo_services"] |
| 6 module keyboard; | 6 module keyboard; |
| 7 | 7 |
| 8 struct CompletionData { | 8 struct CompletionData { |
| 9 int64 id; | 9 int64 id; |
| 10 int32 position; | 10 int32 position; |
| 11 string text; | 11 string text; |
| 12 string label; | 12 string label; |
| 13 }; | 13 }; |
| 14 | 14 |
| 15 struct CorrectionData { | 15 struct CorrectionData { |
| 16 int32 offset; | 16 int32 offset; |
| 17 string old_text; | 17 string old_text; |
| 18 string new_text; | 18 string new_text; |
| 19 }; | 19 }; |
| 20 | 20 |
| 21 enum SubmitAction { |
| 22 DONE, |
| 23 }; |
| 24 |
| 21 interface KeyboardClient { | 25 interface KeyboardClient { |
| 22 CommitCompletion(CompletionData completion); | 26 CommitCompletion(CompletionData completion); |
| 23 CommitCorrection(CorrectionData correction); | 27 CommitCorrection(CorrectionData correction); |
| 24 CommitText(string text, int32 newCursorPosition); | 28 CommitText(string text, int32 newCursorPosition); |
| 25 DeleteSurroundingText(int32 beforeLength, int32 afterLength); | 29 DeleteSurroundingText(int32 beforeLength, int32 afterLength); |
| 26 SetComposingRegion(int32 start, int32 end); | 30 SetComposingRegion(int32 start, int32 end); |
| 27 SetComposingText(string text, int32 newCursorPosition); | 31 SetComposingText(string text, int32 newCursorPosition); |
| 28 SetSelection(int32 start, int32 end); | 32 SetSelection(int32 start, int32 end); |
| 33 Submit(SubmitAction action); |
| 29 }; | 34 }; |
| 30 | 35 |
| 31 // Loosely modeled on Android InputType: | 36 // Loosely modeled on Android InputType: |
| 32 // http://developer.android.com/reference/android/text/InputType.html | 37 // http://developer.android.com/reference/android/text/InputType.html |
| 33 enum KeyboardType { | 38 enum KeyboardType { |
| 34 TEXT, | 39 TEXT, |
| 35 NUMBER, | 40 NUMBER, |
| 36 PHONE, | 41 PHONE, |
| 37 DATETIME, | 42 DATETIME, |
| 38 }; | 43 }; |
| 39 | 44 |
| 40 interface KeyboardService { | 45 interface KeyboardService { |
| 41 Show(KeyboardClient client, KeyboardType type); | 46 Show(KeyboardClient client, KeyboardType type); |
| 42 ShowByRequest(); | 47 ShowByRequest(); |
| 43 Hide(); | 48 Hide(); |
| 49 SetText(string text); |
| 50 SetSelection(int32 start, int32 end); |
| 44 }; | 51 }; |
| OLD | NEW |