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