| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef UI_BASE_IME_INPUT_METHOD_H_ | 5 #ifndef UI_BASE_IME_INPUT_METHOD_H_ |
| 6 #define UI_BASE_IME_INPUT_METHOD_H_ | 6 #define UI_BASE_IME_INPUT_METHOD_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/event_types.h" | 11 #include "base/event_types.h" |
| 12 #include "base/i18n/rtl.h" | 12 #include "base/i18n/rtl.h" |
| 13 #include "ui/base/ime/text_input_type.h" | 13 #include "ui/base/ime/text_input_type.h" |
| 14 #include "ui/base/keycodes/keyboard_codes.h" | 14 #include "ui/base/keycodes/keyboard_codes.h" |
| 15 #include "ui/base/ui_export.h" | 15 #include "ui/base/ui_export.h" |
| 16 | 16 |
| 17 namespace ui { | 17 namespace ui { |
| 18 | 18 |
| 19 namespace internal { | 19 namespace internal { |
| 20 class InputMethodDelegate; | 20 class InputMethodDelegate; |
| 21 } // namespace internal | 21 } // namespace internal |
| 22 | 22 |
| 23 class KeyEvent; |
| 23 class TextInputClient; | 24 class TextInputClient; |
| 24 | 25 |
| 25 // An interface implemented by an object that encapsulates a native input method | 26 // An interface implemented by an object that encapsulates a native input method |
| 26 // service provided by the underlying operating system, and acts as a "system | 27 // service provided by the underlying operating system, and acts as a "system |
| 27 // wide" input method for all Chrome windows. A class that implements this | 28 // wide" input method for all Chrome windows. A class that implements this |
| 28 // interface should behave as follows: | 29 // interface should behave as follows: |
| 29 // - Receives a keyboard event directly from a message dispatcher for the | 30 // - Receives a keyboard event directly from a message dispatcher for the |
| 30 // system through the InputMethod::DispatchKeyEvent API, and forwards it to | 31 // system through the InputMethod::DispatchKeyEvent API, and forwards it to |
| 31 // an underlying input method for the OS. | 32 // an underlying input method for the OS. |
| 32 // - The input method should handle the key event either of the following ways: | 33 // - The input method should handle the key event either of the following ways: |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 // Gets the current text input client. Returns NULL when no client is set. | 73 // Gets the current text input client. Returns NULL when no client is set. |
| 73 virtual TextInputClient* GetTextInputClient() const = 0; | 74 virtual TextInputClient* GetTextInputClient() const = 0; |
| 74 | 75 |
| 75 // Dispatches a key event to the input method. The key event will be | 76 // Dispatches a key event to the input method. The key event will be |
| 76 // dispatched back to the caller via | 77 // dispatched back to the caller via |
| 77 // ui::InputMethodDelegate::DispatchKeyEventPostIME(), once it's processed by | 78 // ui::InputMethodDelegate::DispatchKeyEventPostIME(), once it's processed by |
| 78 // the input method. It should only be called by a message dispatcher. | 79 // the input method. It should only be called by a message dispatcher. |
| 79 virtual void DispatchKeyEvent(const base::NativeEvent& native_key_event) = 0; | 80 virtual void DispatchKeyEvent(const base::NativeEvent& native_key_event) = 0; |
| 80 | 81 |
| 81 // TODO(yusukes): Add DispatchFabricatedKeyEvent to support virtual keyboards. | 82 // TODO(yusukes): Add DispatchFabricatedKeyEvent to support virtual keyboards. |
| 83 virtual void DispatchFabricatedKeyEvent(const ui::KeyEvent& event) = 0; |
| 82 | 84 |
| 83 // Called by the focused client whenever its text input type is changed. | 85 // Called by the focused client whenever its text input type is changed. |
| 84 // Before calling this method, the focused client must confirm or clear | 86 // Before calling this method, the focused client must confirm or clear |
| 85 // existing composition text and call InputMethod::CancelComposition() when | 87 // existing composition text and call InputMethod::CancelComposition() when |
| 86 // necessary. Otherwise unexpected behavior may happen. This method has no | 88 // necessary. Otherwise unexpected behavior may happen. This method has no |
| 87 // effect if the client is not the focused client. | 89 // effect if the client is not the focused client. |
| 88 virtual void OnTextInputTypeChanged(const TextInputClient* client) = 0; | 90 virtual void OnTextInputTypeChanged(const TextInputClient* client) = 0; |
| 89 | 91 |
| 90 // Called by the focused client whenever its caret bounds is changed. | 92 // Called by the focused client whenever its caret bounds is changed. |
| 91 // This method has no effect if the client is not the focused client. | 93 // This method has no effect if the client is not the focused client. |
| (...skipping 25 matching lines...) Expand all Loading... |
| 117 // ui::TEXT_INPUT_TYPE_NONE if there is no focused client. | 119 // ui::TEXT_INPUT_TYPE_NONE if there is no focused client. |
| 118 virtual TextInputType GetTextInputType() const = 0; | 120 virtual TextInputType GetTextInputType() const = 0; |
| 119 | 121 |
| 120 // Checks if the focused text input client supports inline composition. | 122 // Checks if the focused text input client supports inline composition. |
| 121 virtual bool CanComposeInline() const = 0; | 123 virtual bool CanComposeInline() const = 0; |
| 122 }; | 124 }; |
| 123 | 125 |
| 124 } // namespace ui | 126 } // namespace ui |
| 125 | 127 |
| 126 #endif // UI_BASE_IME_INPUT_METHOD_H_ | 128 #endif // UI_BASE_IME_INPUT_METHOD_H_ |
| OLD | NEW |