| 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/options/browser_options_handler.h" | 5 #include "chrome/browser/ui/webui/options/browser_options_handler.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "apps/app_window.h" | 10 #include "apps/app_window.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 #include "base/value_conversions.h" | 25 #include "base/value_conversions.h" |
| 26 #include "base/values.h" | 26 #include "base/values.h" |
| 27 #include "chrome/browser/auto_launch_trial.h" | 27 #include "chrome/browser/auto_launch_trial.h" |
| 28 #include "chrome/browser/browser_process.h" | 28 #include "chrome/browser/browser_process.h" |
| 29 #include "chrome/browser/chrome_notification_types.h" | 29 #include "chrome/browser/chrome_notification_types.h" |
| 30 #include "chrome/browser/chrome_page_zoom.h" | 30 #include "chrome/browser/chrome_page_zoom.h" |
| 31 #include "chrome/browser/custom_home_pages_table_model.h" | 31 #include "chrome/browser/custom_home_pages_table_model.h" |
| 32 #include "chrome/browser/download/download_prefs.h" | 32 #include "chrome/browser/download/download_prefs.h" |
| 33 #include "chrome/browser/gpu/gpu_mode_manager.h" | 33 #include "chrome/browser/gpu/gpu_mode_manager.h" |
| 34 #include "chrome/browser/lifetime/application_lifetime.h" | 34 #include "chrome/browser/lifetime/application_lifetime.h" |
| 35 #include "chrome/browser/net/prediction_options.h" |
| 35 #include "chrome/browser/prefs/session_startup_pref.h" | 36 #include "chrome/browser/prefs/session_startup_pref.h" |
| 36 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service.h" | 37 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service.h" |
| 37 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service_factory.
h" | 38 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service_factory.
h" |
| 38 #include "chrome/browser/profile_resetter/automatic_profile_resetter.h" | 39 #include "chrome/browser/profile_resetter/automatic_profile_resetter.h" |
| 39 #include "chrome/browser/profile_resetter/automatic_profile_resetter_factory.h" | 40 #include "chrome/browser/profile_resetter/automatic_profile_resetter_factory.h" |
| 40 #include "chrome/browser/profiles/profile.h" | 41 #include "chrome/browser/profiles/profile.h" |
| 41 #include "chrome/browser/profiles/profile_avatar_icon_util.h" | 42 #include "chrome/browser/profiles/profile_avatar_icon_util.h" |
| 42 #include "chrome/browser/profiles/profile_info_cache.h" | 43 #include "chrome/browser/profiles/profile_info_cache.h" |
| 43 #include "chrome/browser/profiles/profile_manager.h" | 44 #include "chrome/browser/profiles/profile_manager.h" |
| 44 #include "chrome/browser/profiles/profile_metrics.h" | 45 #include "chrome/browser/profiles/profile_metrics.h" |
| (...skipping 788 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 833 auto_open_files_.Init( | 834 auto_open_files_.Init( |
| 834 prefs::kDownloadExtensionsToOpen, prefs, | 835 prefs::kDownloadExtensionsToOpen, prefs, |
| 835 base::Bind(&BrowserOptionsHandler::SetupAutoOpenFileTypes, | 836 base::Bind(&BrowserOptionsHandler::SetupAutoOpenFileTypes, |
| 836 base::Unretained(this))); | 837 base::Unretained(this))); |
| 837 default_zoom_level_.Init( | 838 default_zoom_level_.Init( |
| 838 prefs::kDefaultZoomLevel, prefs, | 839 prefs::kDefaultZoomLevel, prefs, |
| 839 base::Bind(&BrowserOptionsHandler::SetupPageZoomSelector, | 840 base::Bind(&BrowserOptionsHandler::SetupPageZoomSelector, |
| 840 base::Unretained(this))); | 841 base::Unretained(this))); |
| 841 profile_pref_registrar_.Init(prefs); | 842 profile_pref_registrar_.Init(prefs); |
| 842 profile_pref_registrar_.Add( | 843 profile_pref_registrar_.Add( |
| 844 prefs::kNetworkPredictionOptions, |
| 845 base::Bind(&BrowserOptionsHandler::SetupNetworkPredictionControl, |
| 846 base::Unretained(this))); |
| 847 profile_pref_registrar_.Add( |
| 843 prefs::kWebKitDefaultFontSize, | 848 prefs::kWebKitDefaultFontSize, |
| 844 base::Bind(&BrowserOptionsHandler::SetupFontSizeSelector, | 849 base::Bind(&BrowserOptionsHandler::SetupFontSizeSelector, |
| 845 base::Unretained(this))); | 850 base::Unretained(this))); |
| 846 profile_pref_registrar_.Add( | 851 profile_pref_registrar_.Add( |
| 847 prefs::kWebKitDefaultFixedFontSize, | 852 prefs::kWebKitDefaultFixedFontSize, |
| 848 base::Bind(&BrowserOptionsHandler::SetupFontSizeSelector, | 853 base::Bind(&BrowserOptionsHandler::SetupFontSizeSelector, |
| 849 base::Unretained(this))); | 854 base::Unretained(this))); |
| 850 profile_pref_registrar_.Add( | 855 profile_pref_registrar_.Add( |
| 851 prefs::kSupervisedUsers, | 856 prefs::kSupervisedUsers, |
| 852 base::Bind(&BrowserOptionsHandler::SetupManagingSupervisedUsers, | 857 base::Bind(&BrowserOptionsHandler::SetupManagingSupervisedUsers, |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 897 void BrowserOptionsHandler::InitializePage() { | 902 void BrowserOptionsHandler::InitializePage() { |
| 898 page_initialized_ = true; | 903 page_initialized_ = true; |
| 899 | 904 |
| 900 OnTemplateURLServiceChanged(); | 905 OnTemplateURLServiceChanged(); |
| 901 | 906 |
| 902 ObserveThemeChanged(); | 907 ObserveThemeChanged(); |
| 903 OnStateChanged(); | 908 OnStateChanged(); |
| 904 UpdateDefaultBrowserState(); | 909 UpdateDefaultBrowserState(); |
| 905 | 910 |
| 906 SetupMetricsReportingSettingVisibility(); | 911 SetupMetricsReportingSettingVisibility(); |
| 912 SetupNetworkPredictionControl(); |
| 907 SetupFontSizeSelector(); | 913 SetupFontSizeSelector(); |
| 908 SetupPageZoomSelector(); | 914 SetupPageZoomSelector(); |
| 909 SetupAutoOpenFileTypes(); | 915 SetupAutoOpenFileTypes(); |
| 910 SetupProxySettingsSection(); | 916 SetupProxySettingsSection(); |
| 911 SetupManageCertificatesSection(); | 917 SetupManageCertificatesSection(); |
| 912 SetupManagingSupervisedUsers(); | 918 SetupManagingSupervisedUsers(); |
| 913 SetupEasyUnlock(); | 919 SetupEasyUnlock(); |
| 914 SetupExtensionControlledIndicators(); | 920 SetupExtensionControlledIndicators(); |
| 915 | 921 |
| 916 #if defined(OS_CHROMEOS) | 922 #if defined(OS_CHROMEOS) |
| (...skipping 736 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1653 #if defined(GOOGLE_CHROME_BUILD) | 1659 #if defined(GOOGLE_CHROME_BUILD) |
| 1654 // Don't show the reporting setting if we are in the guest mode. | 1660 // Don't show the reporting setting if we are in the guest mode. |
| 1655 if (Profile::FromWebUI(web_ui())->IsGuestSession()) { | 1661 if (Profile::FromWebUI(web_ui())->IsGuestSession()) { |
| 1656 base::FundamentalValue visible(false); | 1662 base::FundamentalValue visible(false); |
| 1657 web_ui()->CallJavascriptFunction( | 1663 web_ui()->CallJavascriptFunction( |
| 1658 "BrowserOptions.setMetricsReportingSettingVisibility", visible); | 1664 "BrowserOptions.setMetricsReportingSettingVisibility", visible); |
| 1659 } | 1665 } |
| 1660 #endif | 1666 #endif |
| 1661 } | 1667 } |
| 1662 | 1668 |
| 1669 void BrowserOptionsHandler::SetupNetworkPredictionControl() { |
| 1670 PrefService* pref_service = Profile::FromWebUI(web_ui())->GetPrefs(); |
| 1671 |
| 1672 base::DictionaryValue dict; |
| 1673 dict.SetInteger("value", |
| 1674 pref_service->GetInteger(prefs::kNetworkPredictionOptions)); |
| 1675 dict.SetBoolean("disabled", |
| 1676 !pref_service->IsUserModifiablePreference( |
| 1677 prefs::kNetworkPredictionOptions)); |
| 1678 |
| 1679 web_ui()->CallJavascriptFunction("BrowserOptions.setNetworkPredictionValue", |
| 1680 dict); |
| 1681 } |
| 1682 |
| 1663 void BrowserOptionsHandler::SetupFontSizeSelector() { | 1683 void BrowserOptionsHandler::SetupFontSizeSelector() { |
| 1664 PrefService* pref_service = Profile::FromWebUI(web_ui())->GetPrefs(); | 1684 PrefService* pref_service = Profile::FromWebUI(web_ui())->GetPrefs(); |
| 1665 const PrefService::Preference* default_font_size = | 1685 const PrefService::Preference* default_font_size = |
| 1666 pref_service->FindPreference(prefs::kWebKitDefaultFontSize); | 1686 pref_service->FindPreference(prefs::kWebKitDefaultFontSize); |
| 1667 const PrefService::Preference* default_fixed_font_size = | 1687 const PrefService::Preference* default_fixed_font_size = |
| 1668 pref_service->FindPreference(prefs::kWebKitDefaultFixedFontSize); | 1688 pref_service->FindPreference(prefs::kWebKitDefaultFixedFontSize); |
| 1669 | 1689 |
| 1670 base::DictionaryValue dict; | 1690 base::DictionaryValue dict; |
| 1671 dict.SetInteger("value", | 1691 dict.SetInteger("value", |
| 1672 pref_service->GetInteger(prefs::kWebKitDefaultFontSize)); | 1692 pref_service->GetInteger(prefs::kWebKitDefaultFontSize)); |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1841 extension = extensions::GetExtensionOverridingProxy( | 1861 extension = extensions::GetExtensionOverridingProxy( |
| 1842 Profile::FromWebUI(web_ui())); | 1862 Profile::FromWebUI(web_ui())); |
| 1843 AppendExtensionData("proxy", extension, &extension_controlled); | 1863 AppendExtensionData("proxy", extension, &extension_controlled); |
| 1844 | 1864 |
| 1845 web_ui()->CallJavascriptFunction("BrowserOptions.toggleExtensionIndicators", | 1865 web_ui()->CallJavascriptFunction("BrowserOptions.toggleExtensionIndicators", |
| 1846 extension_controlled); | 1866 extension_controlled); |
| 1847 #endif // defined(OS_WIN) | 1867 #endif // defined(OS_WIN) |
| 1848 } | 1868 } |
| 1849 | 1869 |
| 1850 } // namespace options | 1870 } // namespace options |
| OLD | NEW |