Upstream version 11.39.266.0
[platform/framework/web/crosswalk.git] / src / chromecast / shell / browser / cast_download_manager_delegate.cc
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.
4
5 #include "chromecast/shell/browser/cast_download_manager_delegate.h"
6
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"
11
12 namespace chromecast {
13 namespace shell {
14
15 CastDownloadManagerDelegate::CastDownloadManagerDelegate() {}
16
17 CastDownloadManagerDelegate::~CastDownloadManagerDelegate() {}
18
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++);
24 }
25
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.
31   base::FilePath empty;
32   callback.Run(
33       empty,
34       content::DownloadItem::TARGET_DISPOSITION_OVERWRITE,
35       content::DOWNLOAD_DANGER_TYPE_MAYBE_DANGEROUS_CONTENT,
36       empty);
37   return true;
38 }
39
40 bool CastDownloadManagerDelegate::ShouldOpenFileBasedOnExtension(
41     const base::FilePath& path) {
42   return false;
43 }
44
45 bool CastDownloadManagerDelegate::ShouldCompleteDownload(
46     content::DownloadItem* item,
47     const base::Closure& callback) {
48   return false;
49 }
50
51 bool CastDownloadManagerDelegate::ShouldOpenDownload(
52     content::DownloadItem* item,
53     const content::DownloadOpenDelayedCallback& callback) {
54   return false;
55 }
56
57 }  // namespace shell
58 }  // namespace chromecast