| 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 "sync/internal_api/sync_manager_impl.h" | 5 #include "sync/internal_api/sync_manager_impl.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/base64.h" | 9 #include "base/base64.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 ready_task.Run(); | 211 ready_task.Run(); |
| 212 return; | 212 return; |
| 213 } | 213 } |
| 214 | 214 |
| 215 ConfigurationParams params(GetSourceFromReason(reason), | 215 ConfigurationParams params(GetSourceFromReason(reason), |
| 216 to_download, | 216 to_download, |
| 217 new_routing_info, | 217 new_routing_info, |
| 218 ready_task, | 218 ready_task, |
| 219 retry_task); | 219 retry_task); |
| 220 | 220 |
| 221 scheduler_->Start(SyncScheduler::CONFIGURATION_MODE); | 221 scheduler_->Start(SyncScheduler::CONFIGURATION_MODE, base::Time()); |
| 222 scheduler_->ScheduleConfiguration(params); | 222 scheduler_->ScheduleConfiguration(params); |
| 223 } | 223 } |
| 224 | 224 |
| 225 void SyncManagerImpl::Init(InitArgs* args) { | 225 void SyncManagerImpl::Init(InitArgs* args) { |
| 226 CHECK(!initialized_); | 226 CHECK(!initialized_); |
| 227 DCHECK(thread_checker_.CalledOnValidThread()); | 227 DCHECK(thread_checker_.CalledOnValidThread()); |
| 228 DCHECK(args->post_factory.get()); | 228 DCHECK(args->post_factory.get()); |
| 229 DCHECK(!args->credentials.email.empty()); | 229 DCHECK(!args->credentials.email.empty()); |
| 230 DCHECK(!args->credentials.sync_token.empty()); | 230 DCHECK(!args->credentials.sync_token.empty()); |
| 231 DCHECK(!args->credentials.scope_set.empty()); | 231 DCHECK(!args->credentials.scope_set.empty()); |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 args->extensions_activity, | 328 args->extensions_activity, |
| 329 listeners, | 329 listeners, |
| 330 &debug_info_event_listener_, | 330 &debug_info_event_listener_, |
| 331 model_type_registry_.get(), | 331 model_type_registry_.get(), |
| 332 args->invalidator_client_id) | 332 args->invalidator_client_id) |
| 333 .Pass(); | 333 .Pass(); |
| 334 session_context_->set_account_name(args->credentials.email); | 334 session_context_->set_account_name(args->credentials.email); |
| 335 scheduler_ = args->internal_components_factory->BuildScheduler( | 335 scheduler_ = args->internal_components_factory->BuildScheduler( |
| 336 name_, session_context_.get(), args->cancelation_signal).Pass(); | 336 name_, session_context_.get(), args->cancelation_signal).Pass(); |
| 337 | 337 |
| 338 scheduler_->Start(SyncScheduler::CONFIGURATION_MODE); | 338 scheduler_->Start(SyncScheduler::CONFIGURATION_MODE, base::Time()); |
| 339 | 339 |
| 340 initialized_ = true; | 340 initialized_ = true; |
| 341 | 341 |
| 342 net::NetworkChangeNotifier::AddIPAddressObserver(this); | 342 net::NetworkChangeNotifier::AddIPAddressObserver(this); |
| 343 net::NetworkChangeNotifier::AddConnectionTypeObserver(this); | 343 net::NetworkChangeNotifier::AddConnectionTypeObserver(this); |
| 344 observing_network_connectivity_changes_ = true; | 344 observing_network_connectivity_changes_ = true; |
| 345 | 345 |
| 346 UpdateCredentials(args->credentials); | 346 UpdateCredentials(args->credentials); |
| 347 | 347 |
| 348 NotifyInitializationSuccess(); | 348 NotifyInitializationSuccess(); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 400 | 400 |
| 401 void SyncManagerImpl::OnPassphraseTypeChanged( | 401 void SyncManagerImpl::OnPassphraseTypeChanged( |
| 402 PassphraseType type, | 402 PassphraseType type, |
| 403 base::Time explicit_passphrase_time) { | 403 base::Time explicit_passphrase_time) { |
| 404 allstatus_.SetPassphraseType(type); | 404 allstatus_.SetPassphraseType(type); |
| 405 allstatus_.SetKeystoreMigrationTime( | 405 allstatus_.SetKeystoreMigrationTime( |
| 406 sync_encryption_handler_->migration_time()); | 406 sync_encryption_handler_->migration_time()); |
| 407 } | 407 } |
| 408 | 408 |
| 409 void SyncManagerImpl::StartSyncingNormally( | 409 void SyncManagerImpl::StartSyncingNormally( |
| 410 const ModelSafeRoutingInfo& routing_info) { | 410 const ModelSafeRoutingInfo& routing_info, |
| 411 base::Time last_poll_time) { |
| 411 // Start the sync scheduler. | 412 // Start the sync scheduler. |
| 412 // TODO(sync): We always want the newest set of routes when we switch back | 413 // TODO(sync): We always want the newest set of routes when we switch back |
| 413 // to normal mode. Figure out how to enforce set_routing_info is always | 414 // to normal mode. Figure out how to enforce set_routing_info is always |
| 414 // appropriately set and that it's only modified when switching to normal | 415 // appropriately set and that it's only modified when switching to normal |
| 415 // mode. | 416 // mode. |
| 416 DCHECK(thread_checker_.CalledOnValidThread()); | 417 DCHECK(thread_checker_.CalledOnValidThread()); |
| 417 session_context_->SetRoutingInfo(routing_info); | 418 session_context_->SetRoutingInfo(routing_info); |
| 418 scheduler_->Start(SyncScheduler::NORMAL_MODE); | 419 scheduler_->Start(SyncScheduler::NORMAL_MODE, |
| 420 last_poll_time); |
| 419 } | 421 } |
| 420 | 422 |
| 421 syncable::Directory* SyncManagerImpl::directory() { | 423 syncable::Directory* SyncManagerImpl::directory() { |
| 422 return share_.directory.get(); | 424 return share_.directory.get(); |
| 423 } | 425 } |
| 424 | 426 |
| 425 const SyncScheduler* SyncManagerImpl::scheduler() const { | 427 const SyncScheduler* SyncManagerImpl::scheduler() const { |
| 426 return scheduler_.get(); | 428 return scheduler_.get(); |
| 427 } | 429 } |
| 428 | 430 |
| (...skipping 595 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1024 bool SyncManagerImpl::HasDirectoryTypeDebugInfoObserver( | 1026 bool SyncManagerImpl::HasDirectoryTypeDebugInfoObserver( |
| 1025 syncer::TypeDebugInfoObserver* observer) { | 1027 syncer::TypeDebugInfoObserver* observer) { |
| 1026 return model_type_registry_->HasDirectoryTypeDebugInfoObserver(observer); | 1028 return model_type_registry_->HasDirectoryTypeDebugInfoObserver(observer); |
| 1027 } | 1029 } |
| 1028 | 1030 |
| 1029 void SyncManagerImpl::RequestEmitDebugInfo() { | 1031 void SyncManagerImpl::RequestEmitDebugInfo() { |
| 1030 model_type_registry_->RequestEmitDebugInfo(); | 1032 model_type_registry_->RequestEmitDebugInfo(); |
| 1031 } | 1033 } |
| 1032 | 1034 |
| 1033 } // namespace syncer | 1035 } // namespace syncer |
| OLD | NEW |