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

Unified Diff: content/public/browser/android/download_controller_android.h

Issue 1217223006: Prompt user for file access permission before download starts (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nits Created 5 years, 5 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/android/download_controller_android.h
diff --git a/content/public/browser/android/download_controller_android.h b/content/public/browser/android/download_controller_android.h
index fd035d734ec1c5bffd3b2580c8501c5f8c60b361..859a8a0a4e7d8decc7c92050308b351c81fe0a94 100644
--- a/content/public/browser/android/download_controller_android.h
+++ b/content/public/browser/android/download_controller_android.h
@@ -5,6 +5,7 @@
#ifndef CONTENT_PUBLIC_BROWSER_ANDROID_DOWNLOAD_CONTROLLER_ANDROID_H_
#define CONTENT_PUBLIC_BROWSER_ANDROID_DOWNLOAD_CONTROLLER_ANDROID_H_
+#include "base/callback.h"
#include "content/common/content_export.h"
#include "content/public/common/context_menu_params.h"
@@ -19,6 +20,10 @@ class CONTENT_EXPORT DownloadControllerAndroid {
// Returns the singleton instance of the DownloadControllerAndroid.
static DownloadControllerAndroid* Get();
+ // Called to set the DownloadControllerAndroid instance.
+ static void SetDownloadControllerAndroid(
+ DownloadControllerAndroid* download_controller);
+
// Starts a new download request with Android. Should be called on the
// UI thread.
virtual void CreateGETDownload(int render_process_id, int render_view_id,
@@ -38,8 +43,22 @@ class CONTENT_EXPORT DownloadControllerAndroid {
virtual void DangerousDownloadValidated(
WebContents* web_contents, int download_id, bool accept) = 0;
+ // Callback when user permission prompt finishes. Args: whether file access
+ // permission is acquired.
+ typedef base::Callback<void(bool)> AcquireFileAccessPermissionCallback;
+
+ // Called to prompt the user for file access permission. When finished,
+ // |callback| will be executed.
+ virtual void AcquireFileAccessPermission(
+ WebContents* web_contents,
+ const AcquireFileAccessPermissionCallback& callback) = 0;
+
+ // Called by unit test to approve or disapprove file access request.
+ virtual void SetApproveFileAccessRequestForTesting(bool approve) {};
+
protected:
virtual ~DownloadControllerAndroid() {};
+ static DownloadControllerAndroid* download_controller_;
};
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698