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

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

Issue 6525005: Revert r74860 as it broke arm: (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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;
61 } 60 }
62 61
63 AdvancedOptionsHandler::~AdvancedOptionsHandler() { 62 AdvancedOptionsHandler::~AdvancedOptionsHandler() {
64 } 63 }
65 64
66 void AdvancedOptionsHandler::GetLocalizedValues( 65 void AdvancedOptionsHandler::GetLocalizedValues(
67 DictionaryValue* localized_strings) { 66 DictionaryValue* localized_strings) {
68 DCHECK(localized_strings); 67 DCHECK(localized_strings);
69 68
70 static OptionsStringResource resources[] = { 69 OptionsStringResource resources[] = {
71 { "downloadLocationGroupName", 70 { "downloadLocationGroupName",
72 IDS_OPTIONS_DOWNLOADLOCATION_GROUP_NAME }, 71 IDS_OPTIONS_DOWNLOADLOCATION_GROUP_NAME },
73 { "downloadLocationChangeButton", 72 { "downloadLocationChangeButton",
74 IDS_OPTIONS_DOWNLOADLOCATION_CHANGE_BUTTON }, 73 IDS_OPTIONS_DOWNLOADLOCATION_CHANGE_BUTTON },
75 { "downloadLocationBrowseTitle", 74 { "downloadLocationBrowseTitle",
76 IDS_OPTIONS_DOWNLOADLOCATION_BROWSE_TITLE }, 75 IDS_OPTIONS_DOWNLOADLOCATION_BROWSE_TITLE },
77 { "downloadLocationBrowseWindowTitle", 76 { "downloadLocationBrowseWindowTitle",
78 IDS_OPTIONS_DOWNLOADLOCATION_BROWSE_WINDOW_TITLE }, 77 IDS_OPTIONS_DOWNLOADLOCATION_BROWSE_WINDOW_TITLE },
79 { "downloadLocationAskForSaveLocation", 78 { "downloadLocationAskForSaveLocation",
80 IDS_OPTIONS_DOWNLOADLOCATION_ASKFORSAVELOCATION }, 79 IDS_OPTIONS_DOWNLOADLOCATION_ASKFORSAVELOCATION },
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 IDS_OPTIONS_FONT_SIZE_LABEL_MEDIUM }, 127 IDS_OPTIONS_FONT_SIZE_LABEL_MEDIUM },
129 { "fontSizeLabelLarge", 128 { "fontSizeLabelLarge",
130 IDS_OPTIONS_FONT_SIZE_LABEL_LARGE }, 129 IDS_OPTIONS_FONT_SIZE_LABEL_LARGE },
131 { "fontSizeLabelVeryLarge", 130 { "fontSizeLabelVeryLarge",
132 IDS_OPTIONS_FONT_SIZE_LABEL_VERY_LARGE }, 131 IDS_OPTIONS_FONT_SIZE_LABEL_VERY_LARGE },
133 { "fontSizeLabelCustom", 132 { "fontSizeLabelCustom",
134 IDS_OPTIONS_FONT_SIZE_LABEL_CUSTOM }, 133 IDS_OPTIONS_FONT_SIZE_LABEL_CUSTOM },
135 { "fontSettingsCustomizeFontsButton", 134 { "fontSettingsCustomizeFontsButton",
136 IDS_OPTIONS_FONTSETTINGS_CUSTOMIZE_FONTS_BUTTON }, 135 IDS_OPTIONS_FONTSETTINGS_CUSTOMIZE_FONTS_BUTTON },
137 { "languageAndSpellCheckSettingsButton", 136 { "languageAndSpellCheckSettingsButton",
138 IDS_OPTIONS_LANGUAGE_AND_SPELLCHECK_BUTTON }, 137 IDS_OPTIONS_LANGUAGE_AND_SPELLCHECK_BUTTON, true },
139 { "advancedSectionTitlePrivacy", 138 { "advancedSectionTitlePrivacy",
140 IDS_OPTIONS_ADVANCED_SECTION_TITLE_PRIVACY }, 139 IDS_OPTIONS_ADVANCED_SECTION_TITLE_PRIVACY, true },
141 { "advancedSectionTitleContent", 140 { "advancedSectionTitleContent",
142 IDS_OPTIONS_ADVANCED_SECTION_TITLE_CONTENT }, 141 IDS_OPTIONS_ADVANCED_SECTION_TITLE_CONTENT, true },
143 { "advancedSectionTitleSecurity", 142 { "advancedSectionTitleSecurity",
144 IDS_OPTIONS_ADVANCED_SECTION_TITLE_SECURITY }, 143 IDS_OPTIONS_ADVANCED_SECTION_TITLE_SECURITY, true },
145 { "advancedSectionTitleNetwork", 144 { "advancedSectionTitleNetwork",
146 IDS_OPTIONS_ADVANCED_SECTION_TITLE_NETWORK }, 145 IDS_OPTIONS_ADVANCED_SECTION_TITLE_NETWORK, true },
147 { "advancedSectionTitleTranslate", 146 { "advancedSectionTitleTranslate",
148 IDS_OPTIONS_ADVANCED_SECTION_TITLE_TRANSLATE }, 147 IDS_OPTIONS_ADVANCED_SECTION_TITLE_TRANSLATE, true },
149 { "translateEnableTranslate", 148 { "translateEnableTranslate",
150 IDS_OPTIONS_TRANSLATE_ENABLE_TRANSLATE }, 149 IDS_OPTIONS_TRANSLATE_ENABLE_TRANSLATE },
151 { "enableLogging", 150 { "enableLogging",
152 IDS_OPTIONS_ENABLE_LOGGING }, 151 IDS_OPTIONS_ENABLE_LOGGING },
153 { "improveBrowsingExperience", 152 { "improveBrowsingExperience",
154 IDS_OPTIONS_IMPROVE_BROWSING_EXPERIENCE }, 153 IDS_OPTIONS_IMPROVE_BROWSING_EXPERIENCE },
155 { "disableWebServices", 154 { "disableWebServices",
156 IDS_OPTIONS_DISABLE_WEB_SERVICES }, 155 IDS_OPTIONS_DISABLE_WEB_SERVICES },
157 #if !defined(OS_CHROMEOS) 156 #if !defined(OS_CHROMEOS)
158 { "advancedSectionTitleCloudPrint", 157 { "advancedSectionTitleCloudPrint",
(...skipping 22 matching lines...) Expand all
181 RegisterStrings(localized_strings, resources, arraysize(resources)); 180 RegisterStrings(localized_strings, resources, arraysize(resources));
182 RegisterTitle(localized_strings, "advancedPage", 181 RegisterTitle(localized_strings, "advancedPage",
183 IDS_OPTIONS_ADVANCED_TAB_LABEL); 182 IDS_OPTIONS_ADVANCED_TAB_LABEL);
184 183
185 localized_strings->SetString("privacyLearnMoreURL", 184 localized_strings->SetString("privacyLearnMoreURL",
186 google_util::AppendGoogleLocaleParam( 185 google_util::AppendGoogleLocaleParam(
187 GURL(chrome::kPrivacyLearnMoreURL)).spec()); 186 GURL(chrome::kPrivacyLearnMoreURL)).spec());
188 #if !defined(OS_CHROMEOS) 187 #if !defined(OS_CHROMEOS)
189 // Add the cloud print proxy management ui section if it's been runtime 188 // Add the cloud print proxy management ui section if it's been runtime
190 // enabled. 189 // enabled.
191 localized_strings->SetBoolean("enable-cloud-print-proxy", 190 localized_strings->SetString(
192 cloud_print_proxy_ui_enabled_); 191 "enable-cloud-print-proxy",
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