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 "mojo/public/cpp/application/application_connection.h" |
| 6 #include "mojo/public/cpp/application/application_delegate.h" |
| 7 #include "mojo/public/cpp/application/application_runner.h" |
| 8 #include "mojo/public/cpp/application/interface_factory.h" |
| 9 #include "mojo/public/cpp/bindings/interface_request.h" |
| 10 #include "services/keyboard_native/keyboard_service_impl.h" |
| 11 |
| 12 namespace keyboard { |
| 13 |
| 14 class KeyboardServiceDelegate : public mojo::ApplicationDelegate, |
| 15 public mojo::InterfaceFactory<KeyboardService> { |
| 16 public: |
| 17 KeyboardServiceDelegate() {} |
| 18 ~KeyboardServiceDelegate() override {} |
| 19 |
| 20 // ApplicationDelegate implementation. |
| 21 bool ConfigureIncomingConnection( |
| 22 mojo::ApplicationConnection* connection) override { |
| 23 connection->AddService<KeyboardService>(this); |
| 24 return true; |
| 25 } |
| 26 |
| 27 // InterfaceFactory<KeyboardService> implementation. |
| 28 void Create(mojo::ApplicationConnection* connection, |
| 29 mojo::InterfaceRequest<KeyboardService> request) override { |
| 30 new KeyboardServiceImpl(request.Pass()); |
| 31 } |
| 32 |
| 33 private: |
| 34 DISALLOW_COPY_AND_ASSIGN(KeyboardServiceDelegate); |
| 35 }; |
| 36 |
| 37 } // namespace keyboard |
| 38 |
| 39 MojoResult MojoMain(MojoHandle application_request) { |
| 40 mojo::ApplicationRunner runner(new keyboard::KeyboardServiceDelegate()); |
| 41 return runner.Run(application_request); |
| 42 } |
OLD | NEW |