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 BookmarkNode* mobile_folder_node, |
34 BookmarkIndex* index, | 34 BookmarkIndex* index, |
35 int64 max_id); | 35 int64 max_id); |
36 ~BookmarkLoadDetails(); | 36 ~BookmarkLoadDetails(); |
37 | 37 |
38 BookmarkNode* bb_node() { return bb_node_.get(); } | 38 BookmarkNode* bb_node() { return bb_node_.get(); } |
39 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(); } | 40 BookmarkNode* mobile_folder_node() { return mobile_folder_node_.get(); } |
41 BookmarkNode* release_synced_folder_node() { | 41 BookmarkNode* release_mobile_folder_node() { |
42 return synced_folder_node_.release(); | 42 return mobile_folder_node_.release(); |
43 } | 43 } |
44 BookmarkNode* other_folder_node() { return other_folder_node_.get(); } | 44 BookmarkNode* other_folder_node() { return other_folder_node_.get(); } |
45 BookmarkNode* release_other_folder_node() { | 45 BookmarkNode* release_other_folder_node() { |
46 return other_folder_node_.release(); | 46 return other_folder_node_.release(); |
47 } | 47 } |
48 BookmarkIndex* index() { return index_.get(); } | 48 BookmarkIndex* index() { return index_.get(); } |
49 BookmarkIndex* release_index() { return index_.release(); } | 49 BookmarkIndex* release_index() { return index_.release(); } |
50 | 50 |
51 // Max id of the nodes. | 51 // Max id of the nodes. |
52 void set_max_id(int64 max_id) { max_id_ = max_id; } | 52 void set_max_id(int64 max_id) { max_id_ = max_id; } |
(...skipping 14 matching lines...) Expand all Loading... |
67 // Whether ids were reassigned. IDs are reassigned during decoding if the | 67 // Whether ids were reassigned. IDs are reassigned during decoding if the |
68 // checksum of the file doesn't match, some IDs are missing or not | 68 // checksum of the file doesn't match, some IDs are missing or not |
69 // unique. Basically, if the user modified the bookmarks directly we'll | 69 // unique. Basically, if the user modified the bookmarks directly we'll |
70 // reassign the ids to ensure they are unique. | 70 // reassign the ids to ensure they are unique. |
71 void set_ids_reassigned(bool value) { ids_reassigned_ = value; } | 71 void set_ids_reassigned(bool value) { ids_reassigned_ = value; } |
72 bool ids_reassigned() const { return ids_reassigned_; } | 72 bool ids_reassigned() const { return ids_reassigned_; } |
73 | 73 |
74 private: | 74 private: |
75 scoped_ptr<BookmarkNode> bb_node_; | 75 scoped_ptr<BookmarkNode> bb_node_; |
76 scoped_ptr<BookmarkNode> other_folder_node_; | 76 scoped_ptr<BookmarkNode> other_folder_node_; |
77 scoped_ptr<BookmarkNode> synced_folder_node_; | 77 scoped_ptr<BookmarkNode> mobile_folder_node_; |
78 scoped_ptr<BookmarkIndex> index_; | 78 scoped_ptr<BookmarkIndex> index_; |
79 int64 max_id_; | 79 int64 max_id_; |
80 std::string computed_checksum_; | 80 std::string computed_checksum_; |
81 std::string stored_checksum_; | 81 std::string stored_checksum_; |
82 bool ids_reassigned_; | 82 bool ids_reassigned_; |
83 | 83 |
84 DISALLOW_COPY_AND_ASSIGN(BookmarkLoadDetails); | 84 DISALLOW_COPY_AND_ASSIGN(BookmarkLoadDetails); |
85 }; | 85 }; |
86 | 86 |
87 // BookmarkStorage handles reading/write the bookmark bar model. The | 87 // BookmarkStorage handles reading/write the bookmark bar model. The |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 // Path to temporary file created during migrating bookmarks from history. | 159 // Path to temporary file created during migrating bookmarks from history. |
160 const FilePath tmp_history_path_; | 160 const FilePath tmp_history_path_; |
161 | 161 |
162 // See class description of BookmarkLoadDetails for details on this. | 162 // See class description of BookmarkLoadDetails for details on this. |
163 scoped_ptr<BookmarkLoadDetails> details_; | 163 scoped_ptr<BookmarkLoadDetails> details_; |
164 | 164 |
165 DISALLOW_COPY_AND_ASSIGN(BookmarkStorage); | 165 DISALLOW_COPY_AND_ASSIGN(BookmarkStorage); |
166 }; | 166 }; |
167 | 167 |
168 #endif // CHROME_BROWSER_BOOKMARKS_BOOKMARK_STORAGE_H_ | 168 #endif // CHROME_BROWSER_BOOKMARKS_BOOKMARK_STORAGE_H_ |
OLD | NEW |