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/shell/view_manager_loader.h" | 5 #include "mojo/shell/view_manager_loader.h" |
6 | 6 |
7 #include "mojo/public/cpp/application/application_connection.h" | 7 #include "mojo/public/cpp/application/application_connection.h" |
8 #include "mojo/public/cpp/application/application_impl.h" | 8 #include "mojo/public/cpp/application/application_impl.h" |
9 #include "mojo/services/view_manager/view_manager_init_service_impl.h" | 9 #include "mojo/services/view_manager/view_manager_init_service_impl.h" |
10 | 10 |
11 namespace mojo { | 11 namespace mojo { |
| 12 |
| 13 using view_manager::ViewManagerInitService; |
| 14 using view_manager::service::ViewManagerInitServiceImpl; |
| 15 |
12 namespace shell { | 16 namespace shell { |
13 | 17 |
14 ViewManagerLoader::ViewManagerLoader() { | 18 ViewManagerLoader::ViewManagerLoader() { |
15 } | 19 } |
16 | 20 |
17 ViewManagerLoader::~ViewManagerLoader() { | 21 ViewManagerLoader::~ViewManagerLoader() { |
18 } | 22 } |
19 | 23 |
20 void ViewManagerLoader::LoadService( | 24 void ViewManagerLoader::LoadService( |
21 ServiceManager* manager, | 25 ServiceManager* manager, |
22 const GURL& url, | 26 const GURL& url, |
23 ScopedMessagePipeHandle shell_handle) { | 27 ScopedMessagePipeHandle shell_handle) { |
24 // TODO(sky): this needs some sort of authentication as well as making sure | 28 // TODO(sky): this needs some sort of authentication as well as making sure |
25 // we only ever have one active at a time. | 29 // we only ever have one active at a time. |
26 scoped_ptr<ApplicationImpl> app( | 30 scoped_ptr<ApplicationImpl> app( |
27 new ApplicationImpl(this, shell_handle.Pass())); | 31 new ApplicationImpl(this, shell_handle.Pass())); |
28 apps_.push_back(app.release()); | 32 apps_.push_back(app.release()); |
29 } | 33 } |
30 | 34 |
31 void ViewManagerLoader::OnServiceError(ServiceManager* manager, | 35 void ViewManagerLoader::OnServiceError(ServiceManager* manager, |
32 const GURL& url) { | 36 const GURL& url) { |
33 } | 37 } |
34 | 38 |
35 bool ViewManagerLoader::ConfigureIncomingConnection( | 39 bool ViewManagerLoader::ConfigureIncomingConnection( |
36 mojo::ApplicationConnection* connection) { | 40 mojo::ApplicationConnection* connection) { |
37 connection->AddService<view_manager::service::ViewManagerInitServiceImpl>(); | 41 connection->AddServiceProvider(this); |
38 return true; | 42 return true; |
39 } | 43 } |
40 | 44 |
| 45 void ViewManagerLoader::BindToRequest( |
| 46 ApplicationConnection* connection, |
| 47 InterfaceRequest<ViewManagerInitService> request) { |
| 48 mojo::BindToRequest(new ViewManagerInitServiceImpl(connection), &request); |
| 49 } |
| 50 |
41 } // namespace shell | 51 } // namespace shell |
42 } // namespace mojo | 52 } // namespace mojo |
OLD | NEW |