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

Unified Diff: services/authenticating_url_loader/authenticating_url_loader_interceptor.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.h
diff --git a/services/authenticating_url_loader/authenticating_url_loader_impl.h b/services/authenticating_url_loader/authenticating_url_loader_interceptor.h
similarity index 52%
rename from services/authenticating_url_loader/authenticating_url_loader_impl.h
rename to services/authenticating_url_loader/authenticating_url_loader_interceptor.h
index 89f2213641779e02285c9eb615a10460c2ac0e7c..5542a43bd1c6203faceedf16622e86f26e4b44a1 100644
--- a/services/authenticating_url_loader/authenticating_url_loader_impl.h
+++ b/services/authenticating_url_loader/authenticating_url_loader_interceptor.h
@@ -2,14 +2,14 @@
// 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_IMPL_H_
-#define SERVICES_AUTHENTICATING_URL_LOADER_AUTHENTICATING_URL_LOADER_IMPL_H_
+#ifndef SERVICES_AUTHENTICATING_URL_LOADER_AUTHENTICATING_URL_LOADER_INTERCEPTOR_H_
+#define SERVICES_AUTHENTICATING_URL_LOADER_AUTHENTICATING_URL_LOADER_INTERCEPTOR_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.mojom.h"
#include "mojo/services/network/public/interfaces/url_loader.mojom.h"
-#include "services/authenticating_url_loader/authenticating_url_loader_factory_impl.h"
+#include "services/authenticating_url_loader/authenticating_url_loader_interceptor_factory.h"
#include "url/gurl.h"
namespace mojo {
@@ -22,42 +22,42 @@ enum RequestAuthorizationState {
REQUEST_USED_FRESH_AUTH_SERVICE_TOKEN,
};
-class AuthenticatingURLLoaderImpl : public AuthenticatingURLLoader,
- public ErrorHandler {
+class AuthenticatingURLLoaderInterceptor : public URLLoaderInterceptor,
+ public ErrorHandler {
public:
- AuthenticatingURLLoaderImpl(InterfaceRequest<AuthenticatingURLLoader> request,
- AuthenticatingURLLoaderFactoryImpl* factory);
- ~AuthenticatingURLLoaderImpl() override;
+ AuthenticatingURLLoaderInterceptor(
+ mojo::InterfaceRequest<URLLoaderInterceptor> request,
+ AuthenticatingURLLoaderInterceptorFactory* factory);
+ ~AuthenticatingURLLoaderInterceptor() override;
private:
- // AuthenticatingURLLoader methods:
- void Start(URLRequestPtr request,
- const Callback<void(URLResponsePtr)>& callback) override;
- void FollowRedirect(const Callback<void(URLResponsePtr)>& callback) override;
-
- // ErrorHandler methods:
+ // URLLoaderInterceptor:
+ void InterceptRequest(mojo::URLRequestPtr request,
+ const InterceptRequestCallback& callback) override;
+ void InterceptFollowRedirect(
+ const InterceptResponseCallback& callback) override;
+ void InterceptResponse(mojo::URLResponsePtr response,
+ const InterceptResponseCallback& callback) override;
+
+ // ErrorHandler:
void OnConnectionError() override;
- void StartNetworkRequest(URLRequestPtr request);
-
- void OnLoadComplete(URLResponsePtr response);
-
- void FollowRedirectInternal();
-
void OnOAuth2TokenReceived(std::string token);
- Binding<AuthenticatingURLLoader> binding_;
- AuthenticatingURLLoaderFactoryImpl* factory_;
- URLLoaderPtr url_loader_;
+ URLRequestPtr BuildRequest(std::string token);
+ void StartRequest(mojo::URLRequestPtr request);
+
+ Binding<URLLoaderInterceptor> binding_;
+ AuthenticatingURLLoaderInterceptorFactory* factory_;
+ InterceptResponseCallback pending_interception_callback_;
URLResponsePtr pending_response_;
RequestAuthorizationState request_authorization_state_;
GURL url_;
bool auto_follow_redirects_;
bool bypass_cache_;
Array<HttpHeaderPtr> headers_;
- Callback<void(URLResponsePtr)> pending_request_callback_;
};
} // namespace mojo
-#endif // SERVICES_AUTHENTICATING_URL_LOADER_AUTHENTICATING_URL_LOADER_IMPL_H_
+#endif // SERVICES_AUTHENTICATING_URL_LOADER_AUTHENTICATING_URL_LOADER_INTERCEPTOR_H_

Powered by Google App Engine
This is Rietveld 408576698