Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef NET_URL_REQUEST_PROTOCOL_INTERCEPT_JOB_FACTORY_H_ | 5 #ifndef NET_URL_REQUEST_PROTOCOL_INTERCEPT_JOB_FACTORY_H_ |
| 6 #define NET_URL_REQUEST_PROTOCOL_INTERCEPT_JOB_FACTORY_H_ | 6 #define NET_URL_REQUEST_PROTOCOL_INTERCEPT_JOB_FACTORY_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "net/base/net_export.h" | 11 #include "net/base/net_export.h" |
| 12 #include "net/url_request/url_request_job_factory.h" | 12 #include "net/url_request/url_request_job_factory.h" |
| 13 | 13 |
| 14 class GURL; | 14 class GURL; |
| 15 | 15 |
| 16 namespace net { | 16 namespace net { |
| 17 | 17 |
| 18 class URLRequest; | 18 class URLRequest; |
| 19 class URLRequestJob; | 19 class URLRequestJob; |
| 20 | 20 |
| 21 // This class acts as a wrapper for URLRequestJobFactory. |protocol_handler_| is | 21 // This class acts as a wrapper for URLRequestJobFactory. |protocol_handler_| is |
| 22 // given the option of creating a URLRequestJob for each potential URLRequest. | 22 // given the option of creating a URLRequestJob for each potential URLRequest. |
| 23 // If |protocol_handler_| does not create a job (i.e. MaybeCreateJob() returns | 23 // If |protocol_handler_| does not create a job (i.e. MaybeCreateJob() returns |
| 24 // NULL) the URLRequest is forwarded to the |job_factory_| to be handled there. | 24 // NULL) the URLRequest is forwarded to the |job_factory_| to be handled there. |
|
mmenke
2013/02/19 17:26:15
I think we should mention that only the ProtocolHa
pauljensen
2013/02/20 15:13:27
Done.
mmenke
2013/02/20 15:48:58
SGTM
| |
| 25 class NET_EXPORT ProtocolInterceptJobFactory : public URLRequestJobFactory { | 25 class NET_EXPORT ProtocolInterceptJobFactory : public URLRequestJobFactory { |
| 26 public: | 26 public: |
| 27 ProtocolInterceptJobFactory(scoped_ptr<URLRequestJobFactory> job_factory, | 27 ProtocolInterceptJobFactory(scoped_ptr<URLRequestJobFactory> job_factory, |
| 28 scoped_ptr<ProtocolHandler> protocol_handler); | 28 scoped_ptr<ProtocolHandler> protocol_handler); |
| 29 virtual ~ProtocolInterceptJobFactory(); | 29 virtual ~ProtocolInterceptJobFactory(); |
| 30 | 30 |
| 31 // URLRequestJobFactory implementation | 31 // URLRequestJobFactory implementation |
| 32 virtual URLRequestJob* MaybeCreateJobWithProtocolHandler( | 32 virtual URLRequestJob* MaybeCreateJobWithProtocolHandler( |
| 33 const std::string& scheme, | 33 const std::string& scheme, |
| 34 URLRequest* request, | 34 URLRequest* request, |
| 35 NetworkDelegate* network_delegate) const OVERRIDE; | 35 NetworkDelegate* network_delegate) const OVERRIDE; |
| 36 virtual bool IsHandledProtocol(const std::string& scheme) const OVERRIDE; | 36 virtual bool IsHandledProtocol(const std::string& scheme) const OVERRIDE; |
| 37 virtual bool IsHandledURL(const GURL& url) const OVERRIDE; | 37 virtual bool IsHandledURL(const GURL& url) const OVERRIDE; |
| 38 virtual bool IsSafeRedirectTarget(const GURL& location) const OVERRIDE; | |
| 38 | 39 |
| 39 private: | 40 private: |
| 40 scoped_ptr<URLRequestJobFactory> job_factory_; | 41 scoped_ptr<URLRequestJobFactory> job_factory_; |
| 41 scoped_ptr<ProtocolHandler> protocol_handler_; | 42 scoped_ptr<ProtocolHandler> protocol_handler_; |
| 42 | 43 |
| 43 DISALLOW_COPY_AND_ASSIGN(ProtocolInterceptJobFactory); | 44 DISALLOW_COPY_AND_ASSIGN(ProtocolInterceptJobFactory); |
| 44 }; | 45 }; |
| 45 | 46 |
| 46 } // namespace net | 47 } // namespace net |
| 47 | 48 |
| 48 #endif // NET_URL_REQUEST_PROTOCOL_INTERCEPT_JOB_FACTORY_H_ | 49 #endif // NET_URL_REQUEST_PROTOCOL_INTERCEPT_JOB_FACTORY_H_ |
| OLD | NEW |