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