Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(437)

Side by Side Diff: chrome/browser/ui/webui/options/advanced_options_handler.cc

Issue 8102019: redesign and reimplement proxy config service and tracker, revise proxy ui on cros (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 #endif 302 #endif
301 } 303 }
302 304
303 void AdvancedOptionsHandler::Observe(int type, 305 void AdvancedOptionsHandler::Observe(int type,
304 const NotificationSource& source, 306 const NotificationSource& source,
305 const NotificationDetails& details) { 307 const NotificationDetails& details) {
306 if (type == chrome::NOTIFICATION_PREF_CHANGED) { 308 if (type == chrome::NOTIFICATION_PREF_CHANGED) {
307 std::string* pref_name = Details<std::string>(details).ptr(); 309 std::string* pref_name = Details<std::string>(details).ptr();
308 if (*pref_name == prefs::kDownloadExtensionsToOpen) { 310 if (*pref_name == prefs::kDownloadExtensionsToOpen) {
309 SetupAutoOpenFileTypesDisabledAttribute(); 311 SetupAutoOpenFileTypesDisabledAttribute();
312 #if !defined(OS_CHROMEOS)
310 } else if (proxy_prefs_->IsObserved(*pref_name)) { 313 } else if (proxy_prefs_->IsObserved(*pref_name)) {
311 SetupProxySettingsSection(); 314 SetupProxySettingsSection();
315 #endif // !defined(OS_CHROMEOS)
312 } else if ((*pref_name == prefs::kCloudPrintEmail) || 316 } else if ((*pref_name == prefs::kCloudPrintEmail) ||
313 (*pref_name == prefs::kCloudPrintProxyEnabled)) { 317 (*pref_name == prefs::kCloudPrintProxyEnabled)) {
314 #if !defined(OS_CHROMEOS) 318 #if !defined(OS_CHROMEOS)
315 if (cloud_print_proxy_ui_enabled_) 319 if (cloud_print_proxy_ui_enabled_)
316 SetupCloudPrintProxySection(); 320 SetupCloudPrintProxySection();
317 #endif 321 #endif
318 } else if (*pref_name == prefs::kWebKitDefaultFontSize) { 322 } else if (*pref_name == prefs::kWebKitDefaultFontSize) {
319 SetupFontSizeLabel(); 323 SetupFontSizeLabel();
320 #if !defined(OS_MACOSX) && !defined(OS_CHROMEOS) 324 #if !defined(OS_MACOSX) && !defined(OS_CHROMEOS)
321 } else if (*pref_name == prefs::kBackgroundModeEnabled) { 325 } else if (*pref_name == prefs::kBackgroundModeEnabled) {
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
539 DownloadManager* manager = 543 DownloadManager* manager =
540 web_ui_->tab_contents()->browser_context()->GetDownloadManager(); 544 web_ui_->tab_contents()->browser_context()->GetDownloadManager();
541 bool disabled = !(manager && 545 bool disabled = !(manager &&
542 DownloadPrefs::FromDownloadManager(manager)->IsAutoOpenUsed()); 546 DownloadPrefs::FromDownloadManager(manager)->IsAutoOpenUsed());
543 base::FundamentalValue value(disabled); 547 base::FundamentalValue value(disabled);
544 web_ui_->CallJavascriptFunction( 548 web_ui_->CallJavascriptFunction(
545 "options.AdvancedOptions.SetAutoOpenFileTypesDisabledAttribute", value); 549 "options.AdvancedOptions.SetAutoOpenFileTypesDisabledAttribute", value);
546 } 550 }
547 551
548 void AdvancedOptionsHandler::SetupProxySettingsSection() { 552 void AdvancedOptionsHandler::SetupProxySettingsSection() {
553 #if defined(OS_CHROMEOS)
Mattias Nissler (ping if slow) 2011/10/19 19:27:36 #if !defined(OS_CHROMEOS) and no return and #else
kuan 2011/10/20 00:41:11 Done.
554 return;
555 #else
549 // Disable the button if proxy settings are managed by a sysadmin or 556 // Disable the button if proxy settings are managed by a sysadmin or
550 // overridden by an extension. 557 // overridden by an extension.
551 PrefService* pref_service = Profile::FromWebUI(web_ui_)->GetPrefs(); 558 PrefService* pref_service = Profile::FromWebUI(web_ui_)->GetPrefs();
552 const PrefService::Preference* proxy_config = 559 const PrefService::Preference* proxy_config =
553 pref_service->FindPreference(prefs::kProxy); 560 pref_service->FindPreference(prefs::kProxy);
554 bool is_extension_controlled = (proxy_config && 561 bool is_extension_controlled = (proxy_config &&
555 proxy_config->IsExtensionControlled()); 562 proxy_config->IsExtensionControlled());
556 563
557 base::FundamentalValue disabled(proxy_prefs_->IsManaged() || 564 base::FundamentalValue disabled(proxy_prefs_->IsManaged() ||
558 is_extension_controlled); 565 is_extension_controlled);
559 566
560 // Get the appropriate info string to describe the button. 567 // Get the appropriate info string to describe the button.
561 string16 label_str; 568 string16 label_str;
562 if (is_extension_controlled) { 569 if (is_extension_controlled) {
563 label_str = l10n_util::GetStringUTF16(IDS_OPTIONS_EXTENSION_PROXIES_LABEL); 570 label_str = l10n_util::GetStringUTF16(IDS_OPTIONS_EXTENSION_PROXIES_LABEL);
564 } else { 571 } else {
565 label_str = l10n_util::GetStringFUTF16(IDS_OPTIONS_SYSTEM_PROXIES_LABEL, 572 label_str = l10n_util::GetStringFUTF16(IDS_OPTIONS_SYSTEM_PROXIES_LABEL,
566 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); 573 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME));
567 } 574 }
568 StringValue label(label_str); 575 StringValue label(label_str);
569 576
570 web_ui_->CallJavascriptFunction( 577 web_ui_->CallJavascriptFunction(
571 "options.AdvancedOptions.SetupProxySettingsSection", disabled, label); 578 "options.AdvancedOptions.SetupProxySettingsSection", disabled, label);
579 #endif // defined(OS_CHROMEOS)
572 } 580 }
573 581
574 void AdvancedOptionsHandler::SetupSSLConfigSettings() { 582 void AdvancedOptionsHandler::SetupSSLConfigSettings() {
575 { 583 {
576 base::FundamentalValue checked(rev_checking_enabled_.GetValue()); 584 base::FundamentalValue checked(rev_checking_enabled_.GetValue());
577 base::FundamentalValue disabled(rev_checking_enabled_.IsManaged()); 585 base::FundamentalValue disabled(rev_checking_enabled_.IsManaged());
578 web_ui_->CallJavascriptFunction( 586 web_ui_->CallJavascriptFunction(
579 "options.AdvancedOptions.SetCheckRevocationCheckboxState", checked, 587 "options.AdvancedOptions.SetCheckRevocationCheckboxState", checked,
580 disabled); 588 disabled);
581 } 589 }
582 } 590 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698