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() {} |
}; |