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. |