diff options
author | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-30 23:48:43 +0000 |
---|---|---|
committer | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-30 23:48:43 +0000 |
commit | e2a284e6c009801faef4dae663649cc14335539e (patch) | |
tree | 102f7d2c52fc99ca7b526ed016b6fd2d5204c97b /chrome/browser/extensions | |
parent | e444c95bb327f0addaa066df4356268cf84bfb46 (diff) | |
download | chromium_src-e2a284e6c009801faef4dae663649cc14335539e.zip chromium_src-e2a284e6c009801faef4dae663649cc14335539e.tar.gz chromium_src-e2a284e6c009801faef4dae663649cc14335539e.tar.bz2 |
GTK: New extension install prompt ui.
BUG=29633
TEST=manual
Review URL: http://codereview.chromium.org/1513002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@43144 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions')
-rw-r--r-- | chrome/browser/extensions/extension_install_ui.cc | 46 | ||||
-rwxr-xr-x | chrome/browser/extensions/extension_install_ui.h | 6 |
2 files changed, 29 insertions, 23 deletions
diff --git a/chrome/browser/extensions/extension_install_ui.cc b/chrome/browser/extensions/extension_install_ui.cc index 3accc44..257f667d 100644 --- a/chrome/browser/extensions/extension_install_ui.cc +++ b/chrome/browser/extensions/extension_install_ui.cc @@ -82,6 +82,9 @@ static bool ExtensionHasFileAccess(Extension* extension) { return false; } +// TODO(estade): remove this function when the old install UI is removed. It +// is commented out on linux/gtk due to compiler warnings. +#if !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. @@ -126,51 +129,54 @@ static std::wstring GetInstallWarning(Extension* extension) { else return l10n_util::GetString(IDS_EXTENSION_PROMPT_WARNING_BROWSER); } +#endif -#if defined(OS_WIN) +#if defined(OS_WIN) || defined(TOOLKIT_GTK) static void GetV2Warnings(Extension* extension, - std::vector<std::wstring>* warnings) { + std::vector<string16>* warnings) { if (!extension->plugins().empty() || ExtensionHasFileAccess(extension)) { // TODO(aa): This one is a bit awkward. Should we have a separate // presentation for this case? warnings->push_back( - l10n_util::GetString(IDS_EXTENSION_PROMPT2_WARNING_FULL_ACCESS)); + l10n_util::GetStringUTF16(IDS_EXTENSION_PROMPT2_WARNING_FULL_ACCESS)); return; } if (extension->HasAccessToAllHosts()) { warnings->push_back( - l10n_util::GetString(IDS_EXTENSION_PROMPT2_WARNING_ALL_HOSTS)); + l10n_util::GetStringUTF16(IDS_EXTENSION_PROMPT2_WARNING_ALL_HOSTS)); } else { std::set<std::string> hosts = extension->GetEffectiveHostPermissions(); if (hosts.size() == 1) { warnings->push_back( - l10n_util::GetStringF(IDS_EXTENSION_PROMPT2_WARNING_1_HOST, - UTF8ToWide(*hosts.begin()))); + l10n_util::GetStringFUTF16(IDS_EXTENSION_PROMPT2_WARNING_1_HOST, + UTF8ToUTF16(*hosts.begin()))); } else if (hosts.size() == 2) { warnings->push_back( - l10n_util::GetStringF(IDS_EXTENSION_PROMPT2_WARNING_2_HOSTS, - UTF8ToWide(*hosts.begin()), - UTF8ToWide(*(++hosts.begin())))); + l10n_util::GetStringFUTF16(IDS_EXTENSION_PROMPT2_WARNING_2_HOSTS, + UTF8ToUTF16(*hosts.begin()), + UTF8ToUTF16(*(++hosts.begin())))); } else if (hosts.size() == 3) { warnings->push_back( - l10n_util::GetStringF(IDS_EXTENSION_PROMPT2_WARNING_3_HOSTS, - UTF8ToWide(*hosts.begin()), - UTF8ToWide(*(++hosts.begin())), - UTF8ToWide(*(++++hosts.begin())))); + l10n_util::GetStringFUTF16(IDS_EXTENSION_PROMPT2_WARNING_3_HOSTS, + UTF8ToUTF16(*hosts.begin()), + UTF8ToUTF16(*(++hosts.begin())), + UTF8ToUTF16(*(++++hosts.begin())))); } else if (hosts.size() >= 4) { warnings->push_back( - l10n_util::GetStringF(IDS_EXTENSION_PROMPT2_WARNING_4_OR_MORE_HOSTS, - UTF8ToWide(*hosts.begin()), - UTF8ToWide(*(++hosts.begin())), - IntToWString(hosts.size() - 2))); + l10n_util::GetStringFUTF16( + IDS_EXTENSION_PROMPT2_WARNING_4_OR_MORE_HOSTS, + UTF8ToUTF16(*hosts.begin()), + UTF8ToUTF16(*(++hosts.begin())), + IntToString16(hosts.size() - 2))); } } if (extension->HasApiPermission(Extension::kTabPermission) || extension->HasApiPermission(Extension::kBookmarkPermission)) { warnings->push_back( - l10n_util::GetString(IDS_EXTENSION_PROMPT2_WARNING_BROWSING_HISTORY)); + l10n_util::GetStringUTF16( + IDS_EXTENSION_PROMPT2_WARNING_BROWSING_HISTORY)); } // TODO(aa): Geolocation, camera/mic, what else? @@ -307,8 +313,8 @@ void ExtensionInstallUI::OnImageLoaded( Source<ExtensionInstallUI>(this), NotificationService::NoDetails()); -#if defined(OS_WIN) - std::vector<std::wstring> warnings; +#if defined(OS_WIN) || defined(TOOLKIT_GTK) + std::vector<string16> warnings; GetV2Warnings(extension_, &warnings); ShowExtensionInstallUIPrompt2Impl( profile_, delegate_, extension_, &icon_, warnings); diff --git a/chrome/browser/extensions/extension_install_ui.h b/chrome/browser/extensions/extension_install_ui.h index 83c165e..822060d 100755 --- a/chrome/browser/extensions/extension_install_ui.h +++ b/chrome/browser/extensions/extension_install_ui.h @@ -6,10 +6,12 @@ #define CHROME_BROWSER_EXTENSIONS_EXTENSION_INSTALL_UI_H_ #include <string> +#include <vector> #include "base/file_path.h" #include "base/ref_counted.h" #include "base/scoped_ptr.h" +#include "base/string16.h" #include "chrome/browser/extensions/image_loading_tracker.h" #include "gfx/native_widget_types.h" #include "third_party/skia/include/core/SkBitmap.h" @@ -114,13 +116,11 @@ class ExtensionInstallUI : public ImageLoadingTracker::Observer { Profile* profile, Delegate* delegate, Extension* extension, SkBitmap* icon, const string16& warning, PromptType type); -#if defined(OS_WIN) // Implements the showing of the new install dialog. The implementations of // this function are platform-specific. static void ShowExtensionInstallUIPrompt2Impl( Profile* profile, Delegate* delegate, Extension* extension, - SkBitmap* icon, const std::vector<std::wstring>& permissions); -#endif + SkBitmap* icon, const std::vector<string16>& permissions); Profile* profile_; MessageLoop* ui_loop_; |