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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 | 117 |
118 // Matches up the bookmark model and the sync model to build model | 118 // Matches up the bookmark model and the sync model to build model |
119 // associations. | 119 // associations. |
120 syncer::SyncError BuildAssociations(); | 120 syncer::SyncError BuildAssociations(); |
121 | 121 |
122 // Associate a top-level node of the bookmark model with a permanent node in | 122 // Associate a top-level node of the bookmark model with a permanent node in |
123 // the sync domain. Such permanent nodes are identified by a tag that is | 123 // the sync domain. Such permanent nodes are identified by a tag that is |
124 // well known to the server and the client, and is unique within a particular | 124 // well known to the server and the client, and is unique within a particular |
125 // user's share. For example, "other_bookmarks" is the tag for the Other | 125 // user's share. For example, "other_bookmarks" is the tag for the Other |
126 // Bookmarks folder. The sync nodes are server-created. | 126 // Bookmarks folder. The sync nodes are server-created. |
127 syncer::SyncError AssociateTaggedPermanentNode( | 127 // Returns true on success, false if association failed. |
| 128 bool AssociateTaggedPermanentNode( |
128 const BookmarkNode* permanent_node, | 129 const BookmarkNode* permanent_node, |
129 const std::string& tag) WARN_UNUSED_RESULT; | 130 const std::string& tag) WARN_UNUSED_RESULT; |
130 | 131 |
131 // Compare the properties of a pair of nodes from either domain. | 132 // Compare the properties of a pair of nodes from either domain. |
132 bool NodesMatch(const BookmarkNode* bookmark, | 133 bool NodesMatch(const BookmarkNode* bookmark, |
133 const syncer::BaseNode* sync_node) const; | 134 const syncer::BaseNode* sync_node) const; |
134 | 135 |
135 BookmarkModel* bookmark_model_; | 136 BookmarkModel* bookmark_model_; |
136 syncer::UserShare* user_share_; | 137 syncer::UserShare* user_share_; |
137 DataTypeErrorHandler* unrecoverable_error_handler_; | 138 DataTypeErrorHandler* unrecoverable_error_handler_; |
138 const bool expect_mobile_bookmarks_folder_; | 139 const bool expect_mobile_bookmarks_folder_; |
139 BookmarkIdToSyncIdMap id_map_; | 140 BookmarkIdToSyncIdMap id_map_; |
140 SyncIdToBookmarkNodeMap id_map_inverse_; | 141 SyncIdToBookmarkNodeMap id_map_inverse_; |
141 // Stores sync ids for dirty associations. | 142 // Stores sync ids for dirty associations. |
142 DirtyAssociationsSyncIds dirty_associations_sync_ids_; | 143 DirtyAssociationsSyncIds dirty_associations_sync_ids_; |
143 | 144 |
144 // Used to post PersistAssociation tasks to the current message loop and | 145 // Used to post PersistAssociation tasks to the current message loop and |
145 // guarantees no invocations can occur if |this| has been deleted. (This | 146 // guarantees no invocations can occur if |this| has been deleted. (This |
146 // allows this class to be non-refcounted). | 147 // allows this class to be non-refcounted). |
147 base::WeakPtrFactory<BookmarkModelAssociator> weak_factory_; | 148 base::WeakPtrFactory<BookmarkModelAssociator> weak_factory_; |
148 | 149 |
149 int number_of_new_sync_nodes_created_at_association_; | 150 int number_of_new_sync_nodes_created_at_association_; |
150 | 151 |
151 DISALLOW_COPY_AND_ASSIGN(BookmarkModelAssociator); | 152 DISALLOW_COPY_AND_ASSIGN(BookmarkModelAssociator); |
152 }; | 153 }; |
153 | 154 |
154 } // namespace browser_sync | 155 } // namespace browser_sync |
155 | 156 |
156 #endif // CHROME_BROWSER_SYNC_GLUE_BOOKMARK_MODEL_ASSOCIATOR_H_ | 157 #endif // CHROME_BROWSER_SYNC_GLUE_BOOKMARK_MODEL_ASSOCIATOR_H_ |
OLD | NEW |