| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 |
| 10 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/compiler_specific.h" |
| 11 #include "net/base/net_export.h" | 13 #include "net/base/net_export.h" |
| 12 #include "net/url_request/url_request_job_factory.h" | 14 #include "net/url_request/url_request_job_factory.h" |
| 13 | 15 |
| 14 namespace net { | 16 namespace net { |
| 15 | 17 |
| 16 class NET_EXPORT URLRequestJobFactoryImpl : public URLRequestJobFactory { | 18 class NET_EXPORT URLRequestJobFactoryImpl : public URLRequestJobFactory { |
| 17 public: | 19 public: |
| 18 URLRequestJobFactoryImpl(); | 20 URLRequestJobFactoryImpl(); |
| 19 virtual ~URLRequestJobFactoryImpl(); | 21 virtual ~URLRequestJobFactoryImpl(); |
| 20 | 22 |
| 23 // Sets the ProtocolHandler for a scheme. Returns true on success, false on |
| 24 // failure (a ProtocolHandler already exists for |scheme|). On success, |
| 25 // URLRequestJobFactory takes ownership of |protocol_handler|. |
| 26 bool SetProtocolHandler(const std::string& scheme, |
| 27 ProtocolHandler* protocol_handler); |
| 28 |
| 21 // URLRequestJobFactory implementation | 29 // 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( | |
| 26 URLRequest* request, NetworkDelegate* network_delegate) const OVERRIDE; | |
| 27 virtual URLRequestJob* MaybeCreateJobWithProtocolHandler( | 30 virtual URLRequestJob* MaybeCreateJobWithProtocolHandler( |
| 28 const std::string& scheme, | 31 const std::string& scheme, |
| 29 URLRequest* request, | 32 URLRequest* request, |
| 30 NetworkDelegate* network_delegate) const OVERRIDE; | 33 NetworkDelegate* network_delegate) const OVERRIDE; |
| 31 virtual URLRequestJob* MaybeInterceptRedirect( | |
| 32 const GURL& location, | |
| 33 URLRequest* request, | |
| 34 NetworkDelegate* network_delegate) const OVERRIDE; | |
| 35 virtual URLRequestJob* MaybeInterceptResponse( | |
| 36 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 |
| 40 private: | 37 private: |
| 41 typedef std::map<std::string, ProtocolHandler*> ProtocolHandlerMap; | 38 typedef std::map<std::string, ProtocolHandler*> ProtocolHandlerMap; |
| 42 typedef std::vector<Interceptor*> InterceptorList; | |
| 43 | 39 |
| 44 ProtocolHandlerMap protocol_handler_map_; | 40 ProtocolHandlerMap protocol_handler_map_; |
| 45 InterceptorList interceptors_; | |
| 46 | 41 |
| 47 DISALLOW_COPY_AND_ASSIGN(URLRequestJobFactoryImpl); | 42 DISALLOW_COPY_AND_ASSIGN(URLRequestJobFactoryImpl); |
| 48 }; | 43 }; |
| 49 | 44 |
| 50 } // namespace net | 45 } // namespace net |
| 51 | 46 |
| 52 #endif // NET_URL_REQUEST_URL_REQUEST_JOB_FACTORY_IMPL_H_ | 47 #endif // NET_URL_REQUEST_URL_REQUEST_JOB_FACTORY_IMPL_H_ |
| OLD | NEW |