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

Unified Diff: content/public/browser/resource_dispatcher_host.h

Issue 2222723002: Avoid calling into the ContentBrowserClient interface from ResourceDispatcherHostImpl to determine … (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Attempt to fix 64 bit windows redness Created 4 years, 4 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: content/public/browser/resource_dispatcher_host.h
diff --git a/content/public/browser/resource_dispatcher_host.h b/content/public/browser/resource_dispatcher_host.h
index 3bdd0cae132f4bb9dbd61c3066db169bf5e1bbf0..b5159ce0380202117edc5938eec4df58125c641c 100644
--- a/content/public/browser/resource_dispatcher_host.h
+++ b/content/public/browser/resource_dispatcher_host.h
@@ -8,6 +8,7 @@
#include <stdint.h>
#include <memory>
+#include <string>
#include "base/callback_forward.h"
#include "content/common/content_export.h"
@@ -25,6 +26,27 @@ struct DownloadSaveInfo;
struct Referrer;
class RenderFrameHost;
+// This callback is invoked when the interceptor finishes processing the
+// header.
+// Parameter 1 is a bool indicating success or failure.
+// Parameter 2 contains the error code in case of failure, else 0.
+typedef base::Callback<void(bool, int)> OnHeaderProcessedCallback;
+
+// This callback is registered by interceptors who are interested in being
+// notified of certain HTTP headers in outgoing requests. For e.g. Origin.
+// Parameter 1 contains the HTTP header.
+// Parameter 2 contains its value.
+// Parameter 3 contains the child process id.
+// Parameter 4 contains the current ResourceContext.
+// Parameter 5 contains the callback which needs to be invoked once the
+// interceptor finishes its processing.
+typedef base::Callback<void(const std::string&,
+ const std::string&,
+ int,
+ ResourceContext*,
+ OnHeaderProcessedCallback)>
+ InterceptorCallback;
+
class CONTENT_EXPORT ResourceDispatcherHost {
public:
// Returns the singleton instance of the ResourceDispatcherHost.
@@ -51,6 +73,17 @@ class CONTENT_EXPORT ResourceDispatcherHost {
// Clears the ResourceDispatcherHostLoginDelegate associated with the request.
virtual void ClearLoginDelegateForRequest(net::URLRequest* request) = 0;
+ // Registers the |interceptor| for the |http_header| passed in.
+ // The |starts_with| parameter is used to match the prefix of the
+ // |http_header| in the response and the interceptor will be invoked if there
+ // is a match. If the |starts_with| parameter is empty, the interceptor will
+ // be invoked for every occurrence of the |http_header|.
+ // Currently only HTTP header based interceptors are supported.
+ // At the moment we only support one interceptor per |http_header|.
+ virtual void RegisterInterceptor(const std::string& http_header,
+ const std::string& starts_with,
+ const InterceptorCallback& interceptor) = 0;
+
protected:
virtual ~ResourceDispatcherHost() {}
};

Powered by Google App Engine
This is Rietveld 408576698