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

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

Issue 8497008: Implement Bookmark All Tabs Dialog with WebUI. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review fix Created 9 years, 1 month 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
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 Tree = cr.ui.Tree; 7 const Tree = cr.ui.Tree;
8 const TreeItem = cr.ui.TreeItem; 8 const TreeItem = cr.ui.TreeItem;
9 9
10 var treeLookup = {}; 10 var treeLookup = {};
11 var tree;
11 12
12 // Manager for persisting the expanded state. 13 // Manager for persisting the expanded state.
13 var expandedManager = { 14 var expandedManager = {
14 /** 15 /**
15 * A map of the collapsed IDs. 16 * A map of the collapsed IDs.
16 * @type {Object} 17 * @type {Object}
17 */ 18 */
18 map: 'bookmarkTreeState' in localStorage ? 19 map: 'bookmarkTreeState' in localStorage ?
19 JSON.parse(localStorage['bookmarkTreeState']) : {}, 20 JSON.parse(localStorage['bookmarkTreeState']) : {},
20 21
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 */ 161 */
161 var BookmarkTree = cr.ui.define('tree'); 162 var BookmarkTree = cr.ui.define('tree');
162 163
163 BookmarkTree.prototype = { 164 BookmarkTree.prototype = {
164 __proto__: Tree.prototype, 165 __proto__: Tree.prototype,
165 166
166 decorate: function() { 167 decorate: function() {
167 Tree.prototype.decorate.call(this); 168 Tree.prototype.decorate.call(this);
168 this.addEventListener('expand', expandedManager); 169 this.addEventListener('expand', expandedManager);
169 this.addEventListener('collapse', expandedManager); 170 this.addEventListener('collapse', expandedManager);
171 bmm.tree = this;
170 }, 172 },
171 173
172 handleBookmarkChanged: function(id, changeInfo) { 174 handleBookmarkChanged: function(id, changeInfo) {
173 var treeItem = treeLookup[id]; 175 var treeItem = treeLookup[id];
174 if (treeItem) 176 if (treeItem)
175 treeItem.label = treeItem.bookmarkNode.title = changeInfo.title; 177 treeItem.label = treeItem.bookmarkNode.title = changeInfo.title;
176 }, 178 },
177 179
178 handleChildrenReordered: function(id, reorderInfo) { 180 handleChildrenReordered: function(id, reorderInfo) {
179 var parentItem = treeLookup[id]; 181 var parentItem = treeLookup[id];
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 remove: function(child) { 295 remove: function(child) {
294 Tree.prototype.remove.call(this, child); 296 Tree.prototype.remove.call(this, child);
295 if (child.bookmarkNode) 297 if (child.bookmarkNode)
296 delete treeLookup[child.bookmarkNode.id]; 298 delete treeLookup[child.bookmarkNode.id];
297 } 299 }
298 }; 300 };
299 301
300 return { 302 return {
301 BookmarkTree: BookmarkTree, 303 BookmarkTree: BookmarkTree,
302 BookmarkTreeItem: BookmarkTreeItem, 304 BookmarkTreeItem: BookmarkTreeItem,
303 treeLookup: treeLookup 305 treeLookup: treeLookup,
306 tree: tree
304 }; 307 };
305 }); 308 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698