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_BASE_H_ | 5 #ifndef UI_BASE_IME_INPUT_METHOD_BASE_H_ |
6 #define UI_BASE_IME_INPUT_METHOD_BASE_H_ | 6 #define UI_BASE_IME_INPUT_METHOD_BASE_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 virtual void OnDidChangeFocusedClient(TextInputClient* focused_before, | 63 virtual void OnDidChangeFocusedClient(TextInputClient* focused_before, |
64 TextInputClient* focused) {} | 64 TextInputClient* focused) {} |
65 | 65 |
66 // IMEInputContextHandlerInterface: | 66 // IMEInputContextHandlerInterface: |
67 void CommitText(const std::string& text) override; | 67 void CommitText(const std::string& text) override; |
68 void UpdateCompositionText(const CompositionText& text, | 68 void UpdateCompositionText(const CompositionText& text, |
69 uint32_t cursor_pos, | 69 uint32_t cursor_pos, |
70 bool visible) override; | 70 bool visible) override; |
71 void DeleteSurroundingText(int32_t offset, uint32_t length) override; | 71 void DeleteSurroundingText(int32_t offset, uint32_t length) override; |
72 void SendKeyEvent(KeyEvent* event) override; | 72 void SendKeyEvent(KeyEvent* event) override; |
| 73 InputMethod* GetInputMethod() override; |
73 | 74 |
74 // Sends a fake key event for IME composing without physical key events. | 75 // Sends a fake key event for IME composing without physical key events. |
75 // Returns true if the faked key event is stopped propagation. | 76 // Returns true if the faked key event is stopped propagation. |
76 bool SendFakeProcessKeyEvent(bool pressed) const; | 77 bool SendFakeProcessKeyEvent(bool pressed) const; |
77 | 78 |
78 // Returns true if |client| is currently focused. | 79 // Returns true if |client| is currently focused. |
79 bool IsTextInputClientFocused(const TextInputClient* client); | 80 bool IsTextInputClientFocused(const TextInputClient* client); |
80 | 81 |
81 // Checks if the focused text input client's text input type is | 82 // Checks if the focused text input client's text input type is |
82 // TEXT_INPUT_TYPE_NONE. Also returns true if there is no focused text | 83 // TEXT_INPUT_TYPE_NONE. Also returns true if there is no focused text |
(...skipping 18 matching lines...) Expand all Loading... |
101 void NotifyTextInputCaretBoundsChanged(const TextInputClient* client); | 102 void NotifyTextInputCaretBoundsChanged(const TextInputClient* client); |
102 | 103 |
103 // Gets the bounds of the composition text or cursor in |client|. | 104 // Gets the bounds of the composition text or cursor in |client|. |
104 std::vector<gfx::Rect> GetCompositionBounds(const TextInputClient* client); | 105 std::vector<gfx::Rect> GetCompositionBounds(const TextInputClient* client); |
105 | 106 |
106 // Indicates whether the IME extension is currently sending a fake key event. | 107 // Indicates whether the IME extension is currently sending a fake key event. |
107 // This is used in SendKeyEvent. | 108 // This is used in SendKeyEvent. |
108 bool sending_key_event_; | 109 bool sending_key_event_; |
109 | 110 |
110 private: | 111 private: |
| 112 // InputMethod: |
| 113 const std::vector<std::unique_ptr<ui::KeyEvent>>& GetKeyEventsForTesting() |
| 114 override; |
| 115 |
111 void SetFocusedTextInputClientInternal(TextInputClient* client); | 116 void SetFocusedTextInputClientInternal(TextInputClient* client); |
112 | 117 |
113 internal::InputMethodDelegate* delegate_; | 118 internal::InputMethodDelegate* delegate_; |
114 TextInputClient* text_input_client_; | 119 TextInputClient* text_input_client_; |
115 | 120 |
116 base::ObserverList<InputMethodObserver> observer_list_; | 121 base::ObserverList<InputMethodObserver> observer_list_; |
117 | 122 |
| 123 std::vector<std::unique_ptr<ui::KeyEvent>> key_events_for_testing_; |
| 124 |
118 DISALLOW_COPY_AND_ASSIGN(InputMethodBase); | 125 DISALLOW_COPY_AND_ASSIGN(InputMethodBase); |
119 }; | 126 }; |
120 | 127 |
121 } // namespace ui | 128 } // namespace ui |
122 | 129 |
123 #endif // UI_BASE_IME_INPUT_METHOD_BASE_H_ | 130 #endif // UI_BASE_IME_INPUT_METHOD_BASE_H_ |
OLD | NEW |