OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "mojo/public/cpp/application/application_connection.h" | 5 #include "mojo/public/cpp/application/application_connection.h" |
6 #include "mojo/public/cpp/application/application_delegate.h" | 6 #include "mojo/public/cpp/application/application_delegate.h" |
7 #include "mojo/services/view_manager/view_manager_init_service_impl.h" | 7 #include "mojo/services/view_manager/view_manager_init_service_impl.h" |
8 | 8 |
9 namespace mojo { | 9 namespace mojo { |
10 namespace view_manager { | 10 namespace view_manager { |
11 namespace service { | 11 namespace service { |
12 | 12 |
13 class ViewManagerApp : public ApplicationDelegate { | 13 class ViewManagerApp : public ApplicationDelegate, |
| 14 public InterfaceFactory<ViewManagerInitService> { |
14 public: | 15 public: |
15 ViewManagerApp() {} | 16 ViewManagerApp() {} |
16 virtual ~ViewManagerApp() {} | 17 virtual ~ViewManagerApp() {} |
17 | 18 |
18 virtual bool ConfigureIncomingConnection(ApplicationConnection* connection) | 19 virtual bool ConfigureIncomingConnection( |
19 MOJO_OVERRIDE { | 20 ApplicationConnection* connection) OVERRIDE { |
20 // TODO(sky): this needs some sort of authentication as well as making sure | 21 // TODO(sky): this needs some sort of authentication as well as making sure |
21 // we only ever have one active at a time. | 22 // we only ever have one active at a time. |
22 connection->AddService<ViewManagerInitServiceImpl>(); | 23 connection->AddService(this); |
23 return true; | 24 return true; |
24 } | 25 } |
25 | 26 |
| 27 virtual void Create( |
| 28 ApplicationConnection* connection, |
| 29 InterfaceRequest<ViewManagerInitService> request) OVERRIDE { |
| 30 BindToRequest(new ViewManagerInitServiceImpl(connection), &request); |
| 31 } |
| 32 |
26 private: | 33 private: |
27 DISALLOW_COPY_AND_ASSIGN(ViewManagerApp); | 34 DISALLOW_COPY_AND_ASSIGN(ViewManagerApp); |
28 }; | 35 }; |
29 | 36 |
30 } // namespace service | 37 } // namespace service |
31 } // namespace view_manager | 38 } // namespace view_manager |
32 | 39 |
33 // static | 40 // static |
34 ApplicationDelegate* ApplicationDelegate::Create() { | 41 ApplicationDelegate* ApplicationDelegate::Create() { |
35 return new mojo::view_manager::service::ViewManagerApp(); | 42 return new mojo::view_manager::service::ViewManagerApp(); |
36 } | 43 } |
37 | 44 |
38 } // namespace mojo | 45 } // namespace mojo |
OLD | NEW |