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

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

Issue 173049: Revert r23616 from 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);
54 virtual void OnResponseStarted(URLRequest* request); 55 virtual void OnResponseStarted(URLRequest* request);
55 virtual void OnReadCompleted(URLRequest* request, int num_bytes); 56 virtual void OnReadCompleted(URLRequest* request, int num_bytes);
56 virtual void OnResponseCompleted(URLRequest* request); 57 virtual void OnResponseCompleted(URLRequest* request);
57 58
58 private: 59 private:
59 // Read more bytes from the response. 60 // Read more bytes from the response.
60 void ReadBody(URLRequest* request); 61 void ReadBody(URLRequest* request);
61 62
62 // Called once the request has completed to notify the caller of 63 // Called once the request has completed to notify the caller of
63 // |response_code_| and |response_bytes_|. 64 // |response_code_| and |response_bytes_|.
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 171
171 void ProxyScriptFetcherImpl::OnSSLCertificateError(URLRequest* request, 172 void ProxyScriptFetcherImpl::OnSSLCertificateError(URLRequest* request,
172 int cert_error, 173 int cert_error,
173 X509Certificate* cert) { 174 X509Certificate* cert) {
174 DCHECK(request == cur_request_.get()); 175 DCHECK(request == cur_request_.get());
175 // Certificate errors are in same space as net errors. 176 // Certificate errors are in same space as net errors.
176 result_code_ = cert_error; 177 result_code_ = cert_error;
177 request->Cancel(); 178 request->Cancel();
178 } 179 }
179 180
181 void ProxyScriptFetcherImpl::OnReceivedRedirect(URLRequest* request,
182 const GURL& to_url) {
183 DCHECK(request == cur_request_.get());
184 // OK, thanks for telling.
185 }
186
180 void ProxyScriptFetcherImpl::OnResponseStarted(URLRequest* request) { 187 void ProxyScriptFetcherImpl::OnResponseStarted(URLRequest* request) {
181 DCHECK(request == cur_request_.get()); 188 DCHECK(request == cur_request_.get());
182 189
183 if (!request->status().is_success()) { 190 if (!request->status().is_success()) {
184 OnResponseCompleted(request); 191 OnResponseCompleted(request);
185 return; 192 return;
186 } 193 }
187 194
188 // Require HTTP responses to have a success status code. 195 // Require HTTP responses to have a success status code.
189 if (request->url().SchemeIs("http") || request->url().SchemeIs("https")) { 196 if (request->url().SchemeIs("http") || request->url().SchemeIs("https")) {
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 } 295 }
289 296
290 // static 297 // static
291 size_t ProxyScriptFetcher::SetSizeConstraintForUnittest(size_t size_bytes) { 298 size_t ProxyScriptFetcher::SetSizeConstraintForUnittest(size_t size_bytes) {
292 size_t prev = max_response_bytes; 299 size_t prev = max_response_bytes;
293 max_response_bytes = size_bytes; 300 max_response_bytes = size_bytes;
294 return prev; 301 return prev;
295 } 302 }
296 303
297 } // namespace net 304 } // 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