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

Unified Diff: chrome/browser/extensions/bundle_installer.cc

Issue 9460045: Add Mac interface for installing bundles of extensions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 10 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 side-by-side diff with in-line comments
Download patch
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();
}

Powered by Google App Engine
This is Rietveld 408576698