Index: chrome/browser/resources/bookmark_manager/js/bmm.js |
diff --git a/chrome/browser/resources/bookmark_manager/js/bmm.js b/chrome/browser/resources/bookmark_manager/js/bmm.js |
index 0d7c491f5df305db848fdb25a9f4cedabfad0c07..48e7176a5248d8b7b9a62c053a1d5bb4d3ffd920 100644 |
--- a/chrome/browser/resources/bookmark_manager/js/bmm.js |
+++ b/chrome/browser/resources/bookmark_manager/js/bmm.js |
@@ -4,6 +4,13 @@ |
cr.define('bmm', function() { |
/** |
+ * The id of the managed node. |
+ * @type {string} |
+ * @const |
+ */ |
+ var MANAGED_NODE_ID = '4'; |
+ |
+ /** |
* Whether a node contains another node. |
* TODO(yosin): Once JavaScript style guide is updated and linter follows |
* that, we'll remove useless documentations for |parent| and |descendant|. |
@@ -30,6 +37,18 @@ cr.define('bmm', function() { |
return !('url' in node); |
} |
+ /** |
+ * @param {!BookmarkTreeNode} node The node to test. |
arv (Not doing code reviews)
2014/06/02 23:33:23
The code assumes node can be null but the type ann
arv (Not doing code reviews)
2014/06/02 23:33:23
Remove useless description
Joao da Silva
2014/06/03 14:07:54
The annotation is wrong, fixed.
Joao da Silva
2014/06/03 14:07:54
PRESUBMIT.py runs a javascript linter that fails w
arv (Not doing code reviews)
2014/06/03 14:31:38
Sad. Our linter is out of date.
|
+ * @return {boolean} Whether a bookmark node is managed. |
+ */ |
+ function isManaged(node) { |
+ if (!node) |
+ return false; |
+ if (node.id === MANAGED_NODE_ID) |
+ return true; |
+ return this.contains(bmm.treeLookup[MANAGED_NODE_ID].bookmarkNode, node); |
arv (Not doing code reviews)
2014/06/02 23:33:23
This is O(depth). Is that acceptable?
Joao da Silva
2014/06/03 14:07:54
I think it's fine because the bookmarks tree is ra
|
+ } |
+ |
var loadingPromises = {}; |
/** |
@@ -242,6 +261,7 @@ cr.define('bmm', function() { |
return { |
contains: contains, |
isFolder: isFolder, |
+ isManaged: isManaged, |
loadSubtree: loadSubtree, |
loadTree: loadTree, |
addBookmarkModelListeners: addBookmarkModelListeners |