Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Side by Side Diff: chrome/browser/ui/webui/options/browser_options_handler.cc

Issue 288923004: Add an extension override bubble and warning box for proxy extensions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address review comments Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 IDS_RESET_PROFILE_SETTINGS_DESCRIPTION }, 303 IDS_RESET_PROFILE_SETTINGS_DESCRIPTION },
304 { "resetProfileSettingsSectionTitle", 304 { "resetProfileSettingsSectionTitle",
305 IDS_RESET_PROFILE_SETTINGS_SECTION_TITLE }, 305 IDS_RESET_PROFILE_SETTINGS_SECTION_TITLE },
306 { "safeBrowsingEnableProtection", 306 { "safeBrowsingEnableProtection",
307 IDS_OPTIONS_SAFEBROWSING_ENABLEPROTECTION }, 307 IDS_OPTIONS_SAFEBROWSING_ENABLEPROTECTION },
308 { "safeBrowsingEnableDownloadFeedback", 308 { "safeBrowsingEnableDownloadFeedback",
309 IDS_OPTIONS_SAFEBROWSING_ENABLEDOWNLOADFEEDBACK }, 309 IDS_OPTIONS_SAFEBROWSING_ENABLEDOWNLOADFEEDBACK },
310 { "sectionTitleAppearance", IDS_APPEARANCE_GROUP_NAME }, 310 { "sectionTitleAppearance", IDS_APPEARANCE_GROUP_NAME },
311 { "sectionTitleDefaultBrowser", IDS_OPTIONS_DEFAULTBROWSER_GROUP_NAME }, 311 { "sectionTitleDefaultBrowser", IDS_OPTIONS_DEFAULTBROWSER_GROUP_NAME },
312 { "sectionTitleUsers", IDS_PROFILES_OPTIONS_GROUP_NAME }, 312 { "sectionTitleUsers", IDS_PROFILES_OPTIONS_GROUP_NAME },
313 { "sectionTitleProxy", IDS_OPTIONS_PROXY_GROUP_NAME },
313 { "sectionTitleSearch", IDS_OPTIONS_DEFAULTSEARCH_GROUP_NAME }, 314 { "sectionTitleSearch", IDS_OPTIONS_DEFAULTSEARCH_GROUP_NAME },
314 { "sectionTitleStartup", IDS_OPTIONS_STARTUP_GROUP_NAME }, 315 { "sectionTitleStartup", IDS_OPTIONS_STARTUP_GROUP_NAME },
315 { "sectionTitleSync", IDS_SYNC_OPTIONS_GROUP_NAME }, 316 { "sectionTitleSync", IDS_SYNC_OPTIONS_GROUP_NAME },
316 { "spellingConfirmMessage", IDS_CONTENT_CONTEXT_SPELLING_BUBBLE_TEXT }, 317 { "spellingConfirmMessage", IDS_CONTENT_CONTEXT_SPELLING_BUBBLE_TEXT },
317 { "spellingConfirmEnable", IDS_CONTENT_CONTEXT_SPELLING_BUBBLE_ENABLE }, 318 { "spellingConfirmEnable", IDS_CONTENT_CONTEXT_SPELLING_BUBBLE_ENABLE },
318 { "spellingConfirmDisable", IDS_CONTENT_CONTEXT_SPELLING_BUBBLE_DISABLE }, 319 { "spellingConfirmDisable", IDS_CONTENT_CONTEXT_SPELLING_BUBBLE_DISABLE },
319 { "spellingPref", IDS_OPTIONS_SPELLING_PREF }, 320 { "spellingPref", IDS_OPTIONS_SPELLING_PREF },
320 { "startupRestoreLastSession", IDS_OPTIONS_STARTUP_RESTORE_LAST_SESSION }, 321 { "startupRestoreLastSession", IDS_OPTIONS_STARTUP_RESTORE_LAST_SESSION },
321 { "settingsTitle", IDS_SETTINGS_TITLE }, 322 { "settingsTitle", IDS_SETTINGS_TITLE },
322 { "showAdvancedSettings", IDS_SETTINGS_SHOW_ADVANCED_SETTINGS }, 323 { "showAdvancedSettings", IDS_SETTINGS_SHOW_ADVANCED_SETTINGS },
(...skipping 1380 matching lines...) Expand 10 before | Expand all | Expand 10 after
1703 #endif 1704 #endif
1704 PrefService* pref_service = Profile::FromWebUI(web_ui())->GetPrefs(); 1705 PrefService* pref_service = Profile::FromWebUI(web_ui())->GetPrefs();
1705 const PrefService::Preference* proxy_config = 1706 const PrefService::Preference* proxy_config =
1706 pref_service->FindPreference(prefs::kProxy); 1707 pref_service->FindPreference(prefs::kProxy);
1707 bool is_extension_controlled = (proxy_config && 1708 bool is_extension_controlled = (proxy_config &&
1708 proxy_config->IsExtensionControlled()); 1709 proxy_config->IsExtensionControlled());
1709 1710
1710 base::FundamentalValue disabled(is_win_ash || (proxy_config && 1711 base::FundamentalValue disabled(is_win_ash || (proxy_config &&
1711 !proxy_config->IsUserModifiable())); 1712 !proxy_config->IsUserModifiable()));
1712 base::FundamentalValue extension_controlled(is_extension_controlled); 1713 base::FundamentalValue extension_controlled(is_extension_controlled);
1713 web_ui()->CallJavascriptFunction("BrowserOptions.setupProxySettingsSection", 1714 web_ui()->CallJavascriptFunction("BrowserOptions.setupProxySettingsButton",
1714 disabled, extension_controlled); 1715 disabled, extension_controlled);
1715 1716
1717 #if defined(OS_WIN)
1718 SetupExtensionControlledIndicators();
1719 #endif // defined(OS_WIN)
1720
1716 #endif // !defined(OS_CHROMEOS) 1721 #endif // !defined(OS_CHROMEOS)
1717 } 1722 }
1718 1723
1719 void BrowserOptionsHandler::SetupManageCertificatesSection() { 1724 void BrowserOptionsHandler::SetupManageCertificatesSection() {
1720 #if defined(OS_WIN) 1725 #if defined(OS_WIN)
1721 // Disable the button if the settings page is displayed in Windows Ash, 1726 // Disable the button if the settings page is displayed in Windows Ash,
1722 // otherwise the proxy settings dialog will open on the Windows desktop and 1727 // otherwise the proxy settings dialog will open on the Windows desktop and
1723 // be invisible to a user in Ash. 1728 // be invisible to a user in Ash.
1724 if (helper::GetDesktopType(web_ui()) == chrome::HOST_DESKTOP_TYPE_ASH) { 1729 if (helper::GetDesktopType(web_ui()) == chrome::HOST_DESKTOP_TYPE_ASH) {
1725 base::FundamentalValue enabled(false); 1730 base::FundamentalValue enabled(false);
(...skipping 19 matching lines...) Expand all
1745 web_ui()->CallJavascriptFunction( 1750 web_ui()->CallJavascriptFunction(
1746 "BrowserOptions.updateEasyUnlock", 1751 "BrowserOptions.updateEasyUnlock",
1747 has_pairing_value); 1752 has_pairing_value);
1748 } 1753 }
1749 1754
1750 void BrowserOptionsHandler::SetupExtensionControlledIndicators() { 1755 void BrowserOptionsHandler::SetupExtensionControlledIndicators() {
1751 #if defined(OS_WIN) 1756 #if defined(OS_WIN)
1752 base::DictionaryValue extension_controlled; 1757 base::DictionaryValue extension_controlled;
1753 1758
1754 // Check if an extension is overriding the Search Engine. 1759 // Check if an extension is overriding the Search Engine.
1755 const extensions::Extension* extension = extensions::OverridesSearchEngine( 1760 const extensions::Extension* extension =
1756 Profile::FromWebUI(web_ui()), NULL); 1761 extensions::GetExtensionOverridingSearchEngine(
1762 Profile::FromWebUI(web_ui()), NULL);
1757 AppendExtensionData("searchEngine", extension, &extension_controlled); 1763 AppendExtensionData("searchEngine", extension, &extension_controlled);
1758 1764
1759 // Check if an extension is overriding the Home page. 1765 // Check if an extension is overriding the Home page.
1760 extension = extensions::OverridesHomepage(Profile::FromWebUI(web_ui()), NULL); 1766 extension = extensions::GetExtensionOverridingHomepage(
1767 Profile::FromWebUI(web_ui()), NULL);
1761 AppendExtensionData("homePage", extension, &extension_controlled); 1768 AppendExtensionData("homePage", extension, &extension_controlled);
1762 1769
1763 // Check if an extension is overriding the Startup pages. 1770 // Check if an extension is overriding the Startup pages.
1764 extension = extensions::OverridesStartupPages( 1771 extension = extensions::GetExtensionOverridingStartupPages(
1765 Profile::FromWebUI(web_ui()), NULL); 1772 Profile::FromWebUI(web_ui()), NULL);
1766 AppendExtensionData("startUpPage", extension, &extension_controlled); 1773 AppendExtensionData("startUpPage", extension, &extension_controlled);
1767 1774
1768 // Check if an extension is overriding the NTP page. 1775 // Check if an extension is overriding the NTP page.
1769 GURL ntp_url(chrome::kChromeUINewTabURL); 1776 GURL ntp_url(chrome::kChromeUINewTabURL);
1770 bool ignored_param; 1777 bool ignored_param;
1771 extension = NULL; 1778 extension = NULL;
1772 content::BrowserURLHandler::GetInstance()->RewriteURLIfNecessary( 1779 content::BrowserURLHandler::GetInstance()->RewriteURLIfNecessary(
1773 &ntp_url, 1780 &ntp_url,
1774 web_ui()->GetWebContents()->GetBrowserContext(), 1781 web_ui()->GetWebContents()->GetBrowserContext(),
1775 &ignored_param); 1782 &ignored_param);
1776 if (ntp_url.SchemeIs("chrome-extension")) { 1783 if (ntp_url.SchemeIs("chrome-extension")) {
1777 using extensions::ExtensionRegistry; 1784 using extensions::ExtensionRegistry;
1778 ExtensionRegistry* registry = ExtensionRegistry::Get( 1785 ExtensionRegistry* registry = ExtensionRegistry::Get(
1779 Profile::FromWebUI(web_ui())); 1786 Profile::FromWebUI(web_ui()));
1780 extension = registry->GetExtensionById(ntp_url.host(), 1787 extension = registry->GetExtensionById(ntp_url.host(),
1781 ExtensionRegistry::ENABLED); 1788 ExtensionRegistry::ENABLED);
1782 } 1789 }
1783 AppendExtensionData("newTabPage", extension, &extension_controlled); 1790 AppendExtensionData("newTabPage", extension, &extension_controlled);
1784 1791
1792 // Check if an extension is overwriting the proxy setting.
1793 extension = extensions::GetExtensionOverridingProxy(
1794 Profile::FromWebUI(web_ui()));
1795 AppendExtensionData("proxy", extension, &extension_controlled);
1796
1785 web_ui()->CallJavascriptFunction("BrowserOptions.toggleExtensionIndicators", 1797 web_ui()->CallJavascriptFunction("BrowserOptions.toggleExtensionIndicators",
1786 extension_controlled); 1798 extension_controlled);
1787 #endif // defined(OS_WIN) 1799 #endif // defined(OS_WIN)
1788 } 1800 }
1789 1801
1790 } // namespace options 1802 } // namespace options
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698