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

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

Issue 2813503002: MD Bookmarks: Prevent navigating to invalid folders (Closed)
Patch Set: handleAction -> dispatch Created 3 years, 7 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 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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 var itemId = overElement ? overElement.itemId : null; 151 var itemId = overElement ? overElement.itemId : null;
152 var store = bookmarks.Store.getInstance(); 152 var store = bookmarks.Store.getInstance();
153 153
154 // If hovering over the same folder as last update, open the folder after 154 // If hovering over the same folder as last update, open the folder after
155 // the delay has passed. 155 // the delay has passed.
156 if (overElement && overElement == this.lastElement_) { 156 if (overElement && overElement == this.lastElement_) {
157 if (eventTimestamp - this.lastTimestamp_ < this.EXPAND_FOLDER_DELAY) 157 if (eventTimestamp - this.lastTimestamp_ < this.EXPAND_FOLDER_DELAY)
158 return; 158 return;
159 159
160 var action = bookmarks.actions.changeFolderOpen(itemId, true); 160 var action = bookmarks.actions.changeFolderOpen(itemId, true);
161 store.handleAction(action); 161 store.dispatch(action);
162 } else if ( 162 } else if (
163 overElement && isBookmarkFolderNode(overElement) && 163 overElement && isBookmarkFolderNode(overElement) &&
164 bookmarks.util.hasChildFolders(itemId, store.data.nodes) && 164 bookmarks.util.hasChildFolders(itemId, store.data.nodes) &&
165 store.data.closedFolders.has(itemId)) { 165 store.data.closedFolders.has(itemId)) {
166 // Since this is a closed folder node that has children, set the auto 166 // Since this is a closed folder node that has children, set the auto
167 // expander to this element. 167 // expander to this element.
168 this.lastTimestamp_ = eventTimestamp; 168 this.lastTimestamp_ = eventTimestamp;
169 this.lastElement_ = overElement; 169 this.lastElement_ = overElement;
170 return; 170 return;
171 } 171 }
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after
627 this.dropIndicator_.setTimeout = this.setTimeout_; 627 this.dropIndicator_.setTimeout = this.setTimeout_;
628 } 628 }
629 }; 629 };
630 630
631 return { 631 return {
632 DNDManager: DNDManager, 632 DNDManager: DNDManager,
633 DragInfo: DragInfo, 633 DragInfo: DragInfo,
634 DropIndicator: DropIndicator, 634 DropIndicator: DropIndicator,
635 }; 635 };
636 }); 636 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/md_bookmarks/api_listener.js ('k') | chrome/browser/resources/md_bookmarks/folder_node.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698