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

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

Issue 2641523004: [Sync] Make directory types registration explicit in ModelTypeRegistry (Closed)
Patch Set: Address comments 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
93 void SyncBackendHostImpl::StartSyncingWithServer() { 98 void SyncBackendHostImpl::StartSyncingWithServer() {
94 SDVLOG(1) << "SyncBackendHostImpl::StartSyncingWithServer called."; 99 SDVLOG(1) << "SyncBackendHostImpl::StartSyncingWithServer called.";
95 100
96 ModelSafeRoutingInfo routing_info;
97 registrar_->GetModelSafeRoutingInfo(&routing_info);
98
99 sync_task_runner_->PostTask( 101 sync_task_runner_->PostTask(
100 FROM_HERE, base::Bind(&SyncBackendHostCore::DoStartSyncing, core_, 102 FROM_HERE, base::Bind(&SyncBackendHostCore::DoStartSyncing, core_,
101 routing_info, sync_prefs_->GetLastPollTime())); 103 sync_prefs_->GetLastPollTime()));
102 } 104 }
103 105
104 void SyncBackendHostImpl::SetEncryptionPassphrase(const std::string& passphrase, 106 void SyncBackendHostImpl::SetEncryptionPassphrase(const std::string& passphrase,
105 bool is_explicit) { 107 bool is_explicit) {
106 DCHECK(thread_checker_.CalledOnValidThread()); 108 DCHECK(thread_checker_.CalledOnValidThread());
107 109
108 if (!IsNigoriEnabled()) { 110 if (!IsNigoriEnabled()) {
109 NOTREACHED() << "SetEncryptionPassphrase must never be called when nigori" 111 NOTREACHED() << "SetEncryptionPassphrase must never be called when nigori"
110 " is disabled."; 112 " is disabled.";
111 return; 113 return;
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 void SyncBackendHostImpl::ConfigureDataTypes(ConfigureParams params) { 206 void SyncBackendHostImpl::ConfigureDataTypes(ConfigureParams params) {
205 sync_task_runner_->PostTask( 207 sync_task_runner_->PostTask(
206 FROM_HERE, 208 FROM_HERE,
207 base::Bind(&SyncBackendHostCore::DoPurgeDisabledTypes, core_, 209 base::Bind(&SyncBackendHostCore::DoPurgeDisabledTypes, core_,
208 params.to_purge, params.to_journal, params.to_unapply)); 210 params.to_purge, params.to_journal, params.to_unapply));
209 sync_task_runner_->PostTask( 211 sync_task_runner_->PostTask(
210 FROM_HERE, base::Bind(&SyncBackendHostCore::DoConfigureSyncer, core_, 212 FROM_HERE, base::Bind(&SyncBackendHostCore::DoConfigureSyncer, core_,
211 base::Passed(&params))); 213 base::Passed(&params)));
212 } 214 }
213 215
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
214 void SyncBackendHostImpl::EnableEncryptEverything() { 225 void SyncBackendHostImpl::EnableEncryptEverything() {
215 sync_task_runner_->PostTask( 226 sync_task_runner_->PostTask(
216 FROM_HERE, 227 FROM_HERE,
217 base::Bind(&SyncBackendHostCore::DoEnableEncryptEverything, core_)); 228 base::Bind(&SyncBackendHostCore::DoEnableEncryptEverything, core_));
218 } 229 }
219 230
220 void SyncBackendHostImpl::ActivateDirectoryDataType( 231 void SyncBackendHostImpl::ActivateDirectoryDataType(
221 ModelType type, 232 ModelType type,
222 ModelSafeGroup group, 233 ModelSafeGroup group,
223 ChangeProcessor* change_processor) { 234 ChangeProcessor* change_processor) {
224 registrar_->ActivateDataType(type, group, change_processor, GetUserShare()); 235 registrar_->ActivateDataType(type, group, change_processor, GetUserShare());
225 } 236 }
226 237
227 void SyncBackendHostImpl::DeactivateDirectoryDataType(ModelType type) { 238 void SyncBackendHostImpl::DeactivateDirectoryDataType(ModelType type) {
228 registrar_->DeactivateDataType(type); 239 registrar_->DeactivateDataType(type);
229 } 240 }
230 241
231 void SyncBackendHostImpl::ActivateNonBlockingDataType( 242 void SyncBackendHostImpl::ActivateNonBlockingDataType(
232 ModelType type, 243 ModelType type,
233 std::unique_ptr<ActivationContext> activation_context) { 244 std::unique_ptr<ActivationContext> activation_context) {
234 registrar_->RegisterNonBlockingType(type); 245 registrar_->RegisterNonBlockingType(type);
235 if (activation_context->model_type_state.initial_sync_done()) 246 if (activation_context->model_type_state.initial_sync_done())
236 registrar_->AddRestoredNonBlockingType(type); 247 registrar_->AddRestoredNonBlockingType(type);
237 model_type_connector_->ConnectType(type, std::move(activation_context)); 248 model_type_connector_->ConnectNonBlockingType(type,
249 std::move(activation_context));
238 } 250 }
239 251
240 void SyncBackendHostImpl::DeactivateNonBlockingDataType(ModelType type) { 252 void SyncBackendHostImpl::DeactivateNonBlockingDataType(ModelType type) {
241 model_type_connector_->DisconnectType(type); 253 model_type_connector_->DisconnectNonBlockingType(type);
242 } 254 }
243 255
244 UserShare* SyncBackendHostImpl::GetUserShare() const { 256 UserShare* SyncBackendHostImpl::GetUserShare() const {
245 return core_->sync_manager()->GetUserShare(); 257 return core_->sync_manager()->GetUserShare();
246 } 258 }
247 259
248 SyncBackendHostImpl::Status SyncBackendHostImpl::GetDetailedStatus() { 260 SyncBackendHostImpl::Status SyncBackendHostImpl::GetDetailedStatus() {
249 DCHECK(initialized()); 261 DCHECK(initialized());
250 return core_->sync_manager()->GetDetailedStatus(); 262 return core_->sync_manager()->GetDetailedStatus();
251 } 263 }
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
557 const SyncManager::ClearServerDataCallback& frontend_callback) { 569 const SyncManager::ClearServerDataCallback& frontend_callback) {
558 DCHECK(thread_checker_.CalledOnValidThread()); 570 DCHECK(thread_checker_.CalledOnValidThread());
559 frontend_callback.Run(); 571 frontend_callback.Run();
560 } 572 }
561 573
562 } // namespace syncer 574 } // namespace syncer
563 575
564 #undef SDVLOG 576 #undef SDVLOG
565 577
566 #undef SLOG 578 #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