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_application_loader.h" | 5 #include "mojo/shell/network_application_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 26 matching lines...) Expand all Loading... |
37 return; | 37 return; |
38 | 38 |
39 uintptr_t key = reinterpret_cast<uintptr_t>(manager); | 39 uintptr_t key = reinterpret_cast<uintptr_t>(manager); |
40 if (apps_.find(key) == apps_.end()) { | 40 if (apps_.find(key) == apps_.end()) { |
41 scoped_ptr<ApplicationImpl> app( | 41 scoped_ptr<ApplicationImpl> app( |
42 new ApplicationImpl(this, shell_handle.Pass())); | 42 new ApplicationImpl(this, shell_handle.Pass())); |
43 apps_.add(key, app.Pass()); | 43 apps_.add(key, app.Pass()); |
44 } | 44 } |
45 } | 45 } |
46 | 46 |
47 void NetworkApplicationLoader::OnServiceError(ApplicationManager* manager, | 47 void NetworkApplicationLoader::OnApplicationError(ApplicationManager* manager, |
48 const GURL& url) { | 48 const GURL& url) { |
49 apps_.erase(reinterpret_cast<uintptr_t>(manager)); | 49 apps_.erase(reinterpret_cast<uintptr_t>(manager)); |
50 } | 50 } |
51 | 51 |
52 void NetworkApplicationLoader::Initialize(ApplicationImpl* app) { | 52 void NetworkApplicationLoader::Initialize(ApplicationImpl* app) { |
53 // The context must be created on the same thread as the network service. | 53 // The context must be created on the same thread as the network service. |
54 context_.reset(new NetworkContext(GetBasePath())); | 54 context_.reset(new NetworkContext(GetBasePath())); |
55 } | 55 } |
56 | 56 |
57 bool NetworkApplicationLoader::ConfigureIncomingConnection( | 57 bool NetworkApplicationLoader::ConfigureIncomingConnection( |
58 ApplicationConnection* connection) { | 58 ApplicationConnection* connection) { |
59 connection->AddService(this); | 59 connection->AddService(this); |
60 return true; | 60 return true; |
61 } | 61 } |
62 | 62 |
63 void NetworkApplicationLoader::Create( | 63 void NetworkApplicationLoader::Create( |
64 ApplicationConnection* connection, | 64 ApplicationConnection* connection, |
65 InterfaceRequest<NetworkService> request) { | 65 InterfaceRequest<NetworkService> request) { |
66 BindToRequest(new NetworkServiceImpl(connection, context_.get()), &request); | 66 BindToRequest(new NetworkServiceImpl(connection, context_.get()), &request); |
67 } | 67 } |
68 | 68 |
69 } // namespace shell | 69 } // namespace shell |
70 } // namespace mojo | 70 } // namespace mojo |
OLD | NEW |