OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_VIEWS_IME_MOCK_INPUT_METHOD_H_ | 5 #ifndef UI_VIEWS_IME_MOCK_INPUT_METHOD_H_ |
6 #define UI_VIEWS_IME_MOCK_INPUT_METHOD_H_ | 6 #define UI_VIEWS_IME_MOCK_INPUT_METHOD_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 } | 45 } |
46 bool text_input_type_changed() const { return text_input_type_changed_; } | 46 bool text_input_type_changed() const { return text_input_type_changed_; } |
47 bool caret_bounds_changed() const { return caret_bounds_changed_; } | 47 bool caret_bounds_changed() const { return caret_bounds_changed_; } |
48 bool cancel_composition_called() const { return cancel_composition_called_; } | 48 bool cancel_composition_called() const { return cancel_composition_called_; } |
49 bool input_locale_changed() const { return input_locale_changed_; } | 49 bool input_locale_changed() const { return input_locale_changed_; } |
50 | 50 |
51 // Clears all internal states and result. | 51 // Clears all internal states and result. |
52 void Clear(); | 52 void Clear(); |
53 | 53 |
54 void SetCompositionTextForNextKey(const ui::CompositionText& composition); | 54 void SetCompositionTextForNextKey(const ui::CompositionText& composition); |
55 void SetResultTextForNextKey(const string16& result); | 55 void SetResultTextForNextKey(const base::string16& result); |
56 | 56 |
57 void SetInputLocale(const std::string& locale); | 57 void SetInputLocale(const std::string& locale); |
58 void SetInputTextDirection(base::i18n::TextDirection direction); | 58 void SetInputTextDirection(base::i18n::TextDirection direction); |
59 void SetActive(bool active); | 59 void SetActive(bool active); |
60 | 60 |
61 private: | 61 private: |
62 // Overridden from InputMethodBase. | 62 // Overridden from InputMethodBase. |
63 virtual void OnWillChangeFocus(View* focused_before, View* focused) OVERRIDE; | 63 virtual void OnWillChangeFocus(View* focused_before, View* focused) OVERRIDE; |
64 | 64 |
65 // Clears boolean states defined below. | 65 // Clears boolean states defined below. |
66 void ClearStates(); | 66 void ClearStates(); |
67 | 67 |
68 // Clears only composition information and result text. | 68 // Clears only composition information and result text. |
69 void ClearResult(); | 69 void ClearResult(); |
70 | 70 |
71 // Composition information for the next key event. It'll be cleared | 71 // Composition information for the next key event. It'll be cleared |
72 // automatically after dispatching the next key event. | 72 // automatically after dispatching the next key event. |
73 ui::CompositionText composition_; | 73 ui::CompositionText composition_; |
74 bool composition_changed_; | 74 bool composition_changed_; |
75 | 75 |
76 // Result text for the next key event. It'll be cleared automatically after | 76 // Result text for the next key event. It'll be cleared automatically after |
77 // dispatching the next key event. | 77 // dispatching the next key event. |
78 string16 result_text_; | 78 base::string16 result_text_; |
79 | 79 |
80 // Record call state of corresponding methods. They will be set to false | 80 // Record call state of corresponding methods. They will be set to false |
81 // automatically before dispatching a key event. | 81 // automatically before dispatching a key event. |
82 bool focus_changed_; | 82 bool focus_changed_; |
83 bool untranslated_ime_message_called_; | 83 bool untranslated_ime_message_called_; |
84 bool text_input_type_changed_; | 84 bool text_input_type_changed_; |
85 bool caret_bounds_changed_; | 85 bool caret_bounds_changed_; |
86 bool cancel_composition_called_; | 86 bool cancel_composition_called_; |
87 bool input_locale_changed_; | 87 bool input_locale_changed_; |
88 | 88 |
89 // To mock corresponding input method prooperties. | 89 // To mock corresponding input method prooperties. |
90 std::string locale_; | 90 std::string locale_; |
91 base::i18n::TextDirection direction_; | 91 base::i18n::TextDirection direction_; |
92 bool active_; | 92 bool active_; |
93 | 93 |
94 DISALLOW_COPY_AND_ASSIGN(MockInputMethod); | 94 DISALLOW_COPY_AND_ASSIGN(MockInputMethod); |
95 }; | 95 }; |
96 | 96 |
97 } // namespace views | 97 } // namespace views |
98 | 98 |
99 #endif // UI_VIEWS_IME_MOCK_INPUT_METHOD_H_ | 99 #endif // UI_VIEWS_IME_MOCK_INPUT_METHOD_H_ |
OLD | NEW |