| 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 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 IDS_RESET_PROFILE_SETTINGS_DESCRIPTION }, | 302 IDS_RESET_PROFILE_SETTINGS_DESCRIPTION }, |
| 303 { "resetProfileSettingsSectionTitle", | 303 { "resetProfileSettingsSectionTitle", |
| 304 IDS_RESET_PROFILE_SETTINGS_SECTION_TITLE }, | 304 IDS_RESET_PROFILE_SETTINGS_SECTION_TITLE }, |
| 305 { "safeBrowsingEnableProtection", | 305 { "safeBrowsingEnableProtection", |
| 306 IDS_OPTIONS_SAFEBROWSING_ENABLEPROTECTION }, | 306 IDS_OPTIONS_SAFEBROWSING_ENABLEPROTECTION }, |
| 307 { "safeBrowsingEnableDownloadFeedback", | 307 { "safeBrowsingEnableDownloadFeedback", |
| 308 IDS_OPTIONS_SAFEBROWSING_ENABLEDOWNLOADFEEDBACK }, | 308 IDS_OPTIONS_SAFEBROWSING_ENABLEDOWNLOADFEEDBACK }, |
| 309 { "sectionTitleAppearance", IDS_APPEARANCE_GROUP_NAME }, | 309 { "sectionTitleAppearance", IDS_APPEARANCE_GROUP_NAME }, |
| 310 { "sectionTitleDefaultBrowser", IDS_OPTIONS_DEFAULTBROWSER_GROUP_NAME }, | 310 { "sectionTitleDefaultBrowser", IDS_OPTIONS_DEFAULTBROWSER_GROUP_NAME }, |
| 311 { "sectionTitleUsers", IDS_PROFILES_OPTIONS_GROUP_NAME }, | 311 { "sectionTitleUsers", IDS_PROFILES_OPTIONS_GROUP_NAME }, |
| 312 { "sectionTitleProxy", IDS_OPTIONS_PROXY_GROUP_NAME }, | |
| 313 { "sectionTitleSearch", IDS_OPTIONS_DEFAULTSEARCH_GROUP_NAME }, | 312 { "sectionTitleSearch", IDS_OPTIONS_DEFAULTSEARCH_GROUP_NAME }, |
| 314 { "sectionTitleStartup", IDS_OPTIONS_STARTUP_GROUP_NAME }, | 313 { "sectionTitleStartup", IDS_OPTIONS_STARTUP_GROUP_NAME }, |
| 315 { "sectionTitleSync", IDS_SYNC_OPTIONS_GROUP_NAME }, | 314 { "sectionTitleSync", IDS_SYNC_OPTIONS_GROUP_NAME }, |
| 316 { "spellingConfirmMessage", IDS_CONTENT_CONTEXT_SPELLING_BUBBLE_TEXT }, | 315 { "spellingConfirmMessage", IDS_CONTENT_CONTEXT_SPELLING_BUBBLE_TEXT }, |
| 317 { "spellingConfirmEnable", IDS_CONTENT_CONTEXT_SPELLING_BUBBLE_ENABLE }, | 316 { "spellingConfirmEnable", IDS_CONTENT_CONTEXT_SPELLING_BUBBLE_ENABLE }, |
| 318 { "spellingConfirmDisable", IDS_CONTENT_CONTEXT_SPELLING_BUBBLE_DISABLE }, | 317 { "spellingConfirmDisable", IDS_CONTENT_CONTEXT_SPELLING_BUBBLE_DISABLE }, |
| 319 { "spellingPref", IDS_OPTIONS_SPELLING_PREF }, | 318 { "spellingPref", IDS_OPTIONS_SPELLING_PREF }, |
| 320 { "startupRestoreLastSession", IDS_OPTIONS_STARTUP_RESTORE_LAST_SESSION }, | 319 { "startupRestoreLastSession", IDS_OPTIONS_STARTUP_RESTORE_LAST_SESSION }, |
| 321 { "settingsTitle", IDS_SETTINGS_TITLE }, | 320 { "settingsTitle", IDS_SETTINGS_TITLE }, |
| 322 { "showAdvancedSettings", IDS_SETTINGS_SHOW_ADVANCED_SETTINGS }, | 321 { "showAdvancedSettings", IDS_SETTINGS_SHOW_ADVANCED_SETTINGS }, |
| (...skipping 1378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1701 #endif | 1700 #endif |
| 1702 PrefService* pref_service = Profile::FromWebUI(web_ui())->GetPrefs(); | 1701 PrefService* pref_service = Profile::FromWebUI(web_ui())->GetPrefs(); |
| 1703 const PrefService::Preference* proxy_config = | 1702 const PrefService::Preference* proxy_config = |
| 1704 pref_service->FindPreference(prefs::kProxy); | 1703 pref_service->FindPreference(prefs::kProxy); |
| 1705 bool is_extension_controlled = (proxy_config && | 1704 bool is_extension_controlled = (proxy_config && |
| 1706 proxy_config->IsExtensionControlled()); | 1705 proxy_config->IsExtensionControlled()); |
| 1707 | 1706 |
| 1708 base::FundamentalValue disabled(is_win_ash || (proxy_config && | 1707 base::FundamentalValue disabled(is_win_ash || (proxy_config && |
| 1709 !proxy_config->IsUserModifiable())); | 1708 !proxy_config->IsUserModifiable())); |
| 1710 base::FundamentalValue extension_controlled(is_extension_controlled); | 1709 base::FundamentalValue extension_controlled(is_extension_controlled); |
| 1711 web_ui()->CallJavascriptFunction("BrowserOptions.setupProxySettingsButton", | 1710 web_ui()->CallJavascriptFunction("BrowserOptions.setupProxySettingsSection", |
| 1712 disabled, extension_controlled); | 1711 disabled, extension_controlled); |
| 1713 | 1712 |
| 1714 #if defined(OS_WIN) | |
| 1715 SetupExtensionControlledIndicators(); | |
| 1716 #endif // defined(OS_WIN) | |
| 1717 | |
| 1718 #endif // !defined(OS_CHROMEOS) | 1713 #endif // !defined(OS_CHROMEOS) |
| 1719 } | 1714 } |
| 1720 | 1715 |
| 1721 void BrowserOptionsHandler::SetupManageCertificatesSection() { | 1716 void BrowserOptionsHandler::SetupManageCertificatesSection() { |
| 1722 #if defined(OS_WIN) | 1717 #if defined(OS_WIN) |
| 1723 // Disable the button if the settings page is displayed in Windows Ash, | 1718 // Disable the button if the settings page is displayed in Windows Ash, |
| 1724 // otherwise the proxy settings dialog will open on the Windows desktop and | 1719 // otherwise the proxy settings dialog will open on the Windows desktop and |
| 1725 // be invisible to a user in Ash. | 1720 // be invisible to a user in Ash. |
| 1726 if (helper::GetDesktopType(web_ui()) == chrome::HOST_DESKTOP_TYPE_ASH) { | 1721 if (helper::GetDesktopType(web_ui()) == chrome::HOST_DESKTOP_TYPE_ASH) { |
| 1727 base::FundamentalValue enabled(false); | 1722 base::FundamentalValue enabled(false); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 1747 web_ui()->CallJavascriptFunction( | 1742 web_ui()->CallJavascriptFunction( |
| 1748 "BrowserOptions.updateEasyUnlock", | 1743 "BrowserOptions.updateEasyUnlock", |
| 1749 has_pairing_value); | 1744 has_pairing_value); |
| 1750 } | 1745 } |
| 1751 | 1746 |
| 1752 void BrowserOptionsHandler::SetupExtensionControlledIndicators() { | 1747 void BrowserOptionsHandler::SetupExtensionControlledIndicators() { |
| 1753 #if defined(OS_WIN) | 1748 #if defined(OS_WIN) |
| 1754 base::DictionaryValue extension_controlled; | 1749 base::DictionaryValue extension_controlled; |
| 1755 | 1750 |
| 1756 // Check if an extension is overriding the Search Engine. | 1751 // Check if an extension is overriding the Search Engine. |
| 1757 const extensions::Extension* extension = | 1752 const extensions::Extension* extension = extensions::OverridesSearchEngine( |
| 1758 extensions::GetExtensionOverridingSearchEngine( | 1753 Profile::FromWebUI(web_ui()), NULL); |
| 1759 Profile::FromWebUI(web_ui()), NULL); | |
| 1760 AppendExtensionData("searchEngine", extension, &extension_controlled); | 1754 AppendExtensionData("searchEngine", extension, &extension_controlled); |
| 1761 | 1755 |
| 1762 // Check if an extension is overriding the Home page. | 1756 // Check if an extension is overriding the Home page. |
| 1763 extension = extensions::GetExtensionOverridingHomepage( | 1757 extension = extensions::OverridesHomepage(Profile::FromWebUI(web_ui()), NULL); |
| 1764 Profile::FromWebUI(web_ui()), NULL); | |
| 1765 AppendExtensionData("homePage", extension, &extension_controlled); | 1758 AppendExtensionData("homePage", extension, &extension_controlled); |
| 1766 | 1759 |
| 1767 // Check if an extension is overriding the Startup pages. | 1760 // Check if an extension is overriding the Startup pages. |
| 1768 extension = extensions::GetExtensionOverridingStartupPages( | 1761 extension = extensions::OverridesStartupPages( |
| 1769 Profile::FromWebUI(web_ui()), NULL); | 1762 Profile::FromWebUI(web_ui()), NULL); |
| 1770 AppendExtensionData("startUpPage", extension, &extension_controlled); | 1763 AppendExtensionData("startUpPage", extension, &extension_controlled); |
| 1771 | 1764 |
| 1772 // Check if an extension is overriding the NTP page. | 1765 // Check if an extension is overriding the NTP page. |
| 1773 GURL ntp_url(chrome::kChromeUINewTabURL); | 1766 GURL ntp_url(chrome::kChromeUINewTabURL); |
| 1774 bool ignored_param; | 1767 bool ignored_param; |
| 1775 extension = NULL; | 1768 extension = NULL; |
| 1776 content::BrowserURLHandler::GetInstance()->RewriteURLIfNecessary( | 1769 content::BrowserURLHandler::GetInstance()->RewriteURLIfNecessary( |
| 1777 &ntp_url, | 1770 &ntp_url, |
| 1778 web_ui()->GetWebContents()->GetBrowserContext(), | 1771 web_ui()->GetWebContents()->GetBrowserContext(), |
| 1779 &ignored_param); | 1772 &ignored_param); |
| 1780 if (ntp_url.SchemeIs("chrome-extension")) { | 1773 if (ntp_url.SchemeIs("chrome-extension")) { |
| 1781 using extensions::ExtensionRegistry; | 1774 using extensions::ExtensionRegistry; |
| 1782 ExtensionRegistry* registry = ExtensionRegistry::Get( | 1775 ExtensionRegistry* registry = ExtensionRegistry::Get( |
| 1783 Profile::FromWebUI(web_ui())); | 1776 Profile::FromWebUI(web_ui())); |
| 1784 extension = registry->GetExtensionById(ntp_url.host(), | 1777 extension = registry->GetExtensionById(ntp_url.host(), |
| 1785 ExtensionRegistry::ENABLED); | 1778 ExtensionRegistry::ENABLED); |
| 1786 } | 1779 } |
| 1787 AppendExtensionData("newTabPage", extension, &extension_controlled); | 1780 AppendExtensionData("newTabPage", extension, &extension_controlled); |
| 1788 | 1781 |
| 1789 // Check if an extension is overwriting the proxy setting. | |
| 1790 extension = extensions::GetExtensionOverridingProxy( | |
| 1791 Profile::FromWebUI(web_ui())); | |
| 1792 AppendExtensionData("proxy", extension, &extension_controlled); | |
| 1793 | |
| 1794 web_ui()->CallJavascriptFunction("BrowserOptions.toggleExtensionIndicators", | 1782 web_ui()->CallJavascriptFunction("BrowserOptions.toggleExtensionIndicators", |
| 1795 extension_controlled); | 1783 extension_controlled); |
| 1796 #endif // defined(OS_WIN) | 1784 #endif // defined(OS_WIN) |
| 1797 } | 1785 } |
| 1798 | 1786 |
| 1799 } // namespace options | 1787 } // namespace options |
| OLD | NEW |