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

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

Issue 6973052: When the download folder does not exist, change the download folder to a user's "Downloads" (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Remove PathServiceWrapper and add DefaultDownloadDirectory Created 9 years, 6 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_util.h
diff --git a/chrome/browser/download/download_util.h b/chrome/browser/download/download_util.h
index e7726a9d28ac646f4aa640c022bee14a006139b2..0b726816c2ce8d1e8c65fef0a7f73fe9b6c421c3 100644
--- a/chrome/browser/download/download_util.h
+++ b/chrome/browser/download/download_util.h
@@ -51,8 +51,27 @@ namespace download_util {
// Download temporary file creation --------------------------------------------
-// Return the default download directory.
-const FilePath& GetDefaultDownloadDirectory();
+class DefaultDownloadDirectory {
+ public:
+ // Returns the path of the default download folder.
+ // If the path is being overridden, returns the overridden path.
+ static bool Get(FilePath* path);
+
+ // Overrides the path of the default download folder.
+ // WARNING: We can use this method only on testing context (e.g. download
+ // tests) for temporarily switching the default download folder.
+ // WARNING: In order to override the path, we must use
+ // this method instead of using PathService::Override(),
+ // since PathService::Override() can cause many problems:
+ // http://codereview.chromium.org/2805100
+ static void Override(const FilePath& override_path);
+
+ // Invalidate the overriding of the default download folder.
+ static void UnOverride();
+
+ private:
+ static FilePath override_path_;
+};
// Create a temporary file for a download in the user's default download
// directory and return true if was successful in creating the file.

Powered by Google App Engine
This is Rietveld 408576698