| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 993 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1004 OnStateChanged(); | 1004 OnStateChanged(); |
| 1005 UpdateDefaultBrowserState(); | 1005 UpdateDefaultBrowserState(); |
| 1006 | 1006 |
| 1007 SetupMetricsReportingSettingVisibility(); | 1007 SetupMetricsReportingSettingVisibility(); |
| 1008 SetupMetricsReportingCheckbox(); | 1008 SetupMetricsReportingCheckbox(); |
| 1009 SetupNetworkPredictionControl(); | 1009 SetupNetworkPredictionControl(); |
| 1010 SetupFontSizeSelector(); | 1010 SetupFontSizeSelector(); |
| 1011 SetupPageZoomSelector(); | 1011 SetupPageZoomSelector(); |
| 1012 SetupAutoOpenFileTypes(); | 1012 SetupAutoOpenFileTypes(); |
| 1013 SetupProxySettingsSection(); | 1013 SetupProxySettingsSection(); |
| 1014 SetupManageCertificatesSection(); | |
| 1015 SetupManagingSupervisedUsers(); | 1014 SetupManagingSupervisedUsers(); |
| 1016 SetupEasyUnlock(); | 1015 SetupEasyUnlock(); |
| 1017 SetupExtensionControlledIndicators(); | 1016 SetupExtensionControlledIndicators(); |
| 1018 | 1017 |
| 1019 #if defined(OS_CHROMEOS) | 1018 #if defined(OS_CHROMEOS) |
| 1020 SetupAccessibilityFeatures(); | 1019 SetupAccessibilityFeatures(); |
| 1021 policy::BrowserPolicyConnectorChromeOS* connector = | 1020 policy::BrowserPolicyConnectorChromeOS* connector = |
| 1022 g_browser_process->platform_part()->browser_policy_connector_chromeos(); | 1021 g_browser_process->platform_part()->browser_policy_connector_chromeos(); |
| 1023 enable_factory_reset_ = !connector->IsEnterpriseManaged() && | 1022 enable_factory_reset_ = !connector->IsEnterpriseManaged() && |
| 1024 !user_manager::UserManager::Get()->IsLoggedInAsGuest() && | 1023 !user_manager::UserManager::Get()->IsLoggedInAsGuest() && |
| (...skipping 938 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1963 web_ui()->GetWebContents()->GetBrowserContext()); | 1962 web_ui()->GetWebContents()->GetBrowserContext()); |
| 1964 bool display = manager && | 1963 bool display = manager && |
| 1965 DownloadPrefs::FromDownloadManager(manager)->IsAutoOpenUsed(); | 1964 DownloadPrefs::FromDownloadManager(manager)->IsAutoOpenUsed(); |
| 1966 base::FundamentalValue value(display); | 1965 base::FundamentalValue value(display); |
| 1967 web_ui()->CallJavascriptFunction( | 1966 web_ui()->CallJavascriptFunction( |
| 1968 "BrowserOptions.setAutoOpenFileTypesDisplayed", value); | 1967 "BrowserOptions.setAutoOpenFileTypesDisplayed", value); |
| 1969 } | 1968 } |
| 1970 | 1969 |
| 1971 void BrowserOptionsHandler::SetupProxySettingsSection() { | 1970 void BrowserOptionsHandler::SetupProxySettingsSection() { |
| 1972 #if !defined(OS_CHROMEOS) | 1971 #if !defined(OS_CHROMEOS) |
| 1973 // Disable the button if proxy settings are managed by a sysadmin, overridden | |
| 1974 // by an extension, or the browser is running in Windows Ash (on Windows the | |
| 1975 // proxy settings dialog will open on the Windows desktop and be invisible | |
| 1976 // to a user in Ash). | |
| 1977 bool is_win_ash = false; | |
| 1978 #if defined(OS_WIN) | |
| 1979 chrome::HostDesktopType desktop_type = helper::GetDesktopType(web_ui()); | |
| 1980 is_win_ash = (desktop_type == chrome::HOST_DESKTOP_TYPE_ASH); | |
| 1981 #endif | |
| 1982 PrefService* pref_service = Profile::FromWebUI(web_ui())->GetPrefs(); | 1972 PrefService* pref_service = Profile::FromWebUI(web_ui())->GetPrefs(); |
| 1983 const PrefService::Preference* proxy_config = | 1973 const PrefService::Preference* proxy_config = |
| 1984 pref_service->FindPreference(proxy_config::prefs::kProxy); | 1974 pref_service->FindPreference(proxy_config::prefs::kProxy); |
| 1985 bool is_extension_controlled = (proxy_config && | 1975 bool is_extension_controlled = (proxy_config && |
| 1986 proxy_config->IsExtensionControlled()); | 1976 proxy_config->IsExtensionControlled()); |
| 1987 | 1977 |
| 1988 base::FundamentalValue disabled(is_win_ash || (proxy_config && | 1978 base::FundamentalValue disabled(proxy_config && |
| 1989 !proxy_config->IsUserModifiable())); | 1979 !proxy_config->IsUserModifiable()); |
| 1990 base::FundamentalValue extension_controlled(is_extension_controlled); | 1980 base::FundamentalValue extension_controlled(is_extension_controlled); |
| 1991 web_ui()->CallJavascriptFunction("BrowserOptions.setupProxySettingsButton", | 1981 web_ui()->CallJavascriptFunction("BrowserOptions.setupProxySettingsButton", |
| 1992 disabled, extension_controlled); | 1982 disabled, extension_controlled); |
| 1993 | 1983 |
| 1994 #if defined(OS_WIN) | 1984 #if defined(OS_WIN) |
| 1995 SetupExtensionControlledIndicators(); | 1985 SetupExtensionControlledIndicators(); |
| 1996 #endif // defined(OS_WIN) | 1986 #endif // defined(OS_WIN) |
| 1997 | 1987 |
| 1998 #endif // !defined(OS_CHROMEOS) | 1988 #endif // !defined(OS_CHROMEOS) |
| 1999 } | 1989 } |
| 2000 | 1990 |
| 2001 void BrowserOptionsHandler::SetupManageCertificatesSection() { | |
| 2002 #if defined(OS_WIN) | |
| 2003 // Disable the button if the settings page is displayed in Windows Ash, | |
| 2004 // otherwise the proxy settings dialog will open on the Windows desktop and | |
| 2005 // be invisible to a user in Ash. | |
| 2006 if (helper::GetDesktopType(web_ui()) == chrome::HOST_DESKTOP_TYPE_ASH) { | |
| 2007 base::FundamentalValue enabled(false); | |
| 2008 web_ui()->CallJavascriptFunction("BrowserOptions.enableCertificateButton", | |
| 2009 enabled); | |
| 2010 } | |
| 2011 #endif // defined(OS_WIN) | |
| 2012 } | |
| 2013 | |
| 2014 void BrowserOptionsHandler::SetupManagingSupervisedUsers() { | 1991 void BrowserOptionsHandler::SetupManagingSupervisedUsers() { |
| 2015 bool has_users = !Profile::FromWebUI(web_ui())-> | 1992 bool has_users = !Profile::FromWebUI(web_ui())-> |
| 2016 GetPrefs()->GetDictionary(prefs::kSupervisedUsers)->empty(); | 1993 GetPrefs()->GetDictionary(prefs::kSupervisedUsers)->empty(); |
| 2017 base::FundamentalValue has_users_value(has_users); | 1994 base::FundamentalValue has_users_value(has_users); |
| 2018 web_ui()->CallJavascriptFunction( | 1995 web_ui()->CallJavascriptFunction( |
| 2019 "BrowserOptions.updateManagesSupervisedUsers", | 1996 "BrowserOptions.updateManagesSupervisedUsers", |
| 2020 has_users_value); | 1997 has_users_value); |
| 2021 } | 1998 } |
| 2022 | 1999 |
| 2023 void BrowserOptionsHandler::SetupEasyUnlock() { | 2000 void BrowserOptionsHandler::SetupEasyUnlock() { |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2145 | 2122 |
| 2146 bool BrowserOptionsHandler::IsDeviceOwnerProfile() { | 2123 bool BrowserOptionsHandler::IsDeviceOwnerProfile() { |
| 2147 #if defined(OS_CHROMEOS) | 2124 #if defined(OS_CHROMEOS) |
| 2148 return chromeos::ProfileHelper::IsOwnerProfile(Profile::FromWebUI(web_ui())); | 2125 return chromeos::ProfileHelper::IsOwnerProfile(Profile::FromWebUI(web_ui())); |
| 2149 #else | 2126 #else |
| 2150 return true; | 2127 return true; |
| 2151 #endif | 2128 #endif |
| 2152 } | 2129 } |
| 2153 | 2130 |
| 2154 } // namespace options | 2131 } // namespace options |
| OLD | NEW |