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 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 SetJsEventHandler(event_handler); | 376 SetJsEventHandler(event_handler); |
377 | 377 |
378 AddObserver(&debug_info_event_listener_); | 378 AddObserver(&debug_info_event_listener_); |
379 | 379 |
380 database_path_ = database_location.Append( | 380 database_path_ = database_location.Append( |
381 syncable::Directory::kSyncDatabaseFilename); | 381 syncable::Directory::kSyncDatabaseFilename); |
382 encryptor_ = encryptor; | 382 encryptor_ = encryptor; |
383 unrecoverable_error_handler_ = unrecoverable_error_handler; | 383 unrecoverable_error_handler_ = unrecoverable_error_handler; |
384 report_unrecoverable_error_function_ = report_unrecoverable_error_function; | 384 report_unrecoverable_error_function_ = report_unrecoverable_error_function; |
385 | 385 |
| 386 allstatus_.SetHasKeystoreKey( |
| 387 !restored_keystore_key_for_bootstrapping.empty()); |
386 sync_encryption_handler_.reset(new SyncEncryptionHandlerImpl( | 388 sync_encryption_handler_.reset(new SyncEncryptionHandlerImpl( |
387 &share_, | 389 &share_, |
388 encryptor, | 390 encryptor, |
389 restored_key_for_bootstrapping, | 391 restored_key_for_bootstrapping, |
390 restored_keystore_key_for_bootstrapping)); | 392 restored_keystore_key_for_bootstrapping)); |
391 sync_encryption_handler_->AddObserver(this); | 393 sync_encryption_handler_->AddObserver(this); |
392 sync_encryption_handler_->AddObserver(&debug_info_event_listener_); | 394 sync_encryption_handler_->AddObserver(&debug_info_event_listener_); |
393 sync_encryption_handler_->AddObserver(&js_sync_encryption_handler_observer_); | 395 sync_encryption_handler_->AddObserver(&js_sync_encryption_handler_observer_); |
394 | 396 |
395 FilePath absolute_db_path(database_path_); | 397 FilePath absolute_db_path(database_path_); |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
527 // Does nothing. | 529 // Does nothing. |
528 } | 530 } |
529 | 531 |
530 void SyncManagerImpl::OnPassphraseAccepted() { | 532 void SyncManagerImpl::OnPassphraseAccepted() { |
531 // Does nothing. | 533 // Does nothing. |
532 } | 534 } |
533 | 535 |
534 void SyncManagerImpl::OnBootstrapTokenUpdated( | 536 void SyncManagerImpl::OnBootstrapTokenUpdated( |
535 const std::string& bootstrap_token, | 537 const std::string& bootstrap_token, |
536 BootstrapTokenType type) { | 538 BootstrapTokenType type) { |
537 // Does nothing. | 539 if (type == KEYSTORE_BOOTSTRAP_TOKEN) |
| 540 allstatus_.SetHasKeystoreKey(true); |
538 } | 541 } |
539 | 542 |
540 void SyncManagerImpl::OnEncryptedTypesChanged(ModelTypeSet encrypted_types, | 543 void SyncManagerImpl::OnEncryptedTypesChanged(ModelTypeSet encrypted_types, |
541 bool encrypt_everything) { | 544 bool encrypt_everything) { |
542 allstatus_.SetEncryptedTypes(encrypted_types); | 545 allstatus_.SetEncryptedTypes(encrypted_types); |
543 } | 546 } |
544 | 547 |
545 void SyncManagerImpl::OnEncryptionComplete() { | 548 void SyncManagerImpl::OnEncryptionComplete() { |
546 // Does nothing. | 549 // Does nothing. |
547 } | 550 } |
548 | 551 |
549 void SyncManagerImpl::OnCryptographerStateChanged( | 552 void SyncManagerImpl::OnCryptographerStateChanged( |
550 Cryptographer* cryptographer) { | 553 Cryptographer* cryptographer) { |
551 allstatus_.SetCryptographerReady(cryptographer->is_ready()); | 554 allstatus_.SetCryptographerReady(cryptographer->is_ready()); |
552 allstatus_.SetCryptoHasPendingKeys(cryptographer->has_pending_keys()); | 555 allstatus_.SetCryptoHasPendingKeys(cryptographer->has_pending_keys()); |
| 556 allstatus_.SetKeystoreMigrationTime( |
| 557 sync_encryption_handler_->migration_time()); |
553 } | 558 } |
554 | 559 |
555 void SyncManagerImpl::OnPassphraseTypeChanged(PassphraseType type) { | 560 void SyncManagerImpl::OnPassphraseTypeChanged(PassphraseType type) { |
556 // Does nothing. | 561 allstatus_.SetPassphraseType(type); |
| 562 allstatus_.SetKeystoreMigrationTime( |
| 563 sync_encryption_handler_->migration_time()); |
557 } | 564 } |
558 | 565 |
559 void SyncManagerImpl::StartSyncingNormally( | 566 void SyncManagerImpl::StartSyncingNormally( |
560 const ModelSafeRoutingInfo& routing_info) { | 567 const ModelSafeRoutingInfo& routing_info) { |
561 // Start the sync scheduler. | 568 // Start the sync scheduler. |
562 // TODO(sync): We always want the newest set of routes when we switch back | 569 // TODO(sync): We always want the newest set of routes when we switch back |
563 // to normal mode. Figure out how to enforce set_routing_info is always | 570 // to normal mode. Figure out how to enforce set_routing_info is always |
564 // appropriately set and that it's only modified when switching to normal | 571 // appropriately set and that it's only modified when switching to normal |
565 // mode. | 572 // mode. |
566 DCHECK(thread_checker_.CalledOnValidThread()); | 573 DCHECK(thread_checker_.CalledOnValidThread()); |
(...skipping 779 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1346 int SyncManagerImpl::GetDefaultNudgeDelay() { | 1353 int SyncManagerImpl::GetDefaultNudgeDelay() { |
1347 return kDefaultNudgeDelayMilliseconds; | 1354 return kDefaultNudgeDelayMilliseconds; |
1348 } | 1355 } |
1349 | 1356 |
1350 // static. | 1357 // static. |
1351 int SyncManagerImpl::GetPreferencesNudgeDelay() { | 1358 int SyncManagerImpl::GetPreferencesNudgeDelay() { |
1352 return kPreferencesNudgeDelayMilliseconds; | 1359 return kPreferencesNudgeDelayMilliseconds; |
1353 } | 1360 } |
1354 | 1361 |
1355 } // namespace syncer | 1362 } // namespace syncer |
OLD | NEW |