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

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

Issue 1182523003: Removes TextInputFocusManager. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
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/input_method_base.h" 5 #include "ui/base/ime/input_method_base.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "ui/base/ime/input_method_delegate.h" 10 #include "ui/base/ime/input_method_delegate.h"
11 #include "ui/base/ime/input_method_observer.h" 11 #include "ui/base/ime/input_method_observer.h"
12 #include "ui/base/ime/text_input_client.h" 12 #include "ui/base/ime/text_input_client.h"
13 #include "ui/base/ime/text_input_focus_manager.h"
14 #include "ui/base/ui_base_switches_util.h" 13 #include "ui/base/ui_base_switches_util.h"
15 #include "ui/events/event.h" 14 #include "ui/events/event.h"
16 15
17 namespace ui { 16 namespace ui {
18 17
19 InputMethodBase::InputMethodBase() 18 InputMethodBase::InputMethodBase()
20 : delegate_(NULL), 19 : delegate_(NULL),
21 text_input_client_(NULL), 20 text_input_client_(NULL),
22 system_toplevel_window_focused_(false) { 21 system_toplevel_window_focused_(false) {
23 } 22 }
(...skipping 20 matching lines...) Expand all
44 SetFocusedTextInputClientInternal(client); 43 SetFocusedTextInputClientInternal(client);
45 } 44 }
46 45
47 void InputMethodBase::DetachTextInputClient(TextInputClient* client) { 46 void InputMethodBase::DetachTextInputClient(TextInputClient* client) {
48 if (text_input_client_ != client) 47 if (text_input_client_ != client)
49 return; 48 return;
50 SetFocusedTextInputClientInternal(NULL); 49 SetFocusedTextInputClientInternal(NULL);
51 } 50 }
52 51
53 TextInputClient* InputMethodBase::GetTextInputClient() const { 52 TextInputClient* InputMethodBase::GetTextInputClient() const {
54 if (switches::IsTextInputFocusManagerEnabled())
55 return TextInputFocusManager::GetInstance()->GetFocusedTextInputClient();
56
57 return system_toplevel_window_focused_ ? text_input_client_ : NULL; 53 return system_toplevel_window_focused_ ? text_input_client_ : NULL;
58 } 54 }
59 55
60 void InputMethodBase::OnTextInputTypeChanged(const TextInputClient* client) { 56 void InputMethodBase::OnTextInputTypeChanged(const TextInputClient* client) {
61 if (!IsTextInputClientFocused(client)) 57 if (!IsTextInputClientFocused(client))
62 return; 58 return;
63 NotifyTextInputStateChanged(client); 59 NotifyTextInputStateChanged(client);
64 } 60 }
65 61
66 TextInputType InputMethodBase::GetTextInputType() const { 62 TextInputType InputMethodBase::GetTextInputType() const {
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 } 121 }
126 122
127 void InputMethodBase::NotifyTextInputCaretBoundsChanged( 123 void InputMethodBase::NotifyTextInputCaretBoundsChanged(
128 const TextInputClient* client) { 124 const TextInputClient* client) {
129 FOR_EACH_OBSERVER( 125 FOR_EACH_OBSERVER(
130 InputMethodObserver, observer_list_, OnCaretBoundsChanged(client)); 126 InputMethodObserver, observer_list_, OnCaretBoundsChanged(client));
131 } 127 }
132 128
133 void InputMethodBase::SetFocusedTextInputClientInternal( 129 void InputMethodBase::SetFocusedTextInputClientInternal(
134 TextInputClient* client) { 130 TextInputClient* client) {
135 if (switches::IsTextInputFocusManagerEnabled())
136 return;
137
138 TextInputClient* old = text_input_client_; 131 TextInputClient* old = text_input_client_;
139 if (old == client) 132 if (old == client)
140 return; 133 return;
141 OnWillChangeFocusedClient(old, client); 134 OnWillChangeFocusedClient(old, client);
142 text_input_client_ = client; // NULL allowed. 135 text_input_client_ = client; // NULL allowed.
143 OnDidChangeFocusedClient(old, client); 136 OnDidChangeFocusedClient(old, client);
144 NotifyTextInputStateChanged(text_input_client_); 137 NotifyTextInputStateChanged(text_input_client_);
145 } 138 }
146 139
147 } // namespace ui 140 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698