OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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_encryption_handler_impl.h" | 5 #include "sync/internal_api/sync_encryption_handler_impl.h" |
6 | 6 |
7 #include <queue> | 7 #include <queue> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/base64.h" | 10 #include "base/base64.h" |
(...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
643 } | 643 } |
644 | 644 |
645 // Note: this is called from within a syncable transaction, so we need to post | 645 // Note: this is called from within a syncable transaction, so we need to post |
646 // tasks if we want to do any work that creates a new sync_api transaction. | 646 // tasks if we want to do any work that creates a new sync_api transaction. |
647 void SyncEncryptionHandlerImpl::ApplyNigoriUpdate( | 647 void SyncEncryptionHandlerImpl::ApplyNigoriUpdate( |
648 const sync_pb::NigoriSpecifics& nigori, | 648 const sync_pb::NigoriSpecifics& nigori, |
649 syncable::BaseTransaction* const trans) { | 649 syncable::BaseTransaction* const trans) { |
650 DCHECK(thread_checker_.CalledOnValidThread()); | 650 DCHECK(thread_checker_.CalledOnValidThread()); |
651 DCHECK(trans); | 651 DCHECK(trans); |
652 if (!ApplyNigoriUpdateImpl(nigori, trans)) { | 652 if (!ApplyNigoriUpdateImpl(nigori, trans)) { |
653 MessageLoop::current()->PostTask( | 653 base::MessageLoop::current()->PostTask( |
654 FROM_HERE, | 654 FROM_HERE, |
655 base::Bind(&SyncEncryptionHandlerImpl::RewriteNigori, | 655 base::Bind(&SyncEncryptionHandlerImpl::RewriteNigori, |
656 weak_ptr_factory_.GetWeakPtr())); | 656 weak_ptr_factory_.GetWeakPtr())); |
657 } | 657 } |
658 | 658 |
659 FOR_EACH_OBSERVER( | 659 FOR_EACH_OBSERVER( |
660 SyncEncryptionHandler::Observer, | 660 SyncEncryptionHandler::Observer, |
661 observers_, | 661 observers_, |
662 OnCryptographerStateChanged( | 662 OnCryptographerStateChanged( |
663 &UnlockVaultMutable(trans)->cryptographer)); | 663 &UnlockVaultMutable(trans)->cryptographer)); |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
732 // be able to decrypt them using either the keystore decryptor token | 732 // be able to decrypt them using either the keystore decryptor token |
733 // or the existing keystore keys. | 733 // or the existing keystore keys. |
734 DecryptPendingKeysWithKeystoreKey(keystore_key_, | 734 DecryptPendingKeysWithKeystoreKey(keystore_key_, |
735 nigori.keystore_decryptor_token(), | 735 nigori.keystore_decryptor_token(), |
736 cryptographer); | 736 cryptographer); |
737 } | 737 } |
738 | 738 |
739 // Note that triggering migration will have no effect if we're already | 739 // Note that triggering migration will have no effect if we're already |
740 // properly migrated with the newest keystore keys. | 740 // properly migrated with the newest keystore keys. |
741 if (ShouldTriggerMigration(nigori, *cryptographer)) { | 741 if (ShouldTriggerMigration(nigori, *cryptographer)) { |
742 MessageLoop::current()->PostTask( | 742 base::MessageLoop::current()->PostTask( |
743 FROM_HERE, | 743 FROM_HERE, |
744 base::Bind(&SyncEncryptionHandlerImpl::RewriteNigori, | 744 base::Bind(&SyncEncryptionHandlerImpl::RewriteNigori, |
745 weak_ptr_factory_.GetWeakPtr())); | 745 weak_ptr_factory_.GetWeakPtr())); |
746 } | 746 } |
747 | 747 |
748 return true; | 748 return true; |
749 } | 749 } |
750 | 750 |
751 ModelTypeSet SyncEncryptionHandlerImpl::GetEncryptedTypes( | 751 ModelTypeSet SyncEncryptionHandlerImpl::GetEncryptedTypes( |
752 syncable::BaseTransaction* const trans) const { | 752 syncable::BaseTransaction* const trans) const { |
(...skipping 892 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1645 | 1645 |
1646 base::Time SyncEncryptionHandlerImpl::GetExplicitPassphraseTime() const { | 1646 base::Time SyncEncryptionHandlerImpl::GetExplicitPassphraseTime() const { |
1647 if (passphrase_type_ == FROZEN_IMPLICIT_PASSPHRASE) | 1647 if (passphrase_type_ == FROZEN_IMPLICIT_PASSPHRASE) |
1648 return migration_time(); | 1648 return migration_time(); |
1649 else if (passphrase_type_ == CUSTOM_PASSPHRASE) | 1649 else if (passphrase_type_ == CUSTOM_PASSPHRASE) |
1650 return custom_passphrase_time(); | 1650 return custom_passphrase_time(); |
1651 return base::Time(); | 1651 return base::Time(); |
1652 } | 1652 } |
1653 | 1653 |
1654 } // namespace browser_sync | 1654 } // namespace browser_sync |
OLD | NEW |