OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_CHROMEOS_MOCK_IME_INPUT_CONTEXT_HANDLER_H_ | 5 #ifndef UI_BASE_IME_CHROMEOS_MOCK_IME_INPUT_CONTEXT_HANDLER_H_ |
6 #define UI_BASE_IME_CHROMEOS_MOCK_IME_INPUT_CONTEXT_HANDLER_H_ | 6 #define UI_BASE_IME_CHROMEOS_MOCK_IME_INPUT_CONTEXT_HANDLER_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "ui/base/ime/composition_text.h" | 10 #include "ui/base/ime/composition_text.h" |
11 #include "ui/base/ime/ime_input_context_handler_interface.h" | 11 #include "ui/base/ime/ime_input_context_handler_interface.h" |
12 #include "ui/base/ime/ui_base_ime_export.h" | 12 #include "ui/base/ime/ui_base_ime_export.h" |
13 | 13 |
| 14 namespace ui { |
| 15 class InputMethod; |
| 16 } // ui |
| 17 |
14 namespace chromeos { | 18 namespace chromeos { |
15 | 19 |
16 class UI_BASE_IME_EXPORT MockIMEInputContextHandler | 20 class UI_BASE_IME_EXPORT MockIMEInputContextHandler |
17 : public ui::IMEInputContextHandlerInterface { | 21 : public ui::IMEInputContextHandlerInterface { |
18 public: | 22 public: |
19 struct UpdateCompositionTextArg { | 23 struct UpdateCompositionTextArg { |
20 ui::CompositionText composition_text; | 24 ui::CompositionText composition_text; |
21 uint32_t cursor_pos; | 25 uint32_t cursor_pos; |
22 bool is_visible; | 26 bool is_visible; |
23 }; | 27 }; |
24 | 28 |
25 struct DeleteSurroundingTextArg { | 29 struct DeleteSurroundingTextArg { |
26 int32_t offset; | 30 int32_t offset; |
27 uint32_t length; | 31 uint32_t length; |
28 }; | 32 }; |
29 | 33 |
30 MockIMEInputContextHandler(); | 34 MockIMEInputContextHandler(); |
31 virtual ~MockIMEInputContextHandler(); | 35 virtual ~MockIMEInputContextHandler(); |
32 | 36 |
33 void CommitText(const std::string& text) override; | 37 void CommitText(const std::string& text) override; |
34 void UpdateCompositionText(const ui::CompositionText& text, | 38 void UpdateCompositionText(const ui::CompositionText& text, |
35 uint32_t cursor_pos, | 39 uint32_t cursor_pos, |
36 bool visible) override; | 40 bool visible) override; |
37 void DeleteSurroundingText(int32_t offset, uint32_t length) override; | 41 void DeleteSurroundingText(int32_t offset, uint32_t length) override; |
38 void SendKeyEvent(ui::KeyEvent* event) override; | 42 void SendKeyEvent(ui::KeyEvent* event) override; |
| 43 ui::InputMethod* GetInputMethod() override; |
39 | 44 |
40 int commit_text_call_count() const { return commit_text_call_count_; } | 45 int commit_text_call_count() const { return commit_text_call_count_; } |
41 | 46 |
42 int update_preedit_text_call_count() const { | 47 int update_preedit_text_call_count() const { |
43 return update_preedit_text_call_count_; | 48 return update_preedit_text_call_count_; |
44 } | 49 } |
45 | 50 |
46 int delete_surrounding_text_call_count() const { | 51 int delete_surrounding_text_call_count() const { |
47 return delete_surrounding_text_call_count_; | 52 return delete_surrounding_text_call_count_; |
48 } | 53 } |
(...skipping 18 matching lines...) Expand all Loading... |
67 int update_preedit_text_call_count_; | 72 int update_preedit_text_call_count_; |
68 int delete_surrounding_text_call_count_; | 73 int delete_surrounding_text_call_count_; |
69 std::string last_commit_text_; | 74 std::string last_commit_text_; |
70 UpdateCompositionTextArg last_update_composition_arg_; | 75 UpdateCompositionTextArg last_update_composition_arg_; |
71 DeleteSurroundingTextArg last_delete_surrounding_text_arg_; | 76 DeleteSurroundingTextArg last_delete_surrounding_text_arg_; |
72 }; | 77 }; |
73 | 78 |
74 } // namespace chromeos | 79 } // namespace chromeos |
75 | 80 |
76 #endif // UI_BASE_IME_CHROMEOS_MOCK_IME_INPUT_CONTEXT_HANDLER_H_ | 81 #endif // UI_BASE_IME_CHROMEOS_MOCK_IME_INPUT_CONTEXT_HANDLER_H_ |
OLD | NEW |