| OLD | NEW |
| 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 "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "services/ui/public/interfaces/constants.mojom.h" | 10 #include "services/ui/public/interfaces/constants.mojom.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 InputMethodMus::InputMethodMus(ui::internal::InputMethodDelegate* delegate, | 28 InputMethodMus::InputMethodMus(ui::internal::InputMethodDelegate* delegate, |
| 29 Window* window) | 29 Window* window) |
| 30 : window_(window) { | 30 : window_(window) { |
| 31 SetDelegate(delegate); | 31 SetDelegate(delegate); |
| 32 } | 32 } |
| 33 | 33 |
| 34 InputMethodMus::~InputMethodMus() {} | 34 InputMethodMus::~InputMethodMus() {} |
| 35 | 35 |
| 36 void InputMethodMus::Init(service_manager::Connector* connector) { | 36 void InputMethodMus::Init(service_manager::Connector* connector) { |
| 37 if (connector) | 37 if (connector) |
| 38 connector->ConnectToInterface(ui::mojom::kServiceName, &ime_server_); | 38 connector->BindInterface(ui::mojom::kServiceName, &ime_server_); |
| 39 } | 39 } |
| 40 | 40 |
| 41 void InputMethodMus::DispatchKeyEvent( | 41 void InputMethodMus::DispatchKeyEvent( |
| 42 ui::KeyEvent* event, | 42 ui::KeyEvent* event, |
| 43 std::unique_ptr<base::Callback<void(EventResult)>> ack_callback) { | 43 std::unique_ptr<base::Callback<void(EventResult)>> ack_callback) { |
| 44 DCHECK(event->type() == ui::ET_KEY_PRESSED || | 44 DCHECK(event->type() == ui::ET_KEY_PRESSED || |
| 45 event->type() == ui::ET_KEY_RELEASED); | 45 event->type() == ui::ET_KEY_RELEASED); |
| 46 | 46 |
| 47 // If no text input client, do nothing. | 47 // If no text input client, do nothing. |
| 48 if (!GetTextInputClient()) { | 48 if (!GetTextInputClient()) { |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 event_result = EventResult::HANDLED; | 162 event_result = EventResult::HANDLED; |
| 163 } | 163 } |
| 164 // |ack_callback| can be null if the standard form of DispatchKeyEvent() is | 164 // |ack_callback| can be null if the standard form of DispatchKeyEvent() is |
| 165 // called instead of the version which provides a callback. In mus+ash we | 165 // called instead of the version which provides a callback. In mus+ash we |
| 166 // use the version with callback, but some unittests use the standard form. | 166 // use the version with callback, but some unittests use the standard form. |
| 167 if (ack_callback) | 167 if (ack_callback) |
| 168 ack_callback->Run(event_result); | 168 ack_callback->Run(event_result); |
| 169 } | 169 } |
| 170 | 170 |
| 171 } // namespace aura | 171 } // namespace aura |
| OLD | NEW |