Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(99)

Side by Side Diff: net/url_request/url_request.h

Issue 10855209: Refactoring: ProtocolHandler::MaybeCreateJob takes NetworkDelegate as argument (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Latest merge Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/url_request/ftp_protocol_handler.cc ('k') | net/url_request/url_request.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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(
165 const GURL& location); 167 URLRequest* request,
168 NetworkDelegate* network_delegate,
169 const GURL& location);
166 170
167 // Called after having received a final response, but prior to the 171 // Called after having received a final response, but prior to the
168 // the request delegate being informed of the response. This is also 172 // the request delegate being informed of the response. This is also
169 // called when there is no server response at all to allow interception 173 // called when there is no server response at all to allow interception
170 // on dns or network errors. Can return a new job to replace the existing 174 // on dns or network errors. Can return a new job to replace the existing
171 // job if it should be intercepted, or NULL to allow the normal handling to 175 // job if it should be intercepted, or NULL to allow the normal handling to
172 // continue. If a new job is provided, the delegate never sees the original 176 // continue. If a new job is provided, the delegate never sees the original
173 // response, instead the response produced by the intercept job will be 177 // response, instead the response produced by the intercept job will be
174 // returned. 178 // returned.
175 virtual URLRequestJob* MaybeInterceptResponse(URLRequest* request); 179 virtual URLRequestJob* MaybeInterceptResponse(
180 URLRequest* request, NetworkDelegate* network_delegate);
176 }; 181 };
177 182
178 // Deprecated interfaces in net::URLRequest. They have been moved to 183 // Deprecated interfaces in net::URLRequest. They have been moved to
179 // URLRequest's private section to prevent new uses. Existing uses are 184 // URLRequest's private section to prevent new uses. Existing uses are
180 // explicitly friended here and should be removed over time. 185 // explicitly friended here and should be removed over time.
181 class NET_EXPORT Deprecated { 186 class NET_EXPORT Deprecated {
182 private: 187 private:
183 // TODO(willchan): Kill off these friend declarations. 188 // TODO(willchan): Kill off these friend declarations.
184 friend class extensions::AutoUpdateInterceptor; 189 friend class extensions::AutoUpdateInterceptor;
185 friend class ::ChildProcessSecurityPolicyTest; 190 friend class ::ChildProcessSecurityPolicyTest;
(...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after
816 base::TimeTicks creation_time_; 821 base::TimeTicks creation_time_;
817 822
818 scoped_ptr<const base::debug::StackTrace> stack_trace_; 823 scoped_ptr<const base::debug::StackTrace> stack_trace_;
819 824
820 DISALLOW_COPY_AND_ASSIGN(URLRequest); 825 DISALLOW_COPY_AND_ASSIGN(URLRequest);
821 }; 826 };
822 827
823 } // namespace net 828 } // namespace net
824 829
825 #endif // NET_URL_REQUEST_URL_REQUEST_H_ 830 #endif // NET_URL_REQUEST_URL_REQUEST_H_
OLDNEW
« no previous file with comments | « net/url_request/ftp_protocol_handler.cc ('k') | net/url_request/url_request.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698