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 <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
| 11 #include <vector> |
11 | 12 |
12 #include "base/event_types.h" | 13 #include "base/event_types.h" |
13 #include "build/build_config.h" | 14 #include "build/build_config.h" |
14 #include "ui/base/ime/text_input_mode.h" | 15 #include "ui/base/ime/text_input_mode.h" |
15 #include "ui/base/ime/text_input_type.h" | 16 #include "ui/base/ime/text_input_type.h" |
16 | 17 |
| 18 namespace extensions { |
| 19 class InputImeApiTest; |
| 20 } // namespace extensions |
| 21 |
17 namespace ui { | 22 namespace ui { |
18 | 23 |
19 namespace internal { | 24 namespace internal { |
20 class InputMethodDelegate; | 25 class InputMethodDelegate; |
21 } // namespace internal | 26 } // namespace internal |
22 | 27 |
23 class InputMethodObserver; | 28 class InputMethodObserver; |
24 class KeyEvent; | 29 class KeyEvent; |
25 class TextInputClient; | 30 class TextInputClient; |
26 | 31 |
(...skipping 14 matching lines...) Expand all Loading... |
41 // 2) Send VKEY_PROCESSKEY event to the window using the DispatchKeyEvent API, | 46 // 2) Send VKEY_PROCESSKEY event to the window using the DispatchKeyEvent API, |
42 // then update IME status (e.g. composition text) using TextInputClient, | 47 // then update IME status (e.g. composition text) using TextInputClient, |
43 // and then send the original key up event to the window. | 48 // and then send the original key up event to the window. |
44 // - Keeps track of the focused TextInputClient to see which client can call | 49 // - Keeps track of the focused TextInputClient to see which client can call |
45 // APIs, OnTextInputTypeChanged, OnCaretBoundsChanged, and CancelComposition, | 50 // APIs, OnTextInputTypeChanged, OnCaretBoundsChanged, and CancelComposition, |
46 // that change the state of the input method. | 51 // that change the state of the input method. |
47 // In Aura environment, aura::WindowTreeHost creates an instance of | 52 // In Aura environment, aura::WindowTreeHost creates an instance of |
48 // ui::InputMethod and owns it. | 53 // ui::InputMethod and owns it. |
49 class InputMethod { | 54 class InputMethod { |
50 public: | 55 public: |
| 56 InputMethod() : track_key_events_for_testing_(false) {} |
51 | 57 |
52 #if defined(OS_WIN) | 58 #if defined(OS_WIN) |
53 typedef LRESULT NativeEventResult; | 59 typedef LRESULT NativeEventResult; |
54 #else | 60 #else |
55 typedef int32_t NativeEventResult; | 61 typedef int32_t NativeEventResult; |
56 #endif | 62 #endif |
57 | 63 |
58 virtual ~InputMethod() {} | 64 virtual ~InputMethod() {} |
59 | 65 |
60 // Sets the delegate used by this InputMethod instance. It should only be | 66 // Sets the delegate used by this InputMethod instance. It should only be |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 // etc.) is open. Returns false if no popup window is open or the detection | 151 // etc.) is open. Returns false if no popup window is open or the detection |
146 // of IME popups is not supported. | 152 // of IME popups is not supported. |
147 virtual bool IsCandidatePopupOpen() const = 0; | 153 virtual bool IsCandidatePopupOpen() const = 0; |
148 | 154 |
149 // Displays an on screen keyboard if enabled. | 155 // Displays an on screen keyboard if enabled. |
150 virtual void ShowImeIfNeeded() = 0; | 156 virtual void ShowImeIfNeeded() = 0; |
151 | 157 |
152 // Management of the observer list. | 158 // Management of the observer list. |
153 virtual void AddObserver(InputMethodObserver* observer) = 0; | 159 virtual void AddObserver(InputMethodObserver* observer) = 0; |
154 virtual void RemoveObserver(InputMethodObserver* observer) = 0; | 160 virtual void RemoveObserver(InputMethodObserver* observer) = 0; |
| 161 |
| 162 protected: |
| 163 friend class extensions::InputImeApiTest; |
| 164 |
| 165 // Gets the tracked key events of using input.ime.sendKeyEvents API. |
| 166 virtual std::vector<ui::KeyEvent*> GetKeyEventsForTesting() = 0; |
| 167 |
| 168 // Whether the key events will be tracked. Only used for testing. |
| 169 bool track_key_events_for_testing_; |
155 }; | 170 }; |
156 | 171 |
157 } // namespace ui | 172 } // namespace ui |
158 | 173 |
159 #endif // UI_BASE_IME_INPUT_METHOD_H_ | 174 #endif // UI_BASE_IME_INPUT_METHOD_H_ |
OLD | NEW |