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_GENERIC_CHANGE_PROCESSOR_H_ | 5 #ifndef CHROME_BROWSER_SYNC_GLUE_GENERIC_CHANGE_PROCESSOR_H_ |
6 #define CHROME_BROWSER_SYNC_GLUE_GENERIC_CHANGE_PROCESSOR_H_ | 6 #define CHROME_BROWSER_SYNC_GLUE_GENERIC_CHANGE_PROCESSOR_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
12 #include "base/threading/non_thread_safe.h" | 12 #include "base/threading/non_thread_safe.h" |
13 #include "chrome/browser/sync/glue/change_processor.h" | 13 #include "chrome/browser/sync/glue/change_processor.h" |
14 #include "components/sync_driver/data_type_controller.h" | 14 #include "components/sync_driver/data_type_controller.h" |
15 #include "components/sync_driver/data_type_error_handler.h" | 15 #include "components/sync_driver/data_type_error_handler.h" |
| 16 #include "sync/api/attachments/attachment_service.h" |
| 17 #include "sync/api/attachments/attachment_service_base.h" |
| 18 #include "sync/api/attachments/attachment_service_proxy.h" |
16 #include "sync/api/sync_change_processor.h" | 19 #include "sync/api/sync_change_processor.h" |
17 #include "sync/api/sync_merge_result.h" | 20 #include "sync/api/sync_merge_result.h" |
18 | 21 |
19 namespace syncer { | 22 namespace syncer { |
20 class SyncData; | 23 class SyncData; |
21 class SyncableService; | 24 class SyncableService; |
22 class WriteNode; | 25 class WriteNode; |
23 class WriteTransaction; | 26 class WriteTransaction; |
24 | 27 |
25 typedef std::vector<syncer::SyncData> SyncDataList; | 28 typedef std::vector<syncer::SyncData> SyncDataList; |
(...skipping 13 matching lines...) Expand all Loading... |
39 // be used on the same thread in which it was created. | 42 // be used on the same thread in which it was created. |
40 class GenericChangeProcessor : public ChangeProcessor, | 43 class GenericChangeProcessor : public ChangeProcessor, |
41 public syncer::SyncChangeProcessor, | 44 public syncer::SyncChangeProcessor, |
42 public base::NonThreadSafe { | 45 public base::NonThreadSafe { |
43 public: | 46 public: |
44 // Create a change processor and connect it to the syncer. | 47 // Create a change processor and connect it to the syncer. |
45 GenericChangeProcessor( | 48 GenericChangeProcessor( |
46 DataTypeErrorHandler* error_handler, | 49 DataTypeErrorHandler* error_handler, |
47 const base::WeakPtr<syncer::SyncableService>& local_service, | 50 const base::WeakPtr<syncer::SyncableService>& local_service, |
48 const base::WeakPtr<syncer::SyncMergeResult>& merge_result, | 51 const base::WeakPtr<syncer::SyncMergeResult>& merge_result, |
49 syncer::UserShare* user_share); | 52 syncer::UserShare* user_share, |
| 53 scoped_ptr<syncer::AttachmentServiceBase> attachment_service); |
50 virtual ~GenericChangeProcessor(); | 54 virtual ~GenericChangeProcessor(); |
51 | 55 |
52 // ChangeProcessor interface. | 56 // ChangeProcessor interface. |
53 // Build and store a list of all changes into |syncer_changes_|. | 57 // Build and store a list of all changes into |syncer_changes_|. |
54 virtual void ApplyChangesFromSyncModel( | 58 virtual void ApplyChangesFromSyncModel( |
55 const syncer::BaseTransaction* trans, | 59 const syncer::BaseTransaction* trans, |
56 int64 version, | 60 int64 version, |
57 const syncer::ImmutableChangeRecordList& changes) OVERRIDE; | 61 const syncer::ImmutableChangeRecordList& changes) OVERRIDE; |
58 // Passes |syncer_changes_|, built in ApplyChangesFromSyncModel, onto | 62 // Passes |syncer_changes_|, built in ApplyChangesFromSyncModel, onto |
59 // |local_service_| by way of its ProcessSyncChanges method. | 63 // |local_service_| by way of its ProcessSyncChanges method. |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 // Set in ApplyChangesFromSyncModel, consumed in CommitChangesFromSyncModel. | 123 // Set in ApplyChangesFromSyncModel, consumed in CommitChangesFromSyncModel. |
120 syncer::SyncChangeList syncer_changes_; | 124 syncer::SyncChangeList syncer_changes_; |
121 | 125 |
122 // Our handle to the sync model. Unlike normal ChangeProcessors, we need to | 126 // Our handle to the sync model. Unlike normal ChangeProcessors, we need to |
123 // be able to access the sync model before the change processor begins | 127 // be able to access the sync model before the change processor begins |
124 // listening to changes (the local_service_ will be interacting with us | 128 // listening to changes (the local_service_ will be interacting with us |
125 // when it starts up). As such we can't wait until Start(_) has been called, | 129 // when it starts up). As such we can't wait until Start(_) has been called, |
126 // and have to keep a local pointer to the user_share. | 130 // and have to keep a local pointer to the user_share. |
127 syncer::UserShare* const share_handle_; | 131 syncer::UserShare* const share_handle_; |
128 | 132 |
| 133 scoped_ptr<syncer::AttachmentServiceBase> attachment_service_; |
| 134 syncer::AttachmentServiceProxy attachment_service_proxy_; |
| 135 |
129 DISALLOW_COPY_AND_ASSIGN(GenericChangeProcessor); | 136 DISALLOW_COPY_AND_ASSIGN(GenericChangeProcessor); |
130 }; | 137 }; |
131 | 138 |
132 } // namespace browser_sync | 139 } // namespace browser_sync |
133 | 140 |
134 #endif // CHROME_BROWSER_SYNC_GLUE_GENERIC_CHANGE_PROCESSOR_H_ | 141 #endif // CHROME_BROWSER_SYNC_GLUE_GENERIC_CHANGE_PROCESSOR_H_ |
OLD | NEW |