OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef WebInputMethodController_h |
| 6 #define WebInputMethodController_h |
| 7 |
| 8 #include "WebCompositionUnderline.h" |
| 9 #include "WebWidget.h" |
| 10 |
| 11 namespace blink { |
| 12 |
| 13 class WebString; |
| 14 template <typename T> |
| 15 class WebVector; |
| 16 |
| 17 class WebInputMethodController { |
| 18 |
| 19 public: |
| 20 enum ConfirmCompositionBehavior { |
| 21 DoNotKeepSelection, |
| 22 KeepSelection, |
| 23 }; |
| 24 |
| 25 virtual ~WebInputMethodController() {} |
| 26 // Called to inform the WebInputMethodController of a new composition text. |
| 27 // If selectionStart and selectionEnd has the same value, then it indicates |
| 28 // the input caret position. If the text is empty, then the existing |
| 29 // composition text will be canceled. |
| 30 // Returns true if the composition text was set successfully. |
| 31 virtual bool setComposition( |
| 32 const WebString& text, |
| 33 const WebVector<WebCompositionUnderline>& underlines, |
| 34 int selectionStart, |
| 35 int selectionEnd) |
| 36 = 0; |
| 37 |
| 38 // Called to inform the WebWidget that deleting the ongoing composition if |
| 39 // any, inserting the specified text, and moving the caret according to |
| 40 // relativeCaretPosition. |
| 41 virtual bool commitText(const WebString& text, int relativeCaretPosition) =
0; |
| 42 |
| 43 // Called to inform the WebWidget to confirm an ongoing composition. |
| 44 virtual bool finishComposingText(ConfirmCompositionBehavior selectionBehavio
r) = 0; |
| 45 }; |
| 46 |
| 47 } // namespace blink |
| 48 #endif |
OLD | NEW |