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

Unified Diff: chrome/browser/ui/views/ash/launcher/chrome_launcher_delegate.cc

Issue 10170029: Apps shouldn't disappear from pinned list after update (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nit Created 8 years, 8 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
« no previous file with comments | « chrome/browser/ui/views/ash/launcher/chrome_launcher_delegate.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/ash/launcher/chrome_launcher_delegate.cc
diff --git a/chrome/browser/ui/views/ash/launcher/chrome_launcher_delegate.cc b/chrome/browser/ui/views/ash/launcher/chrome_launcher_delegate.cc
index ffc272c9bc494eeabc6c6e21c1c587f23126f14f..a7245b726de2d27884232c347e33789fc18c93ee 100644
--- a/chrome/browser/ui/views/ash/launcher/chrome_launcher_delegate.cc
+++ b/chrome/browser/ui/views/ash/launcher/chrome_launcher_delegate.cc
@@ -106,6 +106,9 @@ ChromeLauncherDelegate::ChromeLauncherDelegate(Profile* profile,
registrar_.Add(this,
chrome::NOTIFICATION_EXTENSION_UNLOADED,
content::Source<Profile>(profile_));
+ registrar_.Add(this,
+ chrome::NOTIFICATION_EXTENSION_UNINSTALLED,
+ content::Source<Profile>(profile_));
}
ChromeLauncherDelegate::~ChromeLauncherDelegate() {
@@ -155,7 +158,7 @@ void ChromeLauncherDelegate::Init() {
Item pending_item;
pending_item.item_type = TYPE_APP;
pending_item.app_id = app_id;
- pending_pinned_apps_.push(pending_item);
+ pending_pinned_apps_.push_back(pending_item);
}
}
}
@@ -541,7 +544,26 @@ void ChromeLauncherDelegate::Observe(
case chrome::NOTIFICATION_EXTENSION_UNLOADED: {
const Extension* extension =
content::Details<UnloadedExtensionInfo>(details)->extension;
- UnpinAppsWithID(extension->id());
+ if (IsAppPinned(extension->id())) {
+ // TODO(dpolukhin): also we need to remember index of the app to show
+ // it on the same place when it gets loaded again.
+ Item pending_item;
+ pending_item.item_type = TYPE_APP;
+ pending_item.app_id = extension->id();
+ pending_pinned_apps_.push_back(pending_item);
+ UnpinAppsWithID(extension->id());
+ }
+ break;
+ }
+ case chrome::NOTIFICATION_EXTENSION_UNINSTALLED: {
+ std::string id = *content::Details<const std::string>(details).ptr();
+ for (std::deque<Item>::iterator it = pending_pinned_apps_.begin();
+ it != pending_pinned_apps_.end(); ++it) {
+ if (it->app_id == id) {
+ pending_pinned_apps_.erase(it);
+ break;
+ }
+ }
break;
}
default:
@@ -586,6 +608,6 @@ void ChromeLauncherDelegate::ProcessPendingPinnedApps() {
return;
PinAppWithID(item.app_id);
- pending_pinned_apps_.pop();
+ pending_pinned_apps_.pop_front();
}
}
« no previous file with comments | « chrome/browser/ui/views/ash/launcher/chrome_launcher_delegate.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698