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

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

Issue 6490016: DOM UI options handler cleanup: (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove colon DCHECK Created 9 years, 10 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/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 "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 #endif 50 #endif
51 51
52 AdvancedOptionsHandler::AdvancedOptionsHandler() { 52 AdvancedOptionsHandler::AdvancedOptionsHandler() {
53 #if defined(GOOGLE_CHROME_BUILD) && defined(OS_WIN) 53 #if defined(GOOGLE_CHROME_BUILD) && defined(OS_WIN)
54 cloud_print_proxy_ui_enabled_ = true; 54 cloud_print_proxy_ui_enabled_ = true;
55 #elif !defined(OS_CHROMEOS) 55 #elif !defined(OS_CHROMEOS)
56 cloud_print_proxy_ui_enabled_ = 56 cloud_print_proxy_ui_enabled_ =
57 CommandLine::ForCurrentProcess()->HasSwitch( 57 CommandLine::ForCurrentProcess()->HasSwitch(
58 switches::kEnableCloudPrintProxy); 58 switches::kEnableCloudPrintProxy);
59 #endif 59 #endif
60 cloud_print_proxy_ui_enabled_ = true;
60 } 61 }
61 62
62 AdvancedOptionsHandler::~AdvancedOptionsHandler() { 63 AdvancedOptionsHandler::~AdvancedOptionsHandler() {
63 } 64 }
64 65
65 void AdvancedOptionsHandler::GetLocalizedValues( 66 void AdvancedOptionsHandler::GetLocalizedValues(
66 DictionaryValue* localized_strings) { 67 DictionaryValue* localized_strings) {
67 DCHECK(localized_strings); 68 DCHECK(localized_strings);
68 69
69 OptionsStringResource resources[] = { 70 static OptionsStringResource resources[] = {
70 { "downloadLocationGroupName", 71 { "downloadLocationGroupName",
71 IDS_OPTIONS_DOWNLOADLOCATION_GROUP_NAME }, 72 IDS_OPTIONS_DOWNLOADLOCATION_GROUP_NAME },
72 { "downloadLocationChangeButton", 73 { "downloadLocationChangeButton",
73 IDS_OPTIONS_DOWNLOADLOCATION_CHANGE_BUTTON }, 74 IDS_OPTIONS_DOWNLOADLOCATION_CHANGE_BUTTON },
74 { "downloadLocationBrowseTitle", 75 { "downloadLocationBrowseTitle",
75 IDS_OPTIONS_DOWNLOADLOCATION_BROWSE_TITLE }, 76 IDS_OPTIONS_DOWNLOADLOCATION_BROWSE_TITLE },
76 { "downloadLocationBrowseWindowTitle", 77 { "downloadLocationBrowseWindowTitle",
77 IDS_OPTIONS_DOWNLOADLOCATION_BROWSE_WINDOW_TITLE }, 78 IDS_OPTIONS_DOWNLOADLOCATION_BROWSE_WINDOW_TITLE },
78 { "downloadLocationAskForSaveLocation", 79 { "downloadLocationAskForSaveLocation",
79 IDS_OPTIONS_DOWNLOADLOCATION_ASKFORSAVELOCATION }, 80 IDS_OPTIONS_DOWNLOADLOCATION_ASKFORSAVELOCATION },
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 IDS_OPTIONS_FONT_SIZE_LABEL_MEDIUM }, 128 IDS_OPTIONS_FONT_SIZE_LABEL_MEDIUM },
128 { "fontSizeLabelLarge", 129 { "fontSizeLabelLarge",
129 IDS_OPTIONS_FONT_SIZE_LABEL_LARGE }, 130 IDS_OPTIONS_FONT_SIZE_LABEL_LARGE },
130 { "fontSizeLabelVeryLarge", 131 { "fontSizeLabelVeryLarge",
131 IDS_OPTIONS_FONT_SIZE_LABEL_VERY_LARGE }, 132 IDS_OPTIONS_FONT_SIZE_LABEL_VERY_LARGE },
132 { "fontSizeLabelCustom", 133 { "fontSizeLabelCustom",
133 IDS_OPTIONS_FONT_SIZE_LABEL_CUSTOM }, 134 IDS_OPTIONS_FONT_SIZE_LABEL_CUSTOM },
134 { "fontSettingsCustomizeFontsButton", 135 { "fontSettingsCustomizeFontsButton",
135 IDS_OPTIONS_FONTSETTINGS_CUSTOMIZE_FONTS_BUTTON }, 136 IDS_OPTIONS_FONTSETTINGS_CUSTOMIZE_FONTS_BUTTON },
136 { "languageAndSpellCheckSettingsButton", 137 { "languageAndSpellCheckSettingsButton",
137 IDS_OPTIONS_LANGUAGE_AND_SPELLCHECK_BUTTON, true }, 138 IDS_OPTIONS_LANGUAGE_AND_SPELLCHECK_BUTTON },
138 { "advancedSectionTitlePrivacy", 139 { "advancedSectionTitlePrivacy",
139 IDS_OPTIONS_ADVANCED_SECTION_TITLE_PRIVACY, true }, 140 IDS_OPTIONS_ADVANCED_SECTION_TITLE_PRIVACY },
140 { "advancedSectionTitleContent", 141 { "advancedSectionTitleContent",
141 IDS_OPTIONS_ADVANCED_SECTION_TITLE_CONTENT, true }, 142 IDS_OPTIONS_ADVANCED_SECTION_TITLE_CONTENT },
142 { "advancedSectionTitleSecurity", 143 { "advancedSectionTitleSecurity",
143 IDS_OPTIONS_ADVANCED_SECTION_TITLE_SECURITY, true }, 144 IDS_OPTIONS_ADVANCED_SECTION_TITLE_SECURITY },
144 { "advancedSectionTitleNetwork", 145 { "advancedSectionTitleNetwork",
145 IDS_OPTIONS_ADVANCED_SECTION_TITLE_NETWORK, true }, 146 IDS_OPTIONS_ADVANCED_SECTION_TITLE_NETWORK },
146 { "advancedSectionTitleTranslate", 147 { "advancedSectionTitleTranslate",
147 IDS_OPTIONS_ADVANCED_SECTION_TITLE_TRANSLATE, true }, 148 IDS_OPTIONS_ADVANCED_SECTION_TITLE_TRANSLATE },
148 { "translateEnableTranslate", 149 { "translateEnableTranslate",
149 IDS_OPTIONS_TRANSLATE_ENABLE_TRANSLATE }, 150 IDS_OPTIONS_TRANSLATE_ENABLE_TRANSLATE },
150 { "enableLogging", 151 { "enableLogging",
151 IDS_OPTIONS_ENABLE_LOGGING }, 152 IDS_OPTIONS_ENABLE_LOGGING },
152 { "improveBrowsingExperience", 153 { "improveBrowsingExperience",
153 IDS_OPTIONS_IMPROVE_BROWSING_EXPERIENCE }, 154 IDS_OPTIONS_IMPROVE_BROWSING_EXPERIENCE },
154 { "disableWebServices", 155 { "disableWebServices",
155 IDS_OPTIONS_DISABLE_WEB_SERVICES }, 156 IDS_OPTIONS_DISABLE_WEB_SERVICES },
156 #if !defined(OS_CHROMEOS) 157 #if !defined(OS_CHROMEOS)
157 { "advancedSectionTitleCloudPrint", 158 { "advancedSectionTitleCloudPrint",
(...skipping 22 matching lines...) Expand all
180 RegisterStrings(localized_strings, resources, arraysize(resources)); 181 RegisterStrings(localized_strings, resources, arraysize(resources));
181 RegisterTitle(localized_strings, "advancedPage", 182 RegisterTitle(localized_strings, "advancedPage",
182 IDS_OPTIONS_ADVANCED_TAB_LABEL); 183 IDS_OPTIONS_ADVANCED_TAB_LABEL);
183 184
184 localized_strings->SetString("privacyLearnMoreURL", 185 localized_strings->SetString("privacyLearnMoreURL",
185 google_util::AppendGoogleLocaleParam( 186 google_util::AppendGoogleLocaleParam(
186 GURL(chrome::kPrivacyLearnMoreURL)).spec()); 187 GURL(chrome::kPrivacyLearnMoreURL)).spec());
187 #if !defined(OS_CHROMEOS) 188 #if !defined(OS_CHROMEOS)
188 // Add the cloud print proxy management ui section if it's been runtime 189 // Add the cloud print proxy management ui section if it's been runtime
189 // enabled. 190 // enabled.
190 localized_strings->SetString( 191 localized_strings->SetBoolean("enable-cloud-print-proxy",
191 "enable-cloud-print-proxy", 192 cloud_print_proxy_ui_enabled_);
192 cloud_print_proxy_ui_enabled_ ? "true" : "false" );
193 #endif 193 #endif
194 } 194 }
195 195
196 void AdvancedOptionsHandler::Initialize() { 196 void AdvancedOptionsHandler::Initialize() {
197 DCHECK(web_ui_); 197 DCHECK(web_ui_);
198 SetupMetricsReportingCheckbox(); 198 SetupMetricsReportingCheckbox();
199 SetupMetricsReportingSettingVisibility(); 199 SetupMetricsReportingSettingVisibility();
200 SetupFontSizeLabel(); 200 SetupFontSizeLabel();
201 SetupDownloadLocationPath(); 201 SetupDownloadLocationPath();
202 SetupAutoOpenFileTypesDisabledAttribute(); 202 SetupAutoOpenFileTypesDisabledAttribute();
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 UserMetricsRecordAction(UserMetricsAction("Options_ResetAutoOpenFiles")); 369 UserMetricsRecordAction(UserMetricsAction("Options_ResetAutoOpenFiles"));
370 DownloadManager* manager = web_ui_->GetProfile()->GetDownloadManager(); 370 DownloadManager* manager = web_ui_->GetProfile()->GetDownloadManager();
371 if (manager) 371 if (manager)
372 manager->download_prefs()->ResetAutoOpen(); 372 manager->download_prefs()->ResetAutoOpen();
373 } 373 }
374 374
375 void AdvancedOptionsHandler::HandleMetricsReportingCheckbox( 375 void AdvancedOptionsHandler::HandleMetricsReportingCheckbox(
376 const ListValue* args) { 376 const ListValue* args) {
377 #if defined(GOOGLE_CHROME_BUILD) && !defined(OS_CHROMEOS) 377 #if defined(GOOGLE_CHROME_BUILD) && !defined(OS_CHROMEOS)
378 std::string checked_str = WideToUTF8(ExtractStringValue(args)); 378 std::string checked_str = WideToUTF8(ExtractStringValue(args));
379 bool enabled = (checked_str == "true"); 379 bool enabled = checked_str == "true";
380 UserMetricsRecordAction( 380 UserMetricsRecordAction(
381 enabled ? 381 enabled ?
382 UserMetricsAction("Options_MetricsReportingCheckbox_Enable") : 382 UserMetricsAction("Options_MetricsReportingCheckbox_Enable") :
383 UserMetricsAction("Options_MetricsReportingCheckbox_Disable")); 383 UserMetricsAction("Options_MetricsReportingCheckbox_Disable"));
384 bool is_enabled = OptionsUtil::ResolveMetricsReportingEnabled(enabled); 384 bool is_enabled = OptionsUtil::ResolveMetricsReportingEnabled(enabled);
385 enable_metrics_recording_.SetValue(is_enabled); 385 enable_metrics_recording_.SetValue(is_enabled);
386 SetupMetricsReportingCheckbox(); 386 SetupMetricsReportingCheckbox();
387 #endif 387 #endif
388 } 388 }
389 389
390 void AdvancedOptionsHandler::HandleDefaultFontSize(const ListValue* args) { 390 void AdvancedOptionsHandler::HandleDefaultFontSize(const ListValue* args) {
391 int font_size; 391 int font_size;
392 if (ExtractIntegerValue(args, &font_size)) { 392 if (ExtractIntegerValue(args, &font_size)) {
393 if (font_size > 0) { 393 if (font_size > 0) {
394 default_font_size_.SetValue(font_size); 394 default_font_size_.SetValue(font_size);
395 default_fixed_font_size_.SetValue(font_size); 395 default_fixed_font_size_.SetValue(font_size);
396 SetupFontSizeLabel(); 396 SetupFontSizeLabel();
397 } 397 }
398 } 398 }
399 } 399 }
400 400
401 #if defined(OS_WIN) 401 #if defined(OS_WIN)
402 void AdvancedOptionsHandler::HandleCheckRevocationCheckbox( 402 void AdvancedOptionsHandler::HandleCheckRevocationCheckbox(
403 const ListValue* args) { 403 const ListValue* args) {
404 std::string checked_str = WideToUTF8(ExtractStringValue(args)); 404 std::string checked_str = WideToUTF8(ExtractStringValue(args));
405 bool enabled = (checked_str == "true"); 405 bool enabled = checked_str == "true";
406 std::string metric = 406 std::string metric =
407 (enabled ? "Options_CheckCertRevocation_Enable" 407 (enabled ? "Options_CheckCertRevocation_Enable"
408 : "Options_CheckCertRevocation_Disable"); 408 : "Options_CheckCertRevocation_Disable");
409 UserMetricsRecordAction(UserMetricsAction(metric.c_str())); 409 UserMetricsRecordAction(UserMetricsAction(metric.c_str()));
410 net::SSLConfigServiceWin::SetRevCheckingEnabled(enabled); 410 net::SSLConfigServiceWin::SetRevCheckingEnabled(enabled);
411 } 411 }
412 412
413 void AdvancedOptionsHandler::HandleUseSSL3Checkbox(const ListValue* args) { 413 void AdvancedOptionsHandler::HandleUseSSL3Checkbox(const ListValue* args) {
414 std::string checked_str = WideToUTF8(ExtractStringValue(args)); 414 std::string checked_str = WideToUTF8(ExtractStringValue(args));
415 bool enabled = (checked_str == "true"); 415 bool enabled = checked_str == "true";
416 std::string metric = 416 std::string metric =
417 (enabled ? "Options_SSL3_Enable" : "Options_SSL3_Disable"); 417 (enabled ? "Options_SSL3_Enable" : "Options_SSL3_Disable");
418 UserMetricsRecordAction(UserMetricsAction(metric.c_str())); 418 UserMetricsRecordAction(UserMetricsAction(metric.c_str()));
419 net::SSLConfigServiceWin::SetSSL3Enabled(enabled); 419 net::SSLConfigServiceWin::SetSSL3Enabled(enabled);
420 } 420 }
421 421
422 void AdvancedOptionsHandler::HandleUseTLS1Checkbox(const ListValue* args) { 422 void AdvancedOptionsHandler::HandleUseTLS1Checkbox(const ListValue* args) {
423 std::string checked_str = WideToUTF8(ExtractStringValue(args)); 423 std::string checked_str = WideToUTF8(ExtractStringValue(args));
424 bool enabled = (checked_str == "true"); 424 bool enabled = checked_str == "true";
425 std::string metric = 425 std::string metric =
426 (enabled ? "Options_TLS1_Enable" : "Options_TLS1_Disable"); 426 (enabled ? "Options_TLS1_Enable" : "Options_TLS1_Disable");
427 UserMetricsRecordAction(UserMetricsAction(metric.c_str())); 427 UserMetricsRecordAction(UserMetricsAction(metric.c_str()));
428 net::SSLConfigServiceWin::SetTLS1Enabled(enabled); 428 net::SSLConfigServiceWin::SetTLS1Enabled(enabled);
429 } 429 }
430 430
431 void AdvancedOptionsHandler::HandleShowGearsSettings(const ListValue* args) { 431 void AdvancedOptionsHandler::HandleShowGearsSettings(const ListValue* args) {
432 UserMetricsRecordAction(UserMetricsAction("Options_GearsSettings")); 432 UserMetricsRecordAction(UserMetricsAction("Options_GearsSettings"));
433 GearsSettingsPressed( 433 GearsSettingsPressed(
434 web_ui_->tab_contents()->view()->GetTopLevelNativeWindow()); 434 web_ui_->tab_contents()->view()->GetTopLevelNativeWindow());
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
636 FundamentalValue useSSL3Value(useSSL3Setting); 636 FundamentalValue useSSL3Value(useSSL3Setting);
637 web_ui_->CallJavascriptFunction( 637 web_ui_->CallJavascriptFunction(
638 L"options.AdvancedOptions.SetUseSSL3CheckboxState", 638 L"options.AdvancedOptions.SetUseSSL3CheckboxState",
639 useSSL3Value, disabledValue); 639 useSSL3Value, disabledValue);
640 FundamentalValue useTLS1Value(useTLS1Setting); 640 FundamentalValue useTLS1Value(useTLS1Setting);
641 web_ui_->CallJavascriptFunction( 641 web_ui_->CallJavascriptFunction(
642 L"options.AdvancedOptions.SetUseTLS1CheckboxState", 642 L"options.AdvancedOptions.SetUseTLS1CheckboxState",
643 useTLS1Value, disabledValue); 643 useTLS1Value, disabledValue);
644 } 644 }
645 #endif 645 #endif
OLDNEW
« no previous file with comments | « chrome/browser/dom_ui/options/about_page_handler.cc ('k') | chrome/browser/dom_ui/options/browser_options_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698