cast_download_manager_delegate.cc 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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. #include "chromecast/browser/cast_download_manager_delegate.h"
  5. #include <stdint.h>
  6. #include "base/files/file_path.h"
  7. #include "components/download/public/common/download_danger_type.h"
  8. #include "components/download/public/common/download_interrupt_reasons.h"
  9. #include "components/download/public/common/download_item.h"
  10. namespace chromecast {
  11. namespace shell {
  12. CastDownloadManagerDelegate::CastDownloadManagerDelegate() {}
  13. CastDownloadManagerDelegate::~CastDownloadManagerDelegate() {}
  14. void CastDownloadManagerDelegate::GetNextId(
  15. content::DownloadIdCallback callback) {
  16. // See default behavior of DownloadManagerImpl::GetNextId()
  17. static uint32_t next_id = download::DownloadItem::kInvalidId + 1;
  18. std::move(callback).Run(next_id++);
  19. }
  20. bool CastDownloadManagerDelegate::DetermineDownloadTarget(
  21. download::DownloadItem* item,
  22. content::DownloadTargetCallback* callback) {
  23. base::FilePath empty;
  24. std::move(*callback).Run(
  25. empty, download::DownloadItem::TARGET_DISPOSITION_OVERWRITE,
  26. download::DOWNLOAD_DANGER_TYPE_MAYBE_DANGEROUS_CONTENT,
  27. download::DownloadItem::MixedContentStatus::UNKNOWN, empty, empty,
  28. std::string() /*mime_type*/,
  29. download::DOWNLOAD_INTERRUPT_REASON_USER_CANCELED);
  30. return true;
  31. }
  32. bool CastDownloadManagerDelegate::ShouldCompleteDownload(
  33. download::DownloadItem* item,
  34. base::OnceClosure callback) {
  35. return false;
  36. }
  37. bool CastDownloadManagerDelegate::ShouldOpenDownload(
  38. download::DownloadItem* item,
  39. content::DownloadOpenDelayedCallback callback) {
  40. // TODO(qinmin): When this returns false it means this should run the callback
  41. // at some point.
  42. return false;
  43. }
  44. } // namespace shell
  45. } // namespace chromecast