| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_CHROMEOS_H_ | 5 #ifndef UI_BASE_IME_INPUT_METHOD_CHROMEOS_H_ |
| 6 #define UI_BASE_IME_INPUT_METHOD_CHROMEOS_H_ | 6 #define UI_BASE_IME_INPUT_METHOD_CHROMEOS_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 | 21 |
| 22 // A ui::InputMethod implementation based on IBus. | 22 // A ui::InputMethod implementation based on IBus. |
| 23 class UI_BASE_EXPORT InputMethodChromeOS | 23 class UI_BASE_EXPORT InputMethodChromeOS |
| 24 : public InputMethodBase, | 24 : public InputMethodBase, |
| 25 public chromeos::IMEInputContextHandlerInterface { | 25 public chromeos::IMEInputContextHandlerInterface { |
| 26 public: | 26 public: |
| 27 explicit InputMethodChromeOS(internal::InputMethodDelegate* delegate); | 27 explicit InputMethodChromeOS(internal::InputMethodDelegate* delegate); |
| 28 virtual ~InputMethodChromeOS(); | 28 virtual ~InputMethodChromeOS(); |
| 29 | 29 |
| 30 // Overridden from InputMethod: | 30 // Overridden from InputMethod: |
| 31 virtual void OnFocus() OVERRIDE; | 31 virtual void OnFocus() override; |
| 32 virtual void OnBlur() OVERRIDE; | 32 virtual void OnBlur() override; |
| 33 virtual bool OnUntranslatedIMEMessage(const base::NativeEvent& event, | 33 virtual bool OnUntranslatedIMEMessage(const base::NativeEvent& event, |
| 34 NativeEventResult* result) OVERRIDE; | 34 NativeEventResult* result) override; |
| 35 virtual bool DispatchKeyEvent(const ui::KeyEvent& event) OVERRIDE; | 35 virtual bool DispatchKeyEvent(const ui::KeyEvent& event) override; |
| 36 virtual void OnTextInputTypeChanged(const TextInputClient* client) OVERRIDE; | 36 virtual void OnTextInputTypeChanged(const TextInputClient* client) override; |
| 37 virtual void OnCaretBoundsChanged(const TextInputClient* client) OVERRIDE; | 37 virtual void OnCaretBoundsChanged(const TextInputClient* client) override; |
| 38 virtual void CancelComposition(const TextInputClient* client) OVERRIDE; | 38 virtual void CancelComposition(const TextInputClient* client) override; |
| 39 virtual void OnInputLocaleChanged() OVERRIDE; | 39 virtual void OnInputLocaleChanged() override; |
| 40 virtual std::string GetInputLocale() OVERRIDE; | 40 virtual std::string GetInputLocale() override; |
| 41 virtual bool IsActive() OVERRIDE; | 41 virtual bool IsActive() override; |
| 42 virtual bool IsCandidatePopupOpen() const OVERRIDE; | 42 virtual bool IsCandidatePopupOpen() const override; |
| 43 | 43 |
| 44 protected: | 44 protected: |
| 45 // Converts |text| into CompositionText. | 45 // Converts |text| into CompositionText. |
| 46 void ExtractCompositionText(const chromeos::CompositionText& text, | 46 void ExtractCompositionText(const chromeos::CompositionText& text, |
| 47 uint32 cursor_position, | 47 uint32 cursor_position, |
| 48 CompositionText* out_composition) const; | 48 CompositionText* out_composition) const; |
| 49 | 49 |
| 50 // Process a key returned from the input method. | 50 // Process a key returned from the input method. |
| 51 virtual void ProcessKeyEventPostIME(const ui::KeyEvent& event, | 51 virtual void ProcessKeyEventPostIME(const ui::KeyEvent& event, |
| 52 bool handled); | 52 bool handled); |
| 53 | 53 |
| 54 // Resets context and abandon all pending results and key events. | 54 // Resets context and abandon all pending results and key events. |
| 55 void ResetContext(); | 55 void ResetContext(); |
| 56 | 56 |
| 57 private: | 57 private: |
| 58 class PendingKeyEvent; | 58 class PendingKeyEvent; |
| 59 | 59 |
| 60 // Overridden from InputMethodBase: | 60 // Overridden from InputMethodBase: |
| 61 virtual void OnWillChangeFocusedClient(TextInputClient* focused_before, | 61 virtual void OnWillChangeFocusedClient(TextInputClient* focused_before, |
| 62 TextInputClient* focused) OVERRIDE; | 62 TextInputClient* focused) override; |
| 63 virtual void OnDidChangeFocusedClient(TextInputClient* focused_before, | 63 virtual void OnDidChangeFocusedClient(TextInputClient* focused_before, |
| 64 TextInputClient* focused) OVERRIDE; | 64 TextInputClient* focused) override; |
| 65 | 65 |
| 66 // Asks the client to confirm current composition text. | 66 // Asks the client to confirm current composition text. |
| 67 void ConfirmCompositionText(); | 67 void ConfirmCompositionText(); |
| 68 | 68 |
| 69 // Checks the availability of focused text input client and update focus | 69 // Checks the availability of focused text input client and update focus |
| 70 // state. | 70 // state. |
| 71 void UpdateContextFocusState(); | 71 void UpdateContextFocusState(); |
| 72 | 72 |
| 73 // Processes a key event that was already filtered by the input method. | 73 // Processes a key event that was already filtered by the input method. |
| 74 // A VKEY_PROCESSKEY may be dispatched to the focused View. | 74 // A VKEY_PROCESSKEY may be dispatched to the focused View. |
| (...skipping 18 matching lines...) Expand all Loading... |
| 93 | 93 |
| 94 // Abandons all pending key events. It usually happends when we lose keyboard | 94 // Abandons all pending key events. It usually happends when we lose keyboard |
| 95 // focus, the text input type is changed or we are destroyed. | 95 // focus, the text input type is changed or we are destroyed. |
| 96 void AbandonAllPendingKeyEvents(); | 96 void AbandonAllPendingKeyEvents(); |
| 97 | 97 |
| 98 // Passes keyevent and executes character composition if necessary. Returns | 98 // Passes keyevent and executes character composition if necessary. Returns |
| 99 // true if character composer comsumes key event. | 99 // true if character composer comsumes key event. |
| 100 bool ExecuteCharacterComposer(const ui::KeyEvent& event); | 100 bool ExecuteCharacterComposer(const ui::KeyEvent& event); |
| 101 | 101 |
| 102 // chromeos::IMEInputContextHandlerInterface overrides: | 102 // chromeos::IMEInputContextHandlerInterface overrides: |
| 103 virtual void CommitText(const std::string& text) OVERRIDE; | 103 virtual void CommitText(const std::string& text) override; |
| 104 virtual void UpdateCompositionText(const chromeos::CompositionText& text, | 104 virtual void UpdateCompositionText(const chromeos::CompositionText& text, |
| 105 uint32 cursor_pos, | 105 uint32 cursor_pos, |
| 106 bool visible) OVERRIDE; | 106 bool visible) override; |
| 107 virtual void DeleteSurroundingText(int32 offset, uint32 length) OVERRIDE; | 107 virtual void DeleteSurroundingText(int32 offset, uint32 length) override; |
| 108 | 108 |
| 109 // Hides the composition text. | 109 // Hides the composition text. |
| 110 void HidePreeditText(); | 110 void HidePreeditText(); |
| 111 | 111 |
| 112 // Callback function for IMEEngineHandlerInterface::ProcessKeyEvent. | 112 // Callback function for IMEEngineHandlerInterface::ProcessKeyEvent. |
| 113 void ProcessKeyEventDone(uint32 id, ui::KeyEvent* event, bool is_handled); | 113 void ProcessKeyEventDone(uint32 id, ui::KeyEvent* event, bool is_handled); |
| 114 | 114 |
| 115 // Returns whether an input field is focused. Note that password field is not | 115 // Returns whether an input field is focused. Note that password field is not |
| 116 // considered as an input field. | 116 // considered as an input field. |
| 117 bool IsInputFieldFocused(); | 117 bool IsInputFieldFocused(); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 | 149 |
| 150 // Used for making callbacks. | 150 // Used for making callbacks. |
| 151 base::WeakPtrFactory<InputMethodChromeOS> weak_ptr_factory_; | 151 base::WeakPtrFactory<InputMethodChromeOS> weak_ptr_factory_; |
| 152 | 152 |
| 153 DISALLOW_COPY_AND_ASSIGN(InputMethodChromeOS); | 153 DISALLOW_COPY_AND_ASSIGN(InputMethodChromeOS); |
| 154 }; | 154 }; |
| 155 | 155 |
| 156 } // namespace ui | 156 } // namespace ui |
| 157 | 157 |
| 158 #endif // UI_BASE_IME_INPUT_METHOD_CHROMEOS_H_ | 158 #endif // UI_BASE_IME_INPUT_METHOD_CHROMEOS_H_ |
| OLD | NEW |