| Index: content/browser/download/download_request_core.cc
|
| diff --git a/content/browser/download/download_request_core.cc b/content/browser/download/download_request_core.cc
|
| index b30984bd52ad40c1776451ce961344c903206d33..b2865dfb49a654e3af863942a3de44c19da56c50 100644
|
| --- a/content/browser/download/download_request_core.cc
|
| +++ b/content/browser/download/download_request_core.cc
|
| @@ -24,6 +24,7 @@
|
| #include "content/browser/download/download_request_handle.h"
|
| #include "content/browser/download/download_stats.h"
|
| #include "content/browser/loader/resource_dispatcher_host_impl.h"
|
| +#include "content/browser/service_manager/service_manager_context.h"
|
| #include "content/public/browser/browser_thread.h"
|
| #include "content/public/browser/download_interrupt_reasons.h"
|
| #include "content/public/browser/download_item.h"
|
| @@ -31,7 +32,7 @@
|
| #include "content/public/browser/navigation_entry.h"
|
| #include "content/public/browser/resource_context.h"
|
| #include "content/public/browser/web_contents.h"
|
| -#include "device/power_save_blocker/power_save_blocker.h"
|
| +#include "device/wake_lock/public/interfaces/wake_lock_provider.mojom.h"
|
| #include "net/base/elements_upload_data_stream.h"
|
| #include "net/base/io_buffer.h"
|
| #include "net/base/load_flags.h"
|
| @@ -41,6 +42,8 @@
|
| #include "net/http/http_response_headers.h"
|
| #include "net/http/http_status_code.h"
|
| #include "net/url_request/url_request_context.h"
|
| +#include "services/device/public/interfaces/constants.mojom.h"
|
| +#include "services/service_manager/public/cpp/connector.h"
|
|
|
| namespace content {
|
|
|
| @@ -196,11 +199,24 @@ DownloadRequestCore::DownloadRequestCore(net::URLRequest* request,
|
| DCHECK(delegate_);
|
| if (!is_parallel_request)
|
| RecordDownloadCount(UNTHROTTLED_COUNT);
|
| - power_save_blocker_.reset(new device::PowerSaveBlocker(
|
| - device::PowerSaveBlocker::kPowerSaveBlockPreventAppSuspension,
|
| - device::PowerSaveBlocker::kReasonOther, "Download in progress",
|
| - BrowserThread::GetTaskRunnerForThread(BrowserThread::UI),
|
| - BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE)));
|
| +
|
| + // Request Wake Lock.
|
| + service_manager::Connector* connector =
|
| + ServiceManagerContext::GetConnectorForIOThread();
|
| + // |connector| might be nullptr in some testing contexts, in which the
|
| + // service manager connection isn't initialized.
|
| + if (connector) {
|
| + device::mojom::WakeLockProviderPtr wake_lock_provider;
|
| + connector->BindInterface(device::mojom::kServiceName,
|
| + mojo::MakeRequest(&wake_lock_provider));
|
| + wake_lock_provider->GetWakeLockWithoutContext(
|
| + device::mojom::WakeLockType::PreventAppSuspension,
|
| + device::mojom::WakeLockReason::ReasonOther, "Download in progress",
|
| + mojo::MakeRequest(&wake_lock_));
|
| +
|
| + wake_lock_->RequestWakeLock();
|
| + }
|
| +
|
| DownloadRequestData* request_data = DownloadRequestData::Get(request_);
|
| if (request_data) {
|
| save_info_ = request_data->TakeSaveInfo();
|
|
|