Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(20)

Side by Side Diff: chrome/browser/sync/glue/bookmark_model_associator.h

Issue 904083002: Use external ID to match native model nodes during bookmark association. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed CR feedback Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/sync/glue/bookmark_model_associator.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/sync/glue/bookmark_model_associator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698