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 #include "chrome/browser/sync/glue/shared_change_processor.h" | 5 #include "chrome/browser/sync/glue/shared_change_processor.h" |
6 | 6 |
7 #include "chrome/browser/sync/glue/generic_change_processor.h" | 7 #include "chrome/browser/sync/glue/generic_change_processor.h" |
8 #include "chrome/browser/sync/profile_sync_components_factory.h" | 8 #include "chrome/browser/sync/profile_sync_components_factory.h" |
9 #include "chrome/browser/sync/profile_sync_service.h" | 9 #include "chrome/browser/sync/profile_sync_service.h" |
10 #include "content/public/browser/browser_thread.h" | 10 #include "content/public/browser/browser_thread.h" |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 if (disconnected_) { | 135 if (disconnected_) { |
136 syncer::SyncError error(FROM_HERE, | 136 syncer::SyncError error(FROM_HERE, |
137 syncer::SyncError::DATATYPE_ERROR, | 137 syncer::SyncError::DATATYPE_ERROR, |
138 "Change processor disconnected.", | 138 "Change processor disconnected.", |
139 type_); | 139 type_); |
140 return error; | 140 return error; |
141 } | 141 } |
142 return generic_change_processor_->GetAllSyncDataReturnError(type, data); | 142 return generic_change_processor_->GetAllSyncDataReturnError(type, data); |
143 } | 143 } |
144 | 144 |
| 145 syncer::SyncError SharedChangeProcessor::UpdateDataTypeContext( |
| 146 syncer::ModelType type, |
| 147 const std::string& context) { |
| 148 DCHECK(backend_loop_.get()); |
| 149 DCHECK(backend_loop_->BelongsToCurrentThread()); |
| 150 AutoLock lock(monitor_lock_); |
| 151 if (disconnected_) { |
| 152 syncer::SyncError error(FROM_HERE, |
| 153 syncer::SyncError::DATATYPE_ERROR, |
| 154 "Change processor disconnected.", |
| 155 type_); |
| 156 return error; |
| 157 } |
| 158 return generic_change_processor_->UpdateDataTypeContext(type, context); |
| 159 } |
| 160 |
145 bool SharedChangeProcessor::SyncModelHasUserCreatedNodes(bool* has_nodes) { | 161 bool SharedChangeProcessor::SyncModelHasUserCreatedNodes(bool* has_nodes) { |
146 DCHECK(backend_loop_.get()); | 162 DCHECK(backend_loop_.get()); |
147 DCHECK(backend_loop_->BelongsToCurrentThread()); | 163 DCHECK(backend_loop_->BelongsToCurrentThread()); |
148 AutoLock lock(monitor_lock_); | 164 AutoLock lock(monitor_lock_); |
149 if (disconnected_) { | 165 if (disconnected_) { |
150 LOG(ERROR) << "Change processor disconnected."; | 166 LOG(ERROR) << "Change processor disconnected."; |
151 return false; | 167 return false; |
152 } | 168 } |
153 return generic_change_processor_->SyncModelHasUserCreatedNodes( | 169 return generic_change_processor_->SyncModelHasUserCreatedNodes( |
154 type_, has_nodes); | 170 type_, has_nodes); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 return error_handler_->CreateAndUploadError(location, message, type_); | 203 return error_handler_->CreateAndUploadError(location, message, type_); |
188 } else { | 204 } else { |
189 return syncer::SyncError(location, | 205 return syncer::SyncError(location, |
190 syncer::SyncError::DATATYPE_ERROR, | 206 syncer::SyncError::DATATYPE_ERROR, |
191 message, | 207 message, |
192 type_); | 208 type_); |
193 } | 209 } |
194 } | 210 } |
195 | 211 |
196 } // namespace browser_sync | 212 } // namespace browser_sync |
OLD | NEW |