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

Unified Diff: net/url_request/protocol_intercept_job_factory.h

Issue 11293252: Change Interceptors into URLRequestJobFactory::ProtocolHandlers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix PolicyTests to unregister with URLRequestFilter Created 8 years 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: net/url_request/protocol_intercept_job_factory.h
diff --git a/chrome/browser/net/http_intercept_job_factory.h b/net/url_request/protocol_intercept_job_factory.h
similarity index 53%
rename from chrome/browser/net/http_intercept_job_factory.h
rename to net/url_request/protocol_intercept_job_factory.h
index 7e78d3d794c066aac00cc0935c6a452293a17b35..ee5253a08cb27f922450d6b82c2bdc0f95ab4a29 100644
--- a/chrome/browser/net/http_intercept_job_factory.h
+++ b/net/url_request/protocol_intercept_job_factory.h
@@ -2,11 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_BROWSER_NET_HTTP_INTERCEPT_JOB_FACTORY_H_
-#define CHROME_BROWSER_NET_HTTP_INTERCEPT_JOB_FACTORY_H_
+#ifndef NET_URL_REQUEST_PROTOCOL_INTERCEPT_JOB_FACTORY_H_
+#define NET_URL_REQUEST_PROTOCOL_INTERCEPT_JOB_FACTORY_H_
#include "base/basictypes.h"
#include "base/compiler_specific.h"
+#include "base/memory/scoped_ptr.h"
+#include "net/base/net_export.h"
#include "net/url_request/url_request_job_factory.h"
class GURL;
@@ -16,14 +18,19 @@ namespace net {
class URLRequest;
class URLRequestJob;
-// This class acts as a wrapper for URLRequestJobFactory. It handles HTTP and
-// HTTPS jobs using |protocol_handler_|, but forwards all other schemes to the
-// old job factory to be handled there.
-class HttpInterceptJobFactory : public URLRequestJobFactory {
+// This class acts as a wrapper for URLRequestJobFactory. For requests with a
+// scheme matching |scheme_| (or for any scheme if |scheme_| is NULL)
+// |protocol_handler_| is given the option of creating a job. If
+// |protocol_handler_| does not create a job or the scheme does not match the
+// request is forwarded to the |job_factory_| to be handled there.
+class NET_EXPORT ProtocolInterceptJobFactory : public URLRequestJobFactory {
public:
- HttpInterceptJobFactory(const URLRequestJobFactory* job_factory,
- ProtocolHandler* protocol_handler);
- virtual ~HttpInterceptJobFactory();
+ // Passing NULL for |scheme| will cause |protocol_handler| to be passed all
+ // requests.
+ ProtocolInterceptJobFactory(scoped_ptr<URLRequestJobFactory> job_factory,
+ const char* scheme,
+ ProtocolHandler* protocol_handler);
+ virtual ~ProtocolInterceptJobFactory();
// URLRequestJobFactory implementation
virtual bool SetProtocolHandler(const std::string& scheme,
@@ -45,12 +52,13 @@ class HttpInterceptJobFactory : public URLRequestJobFactory {
virtual bool IsHandledURL(const GURL& url) const OVERRIDE;
private:
- const URLRequestJobFactory* job_factory_;
- ProtocolHandler* protocol_handler_;
+ const char* scheme_;
erikwright (departed) 2012/12/07 20:12:05 I'm not sure what the convention for this kind of
pauljensen 2012/12/09 23:14:12 |scheme_| isn't really necessary...I'll remove it
+ scoped_ptr<URLRequestJobFactory> job_factory_;
+ scoped_ptr<ProtocolHandler> protocol_handler_;
- DISALLOW_COPY_AND_ASSIGN(HttpInterceptJobFactory);
+ DISALLOW_COPY_AND_ASSIGN(ProtocolInterceptJobFactory);
};
} // namespace net
-#endif // CHROME_BROWSER_NET_HTTP_INTERCEPT_JOB_FACTORY_H_
+#endif // NET_URL_REQUEST_PROTOCOL_INTERCEPT_JOB_FACTORY_H_

Powered by Google App Engine
This is Rietveld 408576698