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 explicit KeyboardServiceFactoryImpl( | |
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 DISALLOW_COPY_AND_ASSIGN(KeyboardServiceFactoryImpl); | |
36 }; | |
37 | |
38 class KeyboardServiceApp | |
39 : public mojo::ApplicationDelegate, | |
jamesr
2015/11/20 00:09:02
indentation looks off here. run 'git cl format' t
| |
40 public mojo::InterfaceFactory<KeyboardServiceFactory> { | |
41 public: | |
42 KeyboardServiceApp() {} | |
43 ~KeyboardServiceApp() override {} | |
44 | |
45 private: | |
46 | |
47 // |ApplicationDelegate| override: | |
48 bool ConfigureIncomingConnection( | |
49 mojo::ApplicationConnection* connection) override { | |
50 connection->AddService<KeyboardServiceFactory>(this); | |
51 return true; | |
52 } | |
53 | |
54 // |InterfaceFactory<KeyboardService>| implementation: | |
55 void Create( | |
56 mojo::ApplicationConnection* connection, | |
57 mojo::InterfaceRequest<KeyboardServiceFactory> request) override { | |
58 new KeyboardServiceFactoryImpl(request.Pass()); | |
59 } | |
60 | |
61 private: | |
62 | |
63 DISALLOW_COPY_AND_ASSIGN(KeyboardServiceApp); | |
64 }; | |
65 | |
66 } // namespace keyboard | |
67 | |
68 MojoResult MojoMain(MojoHandle application_request) { | |
69 mojo::ApplicationRunnerChromium runner( | |
70 new keyboard::KeyboardServiceApp()); | |
71 return runner.Run(application_request); | |
72 } | |
OLD | NEW |