| 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_DOM_UI_OPTIONS_ADVANCED_OPTIONS_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_DOM_UI_OPTIONS_ADVANCED_OPTIONS_HANDLER_H_ |
| 6 #define CHROME_BROWSER_DOM_UI_OPTIONS_ADVANCED_OPTIONS_HANDLER_H_ | 6 #define CHROME_BROWSER_DOM_UI_OPTIONS_ADVANCED_OPTIONS_HANDLER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "chrome/browser/dom_ui/options/options_ui.h" | 9 #include "chrome/browser/webui/options/advanced_options_handler.h" |
| 10 #include "chrome/browser/prefs/pref_member.h" | 10 // TODO(tfarina): remove this file once all includes have been updated. |
| 11 #include "chrome/browser/prefs/pref_set_observer.h" | |
| 12 #include "chrome/browser/printing/cloud_print/cloud_print_setup_flow.h" | |
| 13 #include "chrome/browser/remoting/remoting_options_handler.h" | |
| 14 #include "chrome/browser/ui/shell_dialogs.h" | |
| 15 | |
| 16 class OptionsManagedBannerHandler; | |
| 17 | |
| 18 // Chrome advanced options page UI handler. | |
| 19 class AdvancedOptionsHandler | |
| 20 : public OptionsPageUIHandler, | |
| 21 public SelectFileDialog::Listener, | |
| 22 public CloudPrintSetupFlow::Delegate { | |
| 23 public: | |
| 24 AdvancedOptionsHandler(); | |
| 25 virtual ~AdvancedOptionsHandler(); | |
| 26 | |
| 27 // OptionsUIHandler implementation. | |
| 28 virtual void GetLocalizedValues(DictionaryValue* localized_strings); | |
| 29 virtual void Initialize(); | |
| 30 | |
| 31 // WebUIMessageHandler implementation. | |
| 32 virtual WebUIMessageHandler* Attach(WebUI* web_ui); | |
| 33 virtual void RegisterMessages(); | |
| 34 | |
| 35 // NotificationObserver implementation. | |
| 36 virtual void Observe(NotificationType type, | |
| 37 const NotificationSource& source, | |
| 38 const NotificationDetails& details); | |
| 39 | |
| 40 // SelectFileDialog::Listener implementation | |
| 41 virtual void FileSelected(const FilePath& path, int index, void* params); | |
| 42 | |
| 43 // CloudPrintSetupFlow::Delegate implementation. | |
| 44 virtual void OnDialogClosed(); | |
| 45 | |
| 46 private: | |
| 47 // Callback for the "selectDownloadLocation" message. This will prompt | |
| 48 // the user for a destination folder using platform-specific APIs. | |
| 49 void HandleSelectDownloadLocation(const ListValue* args); | |
| 50 | |
| 51 // Callback for the "promptForDownloadAction" message. This will set | |
| 52 // the ask for save location pref accordingly. | |
| 53 void HandlePromptForDownload(const ListValue* args); | |
| 54 | |
| 55 // Callback for the "autoOpenFileTypesResetToDefault" message. This will | |
| 56 // remove all auto-open file-type settings. | |
| 57 void HandleAutoOpenButton(const ListValue* args); | |
| 58 | |
| 59 // Callback for the "metricsReportingCheckboxAction" message. This is called | |
| 60 // if the user toggles the metrics reporting checkbox. | |
| 61 void HandleMetricsReportingCheckbox(const ListValue* args); | |
| 62 | |
| 63 // Callback for the "defaultFontSizeAction" message. This is called if the | |
| 64 // user changes the default font size. |args| is an array that contains | |
| 65 // one item, the font size as a numeric value. | |
| 66 void HandleDefaultFontSize(const ListValue* args); | |
| 67 | |
| 68 #if defined(OS_WIN) | |
| 69 // Callback for the "Check SSL Revocation" checkbox. This is needed so we | |
| 70 // can support manual handling on Windows. | |
| 71 void HandleCheckRevocationCheckbox(const ListValue* args); | |
| 72 | |
| 73 // Callback for the "Use SSL3" checkbox. This is needed so we can support | |
| 74 // manual handling on Windows. | |
| 75 void HandleUseSSL3Checkbox(const ListValue* args); | |
| 76 | |
| 77 // Callback for the "Use TLS1" checkbox. This is needed so we can support | |
| 78 // manual handling on Windows. | |
| 79 void HandleUseTLS1Checkbox(const ListValue* args); | |
| 80 | |
| 81 // Callback for the "Show Gears Settings" button. | |
| 82 void HandleShowGearsSettings(const ListValue* args); | |
| 83 #endif | |
| 84 | |
| 85 #if !defined(OS_CHROMEOS) | |
| 86 // Callback for the "showNetworkProxySettings" message. This will invoke | |
| 87 // an appropriate dialog for configuring proxy settings. | |
| 88 void ShowNetworkProxySettings(const ListValue* args); | |
| 89 #endif | |
| 90 | |
| 91 #if !defined(USE_NSS) | |
| 92 // Callback for the "showManageSSLCertificates" message. This will invoke | |
| 93 // an appropriate certificate management action based on the platform. | |
| 94 void ShowManageSSLCertificates(const ListValue* args); | |
| 95 #endif | |
| 96 | |
| 97 #if !defined(OS_CHROMEOS) | |
| 98 // Callback for the Sign in to Cloud Print button. This will start | |
| 99 // the authentication process. | |
| 100 void ShowCloudPrintSetupDialog(const ListValue* args); | |
| 101 | |
| 102 // Callback for the Disable Cloud Print button. This will sign out | |
| 103 // of cloud print. | |
| 104 void HandleDisableCloudPrintProxy(const ListValue* args); | |
| 105 | |
| 106 // Callback for the Cloud Print manage button. This will open a new | |
| 107 // tab pointed at the management URL. | |
| 108 void ShowCloudPrintManagePage(const ListValue* args); | |
| 109 | |
| 110 // Pings the service to send us it's current notion of the enabled state. | |
| 111 void RefreshCloudPrintStatusFromService(); | |
| 112 | |
| 113 // Setup the enabled or disabled state of the cloud print proxy | |
| 114 // management UI. | |
| 115 void SetupCloudPrintProxySection(); | |
| 116 | |
| 117 // Remove cloud print proxy section if cloud print proxy management UI is | |
| 118 // disabled. | |
| 119 void RemoveCloudPrintProxySection(); | |
| 120 | |
| 121 #endif | |
| 122 | |
| 123 #if defined(ENABLE_REMOTING) && !defined(OS_CHROMEOS) | |
| 124 // Removes remoting section. Called if remoting is not enabled. | |
| 125 void RemoveRemotingSection(); | |
| 126 | |
| 127 // Callback for Setup Remoting button. | |
| 128 void ShowRemotingSetupDialog(const ListValue* args); | |
| 129 | |
| 130 // Disable Remoting. | |
| 131 void DisableRemoting(const ListValue* args); | |
| 132 #endif | |
| 133 | |
| 134 // Setup the checked state for the metrics reporting checkbox. | |
| 135 void SetupMetricsReportingCheckbox(); | |
| 136 | |
| 137 // Setup the visibility for the metrics reporting setting. | |
| 138 void SetupMetricsReportingSettingVisibility(); | |
| 139 | |
| 140 void SetupFontSizeLabel(); | |
| 141 | |
| 142 // Setup the download path based on user preferences. | |
| 143 void SetupDownloadLocationPath(); | |
| 144 | |
| 145 // Setup the pref whether to prompt for download location every time. | |
| 146 void SetupPromptForDownload(); | |
| 147 | |
| 148 // Setup the enabled state of the reset button. | |
| 149 void SetupAutoOpenFileTypesDisabledAttribute(); | |
| 150 | |
| 151 // Setup the proxy settings section UI. | |
| 152 void SetupProxySettingsSection(); | |
| 153 | |
| 154 #if defined(OS_WIN) | |
| 155 // Setup the checked state for SSL related checkboxes. | |
| 156 void SetupSSLConfigSettings(); | |
| 157 #endif | |
| 158 | |
| 159 scoped_refptr<SelectFileDialog> select_folder_dialog_; | |
| 160 | |
| 161 #if !defined(OS_CHROMEOS) | |
| 162 BooleanPrefMember enable_metrics_recording_; | |
| 163 StringPrefMember cloud_print_proxy_email_; | |
| 164 BooleanPrefMember cloud_print_proxy_enabled_; | |
| 165 bool cloud_print_proxy_ui_enabled_; | |
| 166 #endif | |
| 167 | |
| 168 #if defined(ENABLE_REMOTING) && !defined(OS_CHROMEOS) | |
| 169 remoting::RemotingOptionsHandler remoting_options_handler_; | |
| 170 #endif | |
| 171 | |
| 172 FilePathPrefMember default_download_location_; | |
| 173 BooleanPrefMember ask_for_save_location_; | |
| 174 StringPrefMember auto_open_files_; | |
| 175 IntegerPrefMember default_font_size_; | |
| 176 IntegerPrefMember default_fixed_font_size_; | |
| 177 scoped_ptr<PrefSetObserver> proxy_prefs_; | |
| 178 scoped_ptr<OptionsManagedBannerHandler> banner_handler_; | |
| 179 | |
| 180 DISALLOW_COPY_AND_ASSIGN(AdvancedOptionsHandler); | |
| 181 }; | |
| 182 | 11 |
| 183 #endif // CHROME_BROWSER_DOM_UI_OPTIONS_ADVANCED_OPTIONS_HANDLER_H_ | 12 #endif // CHROME_BROWSER_DOM_UI_OPTIONS_ADVANCED_OPTIONS_HANDLER_H_ |
| OLD | NEW |