Chromium Code Reviews| 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 #include "content/browser/download/download_request_core.h" | 5 #include "content/browser/download/download_request_core.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 244 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 244 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 245 DVLOG(20) << __func__ << "() " << DebugString(); | 245 DVLOG(20) << __func__ << "() " << DebugString(); |
| 246 download_start_time_ = base::TimeTicks::Now(); | 246 download_start_time_ = base::TimeTicks::Now(); |
| 247 | 247 |
| 248 DownloadInterruptReason result = | 248 DownloadInterruptReason result = |
| 249 request()->response_headers() | 249 request()->response_headers() |
| 250 ? HandleSuccessfulServerResponse(*request()->response_headers(), | 250 ? HandleSuccessfulServerResponse(*request()->response_headers(), |
| 251 save_info_.get()) | 251 save_info_.get()) |
| 252 : DOWNLOAD_INTERRUPT_REASON_NONE; | 252 : DOWNLOAD_INTERRUPT_REASON_NONE; |
| 253 | 253 |
| 254 RecordDownloadHttpResponseCode( | |
|
qinmin
2017/05/04 22:30:58
I think you should do this in OnResponseCompleted
qinmin
2017/05/04 22:47:31
Never mind, SERVER_FAILED was only reported in Han
| |
| 255 request()->response_headers()->response_code()); | |
| 256 | |
| 254 std::unique_ptr<DownloadCreateInfo> create_info = | 257 std::unique_ptr<DownloadCreateInfo> create_info = |
| 255 CreateDownloadCreateInfo(result); | 258 CreateDownloadCreateInfo(result); |
| 256 if (result != DOWNLOAD_INTERRUPT_REASON_NONE) { | 259 if (result != DOWNLOAD_INTERRUPT_REASON_NONE) { |
| 257 delegate_->OnStart(std::move(create_info), | 260 delegate_->OnStart(std::move(create_info), |
| 258 std::unique_ptr<ByteStreamReader>(), | 261 std::unique_ptr<ByteStreamReader>(), |
| 259 base::ResetAndReturn(&on_started_callback_)); | 262 base::ResetAndReturn(&on_started_callback_)); |
| 260 return false; | 263 return false; |
| 261 } | 264 } |
| 262 | 265 |
| 263 // If it's a download, we don't want to poison the cache with it. | 266 // If it's a download, we don't want to poison the cache with it. |
| (...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 690 // old servers that didn't implement "If-Match" and must be ignored when | 693 // old servers that didn't implement "If-Match" and must be ignored when |
| 691 // "If-Match" presents. | 694 // "If-Match" presents. |
| 692 if (has_last_modified) { | 695 if (has_last_modified) { |
| 693 request->SetExtraRequestHeaderByName( | 696 request->SetExtraRequestHeaderByName( |
| 694 net::HttpRequestHeaders::kIfUnmodifiedSince, params->last_modified(), | 697 net::HttpRequestHeaders::kIfUnmodifiedSince, params->last_modified(), |
| 695 true); | 698 true); |
| 696 } | 699 } |
| 697 } | 700 } |
| 698 | 701 |
| 699 } // namespace content | 702 } // namespace content |
| OLD | NEW |