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
3 // found in the LICENSE file.
5 #include "chromecast/browser/cast_download_manager_delegate.h"
7 #include "base/files/file_path.h"
8 #include "base/logging.h"
9 #include "content/public/browser/download_danger_type.h"
10 #include "content/public/browser/download_item.h"
12 namespace chromecast
{
15 CastDownloadManagerDelegate::CastDownloadManagerDelegate() {}
17 CastDownloadManagerDelegate::~CastDownloadManagerDelegate() {}
19 void CastDownloadManagerDelegate::GetNextId(
20 const content::DownloadIdCallback
& callback
) {
21 // See default behavior of DownloadManagerImpl::GetNextId()
22 static uint32 next_id
= content::DownloadItem::kInvalidId
+ 1;
23 callback
.Run(next_id
++);
26 bool CastDownloadManagerDelegate::DetermineDownloadTarget(
27 content::DownloadItem
* item
,
28 const content::DownloadTargetCallback
& callback
) {
29 // Running the DownloadTargetCallback with an empty FilePath signals
30 // that the download should be cancelled.
34 content::DownloadItem::TARGET_DISPOSITION_OVERWRITE
,
35 content::DOWNLOAD_DANGER_TYPE_MAYBE_DANGEROUS_CONTENT
,
40 bool CastDownloadManagerDelegate::ShouldOpenFileBasedOnExtension(
41 const base::FilePath
& path
) {
45 bool CastDownloadManagerDelegate::ShouldCompleteDownload(
46 content::DownloadItem
* item
,
47 const base::Closure
& callback
) {
51 bool CastDownloadManagerDelegate::ShouldOpenDownload(
52 content::DownloadItem
* item
,
53 const content::DownloadOpenDelayedCallback
& callback
) {
58 } // namespace chromecast