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

Unified Diff: components/bookmarks/browser/bookmark_storage.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/bookmarks/browser/bookmark_model.cc ('k') | components/bookmarks/browser/bookmark_storage.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/bookmarks/browser/bookmark_storage.h
diff --git a/components/bookmarks/browser/bookmark_storage.h b/components/bookmarks/browser/bookmark_storage.h
index c7bda05d23b318924e050b6d1d7abc6281ae35d4..20728a58ff4439fabb2d6331189782ad87f0a7ec 100644
--- a/components/bookmarks/browser/bookmark_storage.h
+++ b/components/bookmarks/browser/bookmark_storage.h
@@ -5,10 +5,12 @@
#ifndef COMPONENTS_BOOKMARKS_BROWSER_BOOKMARK_STORAGE_H_
#define COMPONENTS_BOOKMARKS_BROWSER_BOOKMARK_STORAGE_H_
+#include "base/callback_forward.h"
#include "base/files/file_path.h"
#include "base/files/important_file_writer.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
+#include "base/memory/scoped_vector.h"
#include "components/bookmarks/browser/bookmark_node.h"
class BookmarkModel;
@@ -21,6 +23,14 @@ namespace bookmarks {
class BookmarkIndex;
+// A list of BookmarkPermanentNodes that owns them.
+typedef ScopedVector<BookmarkPermanentNode> BookmarkPermanentNodeList;
+
+// A callback that generates a BookmarkPermanentNodeList, given a max ID to
+// use. The max ID argument will be updated after any new nodes have been
+// created and assigned IDs.
+typedef base::Callback<BookmarkPermanentNodeList(int64*)> LoadExtraCallback;
+
// BookmarkLoadDetails is used by BookmarkStorage when loading bookmarks.
// BookmarkModel creates a BookmarkLoadDetails and passes it (including
// ownership) to BookmarkStorage. BookmarkStorage loads the bookmarks (and
@@ -34,10 +44,13 @@ class BookmarkLoadDetails {
BookmarkLoadDetails(BookmarkPermanentNode* bb_node,
BookmarkPermanentNode* other_folder_node,
BookmarkPermanentNode* mobile_folder_node,
+ const LoadExtraCallback& load_extra_callback,
BookmarkIndex* index,
int64 max_id);
~BookmarkLoadDetails();
+ void LoadExtraNodes();
+
BookmarkPermanentNode* bb_node() { return bb_node_.get(); }
BookmarkPermanentNode* release_bb_node() { return bb_node_.release(); }
BookmarkPermanentNode* mobile_folder_node() {
@@ -52,6 +65,12 @@ class BookmarkLoadDetails {
BookmarkPermanentNode* release_other_folder_node() {
return other_folder_node_.release();
}
+ const BookmarkPermanentNodeList& extra_nodes() {
+ return extra_nodes_;
+ }
+ void release_extra_nodes(std::vector<BookmarkPermanentNode*>* extra_nodes) {
+ extra_nodes_.release(extra_nodes);
+ }
BookmarkIndex* index() { return index_.get(); }
BookmarkIndex* release_index() { return index_.release(); }
@@ -96,6 +115,8 @@ class BookmarkLoadDetails {
scoped_ptr<BookmarkPermanentNode> bb_node_;
scoped_ptr<BookmarkPermanentNode> other_folder_node_;
scoped_ptr<BookmarkPermanentNode> mobile_folder_node_;
+ LoadExtraCallback load_extra_callback_;
+ BookmarkPermanentNodeList extra_nodes_;
scoped_ptr<BookmarkIndex> index_;
BookmarkNode::MetaInfoMap model_meta_info_map_;
int64 model_sync_transaction_version_;
« no previous file with comments | « components/bookmarks/browser/bookmark_model.cc ('k') | components/bookmarks/browser/bookmark_storage.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698