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 COMPONENTS_SYNC_BOOKMARKS_BOOKMARK_CHANGE_PROCESSOR_H_ | 5 #ifndef COMPONENTS_SYNC_BOOKMARKS_BOOKMARK_CHANGE_PROCESSOR_H_ |
6 #define COMPONENTS_SYNC_BOOKMARKS_BOOKMARK_CHANGE_PROCESSOR_H_ | 6 #define COMPONENTS_SYNC_BOOKMARKS_BOOKMARK_CHANGE_PROCESSOR_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
| 11 #include <set> |
11 #include <vector> | 12 #include <vector> |
12 | 13 |
13 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
14 #include "base/macros.h" | 15 #include "base/macros.h" |
15 #include "base/threading/thread_checker.h" | 16 #include "base/threading/thread_checker.h" |
16 #include "components/bookmarks/browser/bookmark_model_observer.h" | 17 #include "components/bookmarks/browser/bookmark_model_observer.h" |
17 #include "components/bookmarks/browser/bookmark_node.h" | 18 #include "components/bookmarks/browser/bookmark_node.h" |
18 #include "components/sync/core/data_type_error_handler.h" | 19 #include "components/sync/api/data_type_error_handler.h" |
19 #include "components/sync/driver/change_processor.h" | 20 #include "components/sync/driver/change_processor.h" |
20 #include "components/sync_bookmarks/bookmark_model_associator.h" | 21 #include "components/sync_bookmarks/bookmark_model_associator.h" |
21 | 22 |
22 class Profile; | 23 class Profile; |
23 | 24 |
24 namespace base { | 25 namespace base { |
25 class RefCountedMemory; | 26 class RefCountedMemory; |
26 } | 27 } |
27 | 28 |
28 namespace syncer { | 29 namespace syncer { |
29 class WriteNode; | 30 class WriteNode; |
30 class WriteTransaction; | 31 class WriteTransaction; |
31 } // namespace syncer | 32 } // namespace syncer |
32 | 33 |
33 namespace sync_driver { | 34 namespace sync_driver { |
34 class SyncClient; | 35 class SyncClient; |
35 } | 36 } |
36 | 37 |
37 namespace browser_sync { | 38 namespace browser_sync { |
38 | 39 |
39 // This class is responsible for taking changes from the BookmarkModel | 40 // This class is responsible for taking changes from the BookmarkModel |
40 // and applying them to the sync API 'syncable' model, and vice versa. | 41 // and applying them to the sync API 'syncable' model, and vice versa. |
41 // All operations and use of this class are from the UI thread. | 42 // All operations and use of this class are from the UI thread. |
42 // This is currently bookmarks specific. | 43 // This is currently bookmarks specific. |
43 class BookmarkChangeProcessor : public bookmarks::BookmarkModelObserver, | 44 class BookmarkChangeProcessor : public bookmarks::BookmarkModelObserver, |
44 public sync_driver::ChangeProcessor { | 45 public sync_driver::ChangeProcessor { |
45 public: | 46 public: |
46 BookmarkChangeProcessor(sync_driver::SyncClient* sync_client, | 47 BookmarkChangeProcessor( |
47 BookmarkModelAssociator* model_associator, | 48 sync_driver::SyncClient* sync_client, |
48 syncer::DataTypeErrorHandler* error_handler); | 49 BookmarkModelAssociator* model_associator, |
| 50 std::unique_ptr<syncer::DataTypeErrorHandler> error_handler); |
49 ~BookmarkChangeProcessor() override; | 51 ~BookmarkChangeProcessor() override; |
50 | 52 |
51 // bookmarks::BookmarkModelObserver: | 53 // bookmarks::BookmarkModelObserver: |
52 // BookmarkModel -> sync API model change application. | 54 // BookmarkModel -> sync API model change application. |
53 void BookmarkModelLoaded(bookmarks::BookmarkModel* model, | 55 void BookmarkModelLoaded(bookmarks::BookmarkModel* model, |
54 bool ids_reassigned) override; | 56 bool ids_reassigned) override; |
55 void BookmarkModelBeingDeleted(bookmarks::BookmarkModel* model) override; | 57 void BookmarkModelBeingDeleted(bookmarks::BookmarkModel* model) override; |
56 void BookmarkNodeMoved(bookmarks::BookmarkModel* model, | 58 void BookmarkNodeMoved(bookmarks::BookmarkModel* model, |
57 const bookmarks::BookmarkNode* old_parent, | 59 const bookmarks::BookmarkNode* old_parent, |
58 int old_index, | 60 int old_index, |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 | 254 |
253 // The two models should be associated according to this ModelAssociator. | 255 // The two models should be associated according to this ModelAssociator. |
254 BookmarkModelAssociator* model_associator_; | 256 BookmarkModelAssociator* model_associator_; |
255 | 257 |
256 DISALLOW_COPY_AND_ASSIGN(BookmarkChangeProcessor); | 258 DISALLOW_COPY_AND_ASSIGN(BookmarkChangeProcessor); |
257 }; | 259 }; |
258 | 260 |
259 } // namespace browser_sync | 261 } // namespace browser_sync |
260 | 262 |
261 #endif // COMPONENTS_SYNC_BOOKMARKS_BOOKMARK_CHANGE_PROCESSOR_H_ | 263 #endif // COMPONENTS_SYNC_BOOKMARKS_BOOKMARK_CHANGE_PROCESSOR_H_ |
OLD | NEW |