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

Side by Side Diff: components/bookmarks/browser/bookmark_model.h

Issue 305973004: BookmarkClient can add extra nodes to BookmarkModel. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: renamed methods Created 6 years, 6 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #ifndef COMPONENTS_BOOKMARKS_BROWSER_BOOKMARK_MODEL_H_ 5 #ifndef COMPONENTS_BOOKMARKS_BROWSER_BOOKMARK_MODEL_H_
6 #define COMPONENTS_BOOKMARKS_BROWSER_BOOKMARK_MODEL_H_ 6 #define COMPONENTS_BOOKMARKS_BROWSER_BOOKMARK_MODEL_H_
7 7
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 #include <vector> 10 #include <vector>
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 91
92 // Returns the 'other' node. This is NULL until loaded. 92 // Returns the 'other' node. This is NULL until loaded.
93 const BookmarkNode* other_node() const { return other_node_; } 93 const BookmarkNode* other_node() const { return other_node_; }
94 94
95 // Returns the 'mobile' node. This is NULL until loaded. 95 // Returns the 'mobile' node. This is NULL until loaded.
96 const BookmarkNode* mobile_node() const { return mobile_node_; } 96 const BookmarkNode* mobile_node() const { return mobile_node_; }
97 97
98 bool is_root_node(const BookmarkNode* node) const { return node == &root_; } 98 bool is_root_node(const BookmarkNode* node) const { return node == &root_; }
99 99
100 // Returns whether the given |node| is one of the permanent nodes - root node, 100 // Returns whether the given |node| is one of the permanent nodes - root node,
101 // 'bookmark bar' node, 'other' node or 'mobile' node. 101 // 'bookmark bar' node, 'other' node or 'mobile' node, or one of the root
102 // nodes supplied by the |client_|.
102 bool is_permanent_node(const BookmarkNode* node) const { 103 bool is_permanent_node(const BookmarkNode* node) const {
103 return node == &root_ || 104 return node && (node == &root_ || node->parent() == &root_);
104 node == bookmark_bar_node_ ||
105 node == other_node_ ||
106 node == mobile_node_;
107 } 105 }
108 106
109 // Returns the parent the last node was added to. This never returns NULL 107 // Returns the parent the last node was added to. This never returns NULL
110 // (as long as the model is loaded). 108 // (as long as the model is loaded).
111 const BookmarkNode* GetParentForNewNodes(); 109 const BookmarkNode* GetParentForNewNodes();
112 110
113 void AddObserver(BookmarkModelObserver* observer); 111 void AddObserver(BookmarkModelObserver* observer);
114 void RemoveObserver(BookmarkModelObserver* observer); 112 void RemoveObserver(BookmarkModelObserver* observer);
115 113
116 // Notifies the observers that an extensive set of changes is about to happen, 114 // Notifies the observers that an extensive set of changes is about to happen,
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
419 417
420 // See description of IsDoingExtensiveChanges above. 418 // See description of IsDoingExtensiveChanges above.
421 int extensive_changes_; 419 int extensive_changes_;
422 420
423 scoped_ptr<BookmarkExpandedStateTracker> expanded_state_tracker_; 421 scoped_ptr<BookmarkExpandedStateTracker> expanded_state_tracker_;
424 422
425 DISALLOW_COPY_AND_ASSIGN(BookmarkModel); 423 DISALLOW_COPY_AND_ASSIGN(BookmarkModel);
426 }; 424 };
427 425
428 #endif // COMPONENTS_BOOKMARKS_BROWSER_BOOKMARK_MODEL_H_ 426 #endif // COMPONENTS_BOOKMARKS_BROWSER_BOOKMARK_MODEL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698