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
3 // found in the LICENSE file.
5 #include "content/browser/download/download_file_factory.h"
7 #include "content/browser/download/download_file_impl.h"
8 #include "content/public/browser/power_save_blocker.h"
12 DownloadFileFactory::~DownloadFileFactory() {}
14 DownloadFile
* DownloadFileFactory::CreateFile(
15 scoped_ptr
<DownloadSaveInfo
> save_info
,
16 const base::FilePath
& default_downloads_directory
,
18 const GURL
& referrer_url
,
20 scoped_ptr
<ByteStreamReader
> stream
,
21 const net::BoundNetLog
& bound_net_log
,
22 base::WeakPtr
<DownloadDestinationObserver
> observer
) {
23 scoped_ptr
<PowerSaveBlocker
> psb(
24 PowerSaveBlocker::Create(
25 PowerSaveBlocker::kPowerSaveBlockPreventAppSuspension
,
26 "Download in progress"));
27 return new DownloadFileImpl(
28 save_info
.Pass(), default_downloads_directory
, url
, referrer_url
,
29 calculate_hash
, stream
.Pass(), bound_net_log
,
30 psb
.Pass(), observer
);
33 } // namespace content