diff options
author | skuhne@chromium.org <skuhne@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-12 18:58:21 +0000 |
---|---|---|
committer | skuhne@chromium.org <skuhne@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-12 18:58:21 +0000 |
commit | 7dfc42ea455c7f4d2fe763c1120825057e883347 (patch) | |
tree | 161ed5afed23a436c2521153139c17f1029a22e4 /ash/launcher/launcher_model.cc | |
parent | 7178b99ae57621afa6abca5a1cd4c37a8e49bd08 (diff) | |
download | chromium_src-7dfc42ea455c7f4d2fe763c1120825057e883347.zip chromium_src-7dfc42ea455c7f4d2fe763c1120825057e883347.tar.gz chromium_src-7dfc42ea455c7f4d2fe763c1120825057e883347.tar.bz2 |
Drag and drop creation of shortcuts for running applications fixed
The problem was that applications which are already running, are not (yet) pinned. As such they were limited in movement while dragging within the launcher. This problem was addressed by checking the pinned status and pinning the item when it is not (and reverting that state if the operation gets cancelled).
While fixing that I was running into a problem which predates my involvement: Unpinning running applications was able to scramble the item order.
BUG=248362, 248769
TEST=mostly unit tested, partial visual tests
Review URL: https://chromiumcodereview.appspot.com/15662010
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@205886 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/launcher/launcher_model.cc')
-rw-r--r-- | ash/launcher/launcher_model.cc | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/ash/launcher/launcher_model.cc b/ash/launcher/launcher_model.cc index cac37c0..68e57e0 100644 --- a/ash/launcher/launcher_model.cc +++ b/ash/launcher/launcher_model.cc @@ -94,8 +94,18 @@ void LauncherModel::Set(int index, const LauncherItem& item) { LauncherItemChanged(index, old_item)); // If the type changes confirm that the item is still in the right order. - if (new_index != index) + if (new_index != index) { + // The move function works by removing one item and then inserting it at the + // new location. However - by removing the item first the order will change + // so that our target index needs to be corrected. + // TODO(skuhne): Moving this into the Move function breaks lots of unit + // tests. So several functions were already using this incorrectly. + // That needs to be cleaned up. + if (index < new_index) + new_index--; + Move(index, new_index); + } } int LauncherModel::ItemIndexByID(LauncherID id) const { |