| 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_H_ | 5 #ifndef NET_URL_REQUEST_URL_REQUEST_JOB_FACTORY_H_ |
| 6 #define NET_URL_REQUEST_URL_REQUEST_JOB_FACTORY_H_ | 6 #define NET_URL_REQUEST_URL_REQUEST_JOB_FACTORY_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 // Called after having received a final response, but prior to the | 50 // Called after having received a final response, but prior to the |
| 51 // the request delegate being informed of the response. This is also | 51 // the request delegate being informed of the response. This is also |
| 52 // called when there is no server response at all to allow interception | 52 // called when there is no server response at all to allow interception |
| 53 // on DNS or network errors. Can return a new job to replace the existing | 53 // on DNS or network errors. Can return a new job to replace the existing |
| 54 // job if it should be intercepted, or NULL to allow the normal handling to | 54 // job if it should be intercepted, or NULL to allow the normal handling to |
| 55 // continue. If a new job is provided, the delegate never sees the original | 55 // continue. If a new job is provided, the delegate never sees the original |
| 56 // response, instead the response produced by the intercept job will be | 56 // response, instead the response produced by the intercept job will be |
| 57 // returned. | 57 // returned. |
| 58 virtual URLRequestJob* MaybeInterceptResponse( | 58 virtual URLRequestJob* MaybeInterceptResponse( |
| 59 URLRequest* request) const = 0; | 59 URLRequest* request) const = 0; |
| 60 |
| 61 // Returns true if this interceptor handles requests for URLs with the |
| 62 // given protocol. Returning false does not imply that this interceptor |
| 63 // can't or won't handle requests with the given protocol. |
| 64 virtual bool WillHandleProtocol(const std::string& protocol) const { |
| 65 return false; |
| 66 } |
| 60 }; | 67 }; |
| 61 | 68 |
| 62 URLRequestJobFactory(); | 69 URLRequestJobFactory(); |
| 63 ~URLRequestJobFactory(); | 70 ~URLRequestJobFactory(); |
| 64 | 71 |
| 65 // Sets the ProtocolHandler for a scheme. Returns true on success, false on | 72 // Sets the ProtocolHandler for a scheme. Returns true on success, false on |
| 66 // failure (a ProtocolHandler already exists for |scheme|). On success, | 73 // failure (a ProtocolHandler already exists for |scheme|). On success, |
| 67 // URLRequestJobFactory takes ownership of |protocol_handler|. | 74 // URLRequestJobFactory takes ownership of |protocol_handler|. |
| 68 bool SetProtocolHandler(const std::string& scheme, | 75 bool SetProtocolHandler(const std::string& scheme, |
| 69 ProtocolHandler* protocol_handler); | 76 ProtocolHandler* protocol_handler); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 87 | 94 |
| 88 ProtocolHandlerMap protocol_handler_map_; | 95 ProtocolHandlerMap protocol_handler_map_; |
| 89 InterceptorList interceptors_; | 96 InterceptorList interceptors_; |
| 90 | 97 |
| 91 DISALLOW_COPY_AND_ASSIGN(URLRequestJobFactory); | 98 DISALLOW_COPY_AND_ASSIGN(URLRequestJobFactory); |
| 92 }; | 99 }; |
| 93 | 100 |
| 94 } // namespace net | 101 } // namespace net |
| 95 | 102 |
| 96 #endif // NET_URL_REQUEST_URL_REQUEST_JOB_FACTORY_H_ | 103 #endif // NET_URL_REQUEST_URL_REQUEST_JOB_FACTORY_H_ |
| OLD | NEW |