Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(74)

Side by Side Diff: ui/base/ime/mock_input_method.cc

Issue 1182523003: Removes TextInputFocusManager. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nit per comment. Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/base/ime/input_method_chromeos_unittest.cc ('k') | ui/base/ime/text_input_focus_manager.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "ui/base/ime/input_method_delegate.h" 7 #include "ui/base/ime/input_method_delegate.h"
8 #include "ui/base/ime/text_input_focus_manager.h"
9 #include "ui/base/ui_base_switches_util.h"
10 #include "ui/events/event.h" 8 #include "ui/events/event.h"
11 9
12 namespace ui { 10 namespace ui {
13 11
14 MockInputMethod::MockInputMethod(internal::InputMethodDelegate* delegate) 12 MockInputMethod::MockInputMethod(internal::InputMethodDelegate* delegate)
15 : text_input_client_(NULL), delegate_(delegate) { 13 : text_input_client_(NULL), delegate_(delegate) {
16 } 14 }
17 15
18 MockInputMethod::~MockInputMethod() { 16 MockInputMethod::~MockInputMethod() {
19 FOR_EACH_OBSERVER(InputMethodObserver, observer_list_, 17 FOR_EACH_OBSERVER(InputMethodObserver, observer_list_,
20 OnInputMethodDestroyed(this)); 18 OnInputMethodDestroyed(this));
21 } 19 }
22 20
23 void MockInputMethod::SetDelegate(internal::InputMethodDelegate* delegate) { 21 void MockInputMethod::SetDelegate(internal::InputMethodDelegate* delegate) {
24 delegate_ = delegate; 22 delegate_ = delegate;
25 } 23 }
26 24
27 void MockInputMethod::SetFocusedTextInputClient(TextInputClient* client) { 25 void MockInputMethod::SetFocusedTextInputClient(TextInputClient* client) {
28 if (switches::IsTextInputFocusManagerEnabled())
29 return;
30
31 if (text_input_client_ == client) 26 if (text_input_client_ == client)
32 return; 27 return;
33 text_input_client_ = client; 28 text_input_client_ = client;
34 if (client) 29 if (client)
35 OnTextInputTypeChanged(client); 30 OnTextInputTypeChanged(client);
36 } 31 }
37 32
38 void MockInputMethod::DetachTextInputClient(TextInputClient* client) { 33 void MockInputMethod::DetachTextInputClient(TextInputClient* client) {
39 if (text_input_client_ == client) { 34 if (text_input_client_ == client) {
40 text_input_client_ = NULL; 35 text_input_client_ = NULL;
41 } 36 }
42 } 37 }
43 38
44 TextInputClient* MockInputMethod::GetTextInputClient() const { 39 TextInputClient* MockInputMethod::GetTextInputClient() const {
45 if (switches::IsTextInputFocusManagerEnabled())
46 return TextInputFocusManager::GetInstance()->GetFocusedTextInputClient();
47
48 return text_input_client_; 40 return text_input_client_;
49 } 41 }
50 42
51 bool MockInputMethod::DispatchKeyEvent(const ui::KeyEvent& event) { 43 bool MockInputMethod::DispatchKeyEvent(const ui::KeyEvent& event) {
52 return delegate_->DispatchKeyEventPostIME(event); 44 return delegate_->DispatchKeyEventPostIME(event);
53 } 45 }
54 46
55 void MockInputMethod::OnFocus() { 47 void MockInputMethod::OnFocus() {
56 FOR_EACH_OBSERVER(InputMethodObserver, observer_list_, OnFocus()); 48 FOR_EACH_OBSERVER(InputMethodObserver, observer_list_, OnFocus());
57 } 49 }
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 114
123 void MockInputMethod::AddObserver(InputMethodObserver* observer) { 115 void MockInputMethod::AddObserver(InputMethodObserver* observer) {
124 observer_list_.AddObserver(observer); 116 observer_list_.AddObserver(observer);
125 } 117 }
126 118
127 void MockInputMethod::RemoveObserver(InputMethodObserver* observer) { 119 void MockInputMethod::RemoveObserver(InputMethodObserver* observer) {
128 observer_list_.RemoveObserver(observer); 120 observer_list_.RemoveObserver(observer);
129 } 121 }
130 122
131 } // namespace ui 123 } // namespace ui
OLDNEW
« no previous file with comments | « ui/base/ime/input_method_chromeos_unittest.cc ('k') | ui/base/ime/text_input_focus_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698