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

Unified Diff: net/url_request/url_request_filter.h

Issue 300693005: Make URLRequestFilter use URLRequestInterceptors. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix merge Created 6 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
« no previous file with comments | « net/ocsp/nss_ocsp_unittest.cc ('k') | net/url_request/url_request_filter.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/url_request/url_request_filter.h
diff --git a/net/url_request/url_request_filter.h b/net/url_request/url_request_filter.h
index 418560df5c67388363652caaf0f903e0ce46d3f1..ff1c27303e13beaf932207b791a4f7cf9b3082d6 100644
--- a/net/url_request/url_request_filter.h
+++ b/net/url_request/url_request_filter.h
@@ -27,22 +27,15 @@
#include "base/memory/scoped_ptr.h"
#include "net/base/net_export.h"
#include "net/url_request/url_request.h"
-#include "net/url_request/url_request_job_factory.h"
class GURL;
namespace net {
class URLRequestJob;
+class URLRequestInterceptor;
class NET_EXPORT URLRequestFilter {
public:
- // scheme,hostname -> ProtocolHandler
- typedef std::map<std::pair<std::string, std::string>,
- URLRequestJobFactory::ProtocolHandler* > HostnameHandlerMap;
- // URL -> ProtocolHandler
- typedef base::hash_map<std::string, URLRequestJobFactory::ProtocolHandler*>
- UrlHandlerMap;
-
~URLRequestFilter();
static URLRequest::ProtocolFactory Factory;
@@ -53,10 +46,10 @@ class NET_EXPORT URLRequestFilter {
void AddHostnameHandler(const std::string& scheme,
const std::string& hostname,
URLRequest::ProtocolFactory* factory);
- void AddHostnameProtocolHandler(
+ void AddHostnameInterceptor(
const std::string& scheme,
const std::string& hostname,
- scoped_ptr<URLRequestJobFactory::ProtocolHandler> protocol_handler);
+ scoped_ptr<URLRequestInterceptor> interceptor);
void RemoveHostnameHandler(const std::string& scheme,
const std::string& hostname);
@@ -64,9 +57,8 @@ class NET_EXPORT URLRequestFilter {
// old handlers for the URL if one existed.
bool AddUrlHandler(const GURL& url,
URLRequest::ProtocolFactory* factory);
- bool AddUrlProtocolHandler(
- const GURL& url,
- scoped_ptr<URLRequestJobFactory::ProtocolHandler> protocol_handler);
+ bool AddUrlInterceptor(const GURL& url,
+ scoped_ptr<URLRequestInterceptor> interceptor);
void RemoveUrlHandler(const GURL& url);
@@ -77,23 +69,29 @@ class NET_EXPORT URLRequestFilter {
// Returns the number of times a handler was used to service a request.
int hit_count() const { return hit_count_; }
- protected:
+ private:
+ // scheme,hostname -> URLRequestInterceptor
+ typedef std::map<std::pair<std::string, std::string>,
+ URLRequestInterceptor* > HostnameInterceptorMap;
+ // URL -> URLRequestInterceptor
+ typedef base::hash_map<std::string, URLRequestInterceptor*> URLInterceptorMap;
+
URLRequestFilter();
- // Helper method that looks up the request in the url_handler_map_.
- URLRequestJob* FindRequestHandler(URLRequest* request,
- NetworkDelegate* network_delegate,
- const std::string& scheme);
+ // Helper method that passes the request to any interceptors registered to
+ // to handle it. Returns the resulting URLRequestJob if they create one.
+ URLRequestJob* MaybeInterceptRequest(URLRequest* request,
+ NetworkDelegate* network_delegate,
+ const std::string& scheme);
- // Maps hostnames to factories. Hostnames take priority over URLs.
- HostnameHandlerMap hostname_handler_map_;
+ // Maps hostnames to interceptors. Hostnames take priority over URLs.
+ HostnameInterceptorMap hostname_interceptor_map_;
- // Maps URLs to factories.
- UrlHandlerMap url_handler_map_;
+ // Maps URLs to interceptors.
+ URLInterceptorMap url_interceptor_map_;
int hit_count_;
- private:
// Singleton instance.
static URLRequestFilter* shared_instance_;
« no previous file with comments | « net/ocsp/nss_ocsp_unittest.cc ('k') | net/url_request/url_request_filter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698