Chromium Code Reviews| Index: chrome/browser/bookmarks/bookmark_model.h |
| diff --git a/chrome/browser/bookmarks/bookmark_model.h b/chrome/browser/bookmarks/bookmark_model.h |
| index 0e4ada682fb4b5c3b84d194a4a12d26a714a0c99..ee689c1dadedb742165641ea873eed8e850309f8 100644 |
| --- a/chrome/browser/bookmarks/bookmark_model.h |
| +++ b/chrome/browser/bookmarks/bookmark_model.h |
| @@ -50,7 +50,8 @@ class BookmarkNode : public ui::TreeNode<BookmarkNode> { |
| URL, |
| FOLDER, |
| BOOKMARK_BAR, |
| - OTHER_NODE |
| + OTHER_NODE, |
| + SYNCED |
| }; |
| // Creates a new node with the specified url and id of 0 |
| explicit BookmarkNode(const GURL& url); |
| @@ -109,6 +110,13 @@ class BookmarkNode : public ui::TreeNode<BookmarkNode> { |
| bool is_favicon_loaded() const { return loaded_favicon_; } |
| void set_favicon_loaded(bool value) { loaded_favicon_ = value; } |
| + // Accessor method for controlling the visibility of a bookmark node/sub-tree. |
| + // Note that visibility is not propagated down the tree hierarchy so if a |
| + // parent node is marked as invisible, a child node may return "Visible". This |
| + // function is primarily useful when traversing the model to generate a UI |
| + // representation but we may want to suppress some nodes. |
| + bool IsVisible() const; |
|
sky
2011/05/17 15:59:08
Can you add a TODO to remove this when synced is n
Yaron
2011/05/17 19:17:33
Done.
|
| + |
| HistoryService::Handle favicon_load_handle() const { |
| return favicon_load_handle_; |
| } |
| @@ -193,6 +201,9 @@ class BookmarkModel : public NotificationObserver, public BookmarkService { |
| // Returns the 'other' node. This is NULL until loaded. |
| const BookmarkNode* other_node() { return other_node_; } |
| + // Returns the 'synced' node. This is NULL until loaded. |
| + const BookmarkNode* synced_node() { return synced_node_; } |
| + |
| // Returns the parent the last node was added to. This never returns NULL |
| // (as long as the model is loaded). |
| const BookmarkNode* GetParentForNewNodes(); |
| @@ -311,6 +322,9 @@ class BookmarkModel : public NotificationObserver, public BookmarkService { |
| bool is_bookmark_bar_node(const BookmarkNode* node) const { |
| return node == bookmark_bar_node_; |
| } |
| + bool is_synced_bookmarks_node(const BookmarkNode* node) const { |
| + return node == synced_node_; |
| + } |
| bool is_other_bookmarks_node(const BookmarkNode* node) const { |
| return node == other_node_; |
| } |
| @@ -319,7 +333,8 @@ class BookmarkModel : public NotificationObserver, public BookmarkService { |
| bool is_permanent_node(const BookmarkNode* node) const { |
| return is_root(node) || |
| is_bookmark_bar_node(node) || |
| - is_other_bookmarks_node(node); |
| + is_other_bookmarks_node(node) || |
| + is_synced_bookmarks_node(node); |
| } |
| // Sets the store to NULL, making it so the BookmarkModel does not persist |
| @@ -380,10 +395,11 @@ class BookmarkModel : public NotificationObserver, public BookmarkService { |
| // Returns true if the parent and index are valid. |
| bool IsValidIndex(const BookmarkNode* parent, int index, bool allow_end); |
| - // Creates the bookmark bar/other nodes. These call into |
| + // Creates the bookmark bar/synced/other nodes. These call into |
| // CreateRootNodeFromStarredEntry. |
| BookmarkNode* CreateBookmarkNode(); |
| BookmarkNode* CreateOtherBookmarksNode(); |
| + BookmarkNode* CreateSyncedBookmarksNode(); |
| // Creates a root node (either the bookmark bar node or other node) from the |
| // specified starred entry. |
| @@ -439,6 +455,7 @@ class BookmarkModel : public NotificationObserver, public BookmarkService { |
| BookmarkNode* bookmark_bar_node_; |
| BookmarkNode* other_node_; |
| + BookmarkNode* synced_node_; |
| // The maximum ID assigned to the bookmark nodes in the model. |
| int64 next_node_id_; |