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/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 Loading... | |
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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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(dom_ui_); | 197 DCHECK(dom_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 Loading... | |
369 UserMetricsRecordAction(UserMetricsAction("Options_ResetAutoOpenFiles")); | 369 UserMetricsRecordAction(UserMetricsAction("Options_ResetAutoOpenFiles")); |
370 DownloadManager* manager = dom_ui_->GetProfile()->GetDownloadManager(); | 370 DownloadManager* manager = dom_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"; |
Mike Mammarella
2011/02/11 18:38:48
Personally I like these parens, because they make
Evan Stade
2011/02/11 19:23:33
well, I think clang would complain, but I guess I'
Mike Mammarella
2011/02/11 20:56:19
Yeah, there are just some operators that I don't a
| |
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 dom_ui_->tab_contents()->view()->GetTopLevelNativeWindow()); | 434 dom_ui_->tab_contents()->view()->GetTopLevelNativeWindow()); |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
636 FundamentalValue useSSL3Value(useSSL3Setting); | 636 FundamentalValue useSSL3Value(useSSL3Setting); |
637 dom_ui_->CallJavascriptFunction( | 637 dom_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 dom_ui_->CallJavascriptFunction( | 641 dom_ui_->CallJavascriptFunction( |
642 L"options.AdvancedOptions.SetUseTLS1CheckboxState", | 642 L"options.AdvancedOptions.SetUseTLS1CheckboxState", |
643 useTLS1Value, disabledValue); | 643 useTLS1Value, disabledValue); |
644 } | 644 } |
645 #endif | 645 #endif |
OLD | NEW |