| OLD | NEW |
| 1 // Copyright (c) 2011 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_URL_REQUEST_JOB_FACTORY_IMPL_H_ | 5 #ifndef NET_URL_REQUEST_URL_REQUEST_JOB_FACTORY_IMPL_H_ |
| 6 #define NET_URL_REQUEST_URL_REQUEST_JOB_FACTORY_IMPL_H_ | 6 #define NET_URL_REQUEST_URL_REQUEST_JOB_FACTORY_IMPL_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <vector> | 9 #include <vector> |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.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 namespace net { | 14 namespace net { |
| 15 | 15 |
| 16 class NET_EXPORT URLRequestJobFactoryImpl : public URLRequestJobFactory { | 16 class NET_EXPORT URLRequestJobFactoryImpl : public URLRequestJobFactory { |
| 17 public: | 17 public: |
| 18 URLRequestJobFactoryImpl(); | 18 URLRequestJobFactoryImpl(); |
| 19 virtual ~URLRequestJobFactoryImpl(); | 19 virtual ~URLRequestJobFactoryImpl(); |
| 20 | 20 |
| 21 // URLRequestJobFactory implementation | 21 // URLRequestJobFactory implementation |
| 22 virtual bool SetProtocolHandler(const std::string& scheme, | |
| 23 ProtocolHandler* protocol_handler) OVERRIDE; | |
| 24 virtual void AddInterceptor(Interceptor* interceptor) OVERRIDE; | |
| 25 virtual URLRequestJob* MaybeCreateJobWithInterceptor( | 22 virtual URLRequestJob* MaybeCreateJobWithInterceptor( |
| 26 URLRequest* request, NetworkDelegate* network_delegate) const OVERRIDE; | 23 URLRequest* request, NetworkDelegate* network_delegate) const OVERRIDE; |
| 27 virtual URLRequestJob* MaybeCreateJobWithProtocolHandler( | 24 virtual URLRequestJob* MaybeCreateJobWithProtocolHandler( |
| 28 const std::string& scheme, | 25 const std::string& scheme, |
| 29 URLRequest* request, | 26 URLRequest* request, |
| 30 NetworkDelegate* network_delegate) const OVERRIDE; | 27 NetworkDelegate* network_delegate) const OVERRIDE; |
| 31 virtual URLRequestJob* MaybeInterceptRedirect( | 28 virtual URLRequestJob* MaybeInterceptRedirect( |
| 32 const GURL& location, | 29 const GURL& location, |
| 33 URLRequest* request, | 30 URLRequest* request, |
| 34 NetworkDelegate* network_delegate) const OVERRIDE; | 31 NetworkDelegate* network_delegate) const OVERRIDE; |
| 35 virtual URLRequestJob* MaybeInterceptResponse( | 32 virtual URLRequestJob* MaybeInterceptResponse( |
| 36 URLRequest* request, NetworkDelegate* network_delegate) const OVERRIDE; | 33 URLRequest* request, NetworkDelegate* network_delegate) const OVERRIDE; |
| 37 virtual bool IsHandledProtocol(const std::string& scheme) const OVERRIDE; | 34 virtual bool IsHandledProtocol(const std::string& scheme) const OVERRIDE; |
| 38 virtual bool IsHandledURL(const GURL& url) const OVERRIDE; | 35 virtual bool IsHandledURL(const GURL& url) const OVERRIDE; |
| 39 | 36 |
| 37 // Sets the ProtocolHandler for a scheme. Returns true on success, false on |
| 38 // failure (a ProtocolHandler already exists for |scheme|). On success, |
| 39 // URLRequestJobFactory takes ownership of |protocol_handler|. |
| 40 bool SetProtocolHandler(const std::string& scheme, |
| 41 ProtocolHandler* protocol_handler); |
| 42 |
| 43 // Takes ownership of |interceptor|. Adds it to the end of the Interceptor |
| 44 // list. |
| 45 void AddInterceptor(Interceptor* interceptor); |
| 46 |
| 40 private: | 47 private: |
| 41 typedef std::map<std::string, ProtocolHandler*> ProtocolHandlerMap; | 48 typedef std::map<std::string, ProtocolHandler*> ProtocolHandlerMap; |
| 42 typedef std::vector<Interceptor*> InterceptorList; | 49 typedef std::vector<Interceptor*> InterceptorList; |
| 43 | 50 |
| 44 ProtocolHandlerMap protocol_handler_map_; | 51 ProtocolHandlerMap protocol_handler_map_; |
| 45 InterceptorList interceptors_; | 52 InterceptorList interceptors_; |
| 46 | 53 |
| 47 DISALLOW_COPY_AND_ASSIGN(URLRequestJobFactoryImpl); | 54 DISALLOW_COPY_AND_ASSIGN(URLRequestJobFactoryImpl); |
| 48 }; | 55 }; |
| 49 | 56 |
| 50 } // namespace net | 57 } // namespace net |
| 51 | 58 |
| 52 #endif // NET_URL_REQUEST_URL_REQUEST_JOB_FACTORY_IMPL_H_ | 59 #endif // NET_URL_REQUEST_URL_REQUEST_JOB_FACTORY_IMPL_H_ |
| OLD | NEW |