| 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" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 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. |
| 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 bool SetProtocolHandler(const std::string& scheme, | |
| 33 ProtocolHandler* protocol_handler) OVERRIDE; | |
| 34 virtual void AddInterceptor(Interceptor* interceptor) OVERRIDE; | |
| 35 virtual URLRequestJob* MaybeCreateJobWithInterceptor( | 32 virtual URLRequestJob* MaybeCreateJobWithInterceptor( |
| 36 URLRequest* request, NetworkDelegate* network_delegate) const OVERRIDE; | 33 URLRequest* request, NetworkDelegate* network_delegate) const OVERRIDE; |
| 37 virtual URLRequestJob* MaybeCreateJobWithProtocolHandler( | 34 virtual URLRequestJob* MaybeCreateJobWithProtocolHandler( |
| 38 const std::string& scheme, | 35 const std::string& scheme, |
| 39 URLRequest* request, | 36 URLRequest* request, |
| 40 NetworkDelegate* network_delegate) const OVERRIDE; | 37 NetworkDelegate* network_delegate) const OVERRIDE; |
| 41 virtual URLRequestJob* MaybeInterceptRedirect( | 38 virtual URLRequestJob* MaybeInterceptRedirect( |
| 42 const GURL& location, | 39 const GURL& location, |
| 43 URLRequest* request, | 40 URLRequest* request, |
| 44 NetworkDelegate* network_delegate) const OVERRIDE; | 41 NetworkDelegate* network_delegate) const OVERRIDE; |
| 45 virtual URLRequestJob* MaybeInterceptResponse( | 42 virtual URLRequestJob* MaybeInterceptResponse( |
| 46 URLRequest* request, NetworkDelegate* network_delegate) const OVERRIDE; | 43 URLRequest* request, NetworkDelegate* network_delegate) const OVERRIDE; |
| 47 virtual bool IsHandledProtocol(const std::string& scheme) const OVERRIDE; | 44 virtual bool IsHandledProtocol(const std::string& scheme) const OVERRIDE; |
| 48 virtual bool IsHandledURL(const GURL& url) const OVERRIDE; | 45 virtual bool IsHandledURL(const GURL& url) const OVERRIDE; |
| 49 | 46 |
| 50 private: | 47 private: |
| 51 scoped_ptr<URLRequestJobFactory> job_factory_; | 48 scoped_ptr<URLRequestJobFactory> job_factory_; |
| 52 scoped_ptr<ProtocolHandler> protocol_handler_; | 49 scoped_ptr<ProtocolHandler> protocol_handler_; |
| 53 | 50 |
| 54 DISALLOW_COPY_AND_ASSIGN(ProtocolInterceptJobFactory); | 51 DISALLOW_COPY_AND_ASSIGN(ProtocolInterceptJobFactory); |
| 55 }; | 52 }; |
| 56 | 53 |
| 57 } // namespace net | 54 } // namespace net |
| 58 | 55 |
| 59 #endif // NET_URL_REQUEST_PROTOCOL_INTERCEPT_JOB_FACTORY_H_ | 56 #endif // NET_URL_REQUEST_PROTOCOL_INTERCEPT_JOB_FACTORY_H_ |
| OLD | NEW |