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/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" |
11 #include "base/bind_helpers.h" | 11 #include "base/bind_helpers.h" |
12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
13 #include "base/utf_string_conversions.h" | 13 #include "base/utf_string_conversions.h" |
14 #include "base/values.h" | 14 #include "base/values.h" |
15 #include "chrome/browser/browser_process.h" | 15 #include "chrome/browser/browser_process.h" |
| 16 #include "chrome/browser/chrome_page_zoom.h" |
16 #include "chrome/browser/download/download_prefs.h" | 17 #include "chrome/browser/download/download_prefs.h" |
17 #include "chrome/browser/google/google_util.h" | 18 #include "chrome/browser/google/google_util.h" |
18 #include "chrome/browser/prefs/pref_service.h" | 19 #include "chrome/browser/prefs/pref_service.h" |
19 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service.h" | 20 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service.h" |
20 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service_factory.
h" | 21 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service_factory.
h" |
21 #include "chrome/browser/printing/cloud_print/cloud_print_setup_flow.h" | 22 #include "chrome/browser/printing/cloud_print/cloud_print_setup_flow.h" |
22 #include "chrome/browser/printing/cloud_print/cloud_print_url.h" | 23 #include "chrome/browser/printing/cloud_print/cloud_print_url.h" |
23 #include "chrome/browser/profiles/profile.h" | 24 #include "chrome/browser/profiles/profile.h" |
24 #include "chrome/browser/service/service_process_control.h" | 25 #include "chrome/browser/service/service_process_control.h" |
25 #include "chrome/browser/ui/options/options_util.h" | 26 #include "chrome/browser/ui/options/options_util.h" |
26 #include "chrome/common/chrome_notification_types.h" | 27 #include "chrome/common/chrome_notification_types.h" |
27 #include "chrome/common/chrome_switches.h" | 28 #include "chrome/common/chrome_switches.h" |
28 #include "chrome/common/pref_names.h" | 29 #include "chrome/common/pref_names.h" |
29 #include "chrome/common/url_constants.h" | 30 #include "chrome/common/url_constants.h" |
30 #include "content/browser/download/download_manager.h" | 31 #include "content/browser/download/download_manager.h" |
31 #include "content/browser/tab_contents/tab_contents.h" | 32 #include "content/browser/tab_contents/tab_contents.h" |
32 #include "content/browser/tab_contents/tab_contents_view.h" | 33 #include "content/browser/tab_contents/tab_contents_view.h" |
33 #include "content/browser/user_metrics.h" | 34 #include "content/browser/user_metrics.h" |
34 #include "content/public/browser/notification_details.h" | 35 #include "content/public/browser/notification_details.h" |
35 #include "content/public/browser/notification_types.h" | 36 #include "content/public/browser/notification_types.h" |
| 37 #include "content/public/common/page_zoom.h" |
36 #include "grit/chromium_strings.h" | 38 #include "grit/chromium_strings.h" |
37 #include "grit/generated_resources.h" | 39 #include "grit/generated_resources.h" |
38 #include "grit/locale_settings.h" | 40 #include "grit/locale_settings.h" |
| 41 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" |
39 #include "ui/base/l10n/l10n_util.h" | 42 #include "ui/base/l10n/l10n_util.h" |
40 | 43 |
41 #if !defined(OS_CHROMEOS) | 44 #if !defined(OS_CHROMEOS) |
42 #include "chrome/browser/printing/cloud_print/cloud_print_setup_handler.h" | 45 #include "chrome/browser/printing/cloud_print/cloud_print_setup_handler.h" |
43 #include "chrome/browser/ui/webui/options/advanced_options_utils.h" | 46 #include "chrome/browser/ui/webui/options/advanced_options_utils.h" |
44 #endif | 47 #endif |
45 | 48 |
46 AdvancedOptionsHandler::AdvancedOptionsHandler() { | 49 AdvancedOptionsHandler::AdvancedOptionsHandler() { |
47 | 50 |
48 #if(!defined(GOOGLE_CHROME_BUILD) && defined(OS_WIN)) | 51 #if(!defined(GOOGLE_CHROME_BUILD) && defined(OS_WIN)) |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 { "suggestPref", | 114 { "suggestPref", |
112 IDS_OPTIONS_SUGGEST_PREF }, | 115 IDS_OPTIONS_SUGGEST_PREF }, |
113 #if defined(GOOGLE_CHROME_BUILD) && defined(OS_WIN) | 116 #if defined(GOOGLE_CHROME_BUILD) && defined(OS_WIN) |
114 { "spellingPref", | 117 { "spellingPref", |
115 IDS_OPTIONS_SPELLING_PREF }, | 118 IDS_OPTIONS_SPELLING_PREF }, |
116 #endif | 119 #endif |
117 { "tabsToLinksPref", | 120 { "tabsToLinksPref", |
118 IDS_OPTIONS_TABS_TO_LINKS_PREF }, | 121 IDS_OPTIONS_TABS_TO_LINKS_PREF }, |
119 { "fontSettingsInfo", | 122 { "fontSettingsInfo", |
120 IDS_OPTIONS_FONTSETTINGS_INFO }, | 123 IDS_OPTIONS_FONTSETTINGS_INFO }, |
121 { "defaultZoomLevelLabel", | 124 { "defaultZoomFactorLabel", |
122 IDS_OPTIONS_DEFAULT_ZOOM_LEVEL_LABEL }, | 125 IDS_OPTIONS_DEFAULT_ZOOM_LEVEL_LABEL }, |
123 { "defaultFontSizeLabel", | 126 { "defaultFontSizeLabel", |
124 IDS_OPTIONS_DEFAULT_FONT_SIZE_LABEL }, | 127 IDS_OPTIONS_DEFAULT_FONT_SIZE_LABEL }, |
125 { "fontSizeLabelVerySmall", | 128 { "fontSizeLabelVerySmall", |
126 IDS_OPTIONS_FONT_SIZE_LABEL_VERY_SMALL }, | 129 IDS_OPTIONS_FONT_SIZE_LABEL_VERY_SMALL }, |
127 { "fontSizeLabelSmall", | 130 { "fontSizeLabelSmall", |
128 IDS_OPTIONS_FONT_SIZE_LABEL_SMALL }, | 131 IDS_OPTIONS_FONT_SIZE_LABEL_SMALL }, |
129 { "fontSizeLabelMedium", | 132 { "fontSizeLabelMedium", |
130 IDS_OPTIONS_FONT_SIZE_LABEL_MEDIUM }, | 133 IDS_OPTIONS_FONT_SIZE_LABEL_MEDIUM }, |
131 { "fontSizeLabelLarge", | 134 { "fontSizeLabelLarge", |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 localized_strings->SetString("cloudPrintLearnMoreURL", | 201 localized_strings->SetString("cloudPrintLearnMoreURL", |
199 google_util::AppendGoogleLocaleParam( | 202 google_util::AppendGoogleLocaleParam( |
200 GURL(chrome::kCloudPrintLearnMoreURL)).spec()); | 203 GURL(chrome::kCloudPrintLearnMoreURL)).spec()); |
201 #endif | 204 #endif |
202 } | 205 } |
203 | 206 |
204 void AdvancedOptionsHandler::Initialize() { | 207 void AdvancedOptionsHandler::Initialize() { |
205 DCHECK(web_ui_); | 208 DCHECK(web_ui_); |
206 SetupMetricsReportingCheckbox(); | 209 SetupMetricsReportingCheckbox(); |
207 SetupMetricsReportingSettingVisibility(); | 210 SetupMetricsReportingSettingVisibility(); |
208 SetupFontSizeLabel(); | 211 SetupFontSizeSelector(); |
| 212 SetupPageZoomSelector(); |
209 SetupAutoOpenFileTypesDisabledAttribute(); | 213 SetupAutoOpenFileTypesDisabledAttribute(); |
210 SetupProxySettingsSection(); | 214 SetupProxySettingsSection(); |
211 SetupSSLConfigSettings(); | 215 SetupSSLConfigSettings(); |
212 #if !defined(OS_CHROMEOS) | 216 #if !defined(OS_CHROMEOS) |
213 if (cloud_print_proxy_ui_enabled_) { | 217 if (cloud_print_proxy_ui_enabled_) { |
214 SetupCloudPrintProxySection(); | 218 SetupCloudPrintProxySection(); |
215 RefreshCloudPrintStatusFromService(); | 219 RefreshCloudPrintStatusFromService(); |
216 } else { | 220 } else { |
217 RemoveCloudPrintProxySection(); | 221 RemoveCloudPrintProxySection(); |
218 } | 222 } |
(...skipping 23 matching lines...) Expand all Loading... |
242 g_browser_process->local_state(), this); | 246 g_browser_process->local_state(), this); |
243 | 247 |
244 #if !defined(OS_MACOSX) && !defined(OS_CHROMEOS) | 248 #if !defined(OS_MACOSX) && !defined(OS_CHROMEOS) |
245 background_mode_enabled_.Init(prefs::kBackgroundModeEnabled, | 249 background_mode_enabled_.Init(prefs::kBackgroundModeEnabled, |
246 g_browser_process->local_state(), | 250 g_browser_process->local_state(), |
247 this); | 251 this); |
248 #endif | 252 #endif |
249 | 253 |
250 auto_open_files_.Init(prefs::kDownloadExtensionsToOpen, prefs, this); | 254 auto_open_files_.Init(prefs::kDownloadExtensionsToOpen, prefs, this); |
251 default_font_size_.Init(prefs::kWebKitDefaultFontSize, prefs, this); | 255 default_font_size_.Init(prefs::kWebKitDefaultFontSize, prefs, this); |
| 256 default_zoom_level_.Init(prefs::kDefaultZoomLevel, prefs, this); |
252 #if !defined(OS_CHROMEOS) | 257 #if !defined(OS_CHROMEOS) |
253 proxy_prefs_.reset( | 258 proxy_prefs_.reset( |
254 PrefSetObserver::CreateProxyPrefSetObserver(prefs, this)); | 259 PrefSetObserver::CreateProxyPrefSetObserver(prefs, this)); |
255 #endif // !defined(OS_CHROMEOS) | 260 #endif // !defined(OS_CHROMEOS) |
256 | 261 |
257 // Return result from the superclass. | 262 // Return result from the superclass. |
258 return handler; | 263 return handler; |
259 } | 264 } |
260 | 265 |
261 void AdvancedOptionsHandler::RegisterMessages() { | 266 void AdvancedOptionsHandler::RegisterMessages() { |
262 // Setup handlers specific to this panel. | 267 // Setup handlers specific to this panel. |
263 DCHECK(web_ui_); | 268 DCHECK(web_ui_); |
264 web_ui_->RegisterMessageCallback("selectDownloadLocation", | 269 web_ui_->RegisterMessageCallback("selectDownloadLocation", |
265 base::Bind(&AdvancedOptionsHandler::HandleSelectDownloadLocation, | 270 base::Bind(&AdvancedOptionsHandler::HandleSelectDownloadLocation, |
266 base::Unretained(this))); | 271 base::Unretained(this))); |
267 web_ui_->RegisterMessageCallback("autoOpenFileTypesAction", | 272 web_ui_->RegisterMessageCallback("autoOpenFileTypesAction", |
268 base::Bind(&AdvancedOptionsHandler::HandleAutoOpenButton, | 273 base::Bind(&AdvancedOptionsHandler::HandleAutoOpenButton, |
269 base::Unretained(this))); | 274 base::Unretained(this))); |
270 web_ui_->RegisterMessageCallback("defaultFontSizeAction", | 275 web_ui_->RegisterMessageCallback("defaultFontSizeAction", |
271 base::Bind(&AdvancedOptionsHandler::HandleDefaultFontSize, | 276 base::Bind(&AdvancedOptionsHandler::HandleDefaultFontSize, |
272 base::Unretained(this))); | 277 base::Unretained(this))); |
| 278 web_ui_->RegisterMessageCallback("defaultZoomFactorAction", |
| 279 base::Bind(&AdvancedOptionsHandler::HandleDefaultZoomFactor, |
| 280 base::Unretained(this))); |
273 #if !defined(OS_CHROMEOS) | 281 #if !defined(OS_CHROMEOS) |
274 web_ui_->RegisterMessageCallback("metricsReportingCheckboxAction", | 282 web_ui_->RegisterMessageCallback("metricsReportingCheckboxAction", |
275 base::Bind(&AdvancedOptionsHandler::HandleMetricsReportingCheckbox, | 283 base::Bind(&AdvancedOptionsHandler::HandleMetricsReportingCheckbox, |
276 base::Unretained(this))); | 284 base::Unretained(this))); |
277 #endif | 285 #endif |
278 #if !defined(USE_NSS) && !defined(USE_OPENSSL) | 286 #if !defined(USE_NSS) && !defined(USE_OPENSSL) |
279 web_ui_->RegisterMessageCallback("showManageSSLCertificates", | 287 web_ui_->RegisterMessageCallback("showManageSSLCertificates", |
280 base::Bind(&AdvancedOptionsHandler::ShowManageSSLCertificates, | 288 base::Bind(&AdvancedOptionsHandler::ShowManageSSLCertificates, |
281 base::Unretained(this))); | 289 base::Unretained(this))); |
282 #endif | 290 #endif |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 } else if (proxy_prefs_->IsObserved(*pref_name)) { | 326 } else if (proxy_prefs_->IsObserved(*pref_name)) { |
319 SetupProxySettingsSection(); | 327 SetupProxySettingsSection(); |
320 #endif // !defined(OS_CHROMEOS) | 328 #endif // !defined(OS_CHROMEOS) |
321 } else if ((*pref_name == prefs::kCloudPrintEmail) || | 329 } else if ((*pref_name == prefs::kCloudPrintEmail) || |
322 (*pref_name == prefs::kCloudPrintProxyEnabled)) { | 330 (*pref_name == prefs::kCloudPrintProxyEnabled)) { |
323 #if !defined(OS_CHROMEOS) | 331 #if !defined(OS_CHROMEOS) |
324 if (cloud_print_proxy_ui_enabled_) | 332 if (cloud_print_proxy_ui_enabled_) |
325 SetupCloudPrintProxySection(); | 333 SetupCloudPrintProxySection(); |
326 #endif | 334 #endif |
327 } else if (*pref_name == prefs::kWebKitDefaultFontSize) { | 335 } else if (*pref_name == prefs::kWebKitDefaultFontSize) { |
328 SetupFontSizeLabel(); | 336 SetupFontSizeSelector(); |
| 337 } else if (*pref_name == prefs::kDefaultZoomLevel) { |
| 338 SetupPageZoomSelector(); |
329 #if !defined(OS_MACOSX) && !defined(OS_CHROMEOS) | 339 #if !defined(OS_MACOSX) && !defined(OS_CHROMEOS) |
330 } else if (*pref_name == prefs::kBackgroundModeEnabled) { | 340 } else if (*pref_name == prefs::kBackgroundModeEnabled) { |
331 SetupBackgroundModeSettings(); | 341 SetupBackgroundModeSettings(); |
332 #endif | 342 #endif |
333 } | 343 } |
334 } | 344 } |
335 } | 345 } |
336 | 346 |
337 void AdvancedOptionsHandler::HandleSelectDownloadLocation( | 347 void AdvancedOptionsHandler::HandleSelectDownloadLocation( |
338 const ListValue* args) { | 348 const ListValue* args) { |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
381 enable_metrics_recording_.SetValue(is_enabled); | 391 enable_metrics_recording_.SetValue(is_enabled); |
382 SetupMetricsReportingCheckbox(); | 392 SetupMetricsReportingCheckbox(); |
383 #endif | 393 #endif |
384 } | 394 } |
385 | 395 |
386 void AdvancedOptionsHandler::HandleDefaultFontSize(const ListValue* args) { | 396 void AdvancedOptionsHandler::HandleDefaultFontSize(const ListValue* args) { |
387 int font_size; | 397 int font_size; |
388 if (ExtractIntegerValue(args, &font_size)) { | 398 if (ExtractIntegerValue(args, &font_size)) { |
389 if (font_size > 0) { | 399 if (font_size > 0) { |
390 default_font_size_.SetValue(font_size); | 400 default_font_size_.SetValue(font_size); |
391 SetupFontSizeLabel(); | 401 SetupFontSizeSelector(); |
392 } | 402 } |
393 } | 403 } |
394 } | 404 } |
395 | 405 |
| 406 void AdvancedOptionsHandler::HandleDefaultZoomFactor(const ListValue* args) { |
| 407 double zoom_factor; |
| 408 if (ExtractDoubleValue(args, &zoom_factor)) { |
| 409 default_zoom_level_.SetValue( |
| 410 WebKit::WebView::zoomFactorToZoomLevel(zoom_factor)); |
| 411 } |
| 412 } |
| 413 |
396 void AdvancedOptionsHandler::HandleCheckRevocationCheckbox( | 414 void AdvancedOptionsHandler::HandleCheckRevocationCheckbox( |
397 const ListValue* args) { | 415 const ListValue* args) { |
398 std::string checked_str = UTF16ToUTF8(ExtractStringValue(args)); | 416 std::string checked_str = UTF16ToUTF8(ExtractStringValue(args)); |
399 bool enabled = checked_str == "true"; | 417 bool enabled = checked_str == "true"; |
400 UserMetrics::RecordAction( | 418 UserMetrics::RecordAction( |
401 enabled ? | 419 enabled ? |
402 UserMetricsAction("Options_CheckCertRevocation_Enable") : | 420 UserMetricsAction("Options_CheckCertRevocation_Enable") : |
403 UserMetricsAction("Options_CheckCertRevocation_Disable")); | 421 UserMetricsAction("Options_CheckCertRevocation_Disable")); |
404 rev_checking_enabled_.SetValue(enabled); | 422 rev_checking_enabled_.SetValue(enabled); |
405 } | 423 } |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
458 | 476 |
459 void AdvancedOptionsHandler::HandleDisableCloudPrintProxy( | 477 void AdvancedOptionsHandler::HandleDisableCloudPrintProxy( |
460 const ListValue* args) { | 478 const ListValue* args) { |
461 UserMetrics::RecordAction( | 479 UserMetrics::RecordAction( |
462 UserMetricsAction("Options_DisableCloudPrintProxy")); | 480 UserMetricsAction("Options_DisableCloudPrintProxy")); |
463 CloudPrintProxyServiceFactory::GetForProfile(Profile::FromWebUI(web_ui_))-> | 481 CloudPrintProxyServiceFactory::GetForProfile(Profile::FromWebUI(web_ui_))-> |
464 DisableForUser(); | 482 DisableForUser(); |
465 } | 483 } |
466 | 484 |
467 void AdvancedOptionsHandler::RefreshCloudPrintStatusFromService() { | 485 void AdvancedOptionsHandler::RefreshCloudPrintStatusFromService() { |
468 DCHECK(web_ui_); | |
469 if (cloud_print_proxy_ui_enabled_) | 486 if (cloud_print_proxy_ui_enabled_) |
470 CloudPrintProxyServiceFactory::GetForProfile(Profile::FromWebUI(web_ui_))-> | 487 CloudPrintProxyServiceFactory::GetForProfile(Profile::FromWebUI(web_ui_))-> |
471 RefreshStatusFromService(); | 488 RefreshStatusFromService(); |
472 } | 489 } |
473 | 490 |
474 void AdvancedOptionsHandler::SetupCloudPrintProxySection() { | 491 void AdvancedOptionsHandler::SetupCloudPrintProxySection() { |
475 Profile* profile = Profile::FromWebUI(web_ui_); | 492 Profile* profile = Profile::FromWebUI(web_ui_); |
476 if (!CloudPrintProxyServiceFactory::GetForProfile(profile)) { | 493 if (!CloudPrintProxyServiceFactory::GetForProfile(profile)) { |
477 cloud_print_proxy_ui_enabled_ = false; | 494 cloud_print_proxy_ui_enabled_ = false; |
478 RemoveCloudPrintProxySection(); | 495 RemoveCloudPrintProxySection(); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
528 // Don't show the reporting setting if we are in the guest mode. | 545 // Don't show the reporting setting if we are in the guest mode. |
529 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kGuestSession)) { | 546 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kGuestSession)) { |
530 base::FundamentalValue visible(false); | 547 base::FundamentalValue visible(false); |
531 web_ui_->CallJavascriptFunction( | 548 web_ui_->CallJavascriptFunction( |
532 "options.AdvancedOptions.SetMetricsReportingSettingVisibility", | 549 "options.AdvancedOptions.SetMetricsReportingSettingVisibility", |
533 visible); | 550 visible); |
534 } | 551 } |
535 #endif | 552 #endif |
536 } | 553 } |
537 | 554 |
538 void AdvancedOptionsHandler::SetupFontSizeLabel() { | 555 void AdvancedOptionsHandler::SetupFontSizeSelector() { |
539 // We're only interested in integer values, so convert to int. | 556 // We're only interested in integer values, so convert to int. |
540 base::FundamentalValue font_size(default_font_size_.GetValue()); | 557 base::FundamentalValue font_size(default_font_size_.GetValue()); |
541 web_ui_->CallJavascriptFunction( | 558 web_ui_->CallJavascriptFunction( |
542 "options.AdvancedOptions.SetFontSize", font_size); | 559 "options.AdvancedOptions.SetFontSize", font_size); |
543 } | 560 } |
544 | 561 |
| 562 void AdvancedOptionsHandler::SetupPageZoomSelector() { |
| 563 PrefService* pref_service = Profile::FromWebUI(web_ui_)->GetPrefs(); |
| 564 double default_zoom_level = pref_service->GetDouble(prefs::kDefaultZoomLevel); |
| 565 double default_zoom_factor = |
| 566 WebKit::WebView::zoomLevelToZoomFactor(default_zoom_level); |
| 567 |
| 568 // Generate a vector of zoom factors from an array of known presets along with |
| 569 // the default factor added if necessary. |
| 570 std::vector<double> zoom_factors = |
| 571 chrome_page_zoom::PresetZoomFactors(default_zoom_factor); |
| 572 |
| 573 // Iterate through the zoom factors and and build the contents of the |
| 574 // selector that will be sent to the javascript handler. |
| 575 // Each item in the list has the following parameters: |
| 576 // 1. Title (string). |
| 577 // 2. Value (double). |
| 578 // 3. Is selected? (bool). |
| 579 ListValue zoom_factors_value; |
| 580 for (std::vector<double>::const_iterator i = zoom_factors.begin(); |
| 581 i != zoom_factors.end(); ++i) { |
| 582 ListValue* option = new ListValue(); |
| 583 double factor = *i; |
| 584 int percent = static_cast<int>(factor * 100 + 0.5); |
| 585 option->Append(Value::CreateStringValue( |
| 586 l10n_util::GetStringFUTF16Int(IDS_ZOOM_PERCENT, percent))); |
| 587 option->Append(Value::CreateDoubleValue(factor)); |
| 588 bool selected = content::ZoomValuesEqual(factor, default_zoom_factor); |
| 589 option->Append(Value::CreateBooleanValue(selected)); |
| 590 zoom_factors_value.Append(option); |
| 591 } |
| 592 |
| 593 web_ui_->CallJavascriptFunction( |
| 594 "options.AdvancedOptions.SetupPageZoomSelector", zoom_factors_value); |
| 595 } |
| 596 |
545 void AdvancedOptionsHandler::SetupAutoOpenFileTypesDisabledAttribute() { | 597 void AdvancedOptionsHandler::SetupAutoOpenFileTypesDisabledAttribute() { |
546 // Set the enabled state for the AutoOpenFileTypesResetToDefault button. | 598 // Set the enabled state for the AutoOpenFileTypesResetToDefault button. |
547 // We enable the button if the user has any auto-open file types registered. | 599 // We enable the button if the user has any auto-open file types registered. |
548 DownloadManager* manager = | 600 DownloadManager* manager = |
549 web_ui_->tab_contents()->browser_context()->GetDownloadManager(); | 601 web_ui_->tab_contents()->browser_context()->GetDownloadManager(); |
550 bool disabled = !(manager && | 602 bool disabled = !(manager && |
551 DownloadPrefs::FromDownloadManager(manager)->IsAutoOpenUsed()); | 603 DownloadPrefs::FromDownloadManager(manager)->IsAutoOpenUsed()); |
552 base::FundamentalValue value(disabled); | 604 base::FundamentalValue value(disabled); |
553 web_ui_->CallJavascriptFunction( | 605 web_ui_->CallJavascriptFunction( |
554 "options.AdvancedOptions.SetAutoOpenFileTypesDisabledAttribute", value); | 606 "options.AdvancedOptions.SetAutoOpenFileTypesDisabledAttribute", value); |
(...skipping 29 matching lines...) Expand all Loading... |
584 | 636 |
585 void AdvancedOptionsHandler::SetupSSLConfigSettings() { | 637 void AdvancedOptionsHandler::SetupSSLConfigSettings() { |
586 { | 638 { |
587 base::FundamentalValue checked(rev_checking_enabled_.GetValue()); | 639 base::FundamentalValue checked(rev_checking_enabled_.GetValue()); |
588 base::FundamentalValue disabled(rev_checking_enabled_.IsManaged()); | 640 base::FundamentalValue disabled(rev_checking_enabled_.IsManaged()); |
589 web_ui_->CallJavascriptFunction( | 641 web_ui_->CallJavascriptFunction( |
590 "options.AdvancedOptions.SetCheckRevocationCheckboxState", checked, | 642 "options.AdvancedOptions.SetCheckRevocationCheckboxState", checked, |
591 disabled); | 643 disabled); |
592 } | 644 } |
593 } | 645 } |
OLD | NEW |