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

Side by Side Diff: components/sync/driver/glue/sync_backend_host_impl.cc

Issue 2644373003: Revert of [Sync] Make directory types registration explicit in ModelTypeRegistry (Closed)
Patch Set: Created 3 years, 11 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "components/sync/driver/glue/sync_backend_host_impl.h" 5 #include "components/sync/driver/glue/sync_backend_host_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 base::Bind(&SyncBackendHostCore::DoRefreshTypes, core_, types)); 83 base::Bind(&SyncBackendHostCore::DoRefreshTypes, core_, types));
84 } 84 }
85 85
86 void SyncBackendHostImpl::UpdateCredentials( 86 void SyncBackendHostImpl::UpdateCredentials(
87 const SyncCredentials& credentials) { 87 const SyncCredentials& credentials) {
88 sync_task_runner_->PostTask( 88 sync_task_runner_->PostTask(
89 FROM_HERE, base::Bind(&SyncBackendHostCore::DoUpdateCredentials, core_, 89 FROM_HERE, base::Bind(&SyncBackendHostCore::DoUpdateCredentials, core_,
90 credentials)); 90 credentials));
91 } 91 }
92 92
93 void SyncBackendHostImpl::StartConfiguration() {
94 sync_task_runner_->PostTask(
95 FROM_HERE, base::Bind(&SyncBackendHostCore::DoStartConfiguration, core_));
96 }
97
98 void SyncBackendHostImpl::StartSyncingWithServer() { 93 void SyncBackendHostImpl::StartSyncingWithServer() {
99 SDVLOG(1) << "SyncBackendHostImpl::StartSyncingWithServer called."; 94 SDVLOG(1) << "SyncBackendHostImpl::StartSyncingWithServer called.";
100 95
96 ModelSafeRoutingInfo routing_info;
97 registrar_->GetModelSafeRoutingInfo(&routing_info);
98
101 sync_task_runner_->PostTask( 99 sync_task_runner_->PostTask(
102 FROM_HERE, base::Bind(&SyncBackendHostCore::DoStartSyncing, core_, 100 FROM_HERE, base::Bind(&SyncBackendHostCore::DoStartSyncing, core_,
103 sync_prefs_->GetLastPollTime())); 101 routing_info, sync_prefs_->GetLastPollTime()));
104 } 102 }
105 103
106 void SyncBackendHostImpl::SetEncryptionPassphrase(const std::string& passphrase, 104 void SyncBackendHostImpl::SetEncryptionPassphrase(const std::string& passphrase,
107 bool is_explicit) { 105 bool is_explicit) {
108 DCHECK(thread_checker_.CalledOnValidThread()); 106 DCHECK(thread_checker_.CalledOnValidThread());
109 107
110 if (!IsNigoriEnabled()) { 108 if (!IsNigoriEnabled()) {
111 NOTREACHED() << "SetEncryptionPassphrase must never be called when nigori" 109 NOTREACHED() << "SetEncryptionPassphrase must never be called when nigori"
112 " is disabled."; 110 " is disabled.";
113 return; 111 return;
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 void SyncBackendHostImpl::ConfigureDataTypes(ConfigureParams params) { 204 void SyncBackendHostImpl::ConfigureDataTypes(ConfigureParams params) {
207 sync_task_runner_->PostTask( 205 sync_task_runner_->PostTask(
208 FROM_HERE, 206 FROM_HERE,
209 base::Bind(&SyncBackendHostCore::DoPurgeDisabledTypes, core_, 207 base::Bind(&SyncBackendHostCore::DoPurgeDisabledTypes, core_,
210 params.to_purge, params.to_journal, params.to_unapply)); 208 params.to_purge, params.to_journal, params.to_unapply));
211 sync_task_runner_->PostTask( 209 sync_task_runner_->PostTask(
212 FROM_HERE, base::Bind(&SyncBackendHostCore::DoConfigureSyncer, core_, 210 FROM_HERE, base::Bind(&SyncBackendHostCore::DoConfigureSyncer, core_,
213 base::Passed(&params))); 211 base::Passed(&params)));
214 } 212 }
215 213
216 void SyncBackendHostImpl::RegisterDirectoryDataType(ModelType type,
217 ModelSafeGroup group) {
218 model_type_connector_->RegisterDirectoryType(type, group);
219 }
220
221 void SyncBackendHostImpl::UnregisterDirectoryDataType(ModelType type) {
222 model_type_connector_->UnregisterDirectoryType(type);
223 }
224
225 void SyncBackendHostImpl::EnableEncryptEverything() { 214 void SyncBackendHostImpl::EnableEncryptEverything() {
226 sync_task_runner_->PostTask( 215 sync_task_runner_->PostTask(
227 FROM_HERE, 216 FROM_HERE,
228 base::Bind(&SyncBackendHostCore::DoEnableEncryptEverything, core_)); 217 base::Bind(&SyncBackendHostCore::DoEnableEncryptEverything, core_));
229 } 218 }
230 219
231 void SyncBackendHostImpl::ActivateDirectoryDataType( 220 void SyncBackendHostImpl::ActivateDirectoryDataType(
232 ModelType type, 221 ModelType type,
233 ModelSafeGroup group, 222 ModelSafeGroup group,
234 ChangeProcessor* change_processor) { 223 ChangeProcessor* change_processor) {
235 registrar_->ActivateDataType(type, group, change_processor, GetUserShare()); 224 registrar_->ActivateDataType(type, group, change_processor, GetUserShare());
236 } 225 }
237 226
238 void SyncBackendHostImpl::DeactivateDirectoryDataType(ModelType type) { 227 void SyncBackendHostImpl::DeactivateDirectoryDataType(ModelType type) {
239 registrar_->DeactivateDataType(type); 228 registrar_->DeactivateDataType(type);
240 } 229 }
241 230
242 void SyncBackendHostImpl::ActivateNonBlockingDataType( 231 void SyncBackendHostImpl::ActivateNonBlockingDataType(
243 ModelType type, 232 ModelType type,
244 std::unique_ptr<ActivationContext> activation_context) { 233 std::unique_ptr<ActivationContext> activation_context) {
245 registrar_->RegisterNonBlockingType(type); 234 registrar_->RegisterNonBlockingType(type);
246 if (activation_context->model_type_state.initial_sync_done()) 235 if (activation_context->model_type_state.initial_sync_done())
247 registrar_->AddRestoredNonBlockingType(type); 236 registrar_->AddRestoredNonBlockingType(type);
248 model_type_connector_->ConnectNonBlockingType(type, 237 model_type_connector_->ConnectType(type, std::move(activation_context));
249 std::move(activation_context));
250 } 238 }
251 239
252 void SyncBackendHostImpl::DeactivateNonBlockingDataType(ModelType type) { 240 void SyncBackendHostImpl::DeactivateNonBlockingDataType(ModelType type) {
253 model_type_connector_->DisconnectNonBlockingType(type); 241 model_type_connector_->DisconnectType(type);
254 } 242 }
255 243
256 UserShare* SyncBackendHostImpl::GetUserShare() const { 244 UserShare* SyncBackendHostImpl::GetUserShare() const {
257 return core_->sync_manager()->GetUserShare(); 245 return core_->sync_manager()->GetUserShare();
258 } 246 }
259 247
260 SyncBackendHostImpl::Status SyncBackendHostImpl::GetDetailedStatus() { 248 SyncBackendHostImpl::Status SyncBackendHostImpl::GetDetailedStatus() {
261 DCHECK(initialized()); 249 DCHECK(initialized());
262 return core_->sync_manager()->GetDetailedStatus(); 250 return core_->sync_manager()->GetDetailedStatus();
263 } 251 }
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
569 const SyncManager::ClearServerDataCallback& frontend_callback) { 557 const SyncManager::ClearServerDataCallback& frontend_callback) {
570 DCHECK(thread_checker_.CalledOnValidThread()); 558 DCHECK(thread_checker_.CalledOnValidThread());
571 frontend_callback.Run(); 559 frontend_callback.Run();
572 } 560 }
573 561
574 } // namespace syncer 562 } // namespace syncer
575 563
576 #undef SDVLOG 564 #undef SDVLOG
577 565
578 #undef SLOG 566 #undef SLOG
OLDNEW
« no previous file with comments | « components/sync/driver/glue/sync_backend_host_impl.h ('k') | components/sync/driver/glue/sync_backend_host_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698