| OLD | NEW |
| 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 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 | 243 |
| 244 UserShare* SyncBackendHostImpl::GetUserShare() const { | 244 UserShare* SyncBackendHostImpl::GetUserShare() const { |
| 245 return core_->sync_manager()->GetUserShare(); | 245 return core_->sync_manager()->GetUserShare(); |
| 246 } | 246 } |
| 247 | 247 |
| 248 SyncBackendHostImpl::Status SyncBackendHostImpl::GetDetailedStatus() { | 248 SyncBackendHostImpl::Status SyncBackendHostImpl::GetDetailedStatus() { |
| 249 DCHECK(initialized()); | 249 DCHECK(initialized()); |
| 250 return core_->sync_manager()->GetDetailedStatus(); | 250 return core_->sync_manager()->GetDetailedStatus(); |
| 251 } | 251 } |
| 252 | 252 |
| 253 SyncCycleSnapshot SyncBackendHostImpl::GetLastCycleSnapshot() const { | |
| 254 return last_snapshot_; | |
| 255 } | |
| 256 | |
| 257 bool SyncBackendHostImpl::HasUnsyncedItems() const { | 253 bool SyncBackendHostImpl::HasUnsyncedItems() const { |
| 258 DCHECK(initialized()); | 254 DCHECK(initialized()); |
| 259 return core_->sync_manager()->HasUnsyncedItems(); | 255 return core_->sync_manager()->HasUnsyncedItems(); |
| 260 } | 256 } |
| 261 | 257 |
| 262 bool SyncBackendHostImpl::IsNigoriEnabled() const { | 258 bool SyncBackendHostImpl::IsNigoriEnabled() const { |
| 263 return registrar_ && registrar_->IsNigoriEnabled(); | 259 return registrar_ && registrar_->IsNigoriEnabled(); |
| 264 } | 260 } |
| 265 | 261 |
| 266 PassphraseType SyncBackendHostImpl::GetPassphraseType() const { | 262 PassphraseType SyncBackendHostImpl::GetPassphraseType() const { |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 377 DCHECK(thread_checker_.CalledOnValidThread()); | 373 DCHECK(thread_checker_.CalledOnValidThread()); |
| 378 host_->OnEngineInitialized(ModelTypeSet(), WeakHandle<JsBackend>(), | 374 host_->OnEngineInitialized(ModelTypeSet(), WeakHandle<JsBackend>(), |
| 379 WeakHandle<DataTypeDebugInfoListener>(), "", | 375 WeakHandle<DataTypeDebugInfoListener>(), "", |
| 380 false); | 376 false); |
| 381 } | 377 } |
| 382 | 378 |
| 383 void SyncBackendHostImpl::HandleSyncCycleCompletedOnFrontendLoop( | 379 void SyncBackendHostImpl::HandleSyncCycleCompletedOnFrontendLoop( |
| 384 const SyncCycleSnapshot& snapshot) { | 380 const SyncCycleSnapshot& snapshot) { |
| 385 DCHECK(thread_checker_.CalledOnValidThread()); | 381 DCHECK(thread_checker_.CalledOnValidThread()); |
| 386 | 382 |
| 387 last_snapshot_ = snapshot; | |
| 388 | |
| 389 SDVLOG(1) << "Got snapshot " << snapshot.ToString(); | |
| 390 | |
| 391 if (!snapshot.poll_finish_time().is_null()) | |
| 392 sync_prefs_->SetLastPollTime(snapshot.poll_finish_time()); | |
| 393 | |
| 394 // Process any changes to the datatypes we're syncing. | 383 // Process any changes to the datatypes we're syncing. |
| 395 // TODO(sync): add support for removing types. | 384 // TODO(sync): add support for removing types. |
| 396 if (initialized()) | 385 if (initialized()) { |
| 397 AddExperimentalTypes(); | 386 AddExperimentalTypes(); |
| 398 | 387 host_->OnSyncCycleCompleted(snapshot); |
| 399 if (initialized()) | 388 } |
| 400 host_->OnSyncCycleCompleted(); | |
| 401 } | 389 } |
| 402 | 390 |
| 403 void SyncBackendHostImpl::RetryConfigurationOnFrontendLoop( | 391 void SyncBackendHostImpl::RetryConfigurationOnFrontendLoop( |
| 404 const base::Closure& retry_callback) { | 392 const base::Closure& retry_callback) { |
| 405 SDVLOG(1) << "Failed to complete configuration, informing of retry."; | 393 SDVLOG(1) << "Failed to complete configuration, informing of retry."; |
| 406 retry_callback.Run(); | 394 retry_callback.Run(); |
| 407 } | 395 } |
| 408 | 396 |
| 409 void SyncBackendHostImpl::PersistEncryptionBootstrapToken( | 397 void SyncBackendHostImpl::PersistEncryptionBootstrapToken( |
| 410 const std::string& token, | 398 const std::string& token, |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 |
| OLD | NEW |