| 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) |
| 29 text_input_client_ = NULL; |
| 30 } |
| 31 |
| 27 TextInputClient* MockInputMethod::GetTextInputClient() const { | 32 TextInputClient* MockInputMethod::GetTextInputClient() const { |
| 28 return text_input_client_; | 33 return text_input_client_; |
| 29 } | 34 } |
| 30 | 35 |
| 31 bool MockInputMethod::DispatchKeyEvent(const base::NativeEvent& native_event) { | 36 bool MockInputMethod::DispatchKeyEvent(const base::NativeEvent& native_event) { |
| 32 return false; | 37 return false; |
| 33 } | 38 } |
| 34 | 39 |
| 35 bool MockInputMethod::DispatchFabricatedKeyEvent(const ui::KeyEvent& event) { | 40 bool MockInputMethod::DispatchFabricatedKeyEvent(const ui::KeyEvent& event) { |
| 36 return false; | 41 return false; |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 | 106 |
| 102 void MockInputMethod::AddObserver(InputMethodObserver* observer) { | 107 void MockInputMethod::AddObserver(InputMethodObserver* observer) { |
| 103 observer_list_.AddObserver(static_cast<Observer*>(observer)); | 108 observer_list_.AddObserver(static_cast<Observer*>(observer)); |
| 104 } | 109 } |
| 105 | 110 |
| 106 void MockInputMethod::RemoveObserver(InputMethodObserver* observer) { | 111 void MockInputMethod::RemoveObserver(InputMethodObserver* observer) { |
| 107 observer_list_.RemoveObserver(static_cast<Observer*>(observer)); | 112 observer_list_.RemoveObserver(static_cast<Observer*>(observer)); |
| 108 } | 113 } |
| 109 | 114 |
| 110 } // namespace ui | 115 } // namespace ui |
| OLD | NEW |