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

Unified Diff: chrome/browser/resources/md_bookmarks/dnd_manager.js

Issue 2962923003: [MD Bookmarks] Add drag and drop indicator. (Closed)
Patch Set: Created 3 years, 5 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
Index: chrome/browser/resources/md_bookmarks/dnd_manager.js
diff --git a/chrome/browser/resources/md_bookmarks/dnd_manager.js b/chrome/browser/resources/md_bookmarks/dnd_manager.js
index 309bd95114365c24a6b78f1171d55443d8045e78..587a452311ea97e728fdf02187e5aead2ac76a69 100644
--- a/chrome/browser/resources/md_bookmarks/dnd_manager.js
+++ b/chrome/browser/resources/md_bookmarks/dnd_manager.js
@@ -289,6 +289,12 @@ cr.define('bookmarks', function() {
* @private {bookmarks.TimerProxy}
*/
this.timerProxy_ = new bookmarks.TimerProxy();
+
+ /**
+ * The bookmark drag and drop indicator chip.
+ * @private {BookmarksDndChipElement}
+ */
+ this.chip_ = null;
}
DNDManager.prototype = {
@@ -319,6 +325,9 @@ cr.define('bookmarks', function() {
},
destroy: function() {
+ if (this.chip_ && this.chip_.parentElement)
+ document.body.removeChild(this.chip_);
+
for (var event in this.documentListeners_)
document.removeEventListener(event, this.documentListeners_[event]);
},
@@ -384,6 +393,8 @@ cr.define('bookmarks', function() {
/** @private */
clearDragData_: function() {
+ this.dndChip.hide();
+
// Defer the clearing of the data so that the bookmark manager API's drop
// event doesn't clear the drop data before the web drop event has a
// chance to execute (on Mac).
@@ -478,6 +489,12 @@ cr.define('bookmarks', function() {
if (!this.dragInfo_.isDragValid())
return;
+ this.dndChip.showForItems(
+ e.clientX, e.clientY,
+ this.dragInfo_.dragData.elements.map(function(x) {
+ return bookmarks.util.normalizeNode(x);
+ }));
+
var overElement = getBookmarkElement(e.path);
this.autoExpander_.update(e, overElement);
if (!overElement)
@@ -643,7 +660,19 @@ cr.define('bookmarks', function() {
setTimerProxyForTesting: function(timerProxy) {
this.timerProxy_ = timerProxy;
this.dropIndicator_.timerProxy = timerProxy;
- }
+ },
+
+ /** @return {BookmarksDndChipElement} */
+ get dndChip() {
+ if (!this.chip_) {
+ this.chip_ =
+ /** @type {BookmarksDndChipElement} */ (
+ document.createElement('bookmarks-dnd-chip'));
+ document.body.appendChild(this.chip_);
+ }
+
+ return this.chip_;
+ },
};
return {
« no previous file with comments | « chrome/browser/resources/md_bookmarks/dnd_manager.html ('k') | chrome/browser/ui/webui/md_bookmarks/md_bookmarks_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698