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

Side by Side Diff: ui/aura/mus/input_method_mus.cc

Issue 2503063003: Add service name constant for UI service. (Closed)
Patch Set: . Created 4 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
OLDNEW
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2015 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/input_method_mus.h" 5 #include "ui/aura/mus/input_method_mus.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "services/ui/public/interfaces/constants.mojom.h"
9 #include "services/ui/public/interfaces/ime.mojom.h" 10 #include "services/ui/public/interfaces/ime.mojom.h"
10 #include "services/ui/public/interfaces/window_tree_constants.mojom.h" 11 #include "services/ui/public/interfaces/window_tree_constants.mojom.h"
11 #include "ui/aura/mus/text_input_client_impl.h" 12 #include "ui/aura/mus/text_input_client_impl.h"
12 #include "ui/aura/mus/window_port_mus.h" 13 #include "ui/aura/mus/window_port_mus.h"
13 #include "ui/aura/window.h" 14 #include "ui/aura/window.h"
14 #include "ui/base/ime/text_input_client.h" 15 #include "ui/base/ime/text_input_client.h"
15 #include "ui/events/event.h" 16 #include "ui/events/event.h"
16 #include "ui/platform_window/mojo/ime_type_converters.h" 17 #include "ui/platform_window/mojo/ime_type_converters.h"
17 #include "ui/platform_window/mojo/text_input_state.mojom.h" 18 #include "ui/platform_window/mojo/text_input_state.mojom.h"
18 19
19 using ui::mojom::EventResult; 20 using ui::mojom::EventResult;
20 21
21 namespace aura { 22 namespace aura {
22 23
23 //////////////////////////////////////////////////////////////////////////////// 24 ////////////////////////////////////////////////////////////////////////////////
24 // InputMethodMus, public: 25 // InputMethodMus, public:
25 26
26 InputMethodMus::InputMethodMus(ui::internal::InputMethodDelegate* delegate, 27 InputMethodMus::InputMethodMus(ui::internal::InputMethodDelegate* delegate,
27 Window* window) 28 Window* window)
28 : window_(window) { 29 : window_(window) {
29 SetDelegate(delegate); 30 SetDelegate(delegate);
30 } 31 }
31 32
32 InputMethodMus::~InputMethodMus() {} 33 InputMethodMus::~InputMethodMus() {}
33 34
34 void InputMethodMus::Init(service_manager::Connector* connector) { 35 void InputMethodMus::Init(service_manager::Connector* connector) {
35 connector->ConnectToInterface("ui", &ime_server_); 36 connector->ConnectToInterface(ui::mojom::kServiceName, &ime_server_);
36 } 37 }
37 38
38 void InputMethodMus::DispatchKeyEvent( 39 void InputMethodMus::DispatchKeyEvent(
39 ui::KeyEvent* event, 40 ui::KeyEvent* event,
40 std::unique_ptr<base::Callback<void(EventResult)>> ack_callback) { 41 std::unique_ptr<base::Callback<void(EventResult)>> ack_callback) {
41 DCHECK(event->type() == ui::ET_KEY_PRESSED || 42 DCHECK(event->type() == ui::ET_KEY_PRESSED ||
42 event->type() == ui::ET_KEY_RELEASED); 43 event->type() == ui::ET_KEY_RELEASED);
43 44
44 // If no text input client, do nothing. 45 // If no text input client, do nothing.
45 if (!GetTextInputClient()) { 46 if (!GetTextInputClient()) {
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 event_result = EventResult::HANDLED; 158 event_result = EventResult::HANDLED;
158 } 159 }
159 // |ack_callback| can be null if the standard form of DispatchKeyEvent() is 160 // |ack_callback| can be null if the standard form of DispatchKeyEvent() is
160 // called instead of the version which provides a callback. In mus+ash we 161 // called instead of the version which provides a callback. In mus+ash we
161 // use the version with callback, but some unittests use the standard form. 162 // use the version with callback, but some unittests use the standard form.
162 if (ack_callback) 163 if (ack_callback)
163 ack_callback->Run(event_result); 164 ack_callback->Run(event_result);
164 } 165 }
165 166
166 } // namespace aura 167 } // namespace aura
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698