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

Side by Side Diff: chrome/browser/dom_ui/options/advanced_options_handler.cc

Issue 5976010: DOMUI Settings: UTH: Section seperators are wrong if the last section is hidden. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 10 years 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/dom_ui/options/advanced_options_handler.h" 5 #include "chrome/browser/dom_ui/options/advanced_options_handler.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "app/l10n_util.h" 9 #include "app/l10n_util.h"
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 SetupDownloadLocationPath(); 198 SetupDownloadLocationPath();
199 SetupAutoOpenFileTypesDisabledAttribute(); 199 SetupAutoOpenFileTypesDisabledAttribute();
200 SetupProxySettingsSection(); 200 SetupProxySettingsSection();
201 #if defined(OS_WIN) 201 #if defined(OS_WIN)
202 SetupSSLConfigSettings(); 202 SetupSSLConfigSettings();
203 #endif 203 #endif
204 #if !defined(OS_CHROMEOS) 204 #if !defined(OS_CHROMEOS)
205 if (cloud_print_proxy_ui_enabled_) { 205 if (cloud_print_proxy_ui_enabled_) {
206 SetupCloudPrintProxySection(); 206 SetupCloudPrintProxySection();
207 RefreshCloudPrintStatusFromService(); 207 RefreshCloudPrintStatusFromService();
208 } else {
209 RemoveCloudPrintProxySection();
208 } 210 }
209 #endif 211 #endif
210 banner_handler_.reset( 212 banner_handler_.reset(
211 new OptionsManagedBannerHandler(dom_ui_, 213 new OptionsManagedBannerHandler(dom_ui_,
212 ASCIIToUTF16("AdvancedOptions"), 214 ASCIIToUTF16("AdvancedOptions"),
213 OPTIONS_PAGE_ADVANCED)); 215 OPTIONS_PAGE_ADVANCED));
214 } 216 }
215 217
216 DOMMessageHandler* AdvancedOptionsHandler::Attach(DOMUI* dom_ui) { 218 DOMMessageHandler* AdvancedOptionsHandler::Attach(DOMUI* dom_ui) {
217 // Call through to superclass. 219 // Call through to superclass.
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
463 void AdvancedOptionsHandler::RefreshCloudPrintStatusFromService() { 465 void AdvancedOptionsHandler::RefreshCloudPrintStatusFromService() {
464 DCHECK(dom_ui_); 466 DCHECK(dom_ui_);
465 if (cloud_print_proxy_ui_enabled_) 467 if (cloud_print_proxy_ui_enabled_)
466 dom_ui_->GetProfile()->GetCloudPrintProxyService()-> 468 dom_ui_->GetProfile()->GetCloudPrintProxyService()->
467 RefreshStatusFromService(); 469 RefreshStatusFromService();
468 } 470 }
469 471
470 void AdvancedOptionsHandler::SetupCloudPrintProxySection() { 472 void AdvancedOptionsHandler::SetupCloudPrintProxySection() {
471 if (NULL == dom_ui_->GetProfile()->GetCloudPrintProxyService()) { 473 if (NULL == dom_ui_->GetProfile()->GetCloudPrintProxyService()) {
472 cloud_print_proxy_ui_enabled_ = false; 474 cloud_print_proxy_ui_enabled_ = false;
473 dom_ui_->CallJavascriptFunction( 475 RemoveCloudPrintProxySection();
474 L"options.AdvancedOptions.HideCloudPrintProxySection");
475 return; 476 return;
476 } 477 }
477 478
478 std::string email; 479 std::string email;
479 if (dom_ui_->GetProfile()->GetPrefs()->HasPrefPath(prefs::kCloudPrintEmail)) 480 if (dom_ui_->GetProfile()->GetPrefs()->HasPrefPath(prefs::kCloudPrintEmail))
480 email = dom_ui_->GetProfile()->GetPrefs()->GetString( 481 email = dom_ui_->GetProfile()->GetPrefs()->GetString(
481 prefs::kCloudPrintEmail); 482 prefs::kCloudPrintEmail);
482 FundamentalValue disabled(email.empty()); 483 FundamentalValue disabled(email.empty());
483 484
484 string16 label_str; 485 string16 label_str;
485 if (email.empty()) { 486 if (email.empty()) {
486 label_str = l10n_util::GetStringUTF16( 487 label_str = l10n_util::GetStringUTF16(
487 IDS_OPTIONS_CLOUD_PRINT_PROXY_DISABLED_LABEL); 488 IDS_OPTIONS_CLOUD_PRINT_PROXY_DISABLED_LABEL);
488 } else { 489 } else {
489 label_str = l10n_util::GetStringFUTF16( 490 label_str = l10n_util::GetStringFUTF16(
490 IDS_OPTIONS_CLOUD_PRINT_PROXY_ENABLED_LABEL, UTF8ToUTF16(email)); 491 IDS_OPTIONS_CLOUD_PRINT_PROXY_ENABLED_LABEL, UTF8ToUTF16(email));
491 } 492 }
492 StringValue label(label_str); 493 StringValue label(label_str);
493 494
494 dom_ui_->CallJavascriptFunction( 495 dom_ui_->CallJavascriptFunction(
495 L"options.AdvancedOptions.SetupCloudPrintProxySection", 496 L"options.AdvancedOptions.SetupCloudPrintProxySection",
496 disabled, label); 497 disabled, label);
497 } 498 }
499
500 void AdvancedOptionsHandler::RemoveCloudPrintProxySection() {
501 dom_ui_->CallJavascriptFunction(
502 L"options.AdvancedOptions.RemoveCloudPrintProxySection");
503 }
504
498 #endif 505 #endif
499 506
500 void AdvancedOptionsHandler::SetupMetricsReportingCheckbox() { 507 void AdvancedOptionsHandler::SetupMetricsReportingCheckbox() {
501 #if defined(GOOGLE_CHROME_BUILD) && !defined(OS_CHROMEOS) 508 #if defined(GOOGLE_CHROME_BUILD) && !defined(OS_CHROMEOS)
502 FundamentalValue checked(enable_metrics_recording_.GetValue()); 509 FundamentalValue checked(enable_metrics_recording_.GetValue());
503 FundamentalValue disabled(enable_metrics_recording_.IsManaged()); 510 FundamentalValue disabled(enable_metrics_recording_.IsManaged());
504 dom_ui_->CallJavascriptFunction( 511 dom_ui_->CallJavascriptFunction(
505 L"options.AdvancedOptions.SetMetricsReportingCheckboxState", checked, 512 L"options.AdvancedOptions.SetMetricsReportingCheckboxState", checked,
506 disabled); 513 disabled);
507 #endif 514 #endif
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
600 FundamentalValue useSSL3Value(useSSL3Setting); 607 FundamentalValue useSSL3Value(useSSL3Setting);
601 dom_ui_->CallJavascriptFunction( 608 dom_ui_->CallJavascriptFunction(
602 L"options.AdvancedOptions.SetUseSSL3CheckboxState", 609 L"options.AdvancedOptions.SetUseSSL3CheckboxState",
603 useSSL3Value, disabledValue); 610 useSSL3Value, disabledValue);
604 FundamentalValue useTLS1Value(useTLS1Setting); 611 FundamentalValue useTLS1Value(useTLS1Setting);
605 dom_ui_->CallJavascriptFunction( 612 dom_ui_->CallJavascriptFunction(
606 L"options.AdvancedOptions.SetUseTLS1CheckboxState", 613 L"options.AdvancedOptions.SetUseTLS1CheckboxState",
607 useTLS1Value, disabledValue); 614 useTLS1Value, disabledValue);
608 } 615 }
609 #endif 616 #endif
OLDNEW
« no previous file with comments | « chrome/browser/dom_ui/options/advanced_options_handler.h ('k') | chrome/browser/resources/options/advanced_options.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698