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

Side by Side Diff: chrome/browser/bookmarks/bookmark_storage.h

Issue 149310: Always persist bookmark IDs.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 5 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 (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 CHROME_BROWSER_BOOKMARKS_BOOKMARK_STORAGE_H_ 5 #ifndef CHROME_BROWSER_BOOKMARKS_BOOKMARK_STORAGE_H_
6 #define CHROME_BROWSER_BOOKMARKS_BOOKMARK_STORAGE_H_ 6 #define CHROME_BROWSER_BOOKMARKS_BOOKMARK_STORAGE_H_
7 7
8 #include "base/file_path.h" 8 #include "base/file_path.h"
9 #include "base/ref_counted.h" 9 #include "base/ref_counted.h"
10 #include "base/scoped_ptr.h" 10 #include "base/scoped_ptr.h"
(...skipping 26 matching lines...) Expand all
37 // BookmarkStorage. BoomarkStorage loads the bookmarks (and index) in the 37 // BookmarkStorage. BoomarkStorage loads the bookmarks (and index) in the
38 // background thread, then calls back to the BookmarkModel (on the main 38 // background thread, then calls back to the BookmarkModel (on the main
39 // thread) when loading is done, passing ownership back to the BookmarkModel. 39 // thread) when loading is done, passing ownership back to the BookmarkModel.
40 // While loading BookmarkModel does not maintain references to the contents 40 // While loading BookmarkModel does not maintain references to the contents
41 // of the LoadDetails, this ensures we don't have any threading problems. 41 // of the LoadDetails, this ensures we don't have any threading problems.
42 class LoadDetails { 42 class LoadDetails {
43 public: 43 public:
44 LoadDetails(BookmarkNode* bb_node, 44 LoadDetails(BookmarkNode* bb_node,
45 BookmarkNode* other_folder_node, 45 BookmarkNode* other_folder_node,
46 BookmarkIndex* index, 46 BookmarkIndex* index,
47 int max_id) 47 int64 max_id)
48 : bb_node_(bb_node), 48 : bb_node_(bb_node),
49 other_folder_node_(other_folder_node), 49 other_folder_node_(other_folder_node),
50 index_(index), 50 index_(index),
51 max_id_(max_id) { 51 max_id_(max_id) {
52 } 52 }
53 53
54 void release() { 54 void release() {
55 bb_node_.release(); 55 bb_node_.release();
56 other_folder_node_.release(); 56 other_folder_node_.release();
57 index_.release(); 57 index_.release();
58 } 58 }
59 59
60 BookmarkNode* bb_node() { return bb_node_.get(); } 60 BookmarkNode* bb_node() { return bb_node_.get(); }
61 BookmarkNode* other_folder_node() { return other_folder_node_.get(); } 61 BookmarkNode* other_folder_node() { return other_folder_node_.get(); }
62 BookmarkIndex* index() { return index_.get(); } 62 BookmarkIndex* index() { return index_.get(); }
63 63
64 // Max id of the nodes. 64 // Max id of the nodes.
65 void set_max_id(int max_id) { max_id_ = max_id; } 65 void set_max_id(int64 max_id) { max_id_ = max_id; }
66 int max_id() const { return max_id_; } 66 int64 max_id() const { return max_id_; }
67 67
68 // Computed checksum. 68 // Computed checksum.
69 void set_computed_checksum(const std::string& value) { 69 void set_computed_checksum(const std::string& value) {
70 computed_checksum_ = value; 70 computed_checksum_ = value;
71 } 71 }
72 const std::string& computed_checksum() const { return computed_checksum_; } 72 const std::string& computed_checksum() const { return computed_checksum_; }
73 73
74 // Stored checksum. 74 // Stored checksum.
75 void set_stored_checksum(const std::string& value) { 75 void set_stored_checksum(const std::string& value) {
76 stored_checksum_ = value; 76 stored_checksum_ = value;
77 } 77 }
78 const std::string& stored_checksum() const { return stored_checksum_; } 78 const std::string& stored_checksum() const { return stored_checksum_; }
79 79
80 // Whether ids were reassigned.
81 void set_ids_reassigned(bool value) { ids_reassigned_ = value; }
82 bool ids_reassigned() const { return ids_reassigned_; }
83
80 private: 84 private:
81 scoped_ptr<BookmarkNode> bb_node_; 85 scoped_ptr<BookmarkNode> bb_node_;
82 scoped_ptr<BookmarkNode> other_folder_node_; 86 scoped_ptr<BookmarkNode> other_folder_node_;
83 scoped_ptr<BookmarkIndex> index_; 87 scoped_ptr<BookmarkIndex> index_;
84 int max_id_; 88 int64 max_id_;
85 std::string computed_checksum_; 89 std::string computed_checksum_;
86 std::string stored_checksum_; 90 std::string stored_checksum_;
91 bool ids_reassigned_;
87 92
88 DISALLOW_COPY_AND_ASSIGN(LoadDetails); 93 DISALLOW_COPY_AND_ASSIGN(LoadDetails);
89 }; 94 };
90 95
91 // Creates a BookmarkStorage for the specified model 96 // Creates a BookmarkStorage for the specified model
92 BookmarkStorage(Profile* profile, BookmarkModel* model); 97 BookmarkStorage(Profile* profile, BookmarkModel* model);
93 ~BookmarkStorage(); 98 ~BookmarkStorage();
94 99
95 // Loads the bookmarks into the model, notifying the model when done. This 100 // Loads the bookmarks into the model, notifying the model when done. This
96 // takes ownership of |details|. See LoadDetails for details. 101 // takes ownership of |details|. See LoadDetails for details.
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 // Path to temporary file created during migrating bookmarks from history. 168 // Path to temporary file created during migrating bookmarks from history.
164 const FilePath tmp_history_path_; 169 const FilePath tmp_history_path_;
165 170
166 // See class description of LoadDetails for details on this. 171 // See class description of LoadDetails for details on this.
167 scoped_ptr<LoadDetails> details_; 172 scoped_ptr<LoadDetails> details_;
168 173
169 DISALLOW_COPY_AND_ASSIGN(BookmarkStorage); 174 DISALLOW_COPY_AND_ASSIGN(BookmarkStorage);
170 }; 175 };
171 176
172 #endif // CHROME_BROWSER_BOOKMARKS_BOOKMARK_STORAGE_H_ 177 #endif // CHROME_BROWSER_BOOKMARKS_BOOKMARK_STORAGE_H_
OLDNEW
« no previous file with comments | « chrome/browser/bookmarks/bookmark_model_unittest.cc ('k') | chrome/browser/bookmarks/bookmark_storage.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698