OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 // ownership) to BookmarkStorage. BoomarkStorage loads the bookmarks (and index) | 23 // ownership) to BookmarkStorage. BoomarkStorage loads the bookmarks (and index) |
24 // in the background thread, then calls back to the BookmarkModel (on the main | 24 // in the background thread, then calls back to the BookmarkModel (on the main |
25 // thread) when loading is done, passing ownership back to the BookmarkModel. | 25 // thread) when loading is done, passing ownership back to the BookmarkModel. |
26 // While loading BookmarkModel does not maintain references to the contents | 26 // While loading BookmarkModel does not maintain references to the contents |
27 // of the BookmarkLoadDetails, this ensures we don't have any threading | 27 // of the BookmarkLoadDetails, this ensures we don't have any threading |
28 // problems. | 28 // problems. |
29 class BookmarkLoadDetails { | 29 class BookmarkLoadDetails { |
30 public: | 30 public: |
31 BookmarkLoadDetails(BookmarkNode* bb_node, | 31 BookmarkLoadDetails(BookmarkNode* bb_node, |
32 BookmarkNode* other_folder_node, | 32 BookmarkNode* other_folder_node, |
| 33 BookmarkNode* synced_folder_node, |
33 BookmarkIndex* index, | 34 BookmarkIndex* index, |
34 int64 max_id); | 35 int64 max_id); |
35 ~BookmarkLoadDetails(); | 36 ~BookmarkLoadDetails(); |
36 | 37 |
37 BookmarkNode* bb_node() { return bb_node_.get(); } | 38 BookmarkNode* bb_node() { return bb_node_.get(); } |
38 BookmarkNode* release_bb_node() { return bb_node_.release(); } | 39 BookmarkNode* release_bb_node() { return bb_node_.release(); } |
| 40 BookmarkNode* synced_folder_node() { return synced_folder_node_.get(); } |
| 41 BookmarkNode* release_synced_folder_node() { |
| 42 return synced_folder_node_.release(); |
| 43 } |
39 BookmarkNode* other_folder_node() { return other_folder_node_.get(); } | 44 BookmarkNode* other_folder_node() { return other_folder_node_.get(); } |
40 BookmarkNode* release_other_folder_node() { | 45 BookmarkNode* release_other_folder_node() { |
41 return other_folder_node_.release(); | 46 return other_folder_node_.release(); |
42 } | 47 } |
43 BookmarkIndex* index() { return index_.get(); } | 48 BookmarkIndex* index() { return index_.get(); } |
44 BookmarkIndex* release_index() { return index_.release(); } | 49 BookmarkIndex* release_index() { return index_.release(); } |
45 | 50 |
46 // Max id of the nodes. | 51 // Max id of the nodes. |
47 void set_max_id(int64 max_id) { max_id_ = max_id; } | 52 void set_max_id(int64 max_id) { max_id_ = max_id; } |
48 int64 max_id() const { return max_id_; } | 53 int64 max_id() const { return max_id_; } |
(...skipping 10 matching lines...) Expand all Loading... |
59 } | 64 } |
60 const std::string& stored_checksum() const { return stored_checksum_; } | 65 const std::string& stored_checksum() const { return stored_checksum_; } |
61 | 66 |
62 // Whether ids were reassigned. | 67 // Whether ids were reassigned. |
63 void set_ids_reassigned(bool value) { ids_reassigned_ = value; } | 68 void set_ids_reassigned(bool value) { ids_reassigned_ = value; } |
64 bool ids_reassigned() const { return ids_reassigned_; } | 69 bool ids_reassigned() const { return ids_reassigned_; } |
65 | 70 |
66 private: | 71 private: |
67 scoped_ptr<BookmarkNode> bb_node_; | 72 scoped_ptr<BookmarkNode> bb_node_; |
68 scoped_ptr<BookmarkNode> other_folder_node_; | 73 scoped_ptr<BookmarkNode> other_folder_node_; |
| 74 scoped_ptr<BookmarkNode> synced_folder_node_; |
69 scoped_ptr<BookmarkIndex> index_; | 75 scoped_ptr<BookmarkIndex> index_; |
70 int64 max_id_; | 76 int64 max_id_; |
71 std::string computed_checksum_; | 77 std::string computed_checksum_; |
72 std::string stored_checksum_; | 78 std::string stored_checksum_; |
73 bool ids_reassigned_; | 79 bool ids_reassigned_; |
74 | 80 |
75 DISALLOW_COPY_AND_ASSIGN(BookmarkLoadDetails); | 81 DISALLOW_COPY_AND_ASSIGN(BookmarkLoadDetails); |
76 }; | 82 }; |
77 | 83 |
78 // BookmarkStorage handles reading/write the bookmark bar model. The | 84 // BookmarkStorage handles reading/write the bookmark bar model. The |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 // Path to temporary file created during migrating bookmarks from history. | 158 // Path to temporary file created during migrating bookmarks from history. |
153 const FilePath tmp_history_path_; | 159 const FilePath tmp_history_path_; |
154 | 160 |
155 // See class description of BookmarkLoadDetails for details on this. | 161 // See class description of BookmarkLoadDetails for details on this. |
156 scoped_ptr<BookmarkLoadDetails> details_; | 162 scoped_ptr<BookmarkLoadDetails> details_; |
157 | 163 |
158 DISALLOW_COPY_AND_ASSIGN(BookmarkStorage); | 164 DISALLOW_COPY_AND_ASSIGN(BookmarkStorage); |
159 }; | 165 }; |
160 | 166 |
161 #endif // CHROME_BROWSER_BOOKMARKS_BOOKMARK_STORAGE_H_ | 167 #endif // CHROME_BROWSER_BOOKMARKS_BOOKMARK_STORAGE_H_ |
OLD | NEW |