Index: chrome/browser/extensions/bundle_installer.cc |
diff --git a/chrome/browser/extensions/bundle_installer.cc b/chrome/browser/extensions/bundle_installer.cc |
index 7da31420fba971c9ef7787a079d18b796d8c00b8..b8bd874cbbe460f7085dbc5fc9c07f92fc9881d1 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,16 @@ 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. |
Yoyo Zhou
2012/02/28 00:42:39
Why remove this comment?
jstritar
2012/03/05 18:05:08
Re-added.
|
- 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,7 +193,7 @@ string16 BundleInstaller::GetHeadingTextFor(Item::State state) const { |
return l10n_util::GetStringUTF16(msg_id); |
} |
-#if !defined(TOOLKIT_GTK) |
+#if defined(TOOLKIT_VIEWS) |
Yoyo Zhou
2012/02/28 00:42:39
I trust you know what to do with the merge conflic
jstritar
2012/03/05 18:05:08
The other CL landed, so I removed this entire bloc
|
// static |
void BundleInstaller::ShowInstalledBubble( |
const BundleInstaller* bundle, Browser* browser) { |
@@ -329,8 +335,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(); |
} |