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

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

Powered by Google App Engine
This is Rietveld 408576698