OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_SYNC_GLUE_BOOKMARK_MODEL_ASSOCIATOR_H_ | 5 #ifndef CHROME_BROWSER_SYNC_GLUE_BOOKMARK_MODEL_ASSOCIATOR_H_ |
6 #define CHROME_BROWSER_SYNC_GLUE_BOOKMARK_MODEL_ASSOCIATOR_H_ | 6 #define CHROME_BROWSER_SYNC_GLUE_BOOKMARK_MODEL_ASSOCIATOR_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 // Associate a top-level node of the bookmark model with a permanent node in | 133 // Associate a top-level node of the bookmark model with a permanent node in |
134 // the sync domain. Such permanent nodes are identified by a tag that is | 134 // the sync domain. Such permanent nodes are identified by a tag that is |
135 // well known to the server and the client, and is unique within a particular | 135 // well known to the server and the client, and is unique within a particular |
136 // user's share. For example, "other_bookmarks" is the tag for the Other | 136 // user's share. For example, "other_bookmarks" is the tag for the Other |
137 // Bookmarks folder. The sync nodes are server-created. | 137 // Bookmarks folder. The sync nodes are server-created. |
138 // Returns true on success, false if association failed. | 138 // Returns true on success, false if association failed. |
139 bool AssociateTaggedPermanentNode( | 139 bool AssociateTaggedPermanentNode( |
140 const bookmarks::BookmarkNode* permanent_node, | 140 const bookmarks::BookmarkNode* permanent_node, |
141 const std::string& tag) WARN_UNUSED_RESULT; | 141 const std::string& tag) WARN_UNUSED_RESULT; |
142 | 142 |
143 // Compare the properties of a pair of nodes from either domain. | |
144 bool NodesMatch(const bookmarks::BookmarkNode* bookmark, | |
145 const syncer::BaseNode* sync_node) const; | |
146 | |
147 // Check whether bookmark model and sync model are synced by comparing | 143 // Check whether bookmark model and sync model are synced by comparing |
148 // their transaction versions. | 144 // their transaction versions. |
149 // Returns a PERSISTENCE_ERROR if a transaction mismatch was detected where | 145 // Returns a PERSISTENCE_ERROR if a transaction mismatch was detected where |
150 // the native model has a newer transaction verison. | 146 // the native model has a newer transaction verison. |
151 syncer::SyncError CheckModelSyncState( | 147 syncer::SyncError CheckModelSyncState( |
152 syncer::SyncMergeResult* local_merge_result, | 148 syncer::SyncMergeResult* local_merge_result, |
153 syncer::SyncMergeResult* syncer_merge_result) const; | 149 syncer::SyncMergeResult* syncer_merge_result) const; |
154 | 150 |
155 bookmarks::BookmarkModel* bookmark_model_; | 151 bookmarks::BookmarkModel* bookmark_model_; |
156 Profile* profile_; | 152 Profile* profile_; |
157 syncer::UserShare* user_share_; | 153 syncer::UserShare* user_share_; |
158 sync_driver::DataTypeErrorHandler* unrecoverable_error_handler_; | 154 sync_driver::DataTypeErrorHandler* unrecoverable_error_handler_; |
159 const bool expect_mobile_bookmarks_folder_; | 155 const bool expect_mobile_bookmarks_folder_; |
160 BookmarkIdToSyncIdMap id_map_; | 156 BookmarkIdToSyncIdMap id_map_; |
161 SyncIdToBookmarkNodeMap id_map_inverse_; | 157 SyncIdToBookmarkNodeMap id_map_inverse_; |
162 // Stores sync ids for dirty associations. | 158 // Stores sync ids for dirty associations. |
163 DirtyAssociationsSyncIds dirty_associations_sync_ids_; | 159 DirtyAssociationsSyncIds dirty_associations_sync_ids_; |
164 | 160 |
165 // Used to post PersistAssociation tasks to the current message loop and | 161 // Used to post PersistAssociation tasks to the current message loop and |
166 // guarantees no invocations can occur if |this| has been deleted. (This | 162 // guarantees no invocations can occur if |this| has been deleted. (This |
167 // allows this class to be non-refcounted). | 163 // allows this class to be non-refcounted). |
168 base::WeakPtrFactory<BookmarkModelAssociator> weak_factory_; | 164 base::WeakPtrFactory<BookmarkModelAssociator> weak_factory_; |
169 | 165 |
170 DISALLOW_COPY_AND_ASSIGN(BookmarkModelAssociator); | 166 DISALLOW_COPY_AND_ASSIGN(BookmarkModelAssociator); |
171 }; | 167 }; |
172 | 168 |
173 } // namespace browser_sync | 169 } // namespace browser_sync |
174 | 170 |
175 #endif // CHROME_BROWSER_SYNC_GLUE_BOOKMARK_MODEL_ASSOCIATOR_H_ | 171 #endif // CHROME_BROWSER_SYNC_GLUE_BOOKMARK_MODEL_ASSOCIATOR_H_ |
OLD | NEW |