OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "services/keyboard/linux/keyboard_service_impl.h" | 5 #include "services/keyboard/linux/keyboard_service_impl.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/strings/string16.h" | 8 #include "base/strings/string16.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "mojo/public/cpp/application/application_connection.h" | 10 #include "mojo/public/cpp/application/application_connection.h" |
11 #include "mojo/public/cpp/application/connect.h" | 11 #include "mojo/public/cpp/application/connect.h" |
12 #include "mojo/services/input_events/interfaces/input_key_codes.mojom.h" | 12 #include "mojo/services/input_events/interfaces/input_key_codes.mojom.h" |
13 | 13 |
14 namespace keyboard { | 14 namespace keyboard { |
15 | 15 |
16 LinuxKeyboardServiceImpl::LinuxKeyboardServiceImpl( | 16 LinuxKeyboardServiceImpl::LinuxKeyboardServiceImpl( |
17 mojo::InterfaceRequest<keyboard::KeyboardService> request, | 17 mojo::InterfaceRequest<keyboard::KeyboardService> request, |
18 mojo::InterfaceRequest<NativeViewportEventDispatcher> dispatcher) | 18 mojo::InterfaceRequest<NativeViewportEventDispatcher> dispatcher) |
19 : event_dispatcher_binding_(this, dispatcher.Pass()), | 19 : event_dispatcher_binding_(this, dispatcher.Pass()), |
20 binding_(this, request.Pass()) { | 20 binding_(this, request.Pass()) { |
21 } | 21 } |
22 | 22 |
23 LinuxKeyboardServiceImpl::~LinuxKeyboardServiceImpl() { | 23 LinuxKeyboardServiceImpl::~LinuxKeyboardServiceImpl() { |
24 } | 24 } |
25 | 25 |
26 void LinuxKeyboardServiceImpl::Show( | 26 void LinuxKeyboardServiceImpl::Show( |
27 keyboard::KeyboardClientPtr client, | 27 mojo::InterfaceHandle<keyboard::KeyboardClient> client, |
28 keyboard::KeyboardType type) { | 28 keyboard::KeyboardType type) { |
29 client_ = client.Pass(); | 29 client_ = keyboard::KeyboardClientPtr::Create(std::move(client)); |
30 } | 30 } |
31 | 31 |
32 void LinuxKeyboardServiceImpl::ShowByRequest() { | 32 void LinuxKeyboardServiceImpl::ShowByRequest() { |
33 } | 33 } |
34 | 34 |
35 void LinuxKeyboardServiceImpl::Hide() { | 35 void LinuxKeyboardServiceImpl::Hide() { |
36 client_ = nullptr; | 36 client_ = nullptr; |
37 } | 37 } |
38 | 38 |
39 void LinuxKeyboardServiceImpl::SetText(const mojo::String& text) { | 39 void LinuxKeyboardServiceImpl::SetText(const mojo::String& text) { |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 text_ += s; | 77 text_ += s; |
78 client_->CommitText(mojo::String(s), 1); | 78 client_->CommitText(mojo::String(s), 1); |
79 break; | 79 break; |
80 } | 80 } |
81 } | 81 } |
82 } | 82 } |
83 callback.Run(); | 83 callback.Run(); |
84 } | 84 } |
85 | 85 |
86 } // namespace keyboard | 86 } // namespace keyboard |
OLD | NEW |