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

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: Remove the extension origin interceptor class. 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..bdd3650fc74eb7e306b3c87489443cb414234593 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,16 @@ struct DownloadSaveInfo;
struct Referrer;
class RenderFrameHost;
+// This callback is invoked when the interceptor finishes processing the
+// header.
+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.
jam 2016/08/10 00:19:26 nit: please document the parameters to this callba
ananta 2016/08/10 00:30:02 Done.
+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 +62,20 @@ 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.
+ // In the future to register a generic interceptor, we could pass in empty
+ // strings for the |http_header| and |starts_with| parameters.
jam 2016/08/10 00:19:26 nit: I'd remove these two lines since we don't nee
ananta 2016/08/10 00:30:02 Done.
+ // 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