OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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_OPTIONS2_BROWSER_OPTIONS_HANDLER2_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_OPTIONS2_BROWSER_OPTIONS_HANDLER2_H_ |
6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS2_BROWSER_OPTIONS_HANDLER2_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS2_BROWSER_OPTIONS_HANDLER2_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
12 #include "chrome/browser/autocomplete/autocomplete_controller_delegate.h" | 12 #include "chrome/browser/autocomplete/autocomplete_controller_delegate.h" |
13 #include "chrome/browser/prefs/pref_member.h" | 13 #include "chrome/browser/prefs/pref_member.h" |
| 14 #include "chrome/browser/printing/cloud_print/cloud_print_setup_handler.h" |
14 #include "chrome/browser/search_engines/template_url_service_observer.h" | 15 #include "chrome/browser/search_engines/template_url_service_observer.h" |
15 #include "chrome/browser/shell_integration.h" | 16 #include "chrome/browser/shell_integration.h" |
16 #include "chrome/browser/sync/profile_sync_service_observer.h" | 17 #include "chrome/browser/sync/profile_sync_service_observer.h" |
| 18 #include "chrome/browser/ui/select_file_dialog.h" |
17 #include "chrome/browser/ui/webui/options2/options_ui2.h" | 19 #include "chrome/browser/ui/webui/options2/options_ui2.h" |
18 #include "ui/base/models/table_model_observer.h" | 20 #include "ui/base/models/table_model_observer.h" |
19 | 21 |
| 22 #if !defined(OS_CHROMEOS) |
| 23 #include "chrome/browser/prefs/pref_set_observer.h" |
| 24 #endif // !defined(OS_CHROMEOS) |
| 25 |
20 class AutocompleteController; | 26 class AutocompleteController; |
| 27 class CloudPrintSetupHandler; |
21 class CustomHomePagesTableModel; | 28 class CustomHomePagesTableModel; |
22 class TemplateURLService; | 29 class TemplateURLService; |
23 | 30 |
24 namespace options2 { | 31 namespace options2 { |
25 | 32 |
26 // Chrome browser options page UI handler. | 33 // Chrome browser options page UI handler. |
27 class BrowserOptionsHandler | 34 class BrowserOptionsHandler |
28 : public OptionsPageUIHandler, | 35 : public OptionsPageUIHandler, |
| 36 public AutocompleteControllerDelegate, |
| 37 public CloudPrintSetupHandlerDelegate, |
29 public ProfileSyncServiceObserver, | 38 public ProfileSyncServiceObserver, |
30 public AutocompleteControllerDelegate, | 39 public SelectFileDialog::Listener, |
31 public ShellIntegration::DefaultWebClientObserver, | 40 public ShellIntegration::DefaultWebClientObserver, |
32 public TemplateURLServiceObserver { | 41 public TemplateURLServiceObserver { |
33 public: | 42 public: |
34 BrowserOptionsHandler(); | 43 BrowserOptionsHandler(); |
35 virtual ~BrowserOptionsHandler(); | 44 virtual ~BrowserOptionsHandler(); |
36 | 45 |
37 virtual void Initialize() OVERRIDE; | 46 virtual void Initialize() OVERRIDE; |
38 | 47 |
39 // OptionsPageUIHandler implementation. | 48 // OptionsPageUIHandler implementation. |
40 virtual void GetLocalizedValues(DictionaryValue* localized_strings) OVERRIDE; | 49 virtual void GetLocalizedValues(DictionaryValue* localized_strings) OVERRIDE; |
(...skipping 11 matching lines...) Expand all Loading... |
52 | 61 |
53 // TemplateURLServiceObserver implementation. | 62 // TemplateURLServiceObserver implementation. |
54 virtual void OnTemplateURLServiceChanged() OVERRIDE; | 63 virtual void OnTemplateURLServiceChanged() OVERRIDE; |
55 | 64 |
56 private: | 65 private: |
57 // content::NotificationObserver implementation. | 66 // content::NotificationObserver implementation. |
58 virtual void Observe(int type, | 67 virtual void Observe(int type, |
59 const content::NotificationSource& source, | 68 const content::NotificationSource& source, |
60 const content::NotificationDetails& details) OVERRIDE; | 69 const content::NotificationDetails& details) OVERRIDE; |
61 | 70 |
| 71 // SelectFileDialog::Listener implementation |
| 72 virtual void FileSelected(const FilePath& path, |
| 73 int index, |
| 74 void* params) OVERRIDE; |
| 75 |
| 76 // CloudPrintSetupHandler::Delegate implementation. |
| 77 virtual void OnCloudPrintSetupClosed() OVERRIDE; |
| 78 |
62 // Makes this the default browser. Called from WebUI. | 79 // Makes this the default browser. Called from WebUI. |
63 void BecomeDefaultBrowser(const base::ListValue* args); | 80 void BecomeDefaultBrowser(const base::ListValue* args); |
64 | 81 |
65 // Sets the search engine at the given index to be default. Called from WebUI. | 82 // Sets the search engine at the given index to be default. Called from WebUI. |
66 void SetDefaultSearchEngine(const base::ListValue* args); | 83 void SetDefaultSearchEngine(const base::ListValue* args); |
67 | 84 |
68 // Gets autocomplete suggestions asynchronously for the given string. | 85 // Gets autocomplete suggestions asynchronously for the given string. |
69 // Called from WebUI. | 86 // Called from WebUI. |
70 void RequestAutocompleteSuggestions(const base::ListValue* args); | 87 void RequestAutocompleteSuggestions(const base::ListValue* args); |
71 | 88 |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 #if defined(OS_CHROMEOS) | 146 #if defined(OS_CHROMEOS) |
130 // Called when the System configuration screen is used to adjust | 147 // Called when the System configuration screen is used to adjust |
131 // the screen brightness. | 148 // the screen brightness. |
132 // |args| will be an empty list. | 149 // |args| will be an empty list. |
133 void DecreaseScreenBrightnessCallback(const base::ListValue* args); | 150 void DecreaseScreenBrightnessCallback(const base::ListValue* args); |
134 void IncreaseScreenBrightnessCallback(const base::ListValue* args); | 151 void IncreaseScreenBrightnessCallback(const base::ListValue* args); |
135 | 152 |
136 void UpdateAccountPicture(); | 153 void UpdateAccountPicture(); |
137 #endif | 154 #endif |
138 | 155 |
| 156 // Callback for the "selectDownloadLocation" message. This will prompt the |
| 157 // user for a destination folder using platform-specific APIs. |
| 158 void HandleSelectDownloadLocation(const ListValue* args); |
| 159 |
| 160 // Callback for the "autoOpenFileTypesResetToDefault" message. This will |
| 161 // remove all auto-open file-type settings. |
| 162 void HandleAutoOpenButton(const ListValue* args); |
| 163 |
| 164 // Callback for the "metricsReportingCheckboxAction" message. This is called |
| 165 // if the user toggles the metrics reporting checkbox. |
| 166 void HandleMetricsReportingCheckbox(const ListValue* args); |
| 167 |
| 168 // Callback for the "defaultFontSizeAction" message. This is called if the |
| 169 // user changes the default font size. |args| is an array that contains |
| 170 // one item, the font size as a numeric value. |
| 171 void HandleDefaultFontSize(const ListValue* args); |
| 172 |
| 173 // Callback for the "defaultZoomFactorAction" message. This is called if the |
| 174 // user changes the default zoom factor. |args| is an array that contains |
| 175 // one item, the zoom factor as a numeric value. |
| 176 void HandleDefaultZoomFactor(const ListValue* args); |
| 177 |
| 178 // Callback for the "Check for server certificate revocation" checkbox. This |
| 179 // is called if the user toggles the "Check for server certificate revocation" |
| 180 // checkbox. |
| 181 void HandleCheckRevocationCheckbox(const ListValue* args); |
| 182 |
| 183 // Callback for the "Use SSL 3.0" checkbox. This is called if the user toggles |
| 184 // the "Use SSL 3.0" checkbox. |
| 185 void HandleUseSSL3Checkbox(const ListValue* args); |
| 186 |
| 187 // Callback for the "Use TLS 1.0" checkbox. This is called if the user toggles |
| 188 // the "Use TLS 1.0" checkbox. |
| 189 void HandleUseTLS1Checkbox(const ListValue* args); |
| 190 |
| 191 #if !defined(OS_CHROMEOS) |
| 192 // Callback for the "showNetworkProxySettings" message. This will invoke |
| 193 // an appropriate dialog for configuring proxy settings. |
| 194 void ShowNetworkProxySettings(const ListValue* args); |
| 195 #endif |
| 196 |
| 197 #if !defined(USE_NSS) |
| 198 // Callback for the "showManageSSLCertificates" message. This will invoke |
| 199 // an appropriate certificate management action based on the platform. |
| 200 void ShowManageSSLCertificates(const ListValue* args); |
| 201 #endif |
| 202 |
| 203 // Callback for the Cloud Print manage button. This will open a new |
| 204 // tab pointed at the management URL. |
| 205 void ShowCloudPrintManagePage(const ListValue* args); |
| 206 |
| 207 // Register localized strings used by Cloud Print |
| 208 void RegisterCloudPrintStrings(DictionaryValue* localized_strings); |
| 209 |
| 210 #if !defined(OS_CHROMEOS) |
| 211 // Callback for the Sign in to Cloud Print button. This will start |
| 212 // the authentication process. |
| 213 void ShowCloudPrintSetupDialog(const ListValue* args); |
| 214 |
| 215 // Callback for the Disable Cloud Print button. This will sign out |
| 216 // of cloud print. |
| 217 void HandleDisableCloudPrintConnector(const ListValue* args); |
| 218 |
| 219 // Pings the service to send us it's current notion of the enabled state. |
| 220 void RefreshCloudPrintStatusFromService(); |
| 221 |
| 222 // Setup the enabled or disabled state of the cloud print connector |
| 223 // management UI. |
| 224 void SetupCloudPrintConnectorSection(); |
| 225 |
| 226 // Remove cloud print connector section if cloud print connector management |
| 227 // UI is disabled. |
| 228 void RemoveCloudPrintConnectorSection(); |
| 229 #endif |
| 230 |
| 231 #if defined(OS_CHROMEOS) |
| 232 // Called when the accessibility checkbox values are changed. |
| 233 // |args| will contain the checkbox checked state as a string |
| 234 // ("true" or "false"). |
| 235 void SpokenFeedbackChangeCallback(const base::ListValue* args); |
| 236 void HighContrastChangeCallback(const base::ListValue* args); |
| 237 void ScreenMagnifierChangeCallback(const base::ListValue* args); |
| 238 void VirtualKeyboardChangeCallback(const base::ListValue* args); |
| 239 #endif |
| 240 |
| 241 #if !defined(OS_MACOSX) && !defined(OS_CHROMEOS) |
| 242 // Sets up the checked state for the "Continue running background apps..." |
| 243 // checkbox. |
| 244 void SetupBackgroundModeSettings(); |
| 245 |
| 246 // Callback for the "Continue running background apps..." checkbox. |
| 247 void HandleBackgroundModeCheckbox(const ListValue* args); |
| 248 #endif |
| 249 |
| 250 // Setup the checked state for the metrics reporting checkbox. |
| 251 void SetupMetricsReportingCheckbox(); |
| 252 |
| 253 // Setup the visibility for the metrics reporting setting. |
| 254 void SetupMetricsReportingSettingVisibility(); |
| 255 |
| 256 // Setup the font size selector control. |
| 257 void SetupFontSizeSelector(); |
| 258 |
| 259 // Setup the page zoom selector control. |
| 260 void SetupPageZoomSelector(); |
| 261 |
| 262 // Setup the enabled state of the reset button. |
| 263 void SetupAutoOpenFileTypesDisabledAttribute(); |
| 264 |
| 265 // Setup the proxy settings section UI. |
| 266 void SetupProxySettingsSection(); |
| 267 |
| 268 // Setup the checked state for SSL related checkboxes. |
| 269 void SetupSSLConfigSettings(); |
| 270 |
| 271 #if defined(OS_CHROMEOS) |
| 272 // Setup the accessibility features for ChromeOS. |
| 273 void SetupAccessibilityFeatures(); |
| 274 #endif |
| 275 |
139 // Returns a newly created dictionary with a number of properties that | 276 // Returns a newly created dictionary with a number of properties that |
140 // correspond to the status of sync. | 277 // correspond to the status of sync. |
141 DictionaryValue* GetSyncStateDictionary(); | 278 DictionaryValue* GetSyncStateDictionary(); |
142 | 279 |
143 scoped_refptr<ShellIntegration::DefaultBrowserWorker> default_browser_worker_; | 280 scoped_refptr<ShellIntegration::DefaultBrowserWorker> default_browser_worker_; |
144 | 281 |
145 StringPrefMember homepage_; | 282 StringPrefMember homepage_; |
146 BooleanPrefMember default_browser_policy_; | 283 BooleanPrefMember default_browser_policy_; |
147 | 284 |
148 TemplateURLService* template_url_service_; // Weak. | 285 TemplateURLService* template_url_service_; // Weak. |
149 | 286 |
150 scoped_ptr<AutocompleteController> autocomplete_controller_; | 287 scoped_ptr<AutocompleteController> autocomplete_controller_; |
151 | 288 |
152 // Used to get |weak_ptr_| to self for use on the File thread. | 289 // Used to get |weak_ptr_| to self for use on the File thread. |
153 base::WeakPtrFactory<BrowserOptionsHandler> weak_ptr_factory_for_file_; | 290 base::WeakPtrFactory<BrowserOptionsHandler> weak_ptr_factory_for_file_; |
154 // Used to post update tasks to the UI thread. | 291 // Used to post update tasks to the UI thread. |
155 base::WeakPtrFactory<BrowserOptionsHandler> weak_ptr_factory_for_ui_; | 292 base::WeakPtrFactory<BrowserOptionsHandler> weak_ptr_factory_for_ui_; |
156 | 293 |
157 // True if the multiprofiles switch is enabled. | 294 // True if the multiprofiles switch is enabled. |
158 bool multiprofile_; | 295 bool multiprofile_; |
159 | 296 |
| 297 scoped_refptr<SelectFileDialog> select_folder_dialog_; |
| 298 |
| 299 #if !defined(OS_CHROMEOS) |
| 300 BooleanPrefMember enable_metrics_recording_; |
| 301 StringPrefMember cloud_print_connector_email_; |
| 302 BooleanPrefMember cloud_print_connector_enabled_; |
| 303 bool cloud_print_connector_ui_enabled_; |
| 304 scoped_ptr<CloudPrintSetupHandler> cloud_print_setup_handler_; |
| 305 #endif |
| 306 |
| 307 // SSLConfigService prefs. |
| 308 BooleanPrefMember rev_checking_enabled_; |
| 309 |
| 310 #if !defined(OS_MACOSX) && !defined(OS_CHROMEOS) |
| 311 BooleanPrefMember background_mode_enabled_; |
| 312 #endif |
| 313 |
| 314 StringPrefMember auto_open_files_; |
| 315 IntegerPrefMember default_font_size_; |
| 316 DoublePrefMember default_zoom_level_; |
| 317 |
| 318 #if !defined(OS_CHROMEOS) |
| 319 scoped_ptr<PrefSetObserver> proxy_prefs_; |
| 320 #endif // !defined(OS_CHROMEOS) |
| 321 |
160 DISALLOW_COPY_AND_ASSIGN(BrowserOptionsHandler); | 322 DISALLOW_COPY_AND_ASSIGN(BrowserOptionsHandler); |
161 }; | 323 }; |
162 | 324 |
163 } // namespace options2 | 325 } // namespace options2 |
164 | 326 |
165 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS2_BROWSER_OPTIONS_HANDLER2_H_ | 327 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS2_BROWSER_OPTIONS_HANDLER2_H_ |
OLD | NEW |