Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(331)

Unified Diff: content/public/browser/download_item.h

Issue 14947007: [Downloads] Allow acquiring dangerous download file. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rename methods for consistency Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/public/browser/download_item.h
diff --git a/content/public/browser/download_item.h b/content/public/browser/download_item.h
index ddc79f5ae63fb62186855ec1cb6076e1b87c99b7..7e82ca7cf458bc03ead74e7d99e513b68ef4d7a7 100644
--- a/content/public/browser/download_item.h
+++ b/content/public/browser/download_item.h
@@ -21,6 +21,7 @@
#include <string>
#include <vector>
+#include "base/callback_forward.h"
#include "base/files/file_path.h"
#include "base/string16.h"
#include "base/supports_user_data.h"
@@ -81,6 +82,9 @@ class CONTENT_EXPORT DownloadItem : public base::SupportsUserData {
// TARGET_DISPOSITION_OVERWRITE.
};
+ // Callback used with AcquireFileAndDeleteDownload().
+ typedef base::Callback<void(const base::FilePath&)> AcquireFileCallback;
+
static const char kEmptyFileHash[];
// Interface that observers of a particular download must implement in order
@@ -111,7 +115,7 @@ class CONTENT_EXPORT DownloadItem : public base::SupportsUserData {
// User Actions --------------------------------------------------------------
// Called when the user has validated the download of a dangerous file.
- virtual void DangerousDownloadValidated() = 0;
+ virtual void ValidateDangerousDownload() = 0;
// Pause a download. Will have no effect if the download is already
// paused.
@@ -133,8 +137,13 @@ class CONTENT_EXPORT DownloadItem : public base::SupportsUserData {
virtual void Cancel(bool user_cancel) = 0;
// Deletes the file from disk and removes the download from the views and
- // history.
- virtual void Delete(DeleteReason reason) = 0;
+ // history. If |callback| is not empty, then the downloaded file will not be
+ // deleted. Instead, the path of the file will be passed into |callback|. If
+ // the intermediate file is not available, then the returned path will be
+ // empty.
+ virtual void DiscardDangerousDownload(
+ DeleteReason reason,
+ const AcquireFileCallback& callback) = 0;
// Removes the download from the views and history.
virtual void Remove() = 0;
@@ -246,7 +255,7 @@ class CONTENT_EXPORT DownloadItem : public base::SupportsUserData {
virtual bool GetFileExternallyRemoved() const = 0;
// True if the file that will be written by the download is dangerous
- // and we will require a call to DangerousDownloadValidated() to complete.
+ // and we will require a call to ValidateDangerousDownload() to complete.
// False if the download is safe or that function has been called.
virtual bool IsDangerous() const = 0;

Powered by Google App Engine
This is Rietveld 408576698