| 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 #include "ui/base/ime/mock_input_method.h" | 5 #include "ui/base/ime/mock_input_method.h" |
| 6 | 6 |
| 7 namespace ui { | 7 namespace ui { |
| 8 | 8 |
| 9 MockInputMethod::MockInputMethod(internal::InputMethodDelegate* delegate) | 9 MockInputMethod::MockInputMethod(internal::InputMethodDelegate* delegate) |
| 10 : text_input_client_(NULL) { | 10 : text_input_client_(NULL) { |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 void MockInputMethod::OnFocus() { | 44 void MockInputMethod::OnFocus() { |
| 45 FOR_EACH_OBSERVER(InputMethodObserver, observer_list_, OnFocus()); | 45 FOR_EACH_OBSERVER(InputMethodObserver, observer_list_, OnFocus()); |
| 46 } | 46 } |
| 47 | 47 |
| 48 void MockInputMethod::OnBlur() { | 48 void MockInputMethod::OnBlur() { |
| 49 FOR_EACH_OBSERVER(InputMethodObserver, observer_list_, OnBlur()); | 49 FOR_EACH_OBSERVER(InputMethodObserver, observer_list_, OnBlur()); |
| 50 } | 50 } |
| 51 | 51 |
| 52 bool MockInputMethod::OnUntranslatedIMEMessage(const base::NativeEvent& event, | 52 bool MockInputMethod::OnUntranslatedIMEMessage(const base::NativeEvent& event, |
| 53 NativeEventResult* result) { | 53 NativeEventResult* result) { |
| 54 FOR_EACH_OBSERVER(InputMethodObserver, | |
| 55 observer_list_, | |
| 56 OnUntranslatedIMEMessage(event)); | |
| 57 if (result) | 54 if (result) |
| 58 *result = NativeEventResult(); | 55 *result = NativeEventResult(); |
| 59 return false; | 56 return false; |
| 60 } | 57 } |
| 61 | 58 |
| 62 void MockInputMethod::OnTextInputTypeChanged(const TextInputClient* client) { | 59 void MockInputMethod::OnTextInputTypeChanged(const TextInputClient* client) { |
| 63 FOR_EACH_OBSERVER(InputMethodObserver, | 60 FOR_EACH_OBSERVER(InputMethodObserver, |
| 64 observer_list_, | 61 observer_list_, |
| 65 OnTextInputTypeChanged(client)); | 62 OnTextInputTypeChanged(client)); |
| 66 FOR_EACH_OBSERVER(InputMethodObserver, | 63 FOR_EACH_OBSERVER(InputMethodObserver, |
| 67 observer_list_, | 64 observer_list_, |
| 68 OnTextInputStateChanged(client)); | 65 OnTextInputStateChanged(client)); |
| 69 } | 66 } |
| 70 | 67 |
| 71 void MockInputMethod::OnCaretBoundsChanged(const TextInputClient* client) { | 68 void MockInputMethod::OnCaretBoundsChanged(const TextInputClient* client) { |
| 72 FOR_EACH_OBSERVER(InputMethodObserver, | 69 FOR_EACH_OBSERVER(InputMethodObserver, |
| 73 observer_list_, | 70 observer_list_, |
| 74 OnCaretBoundsChanged(client)); | 71 OnCaretBoundsChanged(client)); |
| 75 } | 72 } |
| 76 | 73 |
| 77 void MockInputMethod::CancelComposition(const TextInputClient* client) { | 74 void MockInputMethod::CancelComposition(const TextInputClient* client) { |
| 78 } | 75 } |
| 79 | 76 |
| 80 void MockInputMethod::OnInputLocaleChanged() { | 77 void MockInputMethod::OnInputLocaleChanged() { |
| 81 FOR_EACH_OBSERVER(InputMethodObserver, | |
| 82 observer_list_, | |
| 83 OnInputLocaleChanged()); | |
| 84 } | 78 } |
| 85 | 79 |
| 86 std::string MockInputMethod::GetInputLocale() { | 80 std::string MockInputMethod::GetInputLocale() { |
| 87 return ""; | 81 return ""; |
| 88 } | 82 } |
| 89 | 83 |
| 90 base::i18n::TextDirection MockInputMethod::GetInputTextDirection() { | 84 base::i18n::TextDirection MockInputMethod::GetInputTextDirection() { |
| 91 return base::i18n::UNKNOWN_DIRECTION; | 85 return base::i18n::UNKNOWN_DIRECTION; |
| 92 } | 86 } |
| 93 | 87 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 113 | 107 |
| 114 void MockInputMethod::AddObserver(InputMethodObserver* observer) { | 108 void MockInputMethod::AddObserver(InputMethodObserver* observer) { |
| 115 observer_list_.AddObserver(observer); | 109 observer_list_.AddObserver(observer); |
| 116 } | 110 } |
| 117 | 111 |
| 118 void MockInputMethod::RemoveObserver(InputMethodObserver* observer) { | 112 void MockInputMethod::RemoveObserver(InputMethodObserver* observer) { |
| 119 observer_list_.RemoveObserver(observer); | 113 observer_list_.RemoveObserver(observer); |
| 120 } | 114 } |
| 121 | 115 |
| 122 } // namespace ui | 116 } // namespace ui |
| OLD | NEW |