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

Side by Side Diff: chrome/browser/resources/md_bookmarks/dnd_manager.js

Issue 2776993002: [MD Bookmarks] Persist collapsed folders between page loads. (Closed)
Patch Set: fix closure Created 3 years, 8 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 unified diff | Download patch
OLDNEW
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 /**
6 * Enumeration of valid drop locations relative to an element. These are
7 * bit masks to allow combining multiple locations in a single value.
8 * @enum {number}
9 * @const
10 */
11 var DropPosition = {
12 NONE: 0,
13 ABOVE: 1,
14 ON: 2,
15 BELOW: 4,
16 };
17
18 /** @typedef {{element: BookmarkElement, position: DropPosition}} */
19 var DropDestination;
20
21 cr.define('bookmarks', function() { 5 cr.define('bookmarks', function() {
22 /** 6 /**
23 * @param {BookmarkElement} element 7 * @param {BookmarkElement} element
24 * @return {boolean} 8 * @return {boolean}
25 */ 9 */
26 function isBookmarkItem(element) { 10 function isBookmarkItem(element) {
27 return element.tagName == 'BOOKMARKS-ITEM'; 11 return element.tagName == 'BOOKMARKS-ITEM';
28 } 12 }
29 13
30 /** 14 /**
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after
487 /** 471 /**
488 * @private 472 * @private
489 * @param {BookmarkElement} overElement 473 * @param {BookmarkElement} overElement
490 * @return {DropPosition} 474 * @return {DropPosition}
491 */ 475 */
492 calculateDropAboveBelow_: function(overElement) { 476 calculateDropAboveBelow_: function(overElement) {
493 var dragInfo = this.dragInfo_; 477 var dragInfo = this.dragInfo_;
494 var state = bookmarks.Store.getInstance().data; 478 var state = bookmarks.Store.getInstance().data;
495 479
496 // We cannot drop between Bookmarks bar and Other bookmarks. 480 // We cannot drop between Bookmarks bar and Other bookmarks.
497 if (getBookmarkNode(overElement).parentId == bookmarks.util.ROOT_NODE_ID) 481 if (getBookmarkNode(overElement).parentId == ROOT_NODE_ID)
498 return DropPosition.NONE; 482 return DropPosition.NONE;
499 483
500 var isOverFolderNode = isBookmarkFolderNode(overElement); 484 var isOverFolderNode = isBookmarkFolderNode(overElement);
501 485
502 // We can only drop between items in the tree if we have any folders. 486 // We can only drop between items in the tree if we have any folders.
503 if (isOverFolderNode && !dragInfo.isDraggingFolders()) 487 if (isOverFolderNode && !dragInfo.isDraggingFolders())
504 return DropPosition.NONE; 488 return DropPosition.NONE;
505 489
506 var validDropPositions = DropPosition.NONE; 490 var validDropPositions = DropPosition.NONE;
507 491
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
546 return !this.dragInfo_.isDraggingChildBookmark(overElement.itemId) 530 return !this.dragInfo_.isDraggingChildBookmark(overElement.itemId)
547 }, 531 },
548 }; 532 };
549 533
550 return { 534 return {
551 DNDManager: DNDManager, 535 DNDManager: DNDManager,
552 DragInfo: DragInfo, 536 DragInfo: DragInfo,
553 DropIndicator: DropIndicator, 537 DropIndicator: DropIndicator,
554 }; 538 };
555 }); 539 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/md_bookmarks/dnd_manager.html ('k') | chrome/browser/resources/md_bookmarks/reducers.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698