diff options
author | jstritar@chromium.org <jstritar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-19 15:22:48 +0000 |
---|---|---|
committer | jstritar@chromium.org <jstritar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-19 15:22:48 +0000 |
commit | ef8f0ca99fdb6d25dff20e0d60ab64fdfe4fd1a6 (patch) | |
tree | d6bd9bf497f9c3dcc7cb576d5a29e13378af89b9 /chrome/browser/resources | |
parent | 1ab7761d57f2144fac3f03958e571410b595a2b9 (diff) | |
download | chromium_src-ef8f0ca99fdb6d25dff20e0d60ab64fdfe4fd1a6.zip chromium_src-ef8f0ca99fdb6d25dff20e0d60ab64fdfe4fd1a6.tar.gz chromium_src-ef8f0ca99fdb6d25dff20e0d60ab64fdfe4fd1a6.tar.bz2 |
Track which apps the user has re-ordered on the NTP.
BUG=73445
TEST=ExtensionPrefsAppDraggedByUser
Review URL: http://codereview.chromium.org/6543017
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@75497 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/resources')
-rw-r--r-- | chrome/browser/resources/ntp/apps.js | 5 | ||||
-rw-r--r-- | chrome/browser/resources/ntp/drag_drop_controller.js | 7 |
2 files changed, 7 insertions, 5 deletions
diff --git a/chrome/browser/resources/ntp/apps.js b/chrome/browser/resources/ntp/apps.js index 39ef895..935eebf 100644 --- a/chrome/browser/resources/ntp/apps.js +++ b/chrome/browser/resources/ntp/apps.js @@ -524,10 +524,11 @@ var apps = (function() { this.scrollMouseXY_ = null; }, - saveDrag: function() { + saveDrag: function(draggedItem) { this.invalidate_(); this.layout(); + var draggedAppId = draggedItem.querySelector('a').getAttribute('app-id'); var appIds = this.data.filter(function(id) { return id != 'web-store-entry'; }); @@ -535,7 +536,7 @@ var apps = (function() { // Wait until the transitions are complete before notifying the browser. // Otherwise, the apps will be re-rendered while still transitioning. setTimeout(function() { - chrome.send('reorderApps', appIds); + chrome.send('reorderApps', [draggedAppId, appIds]); }, this.transitionsDuration + 10); }, diff --git a/chrome/browser/resources/ntp/drag_drop_controller.js b/chrome/browser/resources/ntp/drag_drop_controller.js index affa9de..92aaebd 100644 --- a/chrome/browser/resources/ntp/drag_drop_controller.js +++ b/chrome/browser/resources/ntp/drag_drop_controller.js @@ -23,9 +23,10 @@ // tells the delegate that the dragged item is currently above // the specified coordinates. // -// saveDrag() --> +// saveDrag(draggedItem) --> // tells the delegate that the drag is done. move the item to the -// position last specified by setDragPlaceholder. (e.g., commit changes) +// position last specified by setDragPlaceholder (e.g., commit changes). +// draggedItem was the item being dragged. // // The distance, in px, that the mouse must move before initiating a drag. @@ -162,7 +163,7 @@ DragAndDropController.prototype = { return; this.delegate_.dragItem = this.startItem_ = null; - this.delegate_.saveDrag(); + this.delegate_.saveDrag(dragItem); dragItem.classList.remove('dragging'); setTimeout(function() { |