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) { |
11 } | 11 } |
12 | 12 |
13 MockInputMethod::~MockInputMethod() { | 13 MockInputMethod::~MockInputMethod() { |
14 } | 14 } |
15 | 15 |
16 void MockInputMethod::SetDelegate(internal::InputMethodDelegate* delegate) { | 16 void MockInputMethod::SetDelegate(internal::InputMethodDelegate* delegate) { |
17 } | 17 } |
18 | 18 |
19 void MockInputMethod::SetFocusedTextInputClient(TextInputClient* client) { | 19 void MockInputMethod::SetFocusedTextInputClient(TextInputClient* client) { |
20 if (text_input_client_ == client) | 20 if (text_input_client_ == client) |
21 return; | 21 return; |
22 text_input_client_ = client; | 22 text_input_client_ = client; |
23 if (client) | 23 if (client) |
24 OnTextInputTypeChanged(client); | 24 OnTextInputTypeChanged(client); |
25 } | 25 } |
26 | 26 |
27 void MockInputMethod::DetachTextInputClient(TextInputClient* client) { | |
28 if (text_input_client_ == client) { | |
Seigo Nonaka
2013/09/04 10:19:21
nit: no need braces for one liner.
Yuki
2013/09/04 14:01:52
Done.
| |
29 text_input_client_ = NULL; | |
30 } | |
31 } | |
32 | |
27 TextInputClient* MockInputMethod::GetTextInputClient() const { | 33 TextInputClient* MockInputMethod::GetTextInputClient() const { |
28 return text_input_client_; | 34 return text_input_client_; |
29 } | 35 } |
30 | 36 |
31 bool MockInputMethod::DispatchKeyEvent(const base::NativeEvent& native_event) { | 37 bool MockInputMethod::DispatchKeyEvent(const base::NativeEvent& native_event) { |
32 return false; | 38 return false; |
33 } | 39 } |
34 | 40 |
35 bool MockInputMethod::DispatchFabricatedKeyEvent(const ui::KeyEvent& event) { | 41 bool MockInputMethod::DispatchFabricatedKeyEvent(const ui::KeyEvent& event) { |
36 return false; | 42 return false; |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
101 | 107 |
102 void MockInputMethod::AddObserver(InputMethodObserver* observer) { | 108 void MockInputMethod::AddObserver(InputMethodObserver* observer) { |
103 observer_list_.AddObserver(static_cast<Observer*>(observer)); | 109 observer_list_.AddObserver(static_cast<Observer*>(observer)); |
104 } | 110 } |
105 | 111 |
106 void MockInputMethod::RemoveObserver(InputMethodObserver* observer) { | 112 void MockInputMethod::RemoveObserver(InputMethodObserver* observer) { |
107 observer_list_.RemoveObserver(static_cast<Observer*>(observer)); | 113 observer_list_.RemoveObserver(static_cast<Observer*>(observer)); |
108 } | 114 } |
109 | 115 |
110 } // namespace ui | 116 } // namespace ui |
OLD | NEW |