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/network_service_loader.h" | 5 #include "mojo/shell/network_service_loader.h" |
6 | 6 |
7 #include "base/base_paths.h" | 7 #include "base/base_paths.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "mojo/public/cpp/application/application_connection.h" | 10 #include "mojo/public/cpp/application/application_connection.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 | 22 |
23 namespace mojo { | 23 namespace mojo { |
24 namespace shell { | 24 namespace shell { |
25 | 25 |
26 NetworkServiceLoader::NetworkServiceLoader() { | 26 NetworkServiceLoader::NetworkServiceLoader() { |
27 } | 27 } |
28 | 28 |
29 NetworkServiceLoader::~NetworkServiceLoader() { | 29 NetworkServiceLoader::~NetworkServiceLoader() { |
30 } | 30 } |
31 | 31 |
32 void NetworkServiceLoader::LoadService( | 32 void NetworkServiceLoader::Load(ServiceManager* manager, |
33 ServiceManager* manager, | 33 const GURL& url, |
34 const GURL& url, | 34 scoped_refptr<LoadCallbacks> callbacks) { |
35 ScopedMessagePipeHandle shell_handle) { | 35 ScopedMessagePipeHandle shell_handle = callbacks->RegisterApplication(); |
| 36 if (!shell_handle.is_valid()) |
| 37 return; |
| 38 |
36 uintptr_t key = reinterpret_cast<uintptr_t>(manager); | 39 uintptr_t key = reinterpret_cast<uintptr_t>(manager); |
37 if (apps_.find(key) == apps_.end()) { | 40 if (apps_.find(key) == apps_.end()) { |
38 scoped_ptr<ApplicationImpl> app( | 41 scoped_ptr<ApplicationImpl> app( |
39 new ApplicationImpl(this, shell_handle.Pass())); | 42 new ApplicationImpl(this, shell_handle.Pass())); |
40 apps_.add(key, app.Pass()); | 43 apps_.add(key, app.Pass()); |
41 } | 44 } |
42 } | 45 } |
43 | 46 |
44 void NetworkServiceLoader::OnServiceError(ServiceManager* manager, | 47 void NetworkServiceLoader::OnServiceError(ServiceManager* manager, |
45 const GURL& url) { | 48 const GURL& url) { |
(...skipping 11 matching lines...) Expand all Loading... |
57 return true; | 60 return true; |
58 } | 61 } |
59 | 62 |
60 void NetworkServiceLoader::Create(ApplicationConnection* connection, | 63 void NetworkServiceLoader::Create(ApplicationConnection* connection, |
61 InterfaceRequest<NetworkService> request) { | 64 InterfaceRequest<NetworkService> request) { |
62 BindToRequest(new NetworkServiceImpl(connection, context_.get()), &request); | 65 BindToRequest(new NetworkServiceImpl(connection, context_.get()), &request); |
63 } | 66 } |
64 | 67 |
65 } // namespace shell | 68 } // namespace shell |
66 } // namespace mojo | 69 } // namespace mojo |
OLD | NEW |