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

Unified Diff: ash/launcher/launcher_model.cc

Issue 10534142: Add support for pinning platform apps (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed review issue. Created 8 years, 6 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 | « no previous file | ash/launcher/launcher_view.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/launcher/launcher_model.cc
diff --git a/ash/launcher/launcher_model.cc b/ash/launcher/launcher_model.cc
index 67d51e44edca110c305ec9f0919013e8a58ca5fa..0362aff6da8e0fb88f0eadc205ec9e1c54a21d72 100644
--- a/ash/launcher/launcher_model.cc
+++ b/ash/launcher/launcher_model.cc
@@ -90,12 +90,18 @@ void LauncherModel::Move(int index, int target_index) {
void LauncherModel::Set(int index, const LauncherItem& item) {
DCHECK(index >= 0 && index < item_count());
+ int new_index = item.type == items_[index].type ?
+ index : ValidateInsertionIndex(item.type, index);
+
LauncherItem old_item(items_[index]);
items_[index] = item;
items_[index].id = old_item.id;
- items_[index].type = old_item.type;
FOR_EACH_OBSERVER(LauncherModelObserver, observers_,
LauncherItemChanged(index, old_item));
+
+ // If the type changes confirm that the item is still in the right order.
+ if (new_index != index)
+ Move(index, new_index);
sky 2012/06/13 23:43:27 nit: spacing is off.
}
int LauncherModel::ItemIndexByID(LauncherID id) {
« no previous file with comments | « no previous file | ash/launcher/launcher_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698