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

Unified Diff: services/authenticating_url_loader/authenticating_url_loader_interceptor_factory.h

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
Index: services/authenticating_url_loader/authenticating_url_loader_interceptor_factory.h
diff --git a/services/authenticating_url_loader/authenticating_url_loader_factory_impl.h b/services/authenticating_url_loader/authenticating_url_loader_interceptor_factory.h
similarity index 71%
copy from services/authenticating_url_loader/authenticating_url_loader_factory_impl.h
copy to services/authenticating_url_loader/authenticating_url_loader_interceptor_factory.h
index dfa6c7ff351130f745fd040e521d103538279b90..af982d7ebad70a762bdbdf2d5459944174bcab04 100644
--- a/services/authenticating_url_loader/authenticating_url_loader_factory_impl.h
+++ b/services/authenticating_url_loader/authenticating_url_loader_interceptor_factory.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef SERVICES_AUTHENTICATING_URL_LOADER_AUTHENTICATING_URL_LOADER_FACTORY_IMPL_H_
-#define SERVICES_AUTHENTICATING_URL_LOADER_AUTHENTICATING_URL_LOADER_FACTORY_IMPL_H_
+#ifndef SERVICES_AUTHENTICATING_URL_LOADER_AUTHENTICATING_URL_LOADER_INTERCEPTOR_FACTORY_H_
+#define SERVICES_AUTHENTICATING_URL_LOADER_AUTHENTICATING_URL_LOADER_INTERCEPTOR_FACTORY_H_
#include <memory>
@@ -11,7 +11,6 @@
#include "mojo/public/cpp/bindings/error_handler.h"
#include "mojo/public/cpp/bindings/interface_request.h"
#include "mojo/public/cpp/bindings/strong_binding.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/network/public/interfaces/network_service.mojom.h"
#include "url/gurl.h"
@@ -20,17 +19,18 @@ namespace mojo {
class ApplicationImpl;
-class AuthenticatingURLLoaderImpl;
+class AuthenticatingURLLoaderInterceptor;
-class AuthenticatingURLLoaderFactoryImpl
- : public AuthenticatingURLLoaderFactory,
+class AuthenticatingURLLoaderInterceptorFactory
+ : public URLLoaderInterceptorFactory,
public ErrorHandler {
public:
- AuthenticatingURLLoaderFactoryImpl(
- mojo::InterfaceRequest<AuthenticatingURLLoaderFactory> request,
+ AuthenticatingURLLoaderInterceptorFactory(
+ mojo::InterfaceRequest<URLLoaderInterceptorFactory> request,
+ authentication::AuthenticationServicePtr authentication_service,
mojo::ApplicationImpl* app,
std::map<GURL, std::string>* cached_tokens);
- ~AuthenticatingURLLoaderFactoryImpl() override;
+ ~AuthenticatingURLLoaderInterceptorFactory() override;
NetworkService* network_service() { return network_service_.get(); }
@@ -41,14 +41,12 @@ class AuthenticatingURLLoaderFactoryImpl
void RetrieveToken(const GURL& url,
const base::Callback<void(std::string)>& callback);
- void OnURLLoaderError(AuthenticatingURLLoaderImpl* url_loader);
+ void OnInterceptorError(AuthenticatingURLLoaderInterceptor* interceptor);
private:
- // AuthenticatingURLLoaderFactory:
- void CreateAuthenticatingURLLoader(
- mojo::InterfaceRequest<AuthenticatingURLLoader> loader_request) override;
- void SetAuthenticationService(
- authentication::AuthenticationServicePtr authentication_service) override;
+ // URLLoaderInterceptorFactory:
+ void Create(
+ mojo::InterfaceRequest<URLLoaderInterceptor> interceptor) override;
// ErrorHandler:
void OnConnectionError() override;
@@ -63,17 +61,18 @@ class AuthenticatingURLLoaderFactoryImpl
void ExecuteCallbacks(const GURL& origin, const std::string& result);
- StrongBinding<AuthenticatingURLLoaderFactory> binding_;
+ StrongBinding<URLLoaderInterceptorFactory> binding_;
+ authentication::AuthenticationServicePtr authentication_service_;
ApplicationImpl* app_;
std::map<GURL, std::string>* cached_tokens_;
std::map<GURL, std::string> cached_accounts_;
- authentication::AuthenticationServicePtr authentication_service_;
NetworkServicePtr network_service_;
- std::vector<std::unique_ptr<AuthenticatingURLLoaderImpl>> url_loaders_;
+ std::vector<std::unique_ptr<AuthenticatingURLLoaderInterceptor>>
+ interceptors_;
std::map<GURL, std::vector<base::Callback<void(std::string)>>>
pendings_retrieve_token_;
};
} // namespace mojo
-#endif // SERVICES_AUTHENTICATING_URL_LOADER_AUTHENTICATING_URL_LOADER_FACTORY_IMPL_H_
+#endif // SERVICES_AUTHENTICATING_URL_LOADER_AUTHENTICATING_URL_LOADER_INTERCEPTOR_FACTORY_H_

Powered by Google App Engine
This is Rietveld 408576698