Index: chrome/browser/download/download_manager.h |
diff --git a/chrome/browser/download/download_manager.h b/chrome/browser/download/download_manager.h |
index e072d42498fcd2310388d3f879e2b1c0f4798f8d..4a5814bb62ea33c4bdc98b1dfec2d2222f197eaf 100644 |
--- a/chrome/browser/download/download_manager.h |
+++ b/chrome/browser/download/download_manager.h |
@@ -86,7 +86,9 @@ class DownloadManager |
// Called immediately after the DownloadManager puts up a select file |
// dialog. |
// |id| indicates which download opened the dialog. |
- virtual void SelectFileDialogDisplayed(int32 id) {} |
+ // |suggested_path| indicates the path suggested in the dialog. |
+ virtual void SelectFileDialogDisplayed( |
+ int32 id, const FilePath& suggested_path) {} |
protected: |
virtual ~Observer() {} |
@@ -251,6 +253,17 @@ class DownloadManager |
// For debugging. |
void AssertNotInQueues(DownloadItem* download); |
+ // Chooses a writable directory from |website_save_dir|, |download_save_dir| |
+ // and |default_download_dir| in this order of priority. |
+ // If none of them is writable, creates |download_save_dir| and |
+ // chooses |download_save_dir|. The choosed directory is stored to |save_dir|. |
+ // Returns true if neither |website_save_dir| nor |download_save_dir| |
+ // is writable, which indicates the select file dialog should be displayed. |
+ static bool ChooseSavableDirectory(const FilePath& website_save_dir, |
Paweł Hajdan Jr.
2011/06/15 09:31:33
Let's avoid having static methods in DownloadManag
haraken1
2011/06/15 10:39:45
Actually, I also prefer download_util.cc to downlo
Randy Smith (Not in Mondays)
2011/06/15 19:48:59
Pawel: Why do you prefer not to have static method
Paweł Hajdan Jr.
2011/06/16 17:41:31
No, actually I'm fine with static methods per se.
haraken1
2011/06/22 18:01:58
Randy:
|
+ const FilePath& download_save_dir, |
+ const FilePath& default_download_dir, |
+ FilePath* save_dir); |
+ |
private: |
// For testing. |
friend class DownloadManagerTest; |
@@ -288,7 +301,8 @@ class DownloadManager |
// stalls from interacting with the file system. |
void CheckIfSuggestedPathExists(int32 download_id, |
DownloadStateInfo state, |
- const FilePath& default_path); |
+ const FilePath& download_save_dir, |
+ const FilePath& default_download_dir); |
// Called on the UI thread once the DownloadManager has determined whether the |
// suggested file path exists. |