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

Side by Side Diff: content/browser/download/download_request_core.cc

Issue 2072403002: Remove content/browser/power_save_blocker_factory.* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: gyp Created 4 years, 6 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 | « content/browser/download/download_browsertest.cc ('k') | content/browser/loader/DEPS » ('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) 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"
11 #include "base/format_macros.h" 11 #include "base/format_macros.h"
12 #include "base/location.h" 12 #include "base/location.h"
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "base/memory/ptr_util.h" 14 #include "base/memory/ptr_util.h"
15 #include "base/metrics/histogram_macros.h" 15 #include "base/metrics/histogram_macros.h"
16 #include "base/metrics/sparse_histogram.h" 16 #include "base/metrics/sparse_histogram.h"
17 #include "base/single_thread_task_runner.h" 17 #include "base/single_thread_task_runner.h"
18 #include "base/strings/stringprintf.h" 18 #include "base/strings/stringprintf.h"
19 #include "base/threading/thread_task_runner_handle.h" 19 #include "base/threading/thread_task_runner_handle.h"
20 #include "content/browser/byte_stream.h" 20 #include "content/browser/byte_stream.h"
21 #include "content/browser/download/download_create_info.h" 21 #include "content/browser/download/download_create_info.h"
22 #include "content/browser/download/download_interrupt_reasons_impl.h" 22 #include "content/browser/download/download_interrupt_reasons_impl.h"
23 #include "content/browser/download/download_manager_impl.h" 23 #include "content/browser/download/download_manager_impl.h"
24 #include "content/browser/download/download_request_handle.h" 24 #include "content/browser/download/download_request_handle.h"
25 #include "content/browser/download/download_stats.h" 25 #include "content/browser/download/download_stats.h"
26 #include "content/browser/loader/resource_dispatcher_host_impl.h" 26 #include "content/browser/loader/resource_dispatcher_host_impl.h"
27 #include "content/browser/power_save_blocker_factory.h"
28 #include "content/public/browser/browser_thread.h" 27 #include "content/public/browser/browser_thread.h"
29 #include "content/public/browser/download_interrupt_reasons.h" 28 #include "content/public/browser/download_interrupt_reasons.h"
30 #include "content/public/browser/download_item.h" 29 #include "content/public/browser/download_item.h"
31 #include "content/public/browser/download_manager_delegate.h" 30 #include "content/public/browser/download_manager_delegate.h"
32 #include "content/public/browser/navigation_entry.h" 31 #include "content/public/browser/navigation_entry.h"
33 #include "content/public/browser/resource_context.h" 32 #include "content/public/browser/resource_context.h"
34 #include "content/public/browser/web_contents.h" 33 #include "content/public/browser/web_contents.h"
34 #include "device/power_save_blocker/power_save_blocker.h"
35 #include "net/base/elements_upload_data_stream.h" 35 #include "net/base/elements_upload_data_stream.h"
36 #include "net/base/io_buffer.h" 36 #include "net/base/io_buffer.h"
37 #include "net/base/load_flags.h" 37 #include "net/base/load_flags.h"
38 #include "net/base/net_errors.h" 38 #include "net/base/net_errors.h"
39 #include "net/base/upload_bytes_element_reader.h" 39 #include "net/base/upload_bytes_element_reader.h"
40 #include "net/http/http_response_headers.h" 40 #include "net/http/http_response_headers.h"
41 #include "net/http/http_status_code.h" 41 #include "net/http/http_status_code.h"
42 #include "net/url_request/url_request_context.h" 42 #include "net/url_request/url_request_context.h"
43 43
44 namespace content { 44 namespace content {
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 last_buffer_size_(0), 197 last_buffer_size_(0),
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_ = device::PowerSaveBlocker::CreateWithTaskRunners(
208 device::PowerSaveBlocker::kPowerSaveBlockPreventAppSuspension, 208 device::PowerSaveBlocker::kPowerSaveBlockPreventAppSuspension,
209 device::PowerSaveBlocker::kReasonOther, "Download in progress"); 209 device::PowerSaveBlocker::kReasonOther, "Download in progress",
210 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI),
211 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE));
210 DownloadRequestData* request_data = DownloadRequestData::Get(request_); 212 DownloadRequestData* request_data = DownloadRequestData::Get(request_);
211 if (request_data) { 213 if (request_data) {
212 save_info_ = request_data->TakeSaveInfo(); 214 save_info_ = request_data->TakeSaveInfo();
213 download_id_ = request_data->download_id(); 215 download_id_ = request_data->download_id();
214 on_started_callback_ = request_data->callback(); 216 on_started_callback_ = request_data->callback();
215 DownloadRequestData::Detach(request_); 217 DownloadRequestData::Detach(request_);
216 is_partial_request_ = save_info_->offset > 0; 218 is_partial_request_ = save_info_->offset > 0;
217 } else { 219 } else {
218 save_info_.reset(new DownloadSaveInfo); 220 save_info_.reset(new DownloadSaveInfo);
219 } 221 }
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after
631 return DOWNLOAD_INTERRUPT_REASON_NONE; 633 return DOWNLOAD_INTERRUPT_REASON_NONE;
632 } 634 }
633 635
634 if (http_headers.response_code() == net::HTTP_PARTIAL_CONTENT) 636 if (http_headers.response_code() == net::HTTP_PARTIAL_CONTENT)
635 return DOWNLOAD_INTERRUPT_REASON_SERVER_BAD_CONTENT; 637 return DOWNLOAD_INTERRUPT_REASON_SERVER_BAD_CONTENT;
636 638
637 return DOWNLOAD_INTERRUPT_REASON_NONE; 639 return DOWNLOAD_INTERRUPT_REASON_NONE;
638 } 640 }
639 641
640 } // namespace content 642 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/download/download_browsertest.cc ('k') | content/browser/loader/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698