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

Side by Side Diff: ui/aura/mus/text_input_client_impl.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 #include "ui/aura/mus/text_input_client_impl.h" 5 #include "ui/aura/mus/text_input_client_impl.h"
6 6
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "ui/aura/mus/input_method_mus.h" 8 #include "ui/aura/mus/input_method_mus.h"
9 #include "ui/base/ime/text_input_client.h" 9 #include "ui/base/ime/text_input_client.h"
10 10
11 namespace aura { 11 namespace aura {
12 12
13 TextInputClientImpl::TextInputClientImpl(ui::TextInputClient* text_input_client) 13 TextInputClientImpl::TextInputClientImpl(
14 : text_input_client_(text_input_client), binding_(this) {} 14 ui::TextInputClient* text_input_client,
15 ui::internal::InputMethodDelegate* delegate)
16 : text_input_client_(text_input_client),
17 binding_(this),
18 delegate_(delegate) {}
15 19
16 TextInputClientImpl::~TextInputClientImpl() {} 20 TextInputClientImpl::~TextInputClientImpl() {}
17 21
18 ui::mojom::TextInputClientPtr TextInputClientImpl::CreateInterfacePtrAndBind() { 22 ui::mojom::TextInputClientPtr TextInputClientImpl::CreateInterfacePtrAndBind() {
19 ui::mojom::TextInputClientPtr ptr; 23 ui::mojom::TextInputClientPtr ptr;
20 binding_.Bind(mojo::MakeRequest(&ptr)); 24 binding_.Bind(mojo::MakeRequest(&ptr));
21 return ptr; 25 return ptr;
22 } 26 }
23 27
24 void TextInputClientImpl::SetCompositionText( 28 void TextInputClientImpl::SetCompositionText(
(...skipping 11 matching lines...) Expand all
36 40
37 void TextInputClientImpl::InsertText(const std::string& text) { 41 void TextInputClientImpl::InsertText(const std::string& text) {
38 text_input_client_->InsertText(base::UTF8ToUTF16(text)); 42 text_input_client_->InsertText(base::UTF8ToUTF16(text));
39 } 43 }
40 44
41 void TextInputClientImpl::InsertChar(std::unique_ptr<ui::Event> event) { 45 void TextInputClientImpl::InsertChar(std::unique_ptr<ui::Event> event) {
42 DCHECK(event->IsKeyEvent()); 46 DCHECK(event->IsKeyEvent());
43 text_input_client_->InsertChar(*event->AsKeyEvent()); 47 text_input_client_->InsertChar(*event->AsKeyEvent());
44 } 48 }
45 49
50 void TextInputClientImpl::DispatchKeyEventPostIME(
51 std::unique_ptr<ui::Event> event,
52 const DispatchKeyEventPostIMECallback& callback) {
53 if (delegate_) {
54 delegate_->DispatchKeyEventPostIME(
55 event->AsKeyEvent(),
56 base::MakeUnique<DispatchKeyEventPostIMECallback>(callback));
57 }
58 }
59
46 } // namespace aura 60 } // namespace aura
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698