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/profile_sync_service.h" | 5 #include "chrome/browser/sync/profile_sync_service.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <map> | 8 #include <map> |
9 #include <ostream> | 9 #include <ostream> |
10 #include <set> | 10 #include <set> |
(...skipping 760 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
771 // this time. | 771 // this time. |
772 syncable::ModelTypeSet types; | 772 syncable::ModelTypeSet types; |
773 GetPreferredDataTypes(&types); | 773 GetPreferredDataTypes(&types); |
774 | 774 |
775 // Reset passphrase_required_reason_ before configuring the DataTypeManager | 775 // Reset passphrase_required_reason_ before configuring the DataTypeManager |
776 // since we know we no longer require the passphrase. | 776 // since we know we no longer require the passphrase. |
777 passphrase_required_reason_ = sync_api::REASON_PASSPHRASE_NOT_REQUIRED; | 777 passphrase_required_reason_ = sync_api::REASON_PASSPHRASE_NOT_REQUIRED; |
778 | 778 |
779 if (data_type_manager_.get()) { | 779 if (data_type_manager_.get()) { |
780 // Unblock the data type manager if necessary. | 780 // Unblock the data type manager if necessary. |
| 781 // This will always trigger a SYNC_CONFIGURE_DONE on completion, which will |
| 782 // step the UI wizard into DONE state (even if no datatypes have changed). |
781 data_type_manager_->Configure(types, | 783 data_type_manager_->Configure(types, |
782 sync_api::CONFIGURE_REASON_RECONFIGURATION); | 784 sync_api::CONFIGURE_REASON_RECONFIGURATION); |
783 } | 785 } |
784 | 786 |
785 NotifyObservers(); | 787 NotifyObservers(); |
786 | |
787 // TODO(tim): We shouldn't call this if !HasSyncSetupCompleted and the user | |
788 // isn't actually at the ENTER_PASSPHRASE screen. It results in a | |
789 // LOG(WARNING) currently. | |
790 wizard_.Step(SyncSetupWizard::DONE); | |
791 } | 788 } |
792 | 789 |
793 void ProfileSyncService::OnEncryptionComplete( | 790 void ProfileSyncService::OnEncryptionComplete( |
794 const syncable::ModelTypeSet& encrypted_types) { | 791 const syncable::ModelTypeSet& encrypted_types) { |
795 NotifyObservers(); | 792 NotifyObservers(); |
796 } | 793 } |
797 | 794 |
798 void ProfileSyncService::OnMigrationNeededForTypes( | 795 void ProfileSyncService::OnMigrationNeededForTypes( |
799 const syncable::ModelTypeSet& types) { | 796 const syncable::ModelTypeSet& types) { |
800 DCHECK(backend_initialized_); | 797 DCHECK(backend_initialized_); |
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1182 ChangeProcessor* change_processor) { | 1179 ChangeProcessor* change_processor) { |
1183 if (!backend_.get()) | 1180 if (!backend_.get()) |
1184 return; | 1181 return; |
1185 backend_->DeactivateDataType(data_type_controller, change_processor); | 1182 backend_->DeactivateDataType(data_type_controller, change_processor); |
1186 } | 1183 } |
1187 | 1184 |
1188 void ProfileSyncService::SetPassphrase(const std::string& passphrase, | 1185 void ProfileSyncService::SetPassphrase(const std::string& passphrase, |
1189 bool is_explicit, | 1186 bool is_explicit, |
1190 bool is_creation) { | 1187 bool is_creation) { |
1191 if (ShouldPushChanges() || IsPassphraseRequired()) { | 1188 if (ShouldPushChanges() || IsPassphraseRequired()) { |
| 1189 VLOG(1) << "Setting " << (is_explicit ? "explicit" : "implicit") |
| 1190 << " passphrase " << (is_creation ? " for creation" : ""); |
1192 backend_->SetPassphrase(passphrase, is_explicit); | 1191 backend_->SetPassphrase(passphrase, is_explicit); |
1193 } else { | 1192 } else { |
1194 if (is_explicit) { | 1193 if (is_explicit) { |
1195 cached_passphrase_.value = passphrase; | 1194 cached_passphrase_.value = passphrase; |
1196 cached_passphrase_.is_explicit = is_explicit; | 1195 cached_passphrase_.is_explicit = is_explicit; |
1197 cached_passphrase_.is_creation = is_creation; | 1196 cached_passphrase_.is_creation = is_creation; |
1198 } else { | 1197 } else { |
1199 gaia_password_ = passphrase; | 1198 gaia_password_ = passphrase; |
1200 } | 1199 } |
1201 } | 1200 } |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1388 // is initialized, all enabled data types are consistent with one | 1387 // is initialized, all enabled data types are consistent with one |
1389 // another, and no unrecoverable error has transpired. | 1388 // another, and no unrecoverable error has transpired. |
1390 if (unrecoverable_error_detected_) | 1389 if (unrecoverable_error_detected_) |
1391 return false; | 1390 return false; |
1392 | 1391 |
1393 if (!data_type_manager_.get()) | 1392 if (!data_type_manager_.get()) |
1394 return false; | 1393 return false; |
1395 | 1394 |
1396 return data_type_manager_->state() == DataTypeManager::CONFIGURED; | 1395 return data_type_manager_->state() == DataTypeManager::CONFIGURED; |
1397 } | 1396 } |
OLD | NEW |