OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_DRIVER_GENERIC_CHANGE_PROCESSOR_H_ | 5 #ifndef COMPONENTS_SYNC_DRIVER_GENERIC_CHANGE_PROCESSOR_H_ |
6 #define COMPONENTS_SYNC_DRIVER_GENERIC_CHANGE_PROCESSOR_H_ | 6 #define COMPONENTS_SYNC_DRIVER_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" |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 virtual bool SyncModelHasUserCreatedNodes(syncer::ModelType type, | 91 virtual bool SyncModelHasUserCreatedNodes(syncer::ModelType type, |
92 bool* has_nodes); | 92 bool* has_nodes); |
93 virtual bool CryptoReadyIfNecessary(syncer::ModelType type); | 93 virtual bool CryptoReadyIfNecessary(syncer::ModelType type); |
94 | 94 |
95 protected: | 95 protected: |
96 // ChangeProcessor interface. | 96 // ChangeProcessor interface. |
97 virtual void StartImpl() OVERRIDE; // Does nothing. | 97 virtual void StartImpl() OVERRIDE; // Does nothing. |
98 virtual syncer::UserShare* share_handle() const OVERRIDE; | 98 virtual syncer::UserShare* share_handle() const OVERRIDE; |
99 | 99 |
100 private: | 100 private: |
101 // Helper methods for acting on changes coming from the datatype. These are | 101 // Logically part of ProcessSyncChanges. |
102 // logically part of ProcessSyncChanges. | 102 // |
| 103 // |new_attachments| is an output parameter containing newly added attachments |
| 104 // that need to be stored. This method will append to it. |
103 syncer::SyncError HandleActionAdd(const syncer::SyncChange& change, | 105 syncer::SyncError HandleActionAdd(const syncer::SyncChange& change, |
104 const std::string& type_str, | 106 const std::string& type_str, |
105 const syncer::ModelType& type, | 107 const syncer::ModelType& type, |
106 const syncer::WriteTransaction& trans, | 108 const syncer::WriteTransaction& trans, |
107 syncer::WriteNode* sync_node); | 109 syncer::WriteNode* sync_node, |
| 110 syncer::AttachmentList* new_attachments); |
| 111 |
| 112 // Logically part of ProcessSyncChanges. |
| 113 // |
| 114 // |new_attachments| is an output parameter containing newly added attachments |
| 115 // that need to be stored. This method will append to it. |
108 syncer::SyncError HandleActionUpdate(const syncer::SyncChange& change, | 116 syncer::SyncError HandleActionUpdate(const syncer::SyncChange& change, |
109 const std::string& type_str, | 117 const std::string& type_str, |
110 const syncer::ModelType& type, | 118 const syncer::ModelType& type, |
111 const syncer::WriteTransaction& trans, | 119 const syncer::WriteTransaction& trans, |
112 syncer::WriteNode* sync_node); | 120 syncer::WriteNode* sync_node, |
| 121 syncer::AttachmentList* new_attachments); |
113 | 122 |
114 // The SyncableService this change processor will forward changes on to. | 123 // The SyncableService this change processor will forward changes on to. |
115 const base::WeakPtr<syncer::SyncableService> local_service_; | 124 const base::WeakPtr<syncer::SyncableService> local_service_; |
116 | 125 |
117 // A SyncMergeResult used to track the changes made during association. The | 126 // A SyncMergeResult used to track the changes made during association. The |
118 // owner will invalidate the weak pointer when association is complete. While | 127 // owner will invalidate the weak pointer when association is complete. While |
119 // the pointer is valid though, we increment it with any changes received | 128 // the pointer is valid though, we increment it with any changes received |
120 // via ProcessSyncChanges. | 129 // via ProcessSyncChanges. |
121 const base::WeakPtr<syncer::SyncMergeResult> merge_result_; | 130 const base::WeakPtr<syncer::SyncMergeResult> merge_result_; |
122 | 131 |
(...skipping 16 matching lines...) Expand all Loading... |
139 base::WeakPtrFactory<syncer::AttachmentService> | 148 base::WeakPtrFactory<syncer::AttachmentService> |
140 attachment_service_weak_ptr_factory_; | 149 attachment_service_weak_ptr_factory_; |
141 syncer::AttachmentServiceProxy attachment_service_proxy_; | 150 syncer::AttachmentServiceProxy attachment_service_proxy_; |
142 | 151 |
143 DISALLOW_COPY_AND_ASSIGN(GenericChangeProcessor); | 152 DISALLOW_COPY_AND_ASSIGN(GenericChangeProcessor); |
144 }; | 153 }; |
145 | 154 |
146 } // namespace browser_sync | 155 } // namespace browser_sync |
147 | 156 |
148 #endif // COMPONENTS_SYNC_DRIVER_GENERIC_CHANGE_PROCESSOR_H_ | 157 #endif // COMPONENTS_SYNC_DRIVER_GENERIC_CHANGE_PROCESSOR_H_ |
OLD | NEW |