| 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 #ifndef SERVICES_KEYBOARD_LINUX_KEYBOARD_SERVICE_IMPL_H_ | 5 #ifndef SERVICES_KEYBOARD_LINUX_KEYBOARD_SERVICE_IMPL_H_ |
| 6 #define SERVICES_KEYBOARD_LINUX_KEYBOARD_SERVICE_IMPL_H_ | 6 #define SERVICES_KEYBOARD_LINUX_KEYBOARD_SERVICE_IMPL_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "mojo/public/cpp/application/interface_factory.h" | 9 #include "mojo/public/cpp/application/interface_factory.h" |
| 10 #include "mojo/public/cpp/bindings/interface_handle.h" |
| 10 #include "mojo/public/cpp/bindings/strong_binding.h" | 11 #include "mojo/public/cpp/bindings/strong_binding.h" |
| 11 #include "mojo/public/interfaces/application/shell.mojom.h" | 12 #include "mojo/public/interfaces/application/shell.mojom.h" |
| 12 #include "mojo/services/keyboard/interfaces/keyboard.mojom.h" | 13 #include "mojo/services/keyboard/interfaces/keyboard.mojom.h" |
| 13 #include "mojo/services/native_viewport/interfaces/native_viewport_event_dispatc
her.mojom.h" | 14 #include "mojo/services/native_viewport/interfaces/native_viewport_event_dispatc
her.mojom.h" |
| 14 | 15 |
| 15 namespace keyboard { | 16 namespace keyboard { |
| 16 | 17 |
| 17 class LinuxKeyboardServiceImpl : public keyboard::KeyboardService, | 18 class LinuxKeyboardServiceImpl : public keyboard::KeyboardService, |
| 18 public mojo::NativeViewportEventDispatcher { | 19 public mojo::NativeViewportEventDispatcher { |
| 19 public: | 20 public: |
| 20 LinuxKeyboardServiceImpl( | 21 LinuxKeyboardServiceImpl( |
| 21 mojo::InterfaceRequest<keyboard::KeyboardService> request, | 22 mojo::InterfaceRequest<keyboard::KeyboardService> request, |
| 22 mojo::InterfaceRequest<NativeViewportEventDispatcher> dispatcher); | 23 mojo::InterfaceRequest<NativeViewportEventDispatcher> dispatcher); |
| 23 ~LinuxKeyboardServiceImpl() override; | 24 ~LinuxKeyboardServiceImpl() override; |
| 24 | 25 |
| 25 // |KeyboardService| overrides: | 26 // |KeyboardService| overrides: |
| 26 void Show(keyboard::KeyboardClientPtr client, | 27 void Show(mojo::InterfaceHandle<keyboard::KeyboardClient> client, |
| 27 keyboard::KeyboardType type) override; | 28 keyboard::KeyboardType type) override; |
| 28 void ShowByRequest() override; | 29 void ShowByRequest() override; |
| 29 void Hide() override; | 30 void Hide() override; |
| 30 void SetText(const mojo::String& text) override; | 31 void SetText(const mojo::String& text) override; |
| 31 void SetSelection(int32_t start, int32_t end) override; | 32 void SetSelection(int32_t start, int32_t end) override; |
| 32 | 33 |
| 33 // |NativeViewportEventDispatcher| overrides: | 34 // |NativeViewportEventDispatcher| overrides: |
| 34 void OnEvent(mojo::EventPtr event, | 35 void OnEvent(mojo::EventPtr event, |
| 35 const OnEventCallback& callback) override; | 36 const OnEventCallback& callback) override; |
| 36 | 37 |
| 37 private: | 38 private: |
| 38 mojo::Binding<mojo::NativeViewportEventDispatcher> event_dispatcher_binding_; | 39 mojo::Binding<mojo::NativeViewportEventDispatcher> event_dispatcher_binding_; |
| 39 mojo::StrongBinding<keyboard::KeyboardService> binding_; | 40 mojo::StrongBinding<keyboard::KeyboardService> binding_; |
| 40 | 41 |
| 41 keyboard::KeyboardClientPtr client_; | 42 keyboard::KeyboardClientPtr client_; |
| 42 std::string text_; | 43 std::string text_; |
| 43 | 44 |
| 44 DISALLOW_COPY_AND_ASSIGN(LinuxKeyboardServiceImpl); | 45 DISALLOW_COPY_AND_ASSIGN(LinuxKeyboardServiceImpl); |
| 45 }; | 46 }; |
| 46 | 47 |
| 47 } // namespace keyboard | 48 } // namespace keyboard |
| 48 | 49 |
| 49 #endif // defined(SERVICES_KEYBOARD_LINUX_KEYBOARD_SERVICE_IMPL_H_) | 50 #endif // defined(SERVICES_KEYBOARD_LINUX_KEYBOARD_SERVICE_IMPL_H_) |
| OLD | NEW |