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

Side by Side Diff: chrome/browser/resources/bookmark_manager/js/bmm/bookmark_tree.js

Issue 11635038: Should not unregister BookmarkTreeItem from lookup table on handling moved event (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 5
6 cr.define('bmm', function() { 6 cr.define('bmm', function() {
7 /** @const */ var Tree = cr.ui.Tree; 7 /** @const */ var Tree = cr.ui.Tree;
8 /** @const */ var TreeItem = cr.ui.TreeItem; 8 /** @const */ var TreeItem = cr.ui.TreeItem;
9 9
10 var treeLookup = {}; 10 var treeLookup = {};
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 var parentItem = treeLookup[bookmarkNode.parentId]; 186 var parentItem = treeLookup[bookmarkNode.parentId];
187 var newItem = new BookmarkTreeItem(bookmarkNode); 187 var newItem = new BookmarkTreeItem(bookmarkNode);
188 addTreeItem(parentItem, newItem); 188 addTreeItem(parentItem, newItem);
189 } 189 }
190 }, 190 },
191 191
192 handleMoved: function(id, moveInfo) { 192 handleMoved: function(id, moveInfo) {
193 var treeItem = treeLookup[id]; 193 var treeItem = treeLookup[id];
194 if (treeItem) { 194 if (treeItem) {
195 var oldParentItem = treeLookup[moveInfo.oldParentId]; 195 var oldParentItem = treeLookup[moveInfo.oldParentId];
196 oldParentItem.remove(treeItem); 196 TreeItem.prototype.remove.call(oldParentItem, treeItem);
arv (Not doing code reviews) 2012/12/20 14:54:51 This seems pretty hacky. Is there an alternative s
197 var newParentItem = treeLookup[moveInfo.parentId]; 197 var newParentItem = treeLookup[moveInfo.parentId];
198 // The tree only shows folders so the index is not the index we want. We 198 // The tree only shows folders so the index is not the index we want. We
199 // therefore get the children need to adjust the index. 199 // therefore get the children need to adjust the index.
200 addTreeItem(newParentItem, treeItem); 200 addTreeItem(newParentItem, treeItem);
201 } 201 }
202 }, 202 },
203 203
204 handleRemoved: function(id, removeInfo) { 204 handleRemoved: function(id, removeInfo) {
205 var parentItem = treeLookup[removeInfo.parentId]; 205 var parentItem = treeLookup[removeInfo.parentId];
206 var itemToRemove = treeLookup[id]; 206 var itemToRemove = treeLookup[id];
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 } 287 }
288 }; 288 };
289 289
290 return { 290 return {
291 BookmarkTree: BookmarkTree, 291 BookmarkTree: BookmarkTree,
292 BookmarkTreeItem: BookmarkTreeItem, 292 BookmarkTreeItem: BookmarkTreeItem,
293 treeLookup: treeLookup, 293 treeLookup: treeLookup,
294 tree: tree 294 tree: tree
295 }; 295 };
296 }); 296 });
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698