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_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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 // Matches up the bookmark model and the sync model to build model | 109 // Matches up the bookmark model and the sync model to build model |
110 // associations. | 110 // associations. |
111 bool BuildAssociations(SyncError* error); | 111 bool BuildAssociations(SyncError* error); |
112 | 112 |
113 // Associate a top-level node of the bookmark model with a permanent node in | 113 // Associate a top-level node of the bookmark model with a permanent node in |
114 // the sync domain. Such permanent nodes are identified by a tag that is | 114 // the sync domain. Such permanent nodes are identified by a tag that is |
115 // well known to the server and the client, and is unique within a particular | 115 // well known to the server and the client, and is unique within a particular |
116 // user's share. For example, "other_bookmarks" is the tag for the Other | 116 // user's share. For example, "other_bookmarks" is the tag for the Other |
117 // Bookmarks folder. The sync nodes are server-created. | 117 // Bookmarks folder. The sync nodes are server-created. |
118 bool AssociateTaggedPermanentNode(const BookmarkNode* permanent_node, | 118 bool AssociateTaggedPermanentNode(const BookmarkNode* permanent_node, |
119 const std::string& tag); | 119 const std::string& tag) WARN_UNUSED_RESULT; |
120 | 120 |
121 // Compare the properties of a pair of nodes from either domain. | 121 // Compare the properties of a pair of nodes from either domain. |
122 bool NodesMatch(const BookmarkNode* bookmark, | 122 bool NodesMatch(const BookmarkNode* bookmark, |
123 const sync_api::BaseNode* sync_node) const; | 123 const sync_api::BaseNode* sync_node) const; |
124 | 124 |
125 BookmarkModel* bookmark_model_; | 125 BookmarkModel* bookmark_model_; |
126 sync_api::UserShare* user_share_; | 126 sync_api::UserShare* user_share_; |
127 UnrecoverableErrorHandler* unrecoverable_error_handler_; | 127 UnrecoverableErrorHandler* unrecoverable_error_handler_; |
128 BookmarkIdToSyncIdMap id_map_; | 128 BookmarkIdToSyncIdMap id_map_; |
129 SyncIdToBookmarkNodeMap id_map_inverse_; | 129 SyncIdToBookmarkNodeMap id_map_inverse_; |
130 // Stores sync ids for dirty associations. | 130 // Stores sync ids for dirty associations. |
131 DirtyAssociationsSyncIds dirty_associations_sync_ids_; | 131 DirtyAssociationsSyncIds dirty_associations_sync_ids_; |
132 | 132 |
133 // Used to post PersistAssociation tasks to the current message loop and | 133 // Used to post PersistAssociation tasks to the current message loop and |
134 // guarantees no invocations can occur if |this| has been deleted. (This | 134 // guarantees no invocations can occur if |this| has been deleted. (This |
135 // allows this class to be non-refcounted). | 135 // allows this class to be non-refcounted). |
136 ScopedRunnableMethodFactory<BookmarkModelAssociator> persist_associations_; | 136 ScopedRunnableMethodFactory<BookmarkModelAssociator> persist_associations_; |
137 | 137 |
138 int number_of_new_sync_nodes_created_at_association_; | 138 int number_of_new_sync_nodes_created_at_association_; |
139 | 139 |
140 DISALLOW_COPY_AND_ASSIGN(BookmarkModelAssociator); | 140 DISALLOW_COPY_AND_ASSIGN(BookmarkModelAssociator); |
141 }; | 141 }; |
142 | 142 |
143 } // namespace browser_sync | 143 } // namespace browser_sync |
144 | 144 |
145 #endif // CHROME_BROWSER_SYNC_GLUE_BOOKMARK_MODEL_ASSOCIATOR_H_ | 145 #endif // CHROME_BROWSER_SYNC_GLUE_BOOKMARK_MODEL_ASSOCIATOR_H_ |
OLD | NEW |