summaryrefslogtreecommitdiffstats
path: root/chrome/browser/extensions/extension_install_ui.cc
diff options
context:
space:
mode:
authoraa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-27 06:47:46 +0000
committeraa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-27 06:47:46 +0000
commitb24d831bff725a59e472f0aaa4547dfb31344490 (patch)
tree90d92f9fb363696c1dbd37b297068624ed4af6ea /chrome/browser/extensions/extension_install_ui.cc
parenta0a04ee4b35d3abb9b4d0bf093fcaead55821473 (diff)
downloadchromium_src-b24d831bff725a59e472f0aaa4547dfb31344490.zip
chromium_src-b24d831bff725a59e472f0aaa4547dfb31344490.tar.gz
chromium_src-b24d831bff725a59e472f0aaa4547dfb31344490.tar.bz2
Update of the extension install UI:
- Give the user more information about which hosts an extension can access. - Remove the red severe warning because it doesn't play well with themes and because it adds nothing when the other text is more specific. - Make the image a bit smaller. Also integrate this new idea with the silent/not-silent update flow. BUG=12129,12140,19582 Review URL: http://codereview.chromium.org/173463 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@24599 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions/extension_install_ui.cc')
-rw-r--r--chrome/browser/extensions/extension_install_ui.cc56
1 files changed, 55 insertions, 1 deletions
diff --git a/chrome/browser/extensions/extension_install_ui.cc b/chrome/browser/extensions/extension_install_ui.cc
index 144ea78f..1023a5a 100644
--- a/chrome/browser/extensions/extension_install_ui.cc
+++ b/chrome/browser/extensions/extension_install_ui.cc
@@ -26,6 +26,59 @@
#include <CoreFoundation/CFUserNotification.h>
#endif
+namespace {
+
+#if defined(OS_WIN) || defined(TOOLKIT_GTK)
+
+static std::wstring GetInstallWarning(Extension* extension) {
+ // If the extension has a plugin, it's easy: the plugin has the most severe
+ // warning.
+ if (!extension->plugins().empty())
+ return l10n_util::GetString(IDS_EXTENSION_PROMPT_WARNING_NEW_FULL_ACCESS);
+
+ // Otherwise, we go in descending order of severity: all hosts, several hosts,
+ // a single host, no hosts. For each of these, we also have a variation of the
+ // message for when api permissions are also requested.
+ if (extension->HasAccessToAllHosts()) {
+ if (extension->api_permissions().empty())
+ return l10n_util::GetString(IDS_EXTENSION_PROMPT_WARNING_NEW_ALL_HOSTS);
+ else
+ return l10n_util::GetString(
+ IDS_EXTENSION_PROMPT_WARNING_NEW_ALL_HOSTS_AND_BROWSER);
+ }
+
+ const std::set<std::string> hosts = extension->GetEffectiveHostPermissions();
+ if (hosts.size() > 1) {
+ if (extension->api_permissions().empty())
+ return l10n_util::GetString(
+ IDS_EXTENSION_PROMPT_WARNING_NEW_MULTIPLE_HOSTS);
+ else
+ return l10n_util::GetString(
+ IDS_EXTENSION_PROMPT_WARNING_NEW_MULTIPLE_HOSTS_AND_BROWSER);
+ }
+
+ if (hosts.size() == 1) {
+ if (extension->api_permissions().empty())
+ return l10n_util::GetStringF(
+ IDS_EXTENSION_PROMPT_WARNING_NEW_SINGLE_HOST,
+ UTF8ToWide(*hosts.begin()));
+ else
+ return l10n_util::GetStringF(
+ IDS_EXTENSION_PROMPT_WARNING_NEW_SINGLE_HOST_AND_BROWSER,
+ UTF8ToWide(*hosts.begin()));
+ }
+
+ DCHECK(hosts.size() == 0);
+ if (extension->api_permissions().empty())
+ return L"";
+ else
+ return l10n_util::GetString(IDS_EXTENSION_PROMPT_WARNING_NEW_BROWSER);
+}
+
+#endif
+
+}
+
ExtensionInstallUI::ExtensionInstallUI(Profile* profile)
: profile_(profile), ui_loop_(MessageLoop::current()) {
}
@@ -49,7 +102,8 @@ void ExtensionInstallUI::ConfirmInstall(Delegate* delegate,
}
#if defined(OS_WIN) || defined(TOOLKIT_GTK)
- ShowExtensionInstallPrompt(profile_, delegate, extension, install_icon);
+ ShowExtensionInstallPrompt(profile_, delegate, extension, install_icon,
+ GetInstallWarning(extension));
#elif defined(OS_MACOSX)
// TODO(port): Implement nicer UI.