Chromium Code Reviews| 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 | 12 |
| 13 using service::ViewManagerInitServiceImpl; | 13 using service::ViewManagerInitServiceImpl; |
| 14 | 14 |
| 15 namespace shell { | 15 namespace shell { |
| 16 | 16 |
| 17 ViewManagerLoader::ViewManagerLoader() { | 17 ViewManagerLoader::ViewManagerLoader() { |
| 18 } | 18 } |
| 19 | 19 |
| 20 ViewManagerLoader::~ViewManagerLoader() { | 20 ViewManagerLoader::~ViewManagerLoader() { |
| 21 } | 21 } |
| 22 | 22 |
| 23 void ViewManagerLoader::LoadService( | 23 void ViewManagerLoader::LoadService( |
| 24 ServiceManager* manager, | 24 ServiceManager* manager, |
| 25 const GURL& url, | 25 const GURL& url, |
| 26 ScopedMessagePipeHandle shell_handle) { | 26 scoped_refptr<LoadServiceCallbacks> callbacks) { |
| 27 ScopedMessagePipeHandle shell_handle = callbacks->RegisterApplication(); | |
| 28 if (!shell_handle.is_valid()) { | |
|
DaveMoore
2014/08/04 21:50:52
Nit: no braces
Aaron Boodman
2014/08/05 05:44:55
Done.
| |
| 29 return; | |
| 30 } | |
| 31 | |
| 27 // TODO(sky): this needs some sort of authentication as well as making sure | 32 // TODO(sky): this needs some sort of authentication as well as making sure |
| 28 // we only ever have one active at a time. | 33 // we only ever have one active at a time. |
| 29 scoped_ptr<ApplicationImpl> app( | 34 scoped_ptr<ApplicationImpl> app( |
| 30 new ApplicationImpl(this, shell_handle.Pass())); | 35 new ApplicationImpl(this, shell_handle.Pass())); |
| 31 apps_.push_back(app.release()); | 36 apps_.push_back(app.release()); |
| 32 } | 37 } |
| 33 | 38 |
| 34 void ViewManagerLoader::OnServiceError(ServiceManager* manager, | 39 void ViewManagerLoader::OnServiceError(ServiceManager* manager, |
| 35 const GURL& url) { | 40 const GURL& url) { |
| 36 } | 41 } |
| 37 | 42 |
| 38 bool ViewManagerLoader::ConfigureIncomingConnection( | 43 bool ViewManagerLoader::ConfigureIncomingConnection( |
| 39 ApplicationConnection* connection) { | 44 ApplicationConnection* connection) { |
| 40 context_.ConfigureIncomingConnection(connection); | 45 context_.ConfigureIncomingConnection(connection); |
| 41 connection->AddService(this); | 46 connection->AddService(this); |
| 42 return true; | 47 return true; |
| 43 } | 48 } |
| 44 | 49 |
| 45 void ViewManagerLoader::Create( | 50 void ViewManagerLoader::Create( |
| 46 ApplicationConnection* connection, | 51 ApplicationConnection* connection, |
| 47 InterfaceRequest<ViewManagerInitService> request) { | 52 InterfaceRequest<ViewManagerInitService> request) { |
| 48 BindToRequest(new ViewManagerInitServiceImpl(connection, &context_), | 53 BindToRequest(new ViewManagerInitServiceImpl(connection, &context_), |
| 49 &request); | 54 &request); |
| 50 } | 55 } |
| 51 | 56 |
| 52 } // namespace shell | 57 } // namespace shell |
| 53 } // namespace mojo | 58 } // namespace mojo |
| OLD | NEW |