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

Unified Diff: chrome/browser/bookmarks/bookmark_model.h

Issue 99217: Implement ID persistence for bookmarks:... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 8 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 | « chrome/browser/bookmarks/bookmark_codec_unittest.cc ('k') | chrome/browser/bookmarks/bookmark_model.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/bookmarks/bookmark_model.h
===================================================================
--- chrome/browser/bookmarks/bookmark_model.h (revision 14989)
+++ chrome/browser/bookmarks/bookmark_model.h (working copy)
@@ -43,13 +43,17 @@
friend class BookmarkModel;
friend class BookmarkCodec;
friend class history::StarredURLDatabase;
+ FRIEND_TEST(BookmarkCodecTest, PersistIDsTest);
FRIEND_TEST(BookmarkEditorViewTest, ChangeParentAndURL);
FRIEND_TEST(BookmarkEditorViewTest, EditURLKeepsPosition);
FRIEND_TEST(BookmarkModelTest, MostRecentlyAddedEntries);
FRIEND_TEST(BookmarkModelTest, GetMostRecentlyAddedNodeForURL);
public:
+ // Creates a new node with the given properties. If the ID is not given or is
+ // 0, it is automatically assigned.
BookmarkNode(BookmarkModel* model, const GURL& url);
+ BookmarkNode(BookmarkModel* model, int id, const GURL& url);
virtual ~BookmarkNode() {}
// Returns the favicon for the this node. If the favicon has not yet been
@@ -92,14 +96,23 @@
// HistoryContentsProvider.
private:
+ // Sets the next ID for bookmark node ID generation.
+ static void SetNextId(int next_id);
+
+ // helper to initialize various fields during construction.
+ void Initialize(BookmarkModel* model, int id);
+
// Resets the properties of the node from the supplied entry.
void Reset(const history::StarredEntry& entry);
+ // Sets the id to the given value.
+ void set_id(int id) { id_ = id; }
+
// The model. This is NULL when created by StarredURLDatabase for migration.
BookmarkModel* model_;
// Unique identifier for this node.
- const int id_;
+ int id_;
// Whether the favicon has been loaded.
bool loaded_favicon_;
« no previous file with comments | « chrome/browser/bookmarks/bookmark_codec_unittest.cc ('k') | chrome/browser/bookmarks/bookmark_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698