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

Unified Diff: chrome/browser/download/download_target_determiner.h

Issue 14640020: [Resumption 9/11] Handle filename determination for resumed downloads. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments 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: 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 dcb0d1e4f0c9bde19d2aa9282d0fc6bad73fc0f8..2b2316549dba86884b2bd1447fa10befdbf158e9 100644
--- a/chrome/browser/download/download_target_determiner.h
+++ b/chrome/browser/download/download_target_determiner.h
@@ -52,6 +52,12 @@ class DownloadTargetDeterminer
public:
// Start the process of determing the target of |download|.
//
+ // |initial_virtual_path| if non-empty, defines the initial virtual path for
+ // the target determination process. If one isn't specified, one will be
+ // generated based on the response data specified in |download| and the
+ // users' downloads directory.
+ // Note: |initial_virtual_path| is only used if download has prompted the
+ // user before and doesn't have a forced path.
// |download_prefs| is required and must outlive |download|. It is used for
// determining the user's preferences regarding the default downloads
// directory, prompting and auto-open behavior.
@@ -65,6 +71,7 @@ class DownloadTargetDeterminer
//
// Start() should be called on the UI thread.
static void Start(content::DownloadItem* download,
+ const base::FilePath& initial_virtual_path,
DownloadPrefs* download_prefs,
const base::FilePath& last_selected_directory,
DownloadTargetDeterminerDelegate* delegate,
@@ -119,6 +126,7 @@ class DownloadTargetDeterminer
// are as per Start() above.
DownloadTargetDeterminer(
content::DownloadItem* download,
+ const base::FilePath& initial_virtual_path,
DownloadPrefs* download_prefs,
const base::FilePath& last_selected_directory,
DownloadTargetDeterminerDelegate* delegate,
@@ -220,7 +228,13 @@ class DownloadTargetDeterminer
Profile* GetProfile();
- bool ShouldPromptForDownload(const base::FilePath& filename);
+ bool ShouldPromptForDownload(const base::FilePath& filename) const;
+
+ // Returns true if the user has been prompted for this download at least once.
+ // Can return true for resumed downloads that have prompted the user
+ // previously even if no prompting happened during the current run of
+ // DownloadTargetDeterminer.
Randy Smith (Not in Mondays) 2013/05/24 01:53:55 If I read the code right, this will return true af
asanka 2013/05/29 22:30:11 Done.
+ bool HasPromptedForPath() const;
// Returns true if this download should show the "dangerous file" warning.
// Various factors are considered, such as the type of the file, whether a
@@ -234,6 +248,7 @@ class DownloadTargetDeterminer
// state
State next_state_;
bool should_prompt_;
+ bool should_notify_extensions_;
bool create_directory_;
DownloadPathReservationTracker::FilenameConflictAction conflict_action_;
content::DownloadDangerType danger_type_;
@@ -242,9 +257,10 @@ class DownloadTargetDeterminer
base::FilePath intermediate_path_;
content::DownloadItem* download_;
+ const bool is_resumption_;
DownloadPrefs* download_prefs_;
DownloadTargetDeterminerDelegate* delegate_;
- base::FilePath last_selected_directory_;
+ const base::FilePath last_selected_directory_;
content::DownloadTargetCallback completion_callback_;
CancelableRequestConsumer history_consumer_;

Powered by Google App Engine
This is Rietveld 408576698