| OLD | NEW |
| 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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 draggable: bookmarkNode.parentId != ROOT_ID | 95 draggable: bookmarkNode.parentId != ROOT_ID |
| 96 }); | 96 }); |
| 97 ti.__proto__ = BookmarkTreeItem.prototype; | 97 ti.__proto__ = BookmarkTreeItem.prototype; |
| 98 treeLookup[bookmarkNode.id] = ti; | 98 treeLookup[bookmarkNode.id] = ti; |
| 99 return ti; | 99 return ti; |
| 100 } | 100 } |
| 101 | 101 |
| 102 BookmarkTreeItem.prototype = { | 102 BookmarkTreeItem.prototype = { |
| 103 __proto__: TreeItem.prototype, | 103 __proto__: TreeItem.prototype, |
| 104 | 104 |
| 105 /** @override */ | |
| 106 remove: function(child) { | |
| 107 TreeItem.prototype.remove.call(this, child); | |
| 108 if (child.bookmarkNode) | |
| 109 delete treeLookup[child.bookmarkNode.id]; | |
| 110 }, | |
| 111 | |
| 112 /** | 105 /** |
| 113 * The ID of the bookmark this tree item represents. | 106 * The ID of the bookmark this tree item represents. |
| 114 * @type {string} | 107 * @type {string} |
| 115 */ | 108 */ |
| 116 get bookmarkId() { | 109 get bookmarkId() { |
| 117 return this.bookmarkNode.id; | 110 return this.bookmarkNode.id; |
| 118 } | 111 } |
| 119 }; | 112 }; |
| 120 | 113 |
| 121 /** | 114 /** |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 } | 280 } |
| 288 }; | 281 }; |
| 289 | 282 |
| 290 return { | 283 return { |
| 291 BookmarkTree: BookmarkTree, | 284 BookmarkTree: BookmarkTree, |
| 292 BookmarkTreeItem: BookmarkTreeItem, | 285 BookmarkTreeItem: BookmarkTreeItem, |
| 293 treeLookup: treeLookup, | 286 treeLookup: treeLookup, |
| 294 tree: tree | 287 tree: tree |
| 295 }; | 288 }; |
| 296 }); | 289 }); |
| OLD | NEW |