OLD | NEW |
---|---|
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 cr.define('bookmarks', function() { | 5 cr.define('bookmarks', function() { |
6 /** | 6 /** |
7 * @param {BookmarkElement} element | 7 * @param {BookmarkElement} element |
8 * @return {boolean} | 8 * @return {boolean} |
9 */ | 9 */ |
10 function isBookmarkItem(element) { | 10 function isBookmarkItem(element) { |
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
345 | 345 |
346 /** | 346 /** |
347 * @private | 347 * @private |
348 * @param {!Event} e | 348 * @param {!Event} e |
349 */ | 349 */ |
350 onDrop_: function(e) { | 350 onDrop_: function(e) { |
351 if (this.dropDestination_) { | 351 if (this.dropDestination_) { |
352 e.preventDefault(); | 352 e.preventDefault(); |
353 | 353 |
354 var dropInfo = this.calculateDropInfo_(this.dropDestination_); | 354 var dropInfo = this.calculateDropInfo_(this.dropDestination_); |
355 if (dropInfo.index != -1) | 355 var index = dropInfo.index != -1 ? dropInfo.index : undefined; |
356 chrome.bookmarkManagerPrivate.drop(dropInfo.parentId, dropInfo.index); | 356 var shouldHighlight = isBookmarkItem(this.dropDestination_.element) || |
357 else | 357 isBookmarkList(this.dropDestination_.element); |
358 chrome.bookmarkManagerPrivate.drop(dropInfo.parentId); | 358 |
359 if (shouldHighlight) | |
360 bookmarks.ApiListener.trackUpdatedItems(); | |
361 | |
362 chrome.bookmarkManagerPrivate.drop( | |
363 dropInfo.parentId, index, function() { | |
calamity
2017/07/19 05:25:14
shouldHighlight ? bookmarks.ApiListener.highlightU
tsergeant
2017/07/19 06:53:12
Done.
| |
364 if (shouldHighlight) | |
365 bookmarks.ApiListener.highlightUpdatedItems(); | |
366 }); | |
359 } | 367 } |
360 | 368 |
361 this.dropDestination_ = null; | 369 this.dropDestination_ = null; |
362 this.dropIndicator_.finish(); | 370 this.dropIndicator_.finish(); |
363 }, | 371 }, |
364 | 372 |
365 /** | 373 /** |
366 * @param {DropDestination} dropDestination | 374 * @param {DropDestination} dropDestination |
367 * @return {{parentId: string, index: number}} | 375 * @return {{parentId: string, index: number}} |
368 */ | 376 */ |
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
684 return this.chip_; | 692 return this.chip_; |
685 }, | 693 }, |
686 }; | 694 }; |
687 | 695 |
688 return { | 696 return { |
689 DNDManager: DNDManager, | 697 DNDManager: DNDManager, |
690 DragInfo: DragInfo, | 698 DragInfo: DragInfo, |
691 DropIndicator: DropIndicator, | 699 DropIndicator: DropIndicator, |
692 }; | 700 }; |
693 }); | 701 }); |
OLD | NEW |