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::Load(ServiceManager* manager, | 32 void NetworkServiceLoader::LoadService( |
33 const GURL& url, | 33 ServiceManager* manager, |
34 scoped_refptr<LoadCallbacks> callbacks) { | 34 const GURL& url, |
35 ScopedMessagePipeHandle shell_handle = callbacks->RegisterApplication(); | 35 ScopedMessagePipeHandle shell_handle) { |
36 if (!shell_handle.is_valid()) | |
37 return; | |
38 | |
39 uintptr_t key = reinterpret_cast<uintptr_t>(manager); | 36 uintptr_t key = reinterpret_cast<uintptr_t>(manager); |
40 if (apps_.find(key) == apps_.end()) { | 37 if (apps_.find(key) == apps_.end()) { |
41 scoped_ptr<ApplicationImpl> app( | 38 scoped_ptr<ApplicationImpl> app( |
42 new ApplicationImpl(this, shell_handle.Pass())); | 39 new ApplicationImpl(this, shell_handle.Pass())); |
43 apps_.add(key, app.Pass()); | 40 apps_.add(key, app.Pass()); |
44 } | 41 } |
45 } | 42 } |
46 | 43 |
47 void NetworkServiceLoader::OnServiceError(ServiceManager* manager, | 44 void NetworkServiceLoader::OnServiceError(ServiceManager* manager, |
48 const GURL& url) { | 45 const GURL& url) { |
(...skipping 11 matching lines...) Expand all Loading... |
60 return true; | 57 return true; |
61 } | 58 } |
62 | 59 |
63 void NetworkServiceLoader::Create(ApplicationConnection* connection, | 60 void NetworkServiceLoader::Create(ApplicationConnection* connection, |
64 InterfaceRequest<NetworkService> request) { | 61 InterfaceRequest<NetworkService> request) { |
65 BindToRequest(new NetworkServiceImpl(connection, context_.get()), &request); | 62 BindToRequest(new NetworkServiceImpl(connection, context_.get()), &request); |
66 } | 63 } |
67 | 64 |
68 } // namespace shell | 65 } // namespace shell |
69 } // namespace mojo | 66 } // namespace mojo |
OLD | NEW |