forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcast_download_manager_delegate.cc
56 lines (45 loc) · 1.84 KB
/
cast_download_manager_delegate.cc
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
// 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 <stdint.h>
#include "base/files/file_path.h"
#include "components/download/public/common/download_danger_type.h"
#include "components/download/public/common/download_interrupt_reasons.h"
#include "components/download/public/common/download_item.h"
namespace chromecast {
namespace shell {
CastDownloadManagerDelegate::CastDownloadManagerDelegate() {}
CastDownloadManagerDelegate::~CastDownloadManagerDelegate() {}
void CastDownloadManagerDelegate::GetNextId(
content::DownloadIdCallback callback) {
// See default behavior of DownloadManagerImpl::GetNextId()
static uint32_t next_id = download::DownloadItem::kInvalidId + 1;
std::move(callback).Run(next_id++);
}
bool CastDownloadManagerDelegate::DetermineDownloadTarget(
download::DownloadItem* item,
content::DownloadTargetCallback* callback) {
base::FilePath empty;
std::move(*callback).Run(
empty, download::DownloadItem::TARGET_DISPOSITION_OVERWRITE,
download::DOWNLOAD_DANGER_TYPE_MAYBE_DANGEROUS_CONTENT,
download::DownloadItem::MixedContentStatus::UNKNOWN, empty,
base::nullopt /*download_schedule*/,
download::DOWNLOAD_INTERRUPT_REASON_USER_CANCELED);
return true;
}
bool CastDownloadManagerDelegate::ShouldCompleteDownload(
download::DownloadItem* item,
base::OnceClosure callback) {
return false;
}
bool CastDownloadManagerDelegate::ShouldOpenDownload(
download::DownloadItem* item,
content::DownloadOpenDelayedCallback callback) {
// TODO(qinmin): When this returns false it means this should run the callback
// at some point.
return false;
}
} // namespace shell
} // namespace chromecast