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 "shell/application_manager/application_manager.h" | 5 #include "shell/application_manager/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 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 181 new LocalFetcher(resolved_url, GetBaseURLAndQuery(resolved_url, nullptr), | 181 new LocalFetcher(resolved_url, GetBaseURLAndQuery(resolved_url, nullptr), |
| 182 callback); | 182 callback); |
| 183 return; | 183 return; |
| 184 } | 184 } |
| 185 | 185 |
| 186 if (!url_response_disk_cache_) { | 186 if (!url_response_disk_cache_) { |
| 187 ConnectToService(GURL("mojo:url_response_disk_cache"), | 187 ConnectToService(GURL("mojo:url_response_disk_cache"), |
| 188 &url_response_disk_cache_); | 188 &url_response_disk_cache_); |
| 189 } | 189 } |
| 190 | 190 |
| 191 if (!url_loader_factory_) { | 191 if (!network_service_) { |
| 192 ConnectToService(GURL("mojo:authenticating_url_loader"), | 192 ConnectToService(GURL("mojo:network_service"), &network_service_); |
| 193 &url_loader_factory_); | |
| 194 } | 193 } |
| 195 | 194 |
| 196 // NOTE: Attempting to initialize the AuthenticationService while connecting | 195 // NOTE: Attempting to initialize the AuthenticationService while connecting |
| 197 // to the AuthenticationService would result in a recursive loop, so it has | 196 // to the AuthenticationService would result in a recursive loop, so it has |
| 198 // to be explicitly avoided here. AuthenticatingURLLoaders work fine without | 197 // to be explicitly avoided here. AuthenticatingURLLoaders work fine without |
| 199 // the AuthenticationService as long as authentication is not needed, so what | 198 // the AuthenticationService as long as authentication is not needed, so what |
| 200 // this means in practice is that the AuthenticationService cannot itself | 199 // this means in practice is that the AuthenticationService cannot itself |
| 201 // require authentication to obtain. | 200 // require authentication to obtain. |
| 202 if (!initialized_authentication_service_ && | 201 if (!initialized_authentication_service_ && |
| 203 !EndsWith(resolved_url.path(), "/authentication.mojo", true)) { | 202 !EndsWith(resolved_url.path(), "/authentication.mojo", true)) { |
|
qsr
2015/06/05 10:54:55
I think we should now be able to not need mojo:aut
blundell
2015/06/05 13:24:17
Done.
| |
| 204 authentication::AuthenticationServicePtr authentication_service; | 203 authentication::AuthenticationServicePtr authentication_service; |
| 205 ConnectToService(GURL("mojo:authentication"), &authentication_service); | 204 ConnectToService(GURL("mojo:authentication"), &authentication_service); |
| 206 url_loader_factory_->SetAuthenticationService( | 205 ConnectToService(GURL("mojo:authenticating_url_loader"), |
| 207 authentication_service.Pass()); | 206 &url_loader_factory_); |
| 207 mojo::URLLoaderInterceptorFactoryPtr interceptor_factory; | |
| 208 url_loader_factory_->CreateURLLoaderInterceptorFactory( | |
| 209 GetProxy(&interceptor_factory), authentication_service.Pass()); | |
| 210 network_service_->RegisterURLLoaderInterceptor(interceptor_factory.Pass()); | |
| 208 initialized_authentication_service_ = true; | 211 initialized_authentication_service_ = true; |
| 209 } | 212 } |
| 210 | 213 |
| 211 new NetworkFetcher(options_.disable_cache, options_.predictable_app_filenames, | 214 new NetworkFetcher(options_.disable_cache, options_.predictable_app_filenames, |
| 212 resolved_url, url_response_disk_cache_.get(), | 215 resolved_url, url_response_disk_cache_.get(), |
| 213 url_loader_factory_.get(), callback); | 216 network_service_.get(), callback); |
| 214 } | 217 } |
| 215 | 218 |
| 216 bool ApplicationManager::ConnectToRunningApplication( | 219 bool ApplicationManager::ConnectToRunningApplication( |
| 217 const GURL& resolved_url, | 220 const GURL& resolved_url, |
| 218 const GURL& requestor_url, | 221 const GURL& requestor_url, |
| 219 InterfaceRequest<ServiceProvider>* services, | 222 InterfaceRequest<ServiceProvider>* services, |
| 220 ServiceProviderPtr* exposed_services) { | 223 ServiceProviderPtr* exposed_services) { |
| 221 GURL application_url = GetBaseURLAndQuery(resolved_url, nullptr); | 224 GURL application_url = GetBaseURLAndQuery(resolved_url, nullptr); |
| 222 ShellImpl* shell_impl = GetShellImpl(application_url); | 225 ShellImpl* shell_impl = GetShellImpl(application_url); |
| 223 if (!shell_impl) | 226 if (!shell_impl) |
| (...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 500 return args_it->second; | 503 return args_it->second; |
| 501 return std::vector<std::string>(); | 504 return std::vector<std::string>(); |
| 502 } | 505 } |
| 503 | 506 |
| 504 void ApplicationManager::CleanupRunner(NativeRunner* runner) { | 507 void ApplicationManager::CleanupRunner(NativeRunner* runner) { |
| 505 native_runners_.erase( | 508 native_runners_.erase( |
| 506 std::find(native_runners_.begin(), native_runners_.end(), runner)); | 509 std::find(native_runners_.begin(), native_runners_.end(), runner)); |
| 507 } | 510 } |
| 508 | 511 |
| 509 } // namespace shell | 512 } // namespace shell |
| OLD | NEW |