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

Unified Diff: chrome/browser/download/download_target_determiner.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: addressing asanka's comments 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: chrome/browser/download/download_target_determiner.h
diff --git a/chrome/browser/download/download_target_determiner.h b/chrome/browser/download/download_target_determiner.h
index 0bb4cb034e297f6e0540ce9aee9d75502a64efe0..f9b96c94e13c4194262e60d1615c8b6f9f9a496d 100644
--- a/chrome/browser/download/download_target_determiner.h
+++ b/chrome/browser/download/download_target_determiner.h
@@ -23,6 +23,9 @@ class DownloadPrefs;
namespace content {
enum DownloadDangerType;
+#if defined(OS_ANDROID)
+class DownloadControllerAndroid;
+#endif
}
// Determines the target of the download.
@@ -93,6 +96,7 @@ class DownloadTargetDeterminer
// Result indicating how the workflow should proceed. The loop ends when a
// handler returns COMPLETE.
enum State {
+ STATE_PROMPT_USER_FOR_PERMISSION,
STATE_GENERATE_TARGET_PATH,
STATE_NOTIFY_EXTENSIONS,
STATE_RESERVE_VIRTUAL_PATH,
@@ -148,6 +152,15 @@ class DownloadTargetDeterminer
// === Main workflow ===
+ // Prompts user for file access if necessary.
+ // Next state:
+ // - STATE_GENERATE_TARGET_PATH.
+ Result DoPromptUserForPermission();
+
+ // Callback invoked after the file access prompt completes. Cancels the
+ // download if the user doesn't grant file access.
+ void PromptUserForPermissionDone(bool granted);
+
// Generates an initial target path. This target is based only on the state of
// the download item.
// Next state:
@@ -318,6 +331,10 @@ class DownloadTargetDeterminer
CompletionCallback completion_callback_;
base::CancelableTaskTracker history_tracker_;
+#if defined(OS_ANDROID)
+ // Download controller for file access prompt.
+ content::DownloadControllerAndroid* download_controller_;
+#endif
base::WeakPtrFactory<DownloadTargetDeterminer> weak_ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(DownloadTargetDeterminer);

Powered by Google App Engine
This is Rietveld 408576698