summaryrefslogtreecommitdiffstats
path: root/ash
diff options
context:
space:
mode:
authordavemoore@chromium.org <davemoore@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-14 03:45:22 +0000
committerdavemoore@chromium.org <davemoore@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-14 03:45:22 +0000
commit73dab1b667e969313caddc2664799839fd6c7d1e (patch)
tree3f668e1f299bffe2a57187601e84fab0dffef96c /ash
parentffd95d9762f1b8d5e26828afe9601460bc28040b (diff)
downloadchromium_src-73dab1b667e969313caddc2664799839fd6c7d1e.zip
chromium_src-73dab1b667e969313caddc2664799839fd6c7d1e.tar.gz
chromium_src-73dab1b667e969313caddc2664799839fd6c7d1e.tar.bz2
Add support for pinning platform apps
BUG=131878 TEST=Existing and new LauncherPlatformAppBrowserTest Review URL: https://chromiumcodereview.appspot.com/10534142 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@142086 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash')
-rw-r--r--ash/launcher/launcher_model.cc8
-rw-r--r--ash/launcher/launcher_view.cc6
2 files changed, 11 insertions, 3 deletions
diff --git a/ash/launcher/launcher_model.cc b/ash/launcher/launcher_model.cc
index 67d51e4..d9aa8ad 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);
}
int LauncherModel::ItemIndexByID(LauncherID id) {
diff --git a/ash/launcher/launcher_view.cc b/ash/launcher/launcher_view.cc
index 9327c83..1b0754d 100644
--- a/ash/launcher/launcher_view.cc
+++ b/ash/launcher/launcher_view.cc
@@ -627,11 +627,13 @@ bool LauncherView::SameDragType(LauncherItemType typea,
switch (typea) {
case TYPE_TABBED:
case TYPE_APP_PANEL:
- return (typeb == TYPE_TABBED || typeb == TYPE_APP_PANEL);
+ case TYPE_PLATFORM_APP:
+ return (typeb == TYPE_TABBED ||
+ typeb == TYPE_APP_PANEL ||
+ typeb == TYPE_PLATFORM_APP);
case TYPE_APP_SHORTCUT:
case TYPE_APP_LIST:
case TYPE_BROWSER_SHORTCUT:
- case TYPE_PLATFORM_APP:
return typeb == typea;
}
NOTREACHED();