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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_UI_WEBUI_OPTIONS_ADVANCED_OPTIONS_HANDLER_H_ 5 #ifndef CHROME_BROWSER_UI_WEBUI_OPTIONS_ADVANCED_OPTIONS_HANDLER_H_
6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_ADVANCED_OPTIONS_HANDLER_H_ 6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_ADVANCED_OPTIONS_HANDLER_H_
7 #pragma once 7 #pragma once
8 8
9 #include "chrome/browser/prefs/pref_member.h" 9 #include "chrome/browser/prefs/pref_member.h"
10 #include "chrome/browser/prefs/pref_set_observer.h" 10 #include "chrome/browser/prefs/pref_set_observer.h"
11 #include "chrome/browser/printing/cloud_print/cloud_print_setup_handler.h" 11 #include "chrome/browser/printing/cloud_print/cloud_print_setup_handler.h"
12 #include "chrome/browser/remoting/remoting_options_handler.h" 12 #include "chrome/browser/remoting/remoting_options_handler.h"
13 #include "chrome/browser/ui/shell_dialogs.h" 13 #include "chrome/browser/ui/shell_dialogs.h"
14 #include "chrome/browser/ui/webui/options/options_ui.h" 14 #include "chrome/browser/ui/webui/options/options_ui.h"
15 15
16 class OptionsManagedBannerHandler; 16 class OptionsManagedBannerHandler;
17 class CloudPrintSetupHandler; 17 class CloudPrintSetupHandler;
18 18
19 // Chrome advanced options page UI handler. 19 // Chrome advanced options page UI handler.
20 class AdvancedOptionsHandler 20 class AdvancedOptionsHandler
21 : public OptionsPageUIHandler, 21 : public OptionsPageUIHandler,
22 public SelectFileDialog::Listener, 22 public SelectFileDialog::Listener,
23 public CloudPrintSetupHandlerDelegate { 23 public CloudPrintSetupHandlerDelegate {
24 public: 24 public:
25
26 class DownloadPathChecker
27 : 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.
28 public:
29 explicit DownloadPathChecker(AdvancedOptionsHandler* handler);
30
31 // Check if the download folder still exists. If the download folder
32 // does not exist, the download folder is changed to the user's
33 // "My Documents" folder. This check runs in the background and may finish
34 // asynchronously after this method returns.
35 void CheckIfDownloadPathExists(const FilePath& path);
36
37 private:
38 friend class base::RefCountedThreadSafe<DownloadPathChecker>;
39 ~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.
40
41 // Called on the FILE thread to check the existence of the download folder.
42 // If it does not exist, this method tells the user's "My Documents"
43 // to OnDownloadPathChanged().
44 void CheckIfDownloadPathExistsOnFileThread(const FilePath path);
45
46 // Called on the UI thread when the FILE thread finds that the download
47 // folder does not exist. This method changes the download folder to
48 // the user's "My Documents" folder and notifies this preference change
49 // to observers.
50 void OnDownloadPathChanged(const FilePath path);
51
52 // The handler we will report back to.
53 AdvancedOptionsHandler* handler_;
54 };
55
25 AdvancedOptionsHandler(); 56 AdvancedOptionsHandler();
26 virtual ~AdvancedOptionsHandler(); 57 virtual ~AdvancedOptionsHandler();
27 58
28 // OptionsPageUIHandler implementation. 59 // OptionsPageUIHandler implementation.
29 virtual void GetLocalizedValues(DictionaryValue* localized_strings); 60 virtual void GetLocalizedValues(DictionaryValue* localized_strings);
30 virtual void Initialize(); 61 virtual void Initialize();
31 62
32 // WebUIMessageHandler implementation. 63 // WebUIMessageHandler implementation.
33 virtual WebUIMessageHandler* Attach(WebUI* web_ui); 64 virtual WebUIMessageHandler* Attach(WebUI* web_ui);
34 virtual void RegisterMessages(); 65 virtual void RegisterMessages();
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 #endif 160 #endif
130 161
131 // Setup the checked state for the metrics reporting checkbox. 162 // Setup the checked state for the metrics reporting checkbox.
132 void SetupMetricsReportingCheckbox(); 163 void SetupMetricsReportingCheckbox();
133 164
134 // Setup the visibility for the metrics reporting setting. 165 // Setup the visibility for the metrics reporting setting.
135 void SetupMetricsReportingSettingVisibility(); 166 void SetupMetricsReportingSettingVisibility();
136 167
137 void SetupFontSizeLabel(); 168 void SetupFontSizeLabel();
138 169
139 // Setup the download path based on user preferences. 170 // Setup the download folder based on user preferences.
140 void SetupDownloadLocationPath(); 171 void SetupDownloadLocationPath();
141 172
142 // Setup the pref whether to prompt for download location every time. 173 // Setup the pref whether to prompt for download location every time.
143 void SetupPromptForDownload(); 174 void SetupPromptForDownload();
144 175
145 // Setup the enabled state of the reset button. 176 // Setup the enabled state of the reset button.
146 void SetupAutoOpenFileTypesDisabledAttribute(); 177 void SetupAutoOpenFileTypesDisabledAttribute();
147 178
148 // Setup the proxy settings section UI. 179 // Setup the proxy settings section UI.
149 void SetupProxySettingsSection(); 180 void SetupProxySettingsSection();
150 181
151 // Setup the checked state for SSL related checkboxes. 182 // Setup the checked state for SSL related checkboxes.
152 void SetupSSLConfigSettings(); 183 void SetupSSLConfigSettings();
153 184
185 scoped_refptr<DownloadPathChecker> download_path_checker_;
186
154 scoped_refptr<SelectFileDialog> select_folder_dialog_; 187 scoped_refptr<SelectFileDialog> select_folder_dialog_;
155 188
156 #if !defined(OS_CHROMEOS) 189 #if !defined(OS_CHROMEOS)
157 BooleanPrefMember enable_metrics_recording_; 190 BooleanPrefMember enable_metrics_recording_;
158 StringPrefMember cloud_print_proxy_email_; 191 StringPrefMember cloud_print_proxy_email_;
159 BooleanPrefMember cloud_print_proxy_enabled_; 192 BooleanPrefMember cloud_print_proxy_enabled_;
160 bool cloud_print_proxy_ui_enabled_; 193 bool cloud_print_proxy_ui_enabled_;
161 scoped_ptr<CloudPrintSetupHandler> cloud_print_setup_handler_; 194 scoped_ptr<CloudPrintSetupHandler> cloud_print_setup_handler_;
162 #endif 195 #endif
163 196
(...skipping 11 matching lines...) Expand all
175 BooleanPrefMember allow_file_selection_dialogs_; 208 BooleanPrefMember allow_file_selection_dialogs_;
176 StringPrefMember auto_open_files_; 209 StringPrefMember auto_open_files_;
177 IntegerPrefMember default_font_size_; 210 IntegerPrefMember default_font_size_;
178 scoped_ptr<PrefSetObserver> proxy_prefs_; 211 scoped_ptr<PrefSetObserver> proxy_prefs_;
179 scoped_ptr<OptionsManagedBannerHandler> banner_handler_; 212 scoped_ptr<OptionsManagedBannerHandler> banner_handler_;
180 213
181 DISALLOW_COPY_AND_ASSIGN(AdvancedOptionsHandler); 214 DISALLOW_COPY_AND_ASSIGN(AdvancedOptionsHandler);
182 }; 215 };
183 216
184 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_ADVANCED_OPTIONS_HANDLER_H_ 217 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_ADVANCED_OPTIONS_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698