OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #include "base/macros.h" | |
6 #include "base/threading/sequenced_worker_pool.h" | |
7 #include "mojo/application/application_runner_chromium.h" | |
8 #include "mojo/public/c/system/main.h" | |
9 #include "mojo/public/cpp/application/application_connection.h" | |
10 #include "mojo/public/cpp/application/application_delegate.h" | |
11 #include "mojo/public/cpp/application/application_impl.h" | |
12 #include "mojo/public/cpp/application/connect.h" | |
13 #include "mojo/public/cpp/application/interface_factory.h" | |
14 #include "mojo/services/native_viewport/interfaces/native_viewport.mojom.h" | |
15 #include "services/keyboard/linux/keyboard_service_impl.h" | |
16 | |
17 namespace keyboard { | |
18 | |
19 class KeyboardServiceFactoryImpl : public ::keyboard::KeyboardServiceFactory { | |
20 public: | |
21 KeyboardServiceFactoryImpl( | |
jamesr
2015/11/19 23:47:33
explicit
| |
22 mojo::InterfaceRequest<KeyboardServiceFactory> request) | |
23 : binding_(this, request.Pass()) {} | |
24 | |
25 // |InterfaceFactory<KeyboardService>| implementation: | |
26 void CreateKeyboardService( | |
27 mojo::InterfaceRequest<mojo::NativeViewportEventDispatcher> dispatcher, | |
28 mojo::InterfaceRequest<KeyboardService> request) override { | |
29 new LinuxKeyboardServiceImpl(request.Pass(), dispatcher.Pass()); | |
30 } | |
31 | |
32 private: | |
33 mojo::StrongBinding<::keyboard::KeyboardServiceFactory> binding_; | |
34 | |
35 }; | |
jamesr
2015/11/19 23:47:33
DISALLOW_... ?
| |
36 | |
37 class KeyboardServiceApp | |
38 : public mojo::ApplicationDelegate, | |
39 public mojo::InterfaceFactory<KeyboardServiceFactory> { | |
40 public: | |
41 KeyboardServiceApp() {} | |
42 ~KeyboardServiceApp() override {} | |
43 | |
44 private: | |
45 | |
46 // |ApplicationDelegate| override: | |
47 bool ConfigureIncomingConnection( | |
48 mojo::ApplicationConnection* connection) override { | |
49 connection->AddService<KeyboardServiceFactory>(this); | |
50 return true; | |
51 } | |
52 | |
53 // |InterfaceFactory<KeyboardService>| implementation: | |
54 void Create( | |
55 mojo::ApplicationConnection* connection, | |
56 mojo::InterfaceRequest<KeyboardServiceFactory> request) override { | |
57 new KeyboardServiceFactoryImpl(request.Pass()); | |
58 } | |
59 | |
60 private: | |
61 | |
62 DISALLOW_COPY_AND_ASSIGN(KeyboardServiceApp); | |
63 }; | |
64 | |
65 } // namespace keyboard | |
66 | |
67 MojoResult MojoMain(MojoHandle application_request) { | |
68 mojo::ApplicationRunnerChromium runner( | |
69 new keyboard::KeyboardServiceApp()); | |
70 return runner.Run(application_request); | |
71 } | |
OLD | NEW |