| 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 #include "net/proxy/proxy_script_fetcher_impl.h" | 5 #include "net/proxy/proxy_script_fetcher_impl.h" |
| 6 | 6 |
| 7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
| 8 #include "base/i18n/icu_string_conversions.h" | 8 #include "base/i18n/icu_string_conversions.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 max_response_bytes_ = size_bytes; | 103 max_response_bytes_ = size_bytes; |
| 104 return prev; | 104 return prev; |
| 105 } | 105 } |
| 106 | 106 |
| 107 void ProxyScriptFetcherImpl::OnResponseCompleted(URLRequest* request) { | 107 void ProxyScriptFetcherImpl::OnResponseCompleted(URLRequest* request) { |
| 108 DCHECK_EQ(request, cur_request_.get()); | 108 DCHECK_EQ(request, cur_request_.get()); |
| 109 | 109 |
| 110 // Use |result_code_| as the request's error if we have already set it to | 110 // Use |result_code_| as the request's error if we have already set it to |
| 111 // something specific. | 111 // something specific. |
| 112 if (result_code_ == OK && !request->status().is_success()) | 112 if (result_code_ == OK && !request->status().is_success()) |
| 113 result_code_ = request->status().os_error(); | 113 result_code_ = request->status().error(); |
| 114 | 114 |
| 115 FetchCompleted(); | 115 FetchCompleted(); |
| 116 } | 116 } |
| 117 | 117 |
| 118 int ProxyScriptFetcherImpl::Fetch(const GURL& url, | 118 int ProxyScriptFetcherImpl::Fetch(const GURL& url, |
| 119 string16* text, | 119 string16* text, |
| 120 CompletionCallback* callback) { | 120 CompletionCallback* callback) { |
| 121 // It is invalid to call Fetch() while a request is already in progress. | 121 // It is invalid to call Fetch() while a request is already in progress. |
| 122 DCHECK(!cur_request_.get()); | 122 DCHECK(!cur_request_.get()); |
| 123 | 123 |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 // is still applicable. | 312 // is still applicable. |
| 313 if (cur_request_id_ != id) | 313 if (cur_request_id_ != id) |
| 314 return; | 314 return; |
| 315 | 315 |
| 316 DCHECK(cur_request_.get()); | 316 DCHECK(cur_request_.get()); |
| 317 result_code_ = ERR_TIMED_OUT; | 317 result_code_ = ERR_TIMED_OUT; |
| 318 cur_request_->Cancel(); | 318 cur_request_->Cancel(); |
| 319 } | 319 } |
| 320 | 320 |
| 321 } // namespace net | 321 } // namespace net |
| OLD | NEW |