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

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

Issue 302313005: Show the Managed Bookmarks folder in the views UI. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased on model changes 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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 155
156 // Sets the URL of |node|. 156 // Sets the URL of |node|.
157 void SetURL(const BookmarkNode* node, const GURL& url); 157 void SetURL(const BookmarkNode* node, const GURL& url);
158 158
159 // Sets the date added time of |node|. 159 // Sets the date added time of |node|.
160 void SetDateAdded(const BookmarkNode* node, base::Time date_added); 160 void SetDateAdded(const BookmarkNode* node, base::Time date_added);
161 161
162 // Returns the set of nodes with the |url|. 162 // Returns the set of nodes with the |url|.
163 void GetNodesByURL(const GURL& url, std::vector<const BookmarkNode*>* nodes); 163 void GetNodesByURL(const GURL& url, std::vector<const BookmarkNode*>* nodes);
164 164
165 // Returns the most recently added node for the |url|. Returns NULL if |url| 165 // Returns the most recently added user node for the |url|; urls from any
166 // is not bookmarked. 166 // nodes that are not editable by the user are never returned by this call.
167 const BookmarkNode* GetMostRecentlyAddedNodeForURL(const GURL& url); 167 // Returns NULL if |url| is not bookmarked.
168 const BookmarkNode* GetMostRecentlyAddedUserNodeForURL(const GURL& url);
168 169
169 // Returns true if there are bookmarks, otherwise returns false. 170 // Returns true if there are bookmarks, otherwise returns false.
170 // This method is thread safe. 171 // This method is thread safe.
171 bool HasBookmarks(); 172 bool HasBookmarks();
172 173
173 // Returns true if there is a bookmark with the |url|. 174 // Returns true if there is a bookmark with the |url|.
174 // This method is thread safe. 175 // This method is thread safe.
175 // See BookmarkService for more details on this. 176 // See BookmarkService for more details on this.
176 virtual bool IsBookmarked(const GURL& url) OVERRIDE; 177 virtual bool IsBookmarked(const GURL& url) OVERRIDE;
177 178
179 // Same as IsBookmarked() but only returns true if at least one of the
180 // bookmarks found can be edited by the user.
181 bool IsBookmarkedByUser(const GURL& url);
sky 2014/06/05 23:46:47 Move this to bookmark_utils.
Joao da Silva 2014/06/06 15:41:03 Done.
182
178 // Returns all the bookmarked urls and their titles. 183 // Returns all the bookmarked urls and their titles.
179 // This method is thread safe. 184 // This method is thread safe.
180 // See BookmarkService for more details on this. 185 // See BookmarkService for more details on this.
181 virtual void GetBookmarks( 186 virtual void GetBookmarks(
182 std::vector<BookmarkService::URLAndTitle>* urls) OVERRIDE; 187 std::vector<BookmarkService::URLAndTitle>* urls) OVERRIDE;
183 188
184 // Blocks until loaded; this is NOT invoked on the main thread. 189 // Blocks until loaded; this is NOT invoked on the main thread.
185 // See BookmarkService for more details on this. 190 // See BookmarkService for more details on this.
186 virtual void BlockTillLoaded() OVERRIDE; 191 virtual void BlockTillLoaded() OVERRIDE;
187 192
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 294
290 // Used to order BookmarkNodes by URL. 295 // Used to order BookmarkNodes by URL.
291 class NodeURLComparator { 296 class NodeURLComparator {
292 public: 297 public:
293 bool operator()(const BookmarkNode* n1, const BookmarkNode* n2) const { 298 bool operator()(const BookmarkNode* n1, const BookmarkNode* n2) const {
294 return n1->url() < n2->url(); 299 return n1->url() < n2->url();
295 } 300 }
296 }; 301 };
297 302
298 // Implementation of IsBookmarked. Before calling this the caller must obtain 303 // Implementation of IsBookmarked. Before calling this the caller must obtain
299 // a lock on |url_lock_|. 304 // a lock on |url_lock_|. If |only_by_editable_nodes| is true then bookmarks
300 bool IsBookmarkedNoLock(const GURL& url); 305 // that the user can't edit are skipped while searching for |url|.
306 bool IsBookmarkedNoLock(const GURL& url, bool only_by_editable_nodes);
301 307
302 // Removes the node from internal maps and recurses through all children. If 308 // Removes the node from internal maps and recurses through all children. If
303 // the node is a url, its url is added to removed_urls. 309 // the node is a url, its url is added to removed_urls.
304 // 310 //
305 // This does NOT delete the node. 311 // This does NOT delete the node.
306 void RemoveNode(BookmarkNode* node, std::set<GURL>* removed_urls); 312 void RemoveNode(BookmarkNode* node, std::set<GURL>* removed_urls);
307 313
308 // Invoked when loading is finished. Sets |loaded_| and notifies observers. 314 // Invoked when loading is finished. Sets |loaded_| and notifies observers.
309 // BookmarkModel takes ownership of |details|. 315 // BookmarkModel takes ownership of |details|.
310 void DoneLoading(scoped_ptr<bookmarks::BookmarkLoadDetails> details); 316 void DoneLoading(scoped_ptr<bookmarks::BookmarkLoadDetails> details);
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 423
418 // See description of IsDoingExtensiveChanges above. 424 // See description of IsDoingExtensiveChanges above.
419 int extensive_changes_; 425 int extensive_changes_;
420 426
421 scoped_ptr<BookmarkExpandedStateTracker> expanded_state_tracker_; 427 scoped_ptr<BookmarkExpandedStateTracker> expanded_state_tracker_;
422 428
423 DISALLOW_COPY_AND_ASSIGN(BookmarkModel); 429 DISALLOW_COPY_AND_ASSIGN(BookmarkModel);
424 }; 430 };
425 431
426 #endif // COMPONENTS_BOOKMARKS_BROWSER_BOOKMARK_MODEL_H_ 432 #endif // COMPONENTS_BOOKMARKS_BROWSER_BOOKMARK_MODEL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698