diff options
Diffstat (limited to 'chrome/browser/extensions/bundle_installer.cc')
-rw-r--r-- | chrome/browser/extensions/bundle_installer.cc | 40 |
1 files changed, 21 insertions, 19 deletions
diff --git a/chrome/browser/extensions/bundle_installer.cc b/chrome/browser/extensions/bundle_installer.cc index 5254c80..1347462 100644 --- a/chrome/browser/extensions/bundle_installer.cc +++ b/chrome/browser/extensions/bundle_installer.cc @@ -9,6 +9,8 @@ #include <vector> #include "base/command_line.h" +#include "base/i18n/rtl.h" +#include "base/utf_string_conversions.h" #include "base/values.h" #include "chrome/browser/extensions/crx_installer.h" #include "chrome/browser/extensions/extension_install_dialog.h" @@ -80,8 +82,7 @@ const int kHeadingIds[3][4] = { IDS_EXTENSION_BUNDLE_INSTALLED_HEADING_EXTENSIONS, IDS_EXTENSION_BUNDLE_INSTALLED_HEADING_APPS, IDS_EXTENSION_BUNDLE_INSTALLED_HEADING_EXTENSION_APPS - }, - { IDS_EXTENSION_BUNDLE_ERROR_HEADING, 0, 0, 0 } + } }; } // namespace @@ -94,6 +95,12 @@ void BundleInstaller::SetAutoApproveForTesting(bool auto_approve) { BundleInstaller::Item::Item() : state(STATE_PENDING) {} +string16 BundleInstaller::Item::GetNameForDisplay() { + string16 name = UTF8ToUTF16(localized_name); + base::i18n::AdjustStringForLocaleDirection(&name); + return l10n_util::GetStringFUTF16(IDS_EXTENSION_PERMISSION_LINE, name); +} + BundleInstaller::BundleInstaller(Profile* profile, const BundleInstaller::ItemList& items) : approved_(false), @@ -162,17 +169,18 @@ void BundleInstaller::CompleteInstall(NavigationController* controller, } string16 BundleInstaller::GetHeadingTextFor(Item::State state) const { - size_t total = 0; - size_t apps = 0; - // For STATE_FAILED, we can't tell if the items were apps or extensions // so we always show the same message. - if (state == Item::STATE_INSTALLED || state == Item::STATE_PENDING) { - total = GetItemsWithState(state).size(); - apps = std::count_if( - dummy_extensions_.begin(), dummy_extensions_.end(), &IsAppPredicate); + if (state == Item::STATE_FAILED) { + if (GetItemsWithState(state).size()) + return l10n_util::GetStringUTF16(IDS_EXTENSION_BUNDLE_ERROR_HEADING); + return string16(); } + size_t total = GetItemsWithState(state).size(); + size_t apps = std::count_if( + dummy_extensions_.begin(), dummy_extensions_.end(), &IsAppPredicate); + bool has_apps = apps > 0; bool has_extensions = apps < total; size_t index = (has_extensions << 0) + (has_apps << 1); @@ -187,14 +195,6 @@ string16 BundleInstaller::GetHeadingTextFor(Item::State state) const { return l10n_util::GetStringUTF16(msg_id); } -#if defined(OS_MACOSX) -// static -void BundleInstaller::ShowInstalledBubble( - const BundleInstaller* bundle, Browser* browser) { - // TODO(jstritar): provide platform specific implementations. -} -#endif - void BundleInstaller::ParseManifests() { if (items_.empty()) { ReportCanceled(false); @@ -329,8 +329,10 @@ void BundleInstaller::OnExtensionInstallFailure(const std::string& id, const std::string& error) { items_[id].state = Item::STATE_FAILED; - std::remove_if(dummy_extensions_.begin(), dummy_extensions_.end(), - MatchIdFunctor(id)); + ExtensionList::iterator i = std::find_if( + dummy_extensions_.begin(), dummy_extensions_.end(), MatchIdFunctor(id)); + CHECK(dummy_extensions_.end() != i); + dummy_extensions_.erase(i); ShowInstalledBubbleIfDone(); } |