OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chromecast/browser/cast_download_manager_delegate.h" | 5 #include "chromecast/browser/cast_download_manager_delegate.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "content/public/browser/download_danger_type.h" | 11 #include "content/public/browser/download_danger_type.h" |
12 #include "content/public/browser/download_interrupt_reasons.h" | |
12 #include "content/public/browser/download_item.h" | 13 #include "content/public/browser/download_item.h" |
13 | 14 |
14 namespace chromecast { | 15 namespace chromecast { |
15 namespace shell { | 16 namespace shell { |
16 | 17 |
17 CastDownloadManagerDelegate::CastDownloadManagerDelegate() {} | 18 CastDownloadManagerDelegate::CastDownloadManagerDelegate() {} |
18 | 19 |
19 CastDownloadManagerDelegate::~CastDownloadManagerDelegate() {} | 20 CastDownloadManagerDelegate::~CastDownloadManagerDelegate() {} |
20 | 21 |
21 void CastDownloadManagerDelegate::GetNextId( | 22 void CastDownloadManagerDelegate::GetNextId( |
22 const content::DownloadIdCallback& callback) { | 23 const content::DownloadIdCallback& callback) { |
23 // See default behavior of DownloadManagerImpl::GetNextId() | 24 // See default behavior of DownloadManagerImpl::GetNextId() |
24 static uint32_t next_id = content::DownloadItem::kInvalidId + 1; | 25 static uint32_t next_id = content::DownloadItem::kInvalidId + 1; |
25 callback.Run(next_id++); | 26 callback.Run(next_id++); |
26 } | 27 } |
27 | 28 |
28 bool CastDownloadManagerDelegate::DetermineDownloadTarget( | 29 bool CastDownloadManagerDelegate::DetermineDownloadTarget( |
29 content::DownloadItem* item, | 30 content::DownloadItem* item, |
30 const content::DownloadTargetCallback& callback) { | 31 const content::DownloadTargetCallback& callback) { |
31 // Running the DownloadTargetCallback with an empty FilePath signals | 32 // Running the DownloadTargetCallback with an empty FilePath signals |
32 // that the download should be cancelled. | 33 // that the download should be cancelled. |
33 base::FilePath empty; | 34 base::FilePath empty; |
34 callback.Run( | 35 callback.Run(empty, content::DownloadItem::TARGET_DISPOSITION_OVERWRITE, |
35 empty, | 36 content::DOWNLOAD_DANGER_TYPE_MAYBE_DANGEROUS_CONTENT, empty, |
36 content::DownloadItem::TARGET_DISPOSITION_OVERWRITE, | 37 content::DOWNLOAD_INTERRUPT_REASON_NONE); |
37 content::DOWNLOAD_DANGER_TYPE_MAYBE_DANGEROUS_CONTENT, | |
38 empty); | |
39 return true; | 38 return true; |
40 } | 39 } |
41 | 40 |
42 bool CastDownloadManagerDelegate::ShouldOpenFileBasedOnExtension( | 41 bool CastDownloadManagerDelegate::ShouldOpenFileBasedOnExtension( |
43 const base::FilePath& path) { | 42 const base::FilePath& path) { |
44 return false; | 43 return false; |
45 } | 44 } |
46 | 45 |
47 bool CastDownloadManagerDelegate::ShouldCompleteDownload( | 46 bool CastDownloadManagerDelegate::ShouldCompleteDownload( |
48 content::DownloadItem* item, | 47 content::DownloadItem* item, |
49 const base::Closure& callback) { | 48 const base::Closure& callback) { |
50 return false; | 49 return false; |
51 } | 50 } |
52 | 51 |
53 bool CastDownloadManagerDelegate::ShouldOpenDownload( | 52 bool CastDownloadManagerDelegate::ShouldOpenDownload( |
54 content::DownloadItem* item, | 53 content::DownloadItem* item, |
55 const content::DownloadOpenDelayedCallback& callback) { | 54 const content::DownloadOpenDelayedCallback& callback) { |
56 return false; | 55 return false; |
57 } | 56 } |
58 | 57 |
59 } // namespace shell | 58 } // namespace shell |
60 } // namespace chromecast | 59 } // namespace chromecast |
svaldez
2016/10/28 17:29:36
Stray whitespace?
asanka
2016/11/07 19:50:15
Not sure what happened here. ¯\_(ツ)_/¯
| |
OLD | NEW |