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

Side by Side Diff: components/sync_bookmarks/bookmark_model_associator.h

Issue 1966023002: [Sync] Move DataTypeErrorHandler to //sync. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Found an unsaved buffer :( Created 4 years, 7 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
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 COMPONENTS_SYNC_BOOKMARKS_BOOKMARK_MODEL_ASSOCIATOR_H_ 5 #ifndef COMPONENTS_SYNC_BOOKMARKS_BOOKMARK_MODEL_ASSOCIATOR_H_
6 #define COMPONENTS_SYNC_BOOKMARKS_BOOKMARK_MODEL_ASSOCIATOR_H_ 6 #define COMPONENTS_SYNC_BOOKMARKS_BOOKMARK_MODEL_ASSOCIATOR_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
11 #include <map> 11 #include <map>
12 #include <set> 12 #include <set>
13 #include <stack> 13 #include <stack>
14 #include <string> 14 #include <string>
15 #include <vector> 15 #include <vector>
16 16
17 #include "base/compiler_specific.h" 17 #include "base/compiler_specific.h"
18 #include "base/containers/hash_tables.h" 18 #include "base/containers/hash_tables.h"
19 #include "base/hash.h" 19 #include "base/hash.h"
20 #include "base/macros.h" 20 #include "base/macros.h"
21 #include "base/memory/weak_ptr.h" 21 #include "base/memory/weak_ptr.h"
22 #include "base/strings/string16.h" 22 #include "base/strings/string16.h"
23 #include "base/threading/thread_checker.h" 23 #include "base/threading/thread_checker.h"
24 #include "components/sync_driver/data_type_error_handler.h"
25 #include "components/sync_driver/model_associator.h" 24 #include "components/sync_driver/model_associator.h"
25 #include "sync/internal_api/public/data_type_error_handler.h"
26 #include "sync/internal_api/public/util/unrecoverable_error_handler.h" 26 #include "sync/internal_api/public/util/unrecoverable_error_handler.h"
27 27
28 class GURL; 28 class GURL;
29 29
30 namespace bookmarks { 30 namespace bookmarks {
31 class BookmarkModel; 31 class BookmarkModel;
32 class BookmarkNode; 32 class BookmarkNode;
33 } 33 }
34 34
35 namespace syncer { 35 namespace syncer {
(...skipping 18 matching lines...) Expand all
54 PerDataTypeAssociatorInterface<bookmarks::BookmarkNode, int64_t> { 54 PerDataTypeAssociatorInterface<bookmarks::BookmarkNode, int64_t> {
55 public: 55 public:
56 static syncer::ModelType model_type() { return syncer::BOOKMARKS; } 56 static syncer::ModelType model_type() { return syncer::BOOKMARKS; }
57 // |expect_mobile_bookmarks_folder| controls whether or not we 57 // |expect_mobile_bookmarks_folder| controls whether or not we
58 // expect the mobile bookmarks permanent folder to be created. 58 // expect the mobile bookmarks permanent folder to be created.
59 // Should be set to true only by mobile clients. 59 // Should be set to true only by mobile clients.
60 BookmarkModelAssociator( 60 BookmarkModelAssociator(
61 bookmarks::BookmarkModel* bookmark_model, 61 bookmarks::BookmarkModel* bookmark_model,
62 sync_driver::SyncClient* sync_client, 62 sync_driver::SyncClient* sync_client,
63 syncer::UserShare* user_share, 63 syncer::UserShare* user_share,
64 sync_driver::DataTypeErrorHandler* unrecoverable_error_handler, 64 syncer::DataTypeErrorHandler* unrecoverable_error_handler,
65 bool expect_mobile_bookmarks_folder); 65 bool expect_mobile_bookmarks_folder);
66 ~BookmarkModelAssociator() override; 66 ~BookmarkModelAssociator() override;
67 67
68 // AssociatorInterface implementation. 68 // AssociatorInterface implementation.
69 // 69 //
70 // AssociateModels iterates through both the sync and the browser 70 // AssociateModels iterates through both the sync and the browser
71 // bookmark model, looking for matched pairs of items. For any pairs it 71 // bookmark model, looking for matched pairs of items. For any pairs it
72 // finds, it will call AssociateSyncID. For any unmatched items, 72 // finds, it will call AssociateSyncID. For any unmatched items,
73 // MergeAndAssociateModels will try to repair the match, e.g. by adding a new 73 // MergeAndAssociateModels will try to repair the match, e.g. by adding a new
74 // node. After successful completion, the models should be identical and 74 // node. After successful completion, the models should be identical and
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 // Check whether bookmark model and sync model are synced by comparing 287 // Check whether bookmark model and sync model are synced by comparing
288 // their transaction versions. 288 // their transaction versions.
289 // Returns a PERSISTENCE_ERROR if a transaction mismatch was detected where 289 // Returns a PERSISTENCE_ERROR if a transaction mismatch was detected where
290 // the native model has a newer transaction verison. 290 // the native model has a newer transaction verison.
291 syncer::SyncError CheckModelSyncState(Context* context) const; 291 syncer::SyncError CheckModelSyncState(Context* context) const;
292 292
293 base::ThreadChecker thread_checker_; 293 base::ThreadChecker thread_checker_;
294 bookmarks::BookmarkModel* bookmark_model_; 294 bookmarks::BookmarkModel* bookmark_model_;
295 sync_driver::SyncClient* sync_client_; 295 sync_driver::SyncClient* sync_client_;
296 syncer::UserShare* user_share_; 296 syncer::UserShare* user_share_;
297 sync_driver::DataTypeErrorHandler* unrecoverable_error_handler_; 297 syncer::DataTypeErrorHandler* unrecoverable_error_handler_;
298 const bool expect_mobile_bookmarks_folder_; 298 const bool expect_mobile_bookmarks_folder_;
299 BookmarkIdToSyncIdMap id_map_; 299 BookmarkIdToSyncIdMap id_map_;
300 SyncIdToBookmarkNodeMap id_map_inverse_; 300 SyncIdToBookmarkNodeMap id_map_inverse_;
301 // Stores sync ids for dirty associations. 301 // Stores sync ids for dirty associations.
302 DirtyAssociationsSyncIds dirty_associations_sync_ids_; 302 DirtyAssociationsSyncIds dirty_associations_sync_ids_;
303 303
304 // Used to post PersistAssociation tasks to the current message loop and 304 // Used to post PersistAssociation tasks to the current message loop and
305 // guarantees no invocations can occur if |this| has been deleted. (This 305 // guarantees no invocations can occur if |this| has been deleted. (This
306 // allows this class to be non-refcounted). 306 // allows this class to be non-refcounted).
307 base::WeakPtrFactory<BookmarkModelAssociator> weak_factory_; 307 base::WeakPtrFactory<BookmarkModelAssociator> weak_factory_;
308 308
309 DISALLOW_COPY_AND_ASSIGN(BookmarkModelAssociator); 309 DISALLOW_COPY_AND_ASSIGN(BookmarkModelAssociator);
310 }; 310 };
311 311
312 } // namespace browser_sync 312 } // namespace browser_sync
313 313
314 #endif // COMPONENTS_SYNC_BOOKMARKS_BOOKMARK_MODEL_ASSOCIATOR_H_ 314 #endif // COMPONENTS_SYNC_BOOKMARKS_BOOKMARK_MODEL_ASSOCIATOR_H_
OLDNEW
« no previous file with comments | « components/sync_bookmarks/bookmark_change_processor.cc ('k') | components/sync_bookmarks/bookmark_model_associator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698