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

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

Issue 48393003: Add InputMethodObserver support into InputMethodBase (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix -Werror=sign-compare Created 7 years, 1 month 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_base.h ('k') | ui/base/ime/input_method_base_unittest.cc » ('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/input_method_base.h" 5 #include "ui/base/ime/input_method_base.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "ui/base/ime/input_method_delegate.h" 8 #include "ui/base/ime/input_method_delegate.h"
9 #include "ui/base/ime/input_method_observer.h" 9 #include "ui/base/ime/input_method_observer.h"
10 #include "ui/base/ime/text_input_client.h" 10 #include "ui/base/ime/text_input_client.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 TextInputClient* InputMethodBase::GetTextInputClient() const { 67 TextInputClient* InputMethodBase::GetTextInputClient() const {
68 return system_toplevel_window_focused_ ? text_input_client_ : NULL; 68 return system_toplevel_window_focused_ ? text_input_client_ : NULL;
69 } 69 }
70 70
71 void InputMethodBase::OnTextInputTypeChanged(const TextInputClient* client) { 71 void InputMethodBase::OnTextInputTypeChanged(const TextInputClient* client) {
72 if (!IsTextInputClientFocused(client)) 72 if (!IsTextInputClientFocused(client))
73 return; 73 return;
74 NotifyTextInputStateChanged(client); 74 NotifyTextInputStateChanged(client);
75 } 75 }
76 76
77 void InputMethodBase::OnCaretBoundsChanged(const TextInputClient* client) {
78 if (!IsTextInputClientFocused(client))
79 return;
80 FOR_EACH_OBSERVER(InputMethodObserver,
81 observer_list_,
82 OnCaretBoundsChanged(client));
83 }
84
85 void InputMethodBase::OnInputLocaleChanged() {
86 FOR_EACH_OBSERVER(InputMethodObserver,
87 observer_list_,
88 OnInputLocaleChanged());
89 }
90
77 TextInputType InputMethodBase::GetTextInputType() const { 91 TextInputType InputMethodBase::GetTextInputType() const {
78 TextInputClient* client = GetTextInputClient(); 92 TextInputClient* client = GetTextInputClient();
79 return client ? client->GetTextInputType() : TEXT_INPUT_TYPE_NONE; 93 return client ? client->GetTextInputType() : TEXT_INPUT_TYPE_NONE;
80 } 94 }
81 95
82 TextInputMode InputMethodBase::GetTextInputMode() const { 96 TextInputMode InputMethodBase::GetTextInputMode() const {
83 TextInputClient* client = GetTextInputClient(); 97 TextInputClient* client = GetTextInputClient();
84 return client ? client->GetTextInputMode() : TEXT_INPUT_MODE_DEFAULT; 98 return client ? client->GetTextInputMode() : TEXT_INPUT_MODE_DEFAULT;
85 } 99 }
86 100
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 TextInputClient* old = text_input_client_; 149 TextInputClient* old = text_input_client_;
136 if (old == client) 150 if (old == client)
137 return; 151 return;
138 OnWillChangeFocusedClient(old, client); 152 OnWillChangeFocusedClient(old, client);
139 text_input_client_ = client; // NULL allowed. 153 text_input_client_ = client; // NULL allowed.
140 OnDidChangeFocusedClient(old, client); 154 OnDidChangeFocusedClient(old, client);
141 NotifyTextInputStateChanged(text_input_client_); 155 NotifyTextInputStateChanged(text_input_client_);
142 } 156 }
143 157
144 } // namespace ui 158 } // namespace ui
OLDNEW
« no previous file with comments | « ui/base/ime/input_method_base.h ('k') | ui/base/ime/input_method_base_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698