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

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

Issue 1257603006: Refactoring for the InputMethod & InputMethodDelegate interfaces. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressed Sadrul's comment. Created 5 years, 4 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_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/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"
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 bool InputMethodBase::IsTextInputTypeNone() const { 97 bool InputMethodBase::IsTextInputTypeNone() const {
98 return GetTextInputType() == TEXT_INPUT_TYPE_NONE; 98 return GetTextInputType() == TEXT_INPUT_TYPE_NONE;
99 } 99 }
100 100
101 void InputMethodBase::OnInputMethodChanged() const { 101 void InputMethodBase::OnInputMethodChanged() const {
102 TextInputClient* client = GetTextInputClient(); 102 TextInputClient* client = GetTextInputClient();
103 if (!IsTextInputTypeNone()) 103 if (!IsTextInputTypeNone())
104 client->OnInputMethodChanged(); 104 client->OnInputMethodChanged();
105 } 105 }
106 106
107 bool InputMethodBase::DispatchKeyEventPostIME( 107 ui::EventDispatchDetails InputMethodBase::DispatchKeyEventPostIME(
108 const ui::KeyEvent& event) const { 108 ui::KeyEvent* event) const {
109 if (!delegate_) 109 ui::EventDispatchDetails details;
110 return false; 110 if (delegate_)
111 111 details = delegate_->DispatchKeyEventPostIME(event);
112 return delegate_->DispatchKeyEventPostIME(event); 112 return details;
113 } 113 }
114 114
115 void InputMethodBase::NotifyTextInputStateChanged( 115 void InputMethodBase::NotifyTextInputStateChanged(
116 const TextInputClient* client) { 116 const TextInputClient* client) {
117 FOR_EACH_OBSERVER(InputMethodObserver, 117 FOR_EACH_OBSERVER(InputMethodObserver,
118 observer_list_, 118 observer_list_,
119 OnTextInputStateChanged(client)); 119 OnTextInputStateChanged(client));
120 } 120 }
121 121
122 void InputMethodBase::NotifyTextInputCaretBoundsChanged( 122 void InputMethodBase::NotifyTextInputCaretBoundsChanged(
123 const TextInputClient* client) { 123 const TextInputClient* client) {
124 FOR_EACH_OBSERVER( 124 FOR_EACH_OBSERVER(
125 InputMethodObserver, observer_list_, OnCaretBoundsChanged(client)); 125 InputMethodObserver, observer_list_, OnCaretBoundsChanged(client));
126 } 126 }
127 127
128 void InputMethodBase::SetFocusedTextInputClientInternal( 128 void InputMethodBase::SetFocusedTextInputClientInternal(
129 TextInputClient* client) { 129 TextInputClient* client) {
130 TextInputClient* old = text_input_client_; 130 TextInputClient* old = text_input_client_;
131 if (old == client) 131 if (old == client)
132 return; 132 return;
133 OnWillChangeFocusedClient(old, client); 133 OnWillChangeFocusedClient(old, client);
134 text_input_client_ = client; // NULL allowed. 134 text_input_client_ = client; // NULL allowed.
135 OnDidChangeFocusedClient(old, client); 135 OnDidChangeFocusedClient(old, client);
136 NotifyTextInputStateChanged(text_input_client_); 136 NotifyTextInputStateChanged(text_input_client_);
137 } 137 }
138 138
139 } // namespace ui 139 } // 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