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..d5fd00c76c7e4aebdd2c7f55c01fbbdeb4fbf0c1 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. |
@@ -86,6 +89,12 @@ class DownloadTargetDeterminer |
static bool IsAdobeReaderUpToDate(); |
#endif |
+#if defined(OS_ANDROID) |
+ // Allows unit test to mock DownloadControllerAndroid. |
+ static void SetDownloadControllerAndroidForTestings( |
+ content::DownloadControllerAndroid* download_controller); |
+#endif |
+ |
private: |
// The main workflow is controlled via a set of state transitions. Each state |
// has an associated handler. The handler for STATE_FOO is DoFoo. Each handler |
@@ -93,6 +102,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 +158,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: |