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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 TextInputClient* focused) {} | 62 TextInputClient* focused) {} |
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 | 73 |
73 // Sends a fake key event for IME composing without physical key events. | 74 // Sends a fake key event for IME composing without physical key events. |
74 // Returns true if the faked key event is stopped propagation. | 75 // Returns true if the faked key event is stopped propagation. |
75 bool SendFakeProcessKeyEvent(bool pressed) const; | 76 bool SendFakeProcessKeyEvent(bool pressed) const; |
76 | 77 |
77 // Returns true if |client| is currently focused. | 78 // Returns true if |client| is currently focused. |
78 bool IsTextInputClientFocused(const TextInputClient* client); | 79 bool IsTextInputClientFocused(const TextInputClient* client); |
79 | 80 |
80 // Checks if the focused text input client's text input type is | 81 // Checks if the focused text input client's text input type is |
81 // TEXT_INPUT_TYPE_NONE. Also returns true if there is no focused text | 82 // TEXT_INPUT_TYPE_NONE. Also returns true if there is no focused text |
(...skipping 13 matching lines...) Expand all Loading... |
95 // Convenience method to notify all observers of TextInputClient changes. | 96 // Convenience method to notify all observers of TextInputClient changes. |
96 void NotifyTextInputStateChanged(const TextInputClient* client); | 97 void NotifyTextInputStateChanged(const TextInputClient* client); |
97 | 98 |
98 // Convenience method to notify all observers of CaretBounds changes on | 99 // Convenience method to notify all observers of CaretBounds changes on |
99 // |client| which is the text input client with focus. | 100 // |client| which is the text input client with focus. |
100 void NotifyTextInputCaretBoundsChanged(const TextInputClient* client); | 101 void NotifyTextInputCaretBoundsChanged(const TextInputClient* client); |
101 | 102 |
102 // Gets the bounds of the composition text or cursor in |client|. | 103 // Gets the bounds of the composition text or cursor in |client|. |
103 std::vector<gfx::Rect> GetCompositionBounds(const TextInputClient* client); | 104 std::vector<gfx::Rect> GetCompositionBounds(const TextInputClient* client); |
104 | 105 |
| 106 // Indicates whether the IME extension is currently sending a fake key event. |
| 107 // This is used in SendKeyEvent. |
| 108 bool sending_key_event_; |
| 109 |
105 private: | 110 private: |
106 void SetFocusedTextInputClientInternal(TextInputClient* client); | 111 void SetFocusedTextInputClientInternal(TextInputClient* client); |
107 | 112 |
108 internal::InputMethodDelegate* delegate_; | 113 internal::InputMethodDelegate* delegate_; |
109 TextInputClient* text_input_client_; | 114 TextInputClient* text_input_client_; |
110 | 115 |
111 base::ObserverList<InputMethodObserver> observer_list_; | 116 base::ObserverList<InputMethodObserver> observer_list_; |
112 | 117 |
113 DISALLOW_COPY_AND_ASSIGN(InputMethodBase); | 118 DISALLOW_COPY_AND_ASSIGN(InputMethodBase); |
114 }; | 119 }; |
115 | 120 |
116 } // namespace ui | 121 } // namespace ui |
117 | 122 |
118 #endif // UI_BASE_IME_INPUT_METHOD_BASE_H_ | 123 #endif // UI_BASE_IME_INPUT_METHOD_BASE_H_ |
OLD | NEW |