OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/options2/browser_options_handler2.h" | 5 #include "chrome/browser/ui/webui/options2/browser_options_handler2.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" |
(...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
558 content::NotificationService::AllSources()); | 558 content::NotificationService::AllSources()); |
559 #if defined(OS_CHROMEOS) | 559 #if defined(OS_CHROMEOS) |
560 registrar_.Add(this, chrome::NOTIFICATION_LOGIN_USER_IMAGE_CHANGED, | 560 registrar_.Add(this, chrome::NOTIFICATION_LOGIN_USER_IMAGE_CHANGED, |
561 content::NotificationService::AllSources()); | 561 content::NotificationService::AllSources()); |
562 #endif | 562 #endif |
563 registrar_.Add(this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED, | 563 registrar_.Add(this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED, |
564 content::Source<ThemeService>( | 564 content::Source<ThemeService>( |
565 ThemeServiceFactory::GetForProfile(profile))); | 565 ThemeServiceFactory::GetForProfile(profile))); |
566 | 566 |
567 UpdateSearchEngines(); | 567 UpdateSearchEngines(); |
568 ObserveThemeChanged(); | |
569 | 568 |
570 #if defined(OS_WIN) | 569 #if defined(OS_WIN) |
571 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 570 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
572 if (!command_line.HasSwitch(switches::kChromeFrame) && | 571 if (!command_line.HasSwitch(switches::kChromeFrame) && |
573 !command_line.HasSwitch(switches::kUserDataDir)) { | 572 !command_line.HasSwitch(switches::kUserDataDir)) { |
574 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, | 573 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, |
575 base::Bind(&BrowserOptionsHandler::CheckAutoLaunch, | 574 base::Bind(&BrowserOptionsHandler::CheckAutoLaunch, |
576 weak_ptr_factory_for_ui_.GetWeakPtr(), | 575 weak_ptr_factory_for_ui_.GetWeakPtr(), |
577 weak_ptr_factory_for_file_.GetWeakPtr(), | 576 weak_ptr_factory_for_file_.GetWeakPtr(), |
578 profile->GetPath())); | 577 profile->GetPath())); |
(...skipping 17 matching lines...) Expand all Loading... | |
596 g_browser_process->local_state(), this); | 595 g_browser_process->local_state(), this); |
597 #endif | 596 #endif |
598 | 597 |
599 auto_open_files_.Init(prefs::kDownloadExtensionsToOpen, prefs, this); | 598 auto_open_files_.Init(prefs::kDownloadExtensionsToOpen, prefs, this); |
600 default_font_size_.Init(prefs::kWebKitGlobalDefaultFontSize, prefs, this); | 599 default_font_size_.Init(prefs::kWebKitGlobalDefaultFontSize, prefs, this); |
601 default_zoom_level_.Init(prefs::kDefaultZoomLevel, prefs, this); | 600 default_zoom_level_.Init(prefs::kDefaultZoomLevel, prefs, this); |
602 #if !defined(OS_CHROMEOS) | 601 #if !defined(OS_CHROMEOS) |
603 proxy_prefs_.reset( | 602 proxy_prefs_.reset( |
604 PrefSetObserver::CreateProxyPrefSetObserver(prefs, this)); | 603 PrefSetObserver::CreateProxyPrefSetObserver(prefs, this)); |
605 #endif // !defined(OS_CHROMEOS) | 604 #endif // !defined(OS_CHROMEOS) |
605 } | |
606 | |
607 void BrowserOptionsHandler::SendPageValues() { | |
608 OnTemplateURLServiceChanged(); | |
609 ObserveThemeChanged(); | |
610 | |
611 if (multiprofile_) | |
612 SendProfilesInfo(); | |
606 | 613 |
607 SetupMetricsReportingCheckbox(); | 614 SetupMetricsReportingCheckbox(); |
608 SetupMetricsReportingSettingVisibility(); | 615 SetupMetricsReportingSettingVisibility(); |
609 SetupFontSizeSelector(); | 616 SetupFontSizeSelector(); |
610 SetupPageZoomSelector(); | 617 SetupPageZoomSelector(); |
611 SetupAutoOpenFileTypesDisabledAttribute(); | 618 SetupAutoOpenFileTypesDisabledAttribute(); |
612 SetupProxySettingsSection(); | 619 SetupProxySettingsSection(); |
613 SetupSSLConfigSettings(); | 620 SetupSSLConfigSettings(); |
614 #if !defined(OS_CHROMEOS) | 621 #if !defined(OS_CHROMEOS) |
615 if (cloud_print_connector_ui_enabled_) { | 622 if (cloud_print_connector_ui_enabled_) { |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
795 | 802 |
796 std::vector<const TemplateURL*> model_urls = | 803 std::vector<const TemplateURL*> model_urls = |
797 template_url_service_->GetTemplateURLs(); | 804 template_url_service_->GetTemplateURLs(); |
798 if (selected_index >= 0 && | 805 if (selected_index >= 0 && |
799 selected_index < static_cast<int>(model_urls.size())) | 806 selected_index < static_cast<int>(model_urls.size())) |
800 template_url_service_->SetDefaultSearchProvider(model_urls[selected_index]); | 807 template_url_service_->SetDefaultSearchProvider(model_urls[selected_index]); |
801 | 808 |
802 content::RecordAction(UserMetricsAction("Options_SearchEngineChanged")); | 809 content::RecordAction(UserMetricsAction("Options_SearchEngineChanged")); |
803 } | 810 } |
804 | 811 |
805 void BrowserOptionsHandler::UpdateSearchEngines() { | 812 void BrowserOptionsHandler::UpdateSearchEngines() { |
Evan Stade
2012/03/13 20:44:50
this function name could probably be improved
Dan Beam
2012/03/13 23:01:45
Done.
| |
806 template_url_service_ = | 813 template_url_service_ = |
807 TemplateURLServiceFactory::GetForProfile(Profile::FromWebUI(web_ui())); | 814 TemplateURLServiceFactory::GetForProfile(Profile::FromWebUI(web_ui())); |
808 if (template_url_service_) { | 815 if (template_url_service_) { |
809 template_url_service_->Load(); | 816 template_url_service_->Load(); |
810 template_url_service_->AddObserver(this); | 817 template_url_service_->AddObserver(this); |
811 OnTemplateURLServiceChanged(); | |
812 } | 818 } |
813 } | 819 } |
814 | 820 |
815 void BrowserOptionsHandler::Observe( | 821 void BrowserOptionsHandler::Observe( |
816 int type, | 822 int type, |
817 const content::NotificationSource& source, | 823 const content::NotificationSource& source, |
818 const content::NotificationDetails& details) { | 824 const content::NotificationDetails& details) { |
819 if (type == chrome::NOTIFICATION_BROWSER_THEME_CHANGED) { | 825 if (type == chrome::NOTIFICATION_BROWSER_THEME_CHANGED) { |
820 ObserveThemeChanged(); | 826 ObserveThemeChanged(); |
821 #if defined(OS_CHROMEOS) | 827 #if defined(OS_CHROMEOS) |
(...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1370 } | 1376 } |
1371 | 1377 |
1372 void BrowserOptionsHandler::SetupSSLConfigSettings() { | 1378 void BrowserOptionsHandler::SetupSSLConfigSettings() { |
1373 base::FundamentalValue checked(rev_checking_enabled_.GetValue()); | 1379 base::FundamentalValue checked(rev_checking_enabled_.GetValue()); |
1374 base::FundamentalValue disabled(rev_checking_enabled_.IsManaged()); | 1380 base::FundamentalValue disabled(rev_checking_enabled_.IsManaged()); |
1375 web_ui()->CallJavascriptFunction( | 1381 web_ui()->CallJavascriptFunction( |
1376 "BrowserOptions.setCheckRevocationCheckboxState", checked, disabled); | 1382 "BrowserOptions.setCheckRevocationCheckboxState", checked, disabled); |
1377 } | 1383 } |
1378 | 1384 |
1379 } // namespace options2 | 1385 } // namespace options2 |
OLD | NEW |