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/application_manager.h" | 5 #include "mojo/shell/application_manager.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 return; | 172 return; |
173 } | 173 } |
174 | 174 |
175 if (resolved_url.SchemeIsFile()) { | 175 if (resolved_url.SchemeIsFile()) { |
176 new LocalFetcher( | 176 new LocalFetcher( |
177 resolved_url, GetBaseURLAndQuery(resolved_url, nullptr), | 177 resolved_url, GetBaseURLAndQuery(resolved_url, nullptr), |
178 base::Bind(callback, NativeApplicationCleanup::DONT_DELETE)); | 178 base::Bind(callback, NativeApplicationCleanup::DONT_DELETE)); |
179 return; | 179 return; |
180 } | 180 } |
181 | 181 |
182 if (!network_service_) | 182 if (!url_loader_factory_) |
183 ConnectToService(GURL("mojo:network_service"), &network_service_); | 183 ConnectToService(GURL("mojo:network_service"), &url_loader_factory_); |
184 | 184 |
185 const NativeApplicationCleanup cleanup = | 185 const NativeApplicationCleanup cleanup = |
186 base::CommandLine::ForCurrentProcess()->HasSwitch( | 186 base::CommandLine::ForCurrentProcess()->HasSwitch( |
187 switches::kDontDeleteOnDownload) | 187 switches::kDontDeleteOnDownload) |
188 ? NativeApplicationCleanup::DONT_DELETE | 188 ? NativeApplicationCleanup::DONT_DELETE |
189 : NativeApplicationCleanup::DELETE; | 189 : NativeApplicationCleanup::DELETE; |
190 | 190 |
191 if (requested_gurl.SchemeIs("mojo")) { | 191 if (requested_gurl.SchemeIs("mojo")) { |
192 // Use the resolved mojo URL in the request to support origin mapping, etc. | 192 // Use the resolved mojo URL in the request to support origin mapping, etc. |
193 mojo::URLRequestPtr resolved_url_request(mojo::URLRequest::New()); | 193 mojo::URLRequestPtr resolved_url_request(mojo::URLRequest::New()); |
194 resolved_url_request->url = resolved_url.spec(); | 194 resolved_url_request->url = resolved_url.spec(); |
195 new NetworkFetcher(disable_cache_, resolved_url_request.Pass(), | 195 new NetworkFetcher(disable_cache_, resolved_url_request.Pass(), |
196 network_service_.get(), base::Bind(callback, cleanup)); | 196 url_loader_factory_.get(), |
| 197 base::Bind(callback, cleanup)); |
197 return; | 198 return; |
198 } | 199 } |
199 | 200 |
200 new NetworkFetcher(disable_cache_, requested_url.Pass(), | 201 new NetworkFetcher(disable_cache_, requested_url.Pass(), |
201 network_service_.get(), base::Bind(callback, cleanup)); | 202 url_loader_factory_.get(), base::Bind(callback, cleanup)); |
202 } | 203 } |
203 | 204 |
204 bool ApplicationManager::ConnectToRunningApplication( | 205 bool ApplicationManager::ConnectToRunningApplication( |
205 const GURL& resolved_url, | 206 const GURL& resolved_url, |
206 const std::string& qualifier, | 207 const std::string& qualifier, |
207 const GURL& requestor_url, | 208 const GURL& requestor_url, |
208 InterfaceRequest<ServiceProvider>* services, | 209 InterfaceRequest<ServiceProvider>* services, |
209 ServiceProviderPtr* exposed_services) { | 210 ServiceProviderPtr* exposed_services) { |
210 GURL application_url = GetBaseURLAndQuery(resolved_url, nullptr); | 211 GURL application_url = GetBaseURLAndQuery(resolved_url, nullptr); |
211 ShellImpl* shell_impl = GetShellImpl(application_url, qualifier); | 212 ShellImpl* shell_impl = GetShellImpl(application_url, qualifier); |
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
535 return pipe.handle0.Pass(); | 536 return pipe.handle0.Pass(); |
536 } | 537 } |
537 | 538 |
538 void ApplicationManager::CleanupRunner(NativeRunner* runner) { | 539 void ApplicationManager::CleanupRunner(NativeRunner* runner) { |
539 native_runners_.erase( | 540 native_runners_.erase( |
540 std::find(native_runners_.begin(), native_runners_.end(), runner)); | 541 std::find(native_runners_.begin(), native_runners_.end(), runner)); |
541 } | 542 } |
542 | 543 |
543 } // namespace shell | 544 } // namespace shell |
544 } // namespace mojo | 545 } // namespace mojo |
OLD | NEW |