| 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 |
| 143 // Check whether bookmark model and sync model are synced by comparing | 147 // Check whether bookmark model and sync model are synced by comparing |
| 144 // their transaction versions. | 148 // their transaction versions. |
| 145 // Returns a PERSISTENCE_ERROR if a transaction mismatch was detected where | 149 // Returns a PERSISTENCE_ERROR if a transaction mismatch was detected where |
| 146 // the native model has a newer transaction verison. | 150 // the native model has a newer transaction verison. |
| 147 syncer::SyncError CheckModelSyncState( | 151 syncer::SyncError CheckModelSyncState( |
| 148 syncer::SyncMergeResult* local_merge_result, | 152 syncer::SyncMergeResult* local_merge_result, |
| 149 syncer::SyncMergeResult* syncer_merge_result) const; | 153 syncer::SyncMergeResult* syncer_merge_result) const; |
| 150 | 154 |
| 151 bookmarks::BookmarkModel* bookmark_model_; | 155 bookmarks::BookmarkModel* bookmark_model_; |
| 152 Profile* profile_; | 156 Profile* profile_; |
| 153 syncer::UserShare* user_share_; | 157 syncer::UserShare* user_share_; |
| 154 sync_driver::DataTypeErrorHandler* unrecoverable_error_handler_; | 158 sync_driver::DataTypeErrorHandler* unrecoverable_error_handler_; |
| 155 const bool expect_mobile_bookmarks_folder_; | 159 const bool expect_mobile_bookmarks_folder_; |
| 156 BookmarkIdToSyncIdMap id_map_; | 160 BookmarkIdToSyncIdMap id_map_; |
| 157 SyncIdToBookmarkNodeMap id_map_inverse_; | 161 SyncIdToBookmarkNodeMap id_map_inverse_; |
| 158 // Stores sync ids for dirty associations. | 162 // Stores sync ids for dirty associations. |
| 159 DirtyAssociationsSyncIds dirty_associations_sync_ids_; | 163 DirtyAssociationsSyncIds dirty_associations_sync_ids_; |
| 160 | 164 |
| 161 // Used to post PersistAssociation tasks to the current message loop and | 165 // Used to post PersistAssociation tasks to the current message loop and |
| 162 // guarantees no invocations can occur if |this| has been deleted. (This | 166 // guarantees no invocations can occur if |this| has been deleted. (This |
| 163 // allows this class to be non-refcounted). | 167 // allows this class to be non-refcounted). |
| 164 base::WeakPtrFactory<BookmarkModelAssociator> weak_factory_; | 168 base::WeakPtrFactory<BookmarkModelAssociator> weak_factory_; |
| 165 | 169 |
| 166 DISALLOW_COPY_AND_ASSIGN(BookmarkModelAssociator); | 170 DISALLOW_COPY_AND_ASSIGN(BookmarkModelAssociator); |
| 167 }; | 171 }; |
| 168 | 172 |
| 169 } // namespace browser_sync | 173 } // namespace browser_sync |
| 170 | 174 |
| 171 #endif // CHROME_BROWSER_SYNC_GLUE_BOOKMARK_MODEL_ASSOCIATOR_H_ | 175 #endif // CHROME_BROWSER_SYNC_GLUE_BOOKMARK_MODEL_ASSOCIATOR_H_ |
| OLD | NEW |