OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_UI_WEBUI_OPTIONS2_ADVANCED_OPTIONS_HANDLER_H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS2_ADVANCED_OPTIONS_HANDLER_H_ |
| 7 #pragma once |
| 8 |
| 9 #include "chrome/browser/prefs/pref_member.h" |
| 10 #include "chrome/browser/printing/cloud_print/cloud_print_setup_handler.h" |
| 11 #include "chrome/browser/ui/select_file_dialog.h" |
| 12 #include "chrome/browser/ui/webui/options2/options_ui2.h" |
| 13 |
| 14 #if !defined(OS_CHROMEOS) |
| 15 #include "chrome/browser/prefs/pref_set_observer.h" |
| 16 #endif // !defined(OS_CHROMEOS) |
| 17 |
| 18 class CloudPrintSetupHandler; |
| 19 |
| 20 // Chrome advanced options page UI handler. |
| 21 class AdvancedOptionsHandler |
| 22 : public OptionsPage2UIHandler, |
| 23 public SelectFileDialog::Listener, |
| 24 public CloudPrintSetupHandlerDelegate { |
| 25 public: |
| 26 AdvancedOptionsHandler(); |
| 27 virtual ~AdvancedOptionsHandler(); |
| 28 |
| 29 // OptionsPage2UIHandler implementation. |
| 30 virtual void GetLocalizedValues(DictionaryValue* localized_strings) OVERRIDE; |
| 31 virtual void Initialize() OVERRIDE; |
| 32 |
| 33 // WebUIMessageHandler implementation. |
| 34 virtual WebUIMessageHandler* Attach(WebUI* web_ui) OVERRIDE; |
| 35 virtual void RegisterMessages() OVERRIDE; |
| 36 |
| 37 // content::NotificationObserver implementation. |
| 38 virtual void Observe(int type, |
| 39 const content::NotificationSource& source, |
| 40 const content::NotificationDetails& details) OVERRIDE; |
| 41 |
| 42 // SelectFileDialog::Listener implementation |
| 43 virtual void FileSelected(const FilePath& path, |
| 44 int index, |
| 45 void* params) OVERRIDE; |
| 46 |
| 47 // CloudPrintSetupHandler::Delegate implementation. |
| 48 virtual void OnCloudPrintSetupClosed() OVERRIDE; |
| 49 |
| 50 private: |
| 51 // Callback for the "selectDownloadLocation" message. This will prompt the |
| 52 // user for a destination folder using platform-specific APIs. |
| 53 void HandleSelectDownloadLocation(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 // Callback for the "defaultZoomFactorAction" message. This is called if the |
| 69 // user changes the default zoom factor. |args| is an array that contains |
| 70 // one item, the zoom factor as a numeric value. |
| 71 void HandleDefaultZoomFactor(const ListValue* args); |
| 72 |
| 73 // Callback for the "Check for server certificate revocation" checkbox. This |
| 74 // is called if the user toggles the "Check for server certificate revocation" |
| 75 // checkbox. |
| 76 void HandleCheckRevocationCheckbox(const ListValue* args); |
| 77 |
| 78 // Callback for the "Use SSL 3.0" checkbox. This is called if the user toggles |
| 79 // the "Use SSL 3.0" checkbox. |
| 80 void HandleUseSSL3Checkbox(const ListValue* args); |
| 81 |
| 82 // Callback for the "Use TLS 1.0" checkbox. This is called if the user toggles |
| 83 // the "Use TLS 1.0" checkbox. |
| 84 void HandleUseTLS1Checkbox(const ListValue* args); |
| 85 |
| 86 #if !defined(OS_CHROMEOS) |
| 87 // Callback for the "showNetworkProxySettings" message. This will invoke |
| 88 // an appropriate dialog for configuring proxy settings. |
| 89 void ShowNetworkProxySettings(const ListValue* args); |
| 90 #endif |
| 91 |
| 92 #if !defined(USE_NSS) |
| 93 // Callback for the "showManageSSLCertificates" message. This will invoke |
| 94 // an appropriate certificate management action based on the platform. |
| 95 void ShowManageSSLCertificates(const ListValue* args); |
| 96 #endif |
| 97 |
| 98 // Callback for the Cloud Print manage button. This will open a new |
| 99 // tab pointed at the management URL. |
| 100 void ShowCloudPrintManagePage(const ListValue* args); |
| 101 |
| 102 #if !defined(OS_CHROMEOS) |
| 103 // Callback for the Sign in to Cloud Print button. This will start |
| 104 // the authentication process. |
| 105 void ShowCloudPrintSetupDialog(const ListValue* args); |
| 106 |
| 107 // Callback for the Disable Cloud Print button. This will sign out |
| 108 // of cloud print. |
| 109 void HandleDisableCloudPrintProxy(const ListValue* args); |
| 110 |
| 111 // Pings the service to send us it's current notion of the enabled state. |
| 112 void RefreshCloudPrintStatusFromService(); |
| 113 |
| 114 // Setup the enabled or disabled state of the cloud print proxy |
| 115 // management UI. |
| 116 void SetupCloudPrintProxySection(); |
| 117 |
| 118 // Remove cloud print proxy section if cloud print proxy management UI is |
| 119 // disabled. |
| 120 void RemoveCloudPrintProxySection(); |
| 121 |
| 122 #endif |
| 123 |
| 124 #if !defined(OS_MACOSX) && !defined(OS_CHROMEOS) |
| 125 // Sets up the checked state for the "Continue running background apps..." |
| 126 // checkbox. |
| 127 void SetupBackgroundModeSettings(); |
| 128 |
| 129 // Callback for the "Continue running background apps..." checkbox. |
| 130 void HandleBackgroundModeCheckbox(const ListValue* args); |
| 131 #endif |
| 132 |
| 133 // Setup the checked state for the metrics reporting checkbox. |
| 134 void SetupMetricsReportingCheckbox(); |
| 135 |
| 136 // Setup the visibility for the metrics reporting setting. |
| 137 void SetupMetricsReportingSettingVisibility(); |
| 138 |
| 139 // Setup the font size selector control. |
| 140 void SetupFontSizeSelector(); |
| 141 |
| 142 // Setup the page zoom selector control. |
| 143 void SetupPageZoomSelector(); |
| 144 |
| 145 // Setup the enabled state of the reset button. |
| 146 void SetupAutoOpenFileTypesDisabledAttribute(); |
| 147 |
| 148 // Setup the proxy settings section UI. |
| 149 void SetupProxySettingsSection(); |
| 150 |
| 151 // Setup the checked state for SSL related checkboxes. |
| 152 void SetupSSLConfigSettings(); |
| 153 |
| 154 scoped_refptr<SelectFileDialog> select_folder_dialog_; |
| 155 |
| 156 #if !defined(OS_CHROMEOS) |
| 157 BooleanPrefMember enable_metrics_recording_; |
| 158 StringPrefMember cloud_print_proxy_email_; |
| 159 BooleanPrefMember cloud_print_proxy_enabled_; |
| 160 bool cloud_print_proxy_ui_enabled_; |
| 161 scoped_ptr<CloudPrintSetupHandler> cloud_print_setup_handler_; |
| 162 #endif |
| 163 |
| 164 // SSLConfigService prefs. |
| 165 BooleanPrefMember rev_checking_enabled_; |
| 166 |
| 167 #if !defined(OS_MACOSX) && !defined(OS_CHROMEOS) |
| 168 BooleanPrefMember background_mode_enabled_; |
| 169 #endif |
| 170 |
| 171 StringPrefMember auto_open_files_; |
| 172 IntegerPrefMember default_font_size_; |
| 173 DoublePrefMember default_zoom_level_; |
| 174 |
| 175 #if !defined(OS_CHROMEOS) |
| 176 scoped_ptr<PrefSetObserver> proxy_prefs_; |
| 177 #endif // !defined(OS_CHROMEOS) |
| 178 |
| 179 DISALLOW_COPY_AND_ASSIGN(AdvancedOptionsHandler); |
| 180 }; |
| 181 |
| 182 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS2_ADVANCED_OPTIONS_HANDLER_H_ |
OLD | NEW |