blob: 9817fcb38d7220eee2b050467fd7a041e636714a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chromecast/browser/cast_download_manager_delegate.h"
#include "base/files/file_path.h"
#include "base/logging.h"
#include "content/public/browser/download_danger_type.h"
#include "content/public/browser/download_item.h"
namespace chromecast {
namespace shell {
CastDownloadManagerDelegate::CastDownloadManagerDelegate() {}
CastDownloadManagerDelegate::~CastDownloadManagerDelegate() {}
void CastDownloadManagerDelegate::GetNextId(
const content::DownloadIdCallback& callback) {
// See default behavior of DownloadManagerImpl::GetNextId()
static uint32 next_id = content::DownloadItem::kInvalidId + 1;
callback.Run(next_id++);
}
bool CastDownloadManagerDelegate::DetermineDownloadTarget(
content::DownloadItem* item,
const content::DownloadTargetCallback& callback) {
// Running the DownloadTargetCallback with an empty FilePath signals
// that the download should be cancelled.
base::FilePath empty;
callback.Run(
empty,
content::DownloadItem::TARGET_DISPOSITION_OVERWRITE,
content::DOWNLOAD_DANGER_TYPE_MAYBE_DANGEROUS_CONTENT,
empty);
return true;
}
bool CastDownloadManagerDelegate::ShouldOpenFileBasedOnExtension(
const base::FilePath& path) {
return false;
}
bool CastDownloadManagerDelegate::ShouldCompleteDownload(
content::DownloadItem* item,
const base::Closure& callback) {
return false;
}
bool CastDownloadManagerDelegate::ShouldOpenDownload(
content::DownloadItem* item,
const content::DownloadOpenDelayedCallback& callback) {
return false;
}
} // namespace shell
} // namespace chromecast
|