OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "android_webview/browser/aw_download_manager_delegate.h" | 5 #include "android_webview/browser/aw_download_manager_delegate.h" |
6 | 6 |
7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
8 #include "content/public/browser/download_danger_type.h" | 8 #include "content/public/browser/download_danger_type.h" |
9 #include "content/public/browser/download_item.h" | 9 #include "content/public/browser/download_item.h" |
10 | 10 |
11 namespace android_webview { | 11 namespace android_webview { |
12 | 12 |
13 AwDownloadManagerDelegate::~AwDownloadManagerDelegate() {} | 13 AwDownloadManagerDelegate::~AwDownloadManagerDelegate() {} |
14 | 14 |
15 bool AwDownloadManagerDelegate::DetermineDownloadTarget( | 15 bool AwDownloadManagerDelegate::DetermineDownloadTarget( |
16 content::DownloadItem* item, | 16 content::DownloadItem* item, |
17 const content::DownloadTargetCallback& callback) { | 17 const content::DownloadTargetCallback& callback) { |
18 // Note this cancel is independent of the URLRequest cancel in | 18 // Note this cancel is independent of the URLRequest cancel in |
19 // AwResourceDispatcherHostDelegate::DownloadStarting. The request | 19 // AwResourceDispatcherHostDelegate::DownloadStarting. The request |
20 // could have already finished by the time DownloadStarting is called. | 20 // could have already finished by the time DownloadStarting is called. |
21 callback.Run(base::FilePath() /* Empty file path for cancel */, | 21 callback.Run(base::FilePath() /* Empty file path for cancel */, |
22 content::DownloadItem::TARGET_DISPOSITION_OVERWRITE, | 22 content::DownloadItem::TARGET_DISPOSITION_OVERWRITE, |
23 content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, | 23 content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, base::FilePath(), |
24 base::FilePath()); | 24 content::DOWNLOAD_INTERRUPT_REASON_USER_CANCELED); |
25 return true; | 25 return true; |
26 } | 26 } |
27 | 27 |
28 bool AwDownloadManagerDelegate::ShouldCompleteDownload( | 28 bool AwDownloadManagerDelegate::ShouldCompleteDownload( |
29 content::DownloadItem* item, | 29 content::DownloadItem* item, |
30 const base::Closure& complete_callback) { | 30 const base::Closure& complete_callback) { |
31 NOTREACHED(); | 31 NOTREACHED(); |
32 return true; | 32 return true; |
33 } | 33 } |
34 | 34 |
35 bool AwDownloadManagerDelegate::ShouldOpenDownload( | 35 bool AwDownloadManagerDelegate::ShouldOpenDownload( |
36 content::DownloadItem* item, | 36 content::DownloadItem* item, |
37 const content::DownloadOpenDelayedCallback& callback) { | 37 const content::DownloadOpenDelayedCallback& callback) { |
38 NOTREACHED(); | 38 NOTREACHED(); |
39 return true; | 39 return true; |
40 } | 40 } |
41 | 41 |
42 void AwDownloadManagerDelegate::GetNextId( | 42 void AwDownloadManagerDelegate::GetNextId( |
43 const content::DownloadIdCallback& callback) { | 43 const content::DownloadIdCallback& callback) { |
44 static uint32_t next_id = content::DownloadItem::kInvalidId + 1; | 44 static uint32_t next_id = content::DownloadItem::kInvalidId + 1; |
45 callback.Run(next_id++); | 45 callback.Run(next_id++); |
46 } | 46 } |
47 | 47 |
48 } // namespace android_webview | 48 } // namespace android_webview |
OLD | NEW |