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

Side by Side Diff: net/proxy/proxy_script_fetcher.cc

Issue 171099: Merge r21417 to 172.... (Closed) Base URL: svn://chrome-svn.corp.google.com/chrome/branches/172/src/
Patch Set: '' Created 11 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
« no previous file with comments | « chrome/common/chrome_plugin_unittest.cc ('k') | net/tools/testserver/testserver.py » ('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) 2008 The Chromium Authors. All rights reserved. Use of this 1 // Copyright (c) 2008 The Chromium Authors. All rights reserved. Use of this
2 // source code is governed by a BSD-style license that can be found in the 2 // source code is governed by a BSD-style license that can be found in the
3 // LICENSE file. 3 // LICENSE file.
4 4
5 #include "net/proxy/proxy_script_fetcher.h" 5 #include "net/proxy/proxy_script_fetcher.h"
6 6
7 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "base/ref_counted.h" 9 #include "base/ref_counted.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 virtual void Fetch(const GURL& url, std::string* bytes, 44 virtual void Fetch(const GURL& url, std::string* bytes,
45 CompletionCallback* callback); 45 CompletionCallback* callback);
46 virtual void Cancel(); 46 virtual void Cancel();
47 47
48 // URLRequest::Delegate methods: 48 // URLRequest::Delegate methods:
49 49
50 virtual void OnAuthRequired(URLRequest* request, 50 virtual void OnAuthRequired(URLRequest* request,
51 AuthChallengeInfo* auth_info); 51 AuthChallengeInfo* auth_info);
52 virtual void OnSSLCertificateError(URLRequest* request, int cert_error, 52 virtual void OnSSLCertificateError(URLRequest* request, int cert_error,
53 X509Certificate* cert); 53 X509Certificate* cert);
54 virtual void OnReceivedRedirect(URLRequest* request, const GURL& to_url);
55 virtual void OnResponseStarted(URLRequest* request); 54 virtual void OnResponseStarted(URLRequest* request);
56 virtual void OnReadCompleted(URLRequest* request, int num_bytes); 55 virtual void OnReadCompleted(URLRequest* request, int num_bytes);
57 virtual void OnResponseCompleted(URLRequest* request); 56 virtual void OnResponseCompleted(URLRequest* request);
58 57
59 private: 58 private:
60 // Read more bytes from the response. 59 // Read more bytes from the response.
61 void ReadBody(URLRequest* request); 60 void ReadBody(URLRequest* request);
62 61
63 // Called once the request has completed to notify the caller of 62 // Called once the request has completed to notify the caller of
64 // |response_code_| and |response_bytes_|. 63 // |response_code_| and |response_bytes_|.
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 170
172 void ProxyScriptFetcherImpl::OnSSLCertificateError(URLRequest* request, 171 void ProxyScriptFetcherImpl::OnSSLCertificateError(URLRequest* request,
173 int cert_error, 172 int cert_error,
174 X509Certificate* cert) { 173 X509Certificate* cert) {
175 DCHECK(request == cur_request_.get()); 174 DCHECK(request == cur_request_.get());
176 // Certificate errors are in same space as net errors. 175 // Certificate errors are in same space as net errors.
177 result_code_ = cert_error; 176 result_code_ = cert_error;
178 request->Cancel(); 177 request->Cancel();
179 } 178 }
180 179
181 void ProxyScriptFetcherImpl::OnReceivedRedirect(URLRequest* request,
182 const GURL& to_url) {
183 DCHECK(request == cur_request_.get());
184 // OK, thanks for telling.
185 }
186
187 void ProxyScriptFetcherImpl::OnResponseStarted(URLRequest* request) { 180 void ProxyScriptFetcherImpl::OnResponseStarted(URLRequest* request) {
188 DCHECK(request == cur_request_.get()); 181 DCHECK(request == cur_request_.get());
189 182
190 if (!request->status().is_success()) { 183 if (!request->status().is_success()) {
191 OnResponseCompleted(request); 184 OnResponseCompleted(request);
192 return; 185 return;
193 } 186 }
194 187
195 // Require HTTP responses to have a success status code. 188 // Require HTTP responses to have a success status code.
196 if (request->url().SchemeIs("http") || request->url().SchemeIs("https")) { 189 if (request->url().SchemeIs("http") || request->url().SchemeIs("https")) {
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 } 288 }
296 289
297 // static 290 // static
298 size_t ProxyScriptFetcher::SetSizeConstraintForUnittest(size_t size_bytes) { 291 size_t ProxyScriptFetcher::SetSizeConstraintForUnittest(size_t size_bytes) {
299 size_t prev = max_response_bytes; 292 size_t prev = max_response_bytes;
300 max_response_bytes = size_bytes; 293 max_response_bytes = size_bytes;
301 return prev; 294 return prev;
302 } 295 }
303 296
304 } // namespace net 297 } // namespace net
OLDNEW
« no previous file with comments | « chrome/common/chrome_plugin_unittest.cc ('k') | net/tools/testserver/testserver.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698