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

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: 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..7fd15d427bbb1a03aaadcde32190ed0aeca7d22e 100644
--- a/chrome/browser/download/download_target_determiner.h
+++ b/chrome/browser/download/download_target_determiner.h
@@ -52,6 +52,11 @@ 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. If the download has a forced path, then
+ // initial_virtual_path must be empty or be the 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 +70,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 +125,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 +227,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.
+ 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
@@ -242,9 +255,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