| 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 | |
| 55 AdvancedOptionsHandler(); | 24 AdvancedOptionsHandler(); |
| 56 virtual ~AdvancedOptionsHandler(); | 25 virtual ~AdvancedOptionsHandler(); |
| 57 | 26 |
| 58 // OptionsPageUIHandler implementation. | 27 // OptionsPageUIHandler implementation. |
| 59 virtual void GetLocalizedValues(DictionaryValue* localized_strings); | 28 virtual void GetLocalizedValues(DictionaryValue* localized_strings); |
| 60 virtual void Initialize(); | 29 virtual void Initialize(); |
| 61 | 30 |
| 62 // WebUIMessageHandler implementation. | 31 // WebUIMessageHandler implementation. |
| 63 virtual WebUIMessageHandler* Attach(WebUI* web_ui); | 32 virtual WebUIMessageHandler* Attach(WebUI* web_ui); |
| 64 virtual void RegisterMessages(); | 33 virtual void RegisterMessages(); |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 #endif | 126 #endif |
| 158 | 127 |
| 159 // Setup the checked state for the metrics reporting checkbox. | 128 // Setup the checked state for the metrics reporting checkbox. |
| 160 void SetupMetricsReportingCheckbox(); | 129 void SetupMetricsReportingCheckbox(); |
| 161 | 130 |
| 162 // Setup the visibility for the metrics reporting setting. | 131 // Setup the visibility for the metrics reporting setting. |
| 163 void SetupMetricsReportingSettingVisibility(); | 132 void SetupMetricsReportingSettingVisibility(); |
| 164 | 133 |
| 165 void SetupFontSizeLabel(); | 134 void SetupFontSizeLabel(); |
| 166 | 135 |
| 167 // Setup the download folder based on user preferences. | 136 // Setup the download path based on user preferences. |
| 168 void SetupDownloadLocationPath(); | 137 void SetupDownloadLocationPath(); |
| 169 | 138 |
| 170 // Setup the pref whether to prompt for download location every time. | 139 // Setup the pref whether to prompt for download location every time. |
| 171 void SetupPromptForDownload(); | 140 void SetupPromptForDownload(); |
| 172 | 141 |
| 173 // Setup the enabled state of the reset button. | 142 // Setup the enabled state of the reset button. |
| 174 void SetupAutoOpenFileTypesDisabledAttribute(); | 143 void SetupAutoOpenFileTypesDisabledAttribute(); |
| 175 | 144 |
| 176 // Setup the proxy settings section UI. | 145 // Setup the proxy settings section UI. |
| 177 void SetupProxySettingsSection(); | 146 void SetupProxySettingsSection(); |
| 178 | 147 |
| 179 // Setup the checked state for SSL related checkboxes. | 148 // Setup the checked state for SSL related checkboxes. |
| 180 void SetupSSLConfigSettings(); | 149 void SetupSSLConfigSettings(); |
| 181 | 150 |
| 182 scoped_refptr<DownloadPathChecker> download_path_checker_; | |
| 183 | |
| 184 scoped_refptr<SelectFileDialog> select_folder_dialog_; | 151 scoped_refptr<SelectFileDialog> select_folder_dialog_; |
| 185 | 152 |
| 186 #if !defined(OS_CHROMEOS) | 153 #if !defined(OS_CHROMEOS) |
| 187 BooleanPrefMember enable_metrics_recording_; | 154 BooleanPrefMember enable_metrics_recording_; |
| 188 StringPrefMember cloud_print_proxy_email_; | 155 StringPrefMember cloud_print_proxy_email_; |
| 189 BooleanPrefMember cloud_print_proxy_enabled_; | 156 BooleanPrefMember cloud_print_proxy_enabled_; |
| 190 bool cloud_print_proxy_ui_enabled_; | 157 bool cloud_print_proxy_ui_enabled_; |
| 191 scoped_ptr<CloudPrintSetupHandler> cloud_print_setup_handler_; | 158 scoped_ptr<CloudPrintSetupHandler> cloud_print_setup_handler_; |
| 192 #endif | 159 #endif |
| 193 | 160 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 205 BooleanPrefMember allow_file_selection_dialogs_; | 172 BooleanPrefMember allow_file_selection_dialogs_; |
| 206 StringPrefMember auto_open_files_; | 173 StringPrefMember auto_open_files_; |
| 207 IntegerPrefMember default_font_size_; | 174 IntegerPrefMember default_font_size_; |
| 208 scoped_ptr<PrefSetObserver> proxy_prefs_; | 175 scoped_ptr<PrefSetObserver> proxy_prefs_; |
| 209 scoped_ptr<OptionsManagedBannerHandler> banner_handler_; | 176 scoped_ptr<OptionsManagedBannerHandler> banner_handler_; |
| 210 | 177 |
| 211 DISALLOW_COPY_AND_ASSIGN(AdvancedOptionsHandler); | 178 DISALLOW_COPY_AND_ASSIGN(AdvancedOptionsHandler); |
| 212 }; | 179 }; |
| 213 | 180 |
| 214 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_ADVANCED_OPTIONS_HANDLER_H_ | 181 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_ADVANCED_OPTIONS_HANDLER_H_ |
| OLD | NEW |