1 // Copyright (c) 2012 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.
5 #include "android_webview/browser/aw_download_manager_delegate.h"
7 #include "base/files/file_path.h"
8 #include "content/public/browser/download_danger_type.h"
9 #include "content/public/browser/download_item.h"
12 namespace android_webview
{
14 AwDownloadManagerDelegate::~AwDownloadManagerDelegate() {}
16 bool AwDownloadManagerDelegate::DetermineDownloadTarget(
17 content::DownloadItem
* item
,
18 const content::DownloadTargetCallback
& callback
) {
19 // Note this cancel is independent of the URLRequest cancel in
20 // AwResourceDispatcherHostDelegate::DownloadStarting. The request
21 // could have already finished by the time DownloadStarting is called.
22 callback
.Run(base::FilePath() /* Empty file path for cancel */,
23 content::DownloadItem::TARGET_DISPOSITION_OVERWRITE
,
24 content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS
,
29 bool AwDownloadManagerDelegate::ShouldCompleteDownload(
30 content::DownloadItem
* item
,
31 const base::Closure
& complete_callback
) {
36 bool AwDownloadManagerDelegate::ShouldOpenDownload(
37 content::DownloadItem
* item
,
38 const content::DownloadOpenDelayedCallback
& callback
) {
43 void AwDownloadManagerDelegate::GetNextId(
44 const content::DownloadIdCallback
& callback
) {
45 static uint32 next_id
= content::DownloadItem::kInvalidId
+ 1;
46 callback
.Run(next_id
++);
49 } // namespace android_webview