cast_download_manager_delegate.cc revision 1320f92c476a1ad9d19dba2a48c72b75566198e9
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 12namespace chromecast { 13namespace shell { 14 15CastDownloadManagerDelegate::CastDownloadManagerDelegate() {} 16 17CastDownloadManagerDelegate::~CastDownloadManagerDelegate() {} 18 19void 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 26bool 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 40bool CastDownloadManagerDelegate::ShouldOpenFileBasedOnExtension( 41 const base::FilePath& path) { 42 return false; 43} 44 45bool CastDownloadManagerDelegate::ShouldCompleteDownload( 46 content::DownloadItem* item, 47 const base::Closure& callback) { 48 return false; 49} 50 51bool CastDownloadManagerDelegate::ShouldOpenDownload( 52 content::DownloadItem* item, 53 const content::DownloadOpenDelayedCallback& callback) { 54 return false; 55} 56 57} // namespace shell 58} // namespace chromecast