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

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

Issue 543863002: Typecheck chrome://bookmarks using Closure Compiler (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@true_master
Patch Set: debug warns Created 6 years, 2 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
« no previous file with comments | « no previous file | chrome/browser/resources/bookmark_manager/js/bmm/bookmark_list.js » ('j') | 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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('bmm', function() { 5 cr.define('bmm', function() {
6 /** 6 /**
7 * Whether a node contains another node. 7 * Whether a node contains another node.
8 * TODO(yosin): Once JavaScript style guide is updated and linter follows 8 * TODO(yosin): Once JavaScript style guide is updated and linter follows
9 * that, we'll remove useless documentations for |parent| and |descendant|. 9 * that, we'll remove useless documentations for |parent| and |descendant|.
10 * TODO(yosin): bmm.contains() should be method of BookmarkTreeNode. 10 * TODO(yosin): bmm.contains() should be method of BookmarkTreeNode.
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 return nodes && nodes[0]; 57 return nodes && nodes[0];
58 }); 58 });
59 } 59 }
60 return loadingPromises[id]; 60 return loadingPromises[id];
61 } 61 }
62 62
63 /** 63 /**
64 * Loads the entire bookmark tree and returns a {@code Promise} that will 64 * Loads the entire bookmark tree and returns a {@code Promise} that will
65 * be fulfilled when done. This reuses multiple loads so that we do not load 65 * be fulfilled when done. This reuses multiple loads so that we do not load
66 * the same tree more than once at the same time. 66 * the same tree more than once at the same time.
67 * @return {!Promise.<Node>} The future promise for the load. 67 * @return {!Promise.<!BookmarkTreeNode>} The future promise for the load.
68 */ 68 */
69 function loadTree() { 69 function loadTree() {
70 return loadSubtree(''); 70 return loadSubtree('');
71 } 71 }
72 72
73 var bookmarkCache = { 73 var bookmarkCache = {
74 /** 74 /**
75 * Removes the cached item from both the list and tree lookups. 75 * Removes the cached item from both the list and tree lookups.
76 */ 76 */
77 remove: function(id) { 77 remove: function(id) {
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 bmm.tree.handleMoved(id, moveInfo); 162 bmm.tree.handleMoved(id, moveInfo);
163 163
164 bookmarkCache.updateChildren(moveInfo.parentId); 164 bookmarkCache.updateChildren(moveInfo.parentId);
165 if (moveInfo.parentId != moveInfo.oldParentId) 165 if (moveInfo.parentId != moveInfo.oldParentId)
166 bookmarkCache.updateChildren(moveInfo.oldParentId); 166 bookmarkCache.updateChildren(moveInfo.oldParentId);
167 } 167 }
168 168
169 /** 169 /**
170 * Callback for when a bookmark node is removed. 170 * Callback for when a bookmark node is removed.
171 * @param {string} id The id of the removed bookmark node. 171 * @param {string} id The id of the removed bookmark node.
172 * @param {!Object} bookmarkNode The information about removed. 172 * @param {!Object} removeInfo The information about removed.
173 */ 173 */
174 function handleRemoved(id, removeInfo) { 174 function handleRemoved(id, removeInfo) {
175 if (bmm.list) 175 if (bmm.list)
176 bmm.list.handleRemoved(id, removeInfo); 176 bmm.list.handleRemoved(id, removeInfo);
177 if (bmm.tree) 177 if (bmm.tree)
178 bmm.tree.handleRemoved(id, removeInfo); 178 bmm.tree.handleRemoved(id, removeInfo);
179 179
180 bookmarkCache.updateChildren(removeInfo.parentId); 180 bookmarkCache.updateChildren(removeInfo.parentId);
181 bookmarkCache.remove(id); 181 bookmarkCache.remove(id);
182 } 182 }
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 }; 240 };
241 241
242 return { 242 return {
243 contains: contains, 243 contains: contains,
244 isFolder: isFolder, 244 isFolder: isFolder,
245 loadSubtree: loadSubtree, 245 loadSubtree: loadSubtree,
246 loadTree: loadTree, 246 loadTree: loadTree,
247 addBookmarkModelListeners: addBookmarkModelListeners 247 addBookmarkModelListeners: addBookmarkModelListeners
248 }; 248 };
249 }); 249 });
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/resources/bookmark_manager/js/bmm/bookmark_list.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698