| 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_URL_REQUEST_H_ | 5 #ifndef NET_URL_REQUEST_URL_REQUEST_H_ |
| 6 #define NET_URL_REQUEST_URL_REQUEST_H_ | 6 #define NET_URL_REQUEST_URL_REQUEST_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 // NOTE: All usage of all instances of this class should be on the same thread. | 112 // NOTE: All usage of all instances of this class should be on the same thread. |
| 113 // | 113 // |
| 114 class NET_EXPORT URLRequest : NON_EXPORTED_BASE(public base::NonThreadSafe), | 114 class NET_EXPORT URLRequest : NON_EXPORTED_BASE(public base::NonThreadSafe), |
| 115 public base::SupportsUserData { | 115 public base::SupportsUserData { |
| 116 public: | 116 public: |
| 117 // Callback function implemented by protocol handlers to create new jobs. | 117 // Callback function implemented by protocol handlers to create new jobs. |
| 118 // The factory may return NULL to indicate an error, which will cause other | 118 // The factory may return NULL to indicate an error, which will cause other |
| 119 // factories to be queried. If no factory handles the request, then the | 119 // factories to be queried. If no factory handles the request, then the |
| 120 // default job will be used. | 120 // default job will be used. |
| 121 typedef URLRequestJob* (ProtocolFactory)(URLRequest* request, | 121 typedef URLRequestJob* (ProtocolFactory)(URLRequest* request, |
| 122 NetworkDelegate* network_delegate, |
| 122 const std::string& scheme); | 123 const std::string& scheme); |
| 123 | 124 |
| 124 // HTTP request/response header IDs (via some preprocessor fun) for use with | 125 // HTTP request/response header IDs (via some preprocessor fun) for use with |
| 125 // SetRequestHeaderById and GetResponseHeaderById. | 126 // SetRequestHeaderById and GetResponseHeaderById. |
| 126 enum { | 127 enum { |
| 127 #define HTTP_ATOM(x) HTTP_ ## x, | 128 #define HTTP_ATOM(x) HTTP_ ## x, |
| 128 #include "net/http/http_atom_list.h" | 129 #include "net/http/http_atom_list.h" |
| 129 #undef HTTP_ATOM | 130 #undef HTTP_ATOM |
| 130 }; | 131 }; |
| 131 | 132 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 146 | 147 |
| 147 // This class handles network interception. Use with | 148 // This class handles network interception. Use with |
| 148 // (Un)RegisterRequestInterceptor. | 149 // (Un)RegisterRequestInterceptor. |
| 149 class NET_EXPORT Interceptor { | 150 class NET_EXPORT Interceptor { |
| 150 public: | 151 public: |
| 151 virtual ~Interceptor() {} | 152 virtual ~Interceptor() {} |
| 152 | 153 |
| 153 // Called for every request made. Should return a new job to handle the | 154 // Called for every request made. Should return a new job to handle the |
| 154 // request if it should be intercepted, or NULL to allow the request to | 155 // request if it should be intercepted, or NULL to allow the request to |
| 155 // be handled in the normal manner. | 156 // be handled in the normal manner. |
| 156 virtual URLRequestJob* MaybeIntercept(URLRequest* request) = 0; | 157 virtual URLRequestJob* MaybeIntercept( |
| 158 URLRequest* request, NetworkDelegate* network_delegate) = 0; |
| 157 | 159 |
| 158 // Called after having received a redirect response, but prior to the | 160 // Called after having received a redirect response, but prior to the |
| 159 // the request delegate being informed of the redirect. Can return a new | 161 // the request delegate being informed of the redirect. Can return a new |
| 160 // job to replace the existing job if it should be intercepted, or NULL | 162 // job to replace the existing job if it should be intercepted, or NULL |
| 161 // to allow the normal handling to continue. If a new job is provided, | 163 // to allow the normal handling to continue. If a new job is provided, |
| 162 // the delegate never sees the original redirect response, instead the | 164 // the delegate never sees the original redirect response, instead the |
| 163 // response produced by the intercept job will be returned. | 165 // response produced by the intercept job will be returned. |
| 164 virtual URLRequestJob* MaybeInterceptRedirect(URLRequest* request, | 166 virtual URLRequestJob* MaybeInterceptRedirect(URLRequest* request, |
| 165 const GURL& location); | 167 const GURL& location); |
| 166 | 168 |
| (...skipping 649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 816 base::TimeTicks creation_time_; | 818 base::TimeTicks creation_time_; |
| 817 | 819 |
| 818 scoped_ptr<const base::debug::StackTrace> stack_trace_; | 820 scoped_ptr<const base::debug::StackTrace> stack_trace_; |
| 819 | 821 |
| 820 DISALLOW_COPY_AND_ASSIGN(URLRequest); | 822 DISALLOW_COPY_AND_ASSIGN(URLRequest); |
| 821 }; | 823 }; |
| 822 | 824 |
| 823 } // namespace net | 825 } // namespace net |
| 824 | 826 |
| 825 #endif // NET_URL_REQUEST_URL_REQUEST_H_ | 827 #endif // NET_URL_REQUEST_URL_REQUEST_H_ |
| OLD | NEW |