OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/sync/internal_api/sync_manager.h" | 5 #include "chrome/browser/sync/internal_api/sync_manager.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/base64.h" | 10 #include "base/base64.h" |
(...skipping 769 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
780 | 780 |
781 bool signed_in = SignIn(credentials); | 781 bool signed_in = SignIn(credentials); |
782 | 782 |
783 if (signed_in && scheduler()) { | 783 if (signed_in && scheduler()) { |
784 scheduler()->Start( | 784 scheduler()->Start( |
785 browser_sync::SyncScheduler::CONFIGURATION_MODE, NULL); | 785 browser_sync::SyncScheduler::CONFIGURATION_MODE, NULL); |
786 } | 786 } |
787 | 787 |
788 initialized_ = true; | 788 initialized_ = true; |
789 | 789 |
| 790 // The following calls check that initialized_ is true. |
| 791 BootstrapEncryption(restored_key_for_bootstrapping); |
| 792 |
790 // Notify that initialization is complete. | 793 // Notify that initialization is complete. |
791 ObserverList<SyncManager::Observer> temp_obs_list; | 794 ObserverList<SyncManager::Observer> temp_obs_list; |
792 CopyObservers(&temp_obs_list); | 795 CopyObservers(&temp_obs_list); |
793 FOR_EACH_OBSERVER(SyncManager::Observer, temp_obs_list, | 796 FOR_EACH_OBSERVER(SyncManager::Observer, temp_obs_list, |
794 OnInitializationComplete( | 797 OnInitializationComplete( |
795 WeakHandle<JsBackend>(weak_ptr_factory_.GetWeakPtr()))); | 798 WeakHandle<JsBackend>(weak_ptr_factory_.GetWeakPtr()))); |
796 | 799 |
797 // The following calls check that initialized_ is true. | |
798 | |
799 BootstrapEncryption(restored_key_for_bootstrapping); | |
800 | |
801 sync_notifier_->AddObserver(this); | 800 sync_notifier_->AddObserver(this); |
802 | 801 |
803 return signed_in; | 802 return signed_in; |
804 } | 803 } |
805 | 804 |
806 void SyncManager::SyncInternal::BootstrapEncryption( | 805 void SyncManager::SyncInternal::BootstrapEncryption( |
807 const std::string& restored_key_for_bootstrapping) { | 806 const std::string& restored_key_for_bootstrapping) { |
808 // Cryptographer should only be accessed while holding a transaction. | 807 // Cryptographer should only be accessed while holding a transaction. |
809 ReadTransaction trans(FROM_HERE, GetUserShare()); | 808 ReadTransaction trans(FROM_HERE, GetUserShare()); |
810 Cryptographer* cryptographer = trans.GetCryptographer(); | 809 Cryptographer* cryptographer = trans.GetCryptographer(); |
(...skipping 1228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2039 | 2038 |
2040 for (syncable::ModelTypeSet::const_iterator i = types.begin(); | 2039 for (syncable::ModelTypeSet::const_iterator i = types.begin(); |
2041 i != types.end(); ++i) { | 2040 i != types.end(); ++i) { |
2042 if (!lookup->initial_sync_ended_for_type(*i)) | 2041 if (!lookup->initial_sync_ended_for_type(*i)) |
2043 return false; | 2042 return false; |
2044 } | 2043 } |
2045 return true; | 2044 return true; |
2046 } | 2045 } |
2047 | 2046 |
2048 } // namespace sync_api | 2047 } // namespace sync_api |
OLD | NEW |