OLD | NEW |
| (Empty) |
1 // Copyright (c) 2012 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_OPTIONS_ADVANCED_OPTIONS_HANDLER_H_ | |
6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_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/options/options_ui.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 OptionsPageUIHandler, | |
23 public SelectFileDialog::Listener, | |
24 public CloudPrintSetupHandlerDelegate { | |
25 public: | |
26 AdvancedOptionsHandler(); | |
27 virtual ~AdvancedOptionsHandler(); | |
28 | |
29 // OptionsPageUIHandler implementation. | |
30 virtual void GetLocalizedValues(DictionaryValue* localized_strings) OVERRIDE; | |
31 virtual void InitializeHandler() OVERRIDE; | |
32 | |
33 // WebUIMessageHandler implementation. | |
34 virtual void RegisterMessages() OVERRIDE; | |
35 | |
36 // content::NotificationObserver implementation. | |
37 virtual void Observe(int type, | |
38 const content::NotificationSource& source, | |
39 const content::NotificationDetails& details) OVERRIDE; | |
40 | |
41 // SelectFileDialog::Listener implementation | |
42 virtual void FileSelected(const FilePath& path, | |
43 int index, | |
44 void* params) OVERRIDE; | |
45 | |
46 // CloudPrintSetupHandler::Delegate implementation. | |
47 virtual void OnCloudPrintSetupClosed() OVERRIDE; | |
48 | |
49 private: | |
50 // Callback for the "selectDownloadLocation" message. This will prompt the | |
51 // user for a destination folder using platform-specific APIs. | |
52 void HandleSelectDownloadLocation(const ListValue* args); | |
53 | |
54 // Callback for the "autoOpenFileTypesResetToDefault" message. This will | |
55 // remove all auto-open file-type settings. | |
56 void HandleAutoOpenButton(const ListValue* args); | |
57 | |
58 // Callback for the "metricsReportingCheckboxAction" message. This is called | |
59 // if the user toggles the metrics reporting checkbox. | |
60 void HandleMetricsReportingCheckbox(const ListValue* args); | |
61 | |
62 // Callback for the "defaultFontSizeAction" message. This is called if the | |
63 // user changes the default font size. |args| is an array that contains | |
64 // one item, the font size as a numeric value. | |
65 void HandleDefaultFontSize(const ListValue* args); | |
66 | |
67 // Callback for the "defaultZoomFactorAction" message. This is called if the | |
68 // user changes the default zoom factor. |args| is an array that contains | |
69 // one item, the zoom factor as a numeric value. | |
70 void HandleDefaultZoomFactor(const ListValue* args); | |
71 | |
72 // Callback for the "Check for server certificate revocation" checkbox. This | |
73 // is called if the user toggles the "Check for server certificate revocation" | |
74 // checkbox. | |
75 void HandleCheckRevocationCheckbox(const ListValue* args); | |
76 | |
77 // Callback for the "Use SSL 3.0" checkbox. This is called if the user toggles | |
78 // the "Use SSL 3.0" checkbox. | |
79 void HandleUseSSL3Checkbox(const ListValue* args); | |
80 | |
81 // Callback for the "Use TLS 1.0" checkbox. This is called if the user toggles | |
82 // the "Use TLS 1.0" checkbox. | |
83 void HandleUseTLS1Checkbox(const ListValue* args); | |
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 // Callback for the Cloud Print manage button. This will open a new | |
98 // tab pointed at the management URL. | |
99 void ShowCloudPrintManagePage(const ListValue* args); | |
100 | |
101 // Register localized strings used by Cloud Print | |
102 void RegisterCloudPrintStrings(DictionaryValue* localized_strings); | |
103 | |
104 #if !defined(OS_CHROMEOS) | |
105 // Callback for the Sign in to Cloud Print button. This will start | |
106 // the authentication process. | |
107 void ShowCloudPrintSetupDialog(const ListValue* args); | |
108 | |
109 // Callback for the Disable Cloud Print button. This will sign out | |
110 // of cloud print. | |
111 void HandleDisableCloudPrintConnector(const ListValue* args); | |
112 | |
113 // Pings the service to send us it's current notion of the enabled state. | |
114 void RefreshCloudPrintStatusFromService(); | |
115 | |
116 // Setup the enabled or disabled state of the cloud print connector | |
117 // management UI. | |
118 void SetupCloudPrintConnectorSection(); | |
119 | |
120 // Remove cloud print connector section if cloud print connector management | |
121 // UI is disabled. | |
122 void RemoveCloudPrintConnectorSection(); | |
123 #endif | |
124 | |
125 #if !defined(OS_MACOSX) && !defined(OS_CHROMEOS) | |
126 // Sets up the checked state for the "Continue running background apps..." | |
127 // checkbox. | |
128 void SetupBackgroundModeSettings(); | |
129 | |
130 // Callback for the "Continue running background apps..." checkbox. | |
131 void HandleBackgroundModeCheckbox(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 // Setup the font size selector control. | |
141 void SetupFontSizeSelector(); | |
142 | |
143 // Setup the page zoom selector control. | |
144 void SetupPageZoomSelector(); | |
145 | |
146 // Setup the enabled state of the reset button. | |
147 void SetupAutoOpenFileTypesDisabledAttribute(); | |
148 | |
149 // Setup the proxy settings section UI. | |
150 void SetupProxySettingsSection(); | |
151 | |
152 // Setup the checked state for SSL related checkboxes. | |
153 void SetupSSLConfigSettings(); | |
154 | |
155 scoped_refptr<SelectFileDialog> select_folder_dialog_; | |
156 | |
157 #if !defined(OS_CHROMEOS) | |
158 BooleanPrefMember enable_metrics_recording_; | |
159 StringPrefMember cloud_print_connector_email_; | |
160 BooleanPrefMember cloud_print_connector_enabled_; | |
161 bool cloud_print_connector_ui_enabled_; | |
162 scoped_ptr<CloudPrintSetupHandler> cloud_print_setup_handler_; | |
163 #endif | |
164 | |
165 // SSLConfigService prefs. | |
166 BooleanPrefMember rev_checking_enabled_; | |
167 | |
168 #if !defined(OS_MACOSX) && !defined(OS_CHROMEOS) | |
169 BooleanPrefMember background_mode_enabled_; | |
170 #endif | |
171 | |
172 StringPrefMember auto_open_files_; | |
173 IntegerPrefMember default_font_size_; | |
174 DoublePrefMember default_zoom_level_; | |
175 | |
176 #if !defined(OS_CHROMEOS) | |
177 scoped_ptr<PrefSetObserver> proxy_prefs_; | |
178 #endif // !defined(OS_CHROMEOS) | |
179 | |
180 DISALLOW_COPY_AND_ASSIGN(AdvancedOptionsHandler); | |
181 }; | |
182 | |
183 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_ADVANCED_OPTIONS_HANDLER_H_ | |
OLD | NEW |