Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(579)

Unified Diff: shell/application_manager/application_manager.cc

Issue 1155283003: Change AuthenticatingURLLoader to be a URLLoaderInterceptor (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Address review Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « shell/application_manager/application_manager.h ('k') | shell/application_manager/network_fetcher.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: shell/application_manager/application_manager.cc
diff --git a/shell/application_manager/application_manager.cc b/shell/application_manager/application_manager.cc
index fb9d467fbdfb407d2d16a42b4a9f5ded45c3e383..dbb14221824e9b752465dc31fecd3b79d674665d 100644
--- a/shell/application_manager/application_manager.cc
+++ b/shell/application_manager/application_manager.cc
@@ -12,6 +12,7 @@
#include "base/trace_event/trace_event.h"
#include "mojo/public/cpp/bindings/binding.h"
#include "mojo/public/cpp/bindings/error_handler.h"
+#include "mojo/services/authenticating_url_loader/public/interfaces/authenticating_url_loader_factory.mojom.h"
#include "mojo/services/authentication/public/interfaces/authentication.mojom.h"
#include "mojo/services/content_handler/public/interfaces/content_handler.mojom.h"
#include "shell/application_manager/fetcher.h"
@@ -100,7 +101,7 @@ ApplicationManager::ApplicationManager(const Options& options,
: options_(options),
delegate_(delegate),
blocking_pool_(nullptr),
- initialized_authentication_service_(false),
+ initialized_authentication_interceptor_(false),
weak_ptr_factory_(this) {
}
@@ -188,29 +189,32 @@ void ApplicationManager::ConnectToApplicationWithParameters(
&url_response_disk_cache_);
}
- if (!url_loader_factory_) {
- ConnectToService(GURL("mojo:authenticating_url_loader"),
- &url_loader_factory_);
+ if (!network_service_) {
+ ConnectToService(GURL("mojo:network_service"), &network_service_);
}
- // NOTE: Attempting to initialize the AuthenticationService while connecting
- // to the AuthenticationService would result in a recursive loop, so it has
- // to be explicitly avoided here. AuthenticatingURLLoaders work fine without
- // the AuthenticationService as long as authentication is not needed, so what
- // this means in practice is that the AuthenticationService cannot itself
- // require authentication to obtain.
- if (!initialized_authentication_service_ &&
- !EndsWith(resolved_url.path(), "/authentication.mojo", true)) {
+ // NOTE: Attempting to initialize the apps used authentication for while
+ // connecting to those apps would result in a recursive loop, so it has to be
+ // explicitly avoided here. What this means in practice is that these apps
+ // cannot themselves require authentication to obtain.
+ if (!initialized_authentication_interceptor_ &&
+ !EndsWith(resolved_url.path(), "/authentication.mojo", true) &&
+ !EndsWith(resolved_url.path(), "/authenticating_url_loader.mojo", true)) {
authentication::AuthenticationServicePtr authentication_service;
ConnectToService(GURL("mojo:authentication"), &authentication_service);
- url_loader_factory_->SetAuthenticationService(
- authentication_service.Pass());
- initialized_authentication_service_ = true;
+ mojo::AuthenticatingURLLoaderFactoryPtr url_loader_factory;
+ ConnectToService(GURL("mojo:authenticating_url_loader"),
+ &url_loader_factory);
+ mojo::URLLoaderInterceptorFactoryPtr interceptor_factory;
+ url_loader_factory->CreateURLLoaderInterceptorFactory(
+ GetProxy(&interceptor_factory), authentication_service.Pass());
+ network_service_->RegisterURLLoaderInterceptor(interceptor_factory.Pass());
+ initialized_authentication_interceptor_ = true;
}
new NetworkFetcher(options_.disable_cache, options_.predictable_app_filenames,
resolved_url, url_response_disk_cache_.get(),
- url_loader_factory_.get(), callback);
+ network_service_.get(), callback);
}
bool ApplicationManager::ConnectToRunningApplication(
« no previous file with comments | « shell/application_manager/application_manager.h ('k') | shell/application_manager/network_fetcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698