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

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

Issue 45733008: sk6_charactercomposer: Merged DispatchKeyEvent and its fabricated version. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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"
11 #include "ui/events/event.h"
11 12
12 namespace ui { 13 namespace ui {
13 14
14 InputMethodBase::InputMethodBase() 15 InputMethodBase::InputMethodBase()
15 : delegate_(NULL), 16 : delegate_(NULL),
16 text_input_client_(NULL), 17 text_input_client_(NULL),
17 system_toplevel_window_focused_(false) { 18 system_toplevel_window_focused_(false) {
18 } 19 }
19 20
20 InputMethodBase::~InputMethodBase() { 21 InputMethodBase::~InputMethodBase() {
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 return GetTextInputType() == TEXT_INPUT_TYPE_NONE; 111 return GetTextInputType() == TEXT_INPUT_TYPE_NONE;
111 } 112 }
112 113
113 void InputMethodBase::OnInputMethodChanged() const { 114 void InputMethodBase::OnInputMethodChanged() const {
114 TextInputClient* client = GetTextInputClient(); 115 TextInputClient* client = GetTextInputClient();
115 if (!IsTextInputTypeNone()) 116 if (!IsTextInputTypeNone())
116 client->OnInputMethodChanged(); 117 client->OnInputMethodChanged();
117 } 118 }
118 119
119 bool InputMethodBase::DispatchKeyEventPostIME( 120 bool InputMethodBase::DispatchKeyEventPostIME(
120 const base::NativeEvent& native_event) const { 121 const ui::KeyEvent& event) const {
121 return delegate_ ? delegate_->DispatchKeyEventPostIME(native_event) : false; 122 if (!delegate_)
122 } 123 return false;
123 124
124 bool InputMethodBase::DispatchFabricatedKeyEventPostIME(EventType type, 125 if (event.HasNativeEvent())
125 KeyboardCode key_code, 126 return delegate_->DispatchKeyEventPostIME(event);
126 int flags) const { 127 else
127 return delegate_ ? delegate_->DispatchFabricatedKeyEventPostIME 128 return delegate_->DispatchFabricatedKeyEventPostIME(event.type(),
128 (type, key_code, flags) : false; 129 event.key_code(),
130 event.flags());
129 } 131 }
130 132
131 void InputMethodBase::NotifyTextInputStateChanged( 133 void InputMethodBase::NotifyTextInputStateChanged(
132 const TextInputClient* client) { 134 const TextInputClient* client) {
133 FOR_EACH_OBSERVER(InputMethodObserver, 135 FOR_EACH_OBSERVER(InputMethodObserver,
134 observer_list_, 136 observer_list_,
135 OnTextInputStateChanged(client)); 137 OnTextInputStateChanged(client));
136 } 138 }
137 139
138 void InputMethodBase::SetFocusedTextInputClientInternal( 140 void InputMethodBase::SetFocusedTextInputClientInternal(
139 TextInputClient* client) { 141 TextInputClient* client) {
140 TextInputClient* old = text_input_client_; 142 TextInputClient* old = text_input_client_;
141 OnWillChangeFocusedClient(old, client); 143 OnWillChangeFocusedClient(old, client);
142 text_input_client_ = client; // NULL allowed. 144 text_input_client_ = client; // NULL allowed.
143 OnDidChangeFocusedClient(old, client); 145 OnDidChangeFocusedClient(old, client);
144 NotifyTextInputStateChanged(text_input_client_); 146 NotifyTextInputStateChanged(text_input_client_);
145 } 147 }
146 148
147 } // namespace ui 149 } // 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