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

Unified Diff: chrome/browser/ui/webui/options/advanced_options_handler.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: Correct typo Created 9 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/ui/webui/options/advanced_options_handler.h
diff --git a/chrome/browser/ui/webui/options/advanced_options_handler.h b/chrome/browser/ui/webui/options/advanced_options_handler.h
index 4f0889e4d2204ee13f1de20cc6ea6c5a05ec753a..31c2b129be631421c8d16647b65c18749cbe939c 100644
--- a/chrome/browser/ui/webui/options/advanced_options_handler.h
+++ b/chrome/browser/ui/webui/options/advanced_options_handler.h
@@ -22,6 +22,37 @@ class AdvancedOptionsHandler
public SelectFileDialog::Listener,
public CloudPrintSetupHandlerDelegate {
public:
+
+ class DownloadPathChecker
+ : public base::RefCountedThreadSafe<DownloadPathChecker> {
Paweł Hajdan Jr. 2011/05/13 09:16:22 nit: Shouldn't this be indented 4 spaces rather th
haraken1 2011/05/17 04:29:05 Done.
+ public:
+ explicit DownloadPathChecker(AdvancedOptionsHandler* handler);
+
+ // Check if the download folder still exists. If the download folder
+ // does not exist, the download folder is changed to the user's
+ // "My Documents" folder. This check runs in the background and may finish
+ // asynchronously after this method returns.
+ void CheckIfDownloadPathExists(const FilePath& path);
+
+ private:
+ friend class base::RefCountedThreadSafe<DownloadPathChecker>;
+ ~DownloadPathChecker() {}
Paweł Hajdan Jr. 2011/05/13 09:16:22 nit: Could you put the dtor implementation in the
haraken1 2011/05/17 04:29:05 Done.
+
+ // Called on the FILE thread to check the existence of the download folder.
+ // If it does not exist, this method tells the user's "My Documents"
+ // to OnDownloadPathChanged().
+ void CheckIfDownloadPathExistsOnFileThread(const FilePath path);
+
+ // Called on the UI thread when the FILE thread finds that the download
+ // folder does not exist. This method changes the download folder to
+ // the user's "My Documents" folder and notifies this preference change
+ // to observers.
+ void OnDownloadPathChanged(const FilePath path);
+
+ // The handler we will report back to.
+ AdvancedOptionsHandler* handler_;
+ };
+
AdvancedOptionsHandler();
virtual ~AdvancedOptionsHandler();
@@ -136,7 +167,7 @@ class AdvancedOptionsHandler
void SetupFontSizeLabel();
- // Setup the download path based on user preferences.
+ // Setup the download folder based on user preferences.
void SetupDownloadLocationPath();
// Setup the pref whether to prompt for download location every time.
@@ -151,6 +182,8 @@ class AdvancedOptionsHandler
// Setup the checked state for SSL related checkboxes.
void SetupSSLConfigSettings();
+ scoped_refptr<DownloadPathChecker> download_path_checker_;
+
scoped_refptr<SelectFileDialog> select_folder_dialog_;
#if !defined(OS_CHROMEOS)

Powered by Google App Engine
This is Rietveld 408576698