Chromium Code Reviews| 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_ |