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 #include "chrome/browser/ui/webui/options/advanced_options_handler.h" | 5 #include "chrome/browser/ui/webui/options/advanced_options_handler.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 g_browser_process->local_state(), this); | 238 g_browser_process->local_state(), this); |
239 | 239 |
240 #if !defined(OS_MACOSX) && !defined(OS_CHROMEOS) | 240 #if !defined(OS_MACOSX) && !defined(OS_CHROMEOS) |
241 background_mode_enabled_.Init(prefs::kBackgroundModeEnabled, | 241 background_mode_enabled_.Init(prefs::kBackgroundModeEnabled, |
242 g_browser_process->local_state(), | 242 g_browser_process->local_state(), |
243 this); | 243 this); |
244 #endif | 244 #endif |
245 | 245 |
246 auto_open_files_.Init(prefs::kDownloadExtensionsToOpen, prefs, this); | 246 auto_open_files_.Init(prefs::kDownloadExtensionsToOpen, prefs, this); |
247 default_font_size_.Init(prefs::kWebKitDefaultFontSize, prefs, this); | 247 default_font_size_.Init(prefs::kWebKitDefaultFontSize, prefs, this); |
| 248 #if !defined(OS_CHROMEOS) |
248 proxy_prefs_.reset( | 249 proxy_prefs_.reset( |
249 PrefSetObserver::CreateProxyPrefSetObserver(prefs, this)); | 250 PrefSetObserver::CreateProxyPrefSetObserver(prefs, this)); |
| 251 #endif // !defined(OS_CHROMEOS) |
250 | 252 |
251 // Return result from the superclass. | 253 // Return result from the superclass. |
252 return handler; | 254 return handler; |
253 } | 255 } |
254 | 256 |
255 void AdvancedOptionsHandler::RegisterMessages() { | 257 void AdvancedOptionsHandler::RegisterMessages() { |
256 // Setup handlers specific to this panel. | 258 // Setup handlers specific to this panel. |
257 DCHECK(web_ui_); | 259 DCHECK(web_ui_); |
258 web_ui_->RegisterMessageCallback("selectDownloadLocation", | 260 web_ui_->RegisterMessageCallback("selectDownloadLocation", |
259 base::Bind(&AdvancedOptionsHandler::HandleSelectDownloadLocation, | 261 base::Bind(&AdvancedOptionsHandler::HandleSelectDownloadLocation, |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 } | 303 } |
302 | 304 |
303 void AdvancedOptionsHandler::Observe( | 305 void AdvancedOptionsHandler::Observe( |
304 int type, | 306 int type, |
305 const content::NotificationSource& source, | 307 const content::NotificationSource& source, |
306 const content::NotificationDetails& details) { | 308 const content::NotificationDetails& details) { |
307 if (type == chrome::NOTIFICATION_PREF_CHANGED) { | 309 if (type == chrome::NOTIFICATION_PREF_CHANGED) { |
308 std::string* pref_name = content::Details<std::string>(details).ptr(); | 310 std::string* pref_name = content::Details<std::string>(details).ptr(); |
309 if (*pref_name == prefs::kDownloadExtensionsToOpen) { | 311 if (*pref_name == prefs::kDownloadExtensionsToOpen) { |
310 SetupAutoOpenFileTypesDisabledAttribute(); | 312 SetupAutoOpenFileTypesDisabledAttribute(); |
| 313 #if !defined(OS_CHROMEOS) |
311 } else if (proxy_prefs_->IsObserved(*pref_name)) { | 314 } else if (proxy_prefs_->IsObserved(*pref_name)) { |
312 SetupProxySettingsSection(); | 315 SetupProxySettingsSection(); |
| 316 #endif // !defined(OS_CHROMEOS) |
313 } else if ((*pref_name == prefs::kCloudPrintEmail) || | 317 } else if ((*pref_name == prefs::kCloudPrintEmail) || |
314 (*pref_name == prefs::kCloudPrintProxyEnabled)) { | 318 (*pref_name == prefs::kCloudPrintProxyEnabled)) { |
315 #if !defined(OS_CHROMEOS) | 319 #if !defined(OS_CHROMEOS) |
316 if (cloud_print_proxy_ui_enabled_) | 320 if (cloud_print_proxy_ui_enabled_) |
317 SetupCloudPrintProxySection(); | 321 SetupCloudPrintProxySection(); |
318 #endif | 322 #endif |
319 } else if (*pref_name == prefs::kWebKitDefaultFontSize) { | 323 } else if (*pref_name == prefs::kWebKitDefaultFontSize) { |
320 SetupFontSizeLabel(); | 324 SetupFontSizeLabel(); |
321 #if !defined(OS_MACOSX) && !defined(OS_CHROMEOS) | 325 #if !defined(OS_MACOSX) && !defined(OS_CHROMEOS) |
322 } else if (*pref_name == prefs::kBackgroundModeEnabled) { | 326 } else if (*pref_name == prefs::kBackgroundModeEnabled) { |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
540 DownloadManager* manager = | 544 DownloadManager* manager = |
541 web_ui_->tab_contents()->browser_context()->GetDownloadManager(); | 545 web_ui_->tab_contents()->browser_context()->GetDownloadManager(); |
542 bool disabled = !(manager && | 546 bool disabled = !(manager && |
543 DownloadPrefs::FromDownloadManager(manager)->IsAutoOpenUsed()); | 547 DownloadPrefs::FromDownloadManager(manager)->IsAutoOpenUsed()); |
544 base::FundamentalValue value(disabled); | 548 base::FundamentalValue value(disabled); |
545 web_ui_->CallJavascriptFunction( | 549 web_ui_->CallJavascriptFunction( |
546 "options.AdvancedOptions.SetAutoOpenFileTypesDisabledAttribute", value); | 550 "options.AdvancedOptions.SetAutoOpenFileTypesDisabledAttribute", value); |
547 } | 551 } |
548 | 552 |
549 void AdvancedOptionsHandler::SetupProxySettingsSection() { | 553 void AdvancedOptionsHandler::SetupProxySettingsSection() { |
| 554 #if !defined(OS_CHROMEOS) |
550 // Disable the button if proxy settings are managed by a sysadmin or | 555 // Disable the button if proxy settings are managed by a sysadmin or |
551 // overridden by an extension. | 556 // overridden by an extension. |
552 PrefService* pref_service = Profile::FromWebUI(web_ui_)->GetPrefs(); | 557 PrefService* pref_service = Profile::FromWebUI(web_ui_)->GetPrefs(); |
553 const PrefService::Preference* proxy_config = | 558 const PrefService::Preference* proxy_config = |
554 pref_service->FindPreference(prefs::kProxy); | 559 pref_service->FindPreference(prefs::kProxy); |
555 bool is_extension_controlled = (proxy_config && | 560 bool is_extension_controlled = (proxy_config && |
556 proxy_config->IsExtensionControlled()); | 561 proxy_config->IsExtensionControlled()); |
557 | 562 |
558 base::FundamentalValue disabled(proxy_prefs_->IsManaged() || | 563 base::FundamentalValue disabled(proxy_prefs_->IsManaged() || |
559 is_extension_controlled); | 564 is_extension_controlled); |
560 | 565 |
561 // Get the appropriate info string to describe the button. | 566 // Get the appropriate info string to describe the button. |
562 string16 label_str; | 567 string16 label_str; |
563 if (is_extension_controlled) { | 568 if (is_extension_controlled) { |
564 label_str = l10n_util::GetStringUTF16(IDS_OPTIONS_EXTENSION_PROXIES_LABEL); | 569 label_str = l10n_util::GetStringUTF16(IDS_OPTIONS_EXTENSION_PROXIES_LABEL); |
565 } else { | 570 } else { |
566 label_str = l10n_util::GetStringFUTF16(IDS_OPTIONS_SYSTEM_PROXIES_LABEL, | 571 label_str = l10n_util::GetStringFUTF16(IDS_OPTIONS_SYSTEM_PROXIES_LABEL, |
567 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); | 572 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); |
568 } | 573 } |
569 StringValue label(label_str); | 574 StringValue label(label_str); |
570 | 575 |
571 web_ui_->CallJavascriptFunction( | 576 web_ui_->CallJavascriptFunction( |
572 "options.AdvancedOptions.SetupProxySettingsSection", disabled, label); | 577 "options.AdvancedOptions.SetupProxySettingsSection", disabled, label); |
| 578 #endif // !defined(OS_CHROMEOS) |
573 } | 579 } |
574 | 580 |
575 void AdvancedOptionsHandler::SetupSSLConfigSettings() { | 581 void AdvancedOptionsHandler::SetupSSLConfigSettings() { |
576 { | 582 { |
577 base::FundamentalValue checked(rev_checking_enabled_.GetValue()); | 583 base::FundamentalValue checked(rev_checking_enabled_.GetValue()); |
578 base::FundamentalValue disabled(rev_checking_enabled_.IsManaged()); | 584 base::FundamentalValue disabled(rev_checking_enabled_.IsManaged()); |
579 web_ui_->CallJavascriptFunction( | 585 web_ui_->CallJavascriptFunction( |
580 "options.AdvancedOptions.SetCheckRevocationCheckboxState", checked, | 586 "options.AdvancedOptions.SetCheckRevocationCheckboxState", checked, |
581 disabled); | 587 disabled); |
582 } | 588 } |
583 } | 589 } |
OLD | NEW |