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

Side by Side Diff: chrome/browser/ui/views/ime_driver/remote_text_input_client.cc

Issue 2957173004: Make DispatchKeyEventPostIME() asynchronous.
Patch Set: cleanup. Created 3 years, 5 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 // Reduce number of log messages by logging each NOTIMPLEMENTED() only once. 5 // Reduce number of log messages by logging each NOTIMPLEMENTED() only once.
6 // This has to be before any other includes, else default is picked up. 6 // This has to be before any other includes, else default is picked up.
7 // See base/logging.h for details on this. 7 // See base/logging.h for details on this.
8 #define NOTIMPLEMENTED_POLICY 5 8 #define NOTIMPLEMENTED_POLICY 5
9 9
10 #include "chrome/browser/ui/views/ime_driver/remote_text_input_client.h" 10 #include "chrome/browser/ui/views/ime_driver/remote_text_input_client.h"
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 // TODO(moshayedi): crbug.com/631527. 163 // TODO(moshayedi): crbug.com/631527.
164 NOTIMPLEMENTED(); 164 NOTIMPLEMENTED();
165 return false; 165 return false;
166 } 166 }
167 167
168 void RemoteTextInputClient::SetTextEditCommandForNextKeyEvent( 168 void RemoteTextInputClient::SetTextEditCommandForNextKeyEvent(
169 ui::TextEditCommand command) { 169 ui::TextEditCommand command) {
170 // TODO(moshayedi): crbug.com/631527. 170 // TODO(moshayedi): crbug.com/631527.
171 NOTIMPLEMENTED(); 171 NOTIMPLEMENTED();
172 } 172 }
173
174 ui::EventDispatchDetails RemoteTextInputClient::DispatchKeyEventPostIME(
175 ui::KeyEvent* event) {
176 return DispatchKeyEventPostIME(event, nullptr);
177 }
178
179 ui::EventDispatchDetails RemoteTextInputClient::DispatchKeyEventPostIME(
180 ui::KeyEvent* event,
181 std::unique_ptr<base::Callback<void(bool)>> ack_callback) {
182 pending_callbacks_.push_back(std::move(ack_callback));
183 remote_client_->DispatchKeyEventPostIME(
184 ui::Event::Clone(*event),
185 base::Bind(&RemoteTextInputClient::DispatchKeyEventPostIMECallback,
186 base::Unretained(this)));
187 return ui::EventDispatchDetails();
188 }
189
190 void RemoteTextInputClient::DispatchKeyEventPostIMECallback(
191 bool stopped_propagation) {
192 DCHECK(!pending_callbacks_.empty());
193 std::unique_ptr<base::Callback<void(bool)>> ack_callback =
194 std::move(pending_callbacks_.front());
195 pending_callbacks_.pop_front();
196
197 if (ack_callback)
198 ack_callback->Run(stopped_propagation);
199 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698