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 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 bytes_read_(0), | 198 bytes_read_(0), |
199 pause_count_(0), | 199 pause_count_(0), |
200 was_deferred_(false), | 200 was_deferred_(false), |
201 is_partial_request_(false), | 201 is_partial_request_(false), |
202 started_(false), | 202 started_(false), |
203 abort_reason_(DOWNLOAD_INTERRUPT_REASON_NONE) { | 203 abort_reason_(DOWNLOAD_INTERRUPT_REASON_NONE) { |
204 DCHECK(request_); | 204 DCHECK(request_); |
205 DCHECK(delegate_); | 205 DCHECK(delegate_); |
206 RecordDownloadCount(UNTHROTTLED_COUNT); | 206 RecordDownloadCount(UNTHROTTLED_COUNT); |
207 power_save_blocker_ = CreatePowerSaveBlocker( | 207 power_save_blocker_ = CreatePowerSaveBlocker( |
208 PowerSaveBlocker::kPowerSaveBlockPreventAppSuspension, | 208 device::PowerSaveBlocker::kPowerSaveBlockPreventAppSuspension, |
209 PowerSaveBlocker::kReasonOther, "Download in progress"); | 209 device::PowerSaveBlocker::kReasonOther, "Download in progress"); |
210 DownloadRequestData* request_data = DownloadRequestData::Get(request_); | 210 DownloadRequestData* request_data = DownloadRequestData::Get(request_); |
211 if (request_data) { | 211 if (request_data) { |
212 save_info_ = request_data->TakeSaveInfo(); | 212 save_info_ = request_data->TakeSaveInfo(); |
213 download_id_ = request_data->download_id(); | 213 download_id_ = request_data->download_id(); |
214 on_started_callback_ = request_data->callback(); | 214 on_started_callback_ = request_data->callback(); |
215 DownloadRequestData::Detach(request_); | 215 DownloadRequestData::Detach(request_); |
216 is_partial_request_ = save_info_->offset > 0; | 216 is_partial_request_ = save_info_->offset > 0; |
217 } else { | 217 } else { |
218 save_info_.reset(new DownloadSaveInfo); | 218 save_info_.reset(new DownloadSaveInfo); |
219 } | 219 } |
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
631 return DOWNLOAD_INTERRUPT_REASON_NONE; | 631 return DOWNLOAD_INTERRUPT_REASON_NONE; |
632 } | 632 } |
633 | 633 |
634 if (http_headers.response_code() == net::HTTP_PARTIAL_CONTENT) | 634 if (http_headers.response_code() == net::HTTP_PARTIAL_CONTENT) |
635 return DOWNLOAD_INTERRUPT_REASON_SERVER_BAD_CONTENT; | 635 return DOWNLOAD_INTERRUPT_REASON_SERVER_BAD_CONTENT; |
636 | 636 |
637 return DOWNLOAD_INTERRUPT_REASON_NONE; | 637 return DOWNLOAD_INTERRUPT_REASON_NONE; |
638 } | 638 } |
639 | 639 |
640 } // namespace content | 640 } // namespace content |
OLD | NEW |