| 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 <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 // failure (a ProtocolHandler already exists for |scheme|). On success, | 26 // failure (a ProtocolHandler already exists for |scheme|). On success, |
| 27 // URLRequestJobFactory takes ownership of |protocol_handler|. | 27 // URLRequestJobFactory takes ownership of |protocol_handler|. |
| 28 bool SetProtocolHandler(const std::string& scheme, | 28 bool SetProtocolHandler(const std::string& scheme, |
| 29 ProtocolHandler* protocol_handler); | 29 ProtocolHandler* protocol_handler); |
| 30 | 30 |
| 31 // URLRequestJobFactory implementation | 31 // URLRequestJobFactory implementation |
| 32 URLRequestJob* MaybeCreateJobWithProtocolHandler( | 32 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 URLRequestJob* MaybeInterceptResponse( |
| 37 URLRequest* request, |
| 38 NetworkDelegate* network_delegate) const override; |
| 39 URLRequestJob* MaybeInterceptRedirect( |
| 40 URLRequest* request, |
| 41 NetworkDelegate* network_delegate, |
| 42 const GURL& location) const override; |
| 36 bool IsHandledProtocol(const std::string& scheme) const override; | 43 bool IsHandledProtocol(const std::string& scheme) const override; |
| 37 bool IsHandledURL(const GURL& url) const override; | 44 bool IsHandledURL(const GURL& url) const override; |
| 38 bool IsSafeRedirectTarget(const GURL& location) const override; | 45 bool IsSafeRedirectTarget(const GURL& location) const override; |
| 39 | 46 |
| 40 private: | 47 private: |
| 41 // For testing only. | 48 // For testing only. |
| 42 friend class URLRequestFilter; | 49 friend class URLRequestFilter; |
| 43 | 50 |
| 44 typedef std::map<std::string, ProtocolHandler*> ProtocolHandlerMap; | 51 typedef std::map<std::string, ProtocolHandler*> ProtocolHandlerMap; |
| 45 | 52 |
| 46 // Sets a global URLRequestInterceptor for testing purposes. The interceptor | 53 // Sets a global URLRequestInterceptor for testing purposes. The interceptor |
| 47 // is given the chance to intercept any request before the corresponding | 54 // is given the chance to intercept any request before the corresponding |
| 48 // ProtocolHandler, but after any other URLRequestJobFactories layered on top | 55 // ProtocolHandler, but after any other URLRequestJobFactories layered on top |
| 49 // of the URLRequestJobFactoryImpl. | 56 // of the URLRequestJobFactoryImpl. |
| 50 // If an interceptor is set, the old interceptor must be cleared before | 57 // If an interceptor is set, the old interceptor must be cleared before |
| 51 // setting a new one. | 58 // setting a new one. |
| 52 static void SetInterceptorForTesting(URLRequestInterceptor* interceptor); | 59 static void SetInterceptorForTesting(URLRequestInterceptor* interceptor); |
| 53 | 60 |
| 54 ProtocolHandlerMap protocol_handler_map_; | 61 ProtocolHandlerMap protocol_handler_map_; |
| 55 | 62 |
| 56 DISALLOW_COPY_AND_ASSIGN(URLRequestJobFactoryImpl); | 63 DISALLOW_COPY_AND_ASSIGN(URLRequestJobFactoryImpl); |
| 57 }; | 64 }; |
| 58 | 65 |
| 59 } // namespace net | 66 } // namespace net |
| 60 | 67 |
| 61 #endif // NET_URL_REQUEST_URL_REQUEST_JOB_FACTORY_IMPL_H_ | 68 #endif // NET_URL_REQUEST_URL_REQUEST_JOB_FACTORY_IMPL_H_ |
| OLD | NEW |