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_file_factory.h" | 5 #include "content/browser/download/download_file_factory.h" |
6 | 6 |
7 #include "content/browser/download/download_file_impl.h" | 7 #include "content/browser/download/download_file_impl.h" |
8 #include "content/browser/power_save_blocker.h" | 8 #include "content/browser/power_save_blocker.h" |
9 | 9 |
10 namespace content { | 10 namespace content { |
11 | 11 |
12 DownloadFileFactory::~DownloadFileFactory() {} | 12 DownloadFileFactory::~DownloadFileFactory() {} |
13 | 13 |
14 DownloadFile* DownloadFileFactory::CreateFile( | 14 DownloadFile* DownloadFileFactory::CreateFile( |
15 scoped_ptr<DownloadCreateInfo> info, | 15 scoped_ptr<DownloadSaveInfo> save_info, |
16 scoped_ptr<content::ByteStreamReader> stream, | 16 const FilePath& default_downloads_directory, |
17 DownloadManager* download_manager, | 17 const GURL& url, |
| 18 const GURL& referrer_url, |
| 19 int64 received_bytes, |
18 bool calculate_hash, | 20 bool calculate_hash, |
19 const net::BoundNetLog& bound_net_log) { | 21 scoped_ptr<ByteStreamReader> stream, |
20 // Ownership will be taken by DownloadFileImpl. | 22 const net::BoundNetLog& bound_net_log, |
21 scoped_ptr<DownloadRequestHandleInterface> request_handle( | 23 base::WeakPtr<DownloadDestinationObserver> observer) { |
22 new DownloadRequestHandle(info->request_handle)); | 24 scoped_ptr<PowerSaveBlocker> psb( |
23 | 25 new PowerSaveBlocker( |
| 26 PowerSaveBlocker::kPowerSaveBlockPreventAppSuspension, |
| 27 "Download in progress")); |
24 return new DownloadFileImpl( | 28 return new DownloadFileImpl( |
25 info.Pass(), stream.Pass(), request_handle.Pass(), download_manager, | 29 save_info.Pass(), default_downloads_directory, url, referrer_url, |
26 calculate_hash, | 30 received_bytes, calculate_hash, stream.Pass(), bound_net_log, |
27 scoped_ptr<content::PowerSaveBlocker>( | 31 psb.Pass(), observer); |
28 new content::PowerSaveBlocker( | |
29 content::PowerSaveBlocker::kPowerSaveBlockPreventAppSuspension, | |
30 "Download in progress")).Pass(), | |
31 bound_net_log); | |
32 } | 32 } |
33 | 33 |
34 } // namespace content | 34 } // namespace content |
OLD | NEW |