OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 <map> | 7 #include <map> |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 682 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
693 passphrase_required_for_decryption_ = for_decryption; | 693 passphrase_required_for_decryption_ = for_decryption; |
694 | 694 |
695 if (!cached_passphrase_.value.empty()) { | 695 if (!cached_passphrase_.value.empty()) { |
696 SetPassphrase(cached_passphrase_.value, | 696 SetPassphrase(cached_passphrase_.value, |
697 cached_passphrase_.is_explicit, | 697 cached_passphrase_.is_explicit, |
698 cached_passphrase_.is_creation); | 698 cached_passphrase_.is_creation); |
699 cached_passphrase_ = CachedPassphrase(); | 699 cached_passphrase_ = CachedPassphrase(); |
700 return; | 700 return; |
701 } | 701 } |
702 | 702 |
703 if (WizardIsVisible()) { | 703 if (WizardIsVisible() && for_decryption) { |
704 wizard_.Step(SyncSetupWizard::ENTER_PASSPHRASE); | 704 wizard_.Step(SyncSetupWizard::ENTER_PASSPHRASE); |
| 705 } else if (WizardIsVisible() && !for_decryption) { |
| 706 // The user is enabling an encrypted data type for the first |
| 707 // time, and we don't even have a default passphrase. We need |
| 708 // to refresh credentials and show the passphrase migration. |
| 709 SigninForPassphraseMigration(NULL); |
705 } | 710 } |
706 | 711 |
707 NotifyObservers(); | 712 NotifyObservers(); |
708 } | 713 } |
709 | 714 |
710 void ProfileSyncService::OnPassphraseAccepted() { | 715 void ProfileSyncService::OnPassphraseAccepted() { |
711 // Make sure the data types that depend on the passphrase are started at | 716 // Make sure the data types that depend on the passphrase are started at |
712 // this time. | 717 // this time. |
713 syncable::ModelTypeSet types; | 718 syncable::ModelTypeSet types; |
714 GetPreferredDataTypes(&types); | 719 GetPreferredDataTypes(&types); |
(...skipping 11 matching lines...) Expand all Loading... |
726 if (!cros_user_.empty()) { | 731 if (!cros_user_.empty()) { |
727 // For ChromeOS, any login UI needs to be handled by the settings page. | 732 // For ChromeOS, any login UI needs to be handled by the settings page. |
728 Browser* browser = BrowserList::GetLastActiveWithProfile(profile()); | 733 Browser* browser = BrowserList::GetLastActiveWithProfile(profile()); |
729 if (browser) | 734 if (browser) |
730 browser->ShowOptionsTab(chrome::kPersonalOptionsSubPage); | 735 browser->ShowOptionsTab(chrome::kPersonalOptionsSubPage); |
731 return; | 736 return; |
732 } | 737 } |
733 | 738 |
734 if (WizardIsVisible()) { | 739 if (WizardIsVisible()) { |
735 wizard_.Focus(); | 740 wizard_.Focus(); |
| 741 // Force the wizard to step to the login screen (which will only actually |
| 742 // happen if the transition is valid). |
| 743 wizard_.Step(SyncSetupWizard::GAIA_LOGIN); |
736 return; | 744 return; |
737 } | 745 } |
738 | 746 |
739 if (!auth_error_time_.is_null()) { | 747 if (!auth_error_time_.is_null()) { |
740 UMA_HISTOGRAM_LONG_TIMES("Sync.ReauthorizationTime", | 748 UMA_HISTOGRAM_LONG_TIMES("Sync.ReauthorizationTime", |
741 base::TimeTicks::Now() - auth_error_time_); | 749 base::TimeTicks::Now() - auth_error_time_); |
742 auth_error_time_ = base::TimeTicks(); // Reset auth_error_time_ to null. | 750 auth_error_time_ = base::TimeTicks(); // Reset auth_error_time_ to null. |
743 } | 751 } |
744 | 752 |
745 wizard_.SetParent(parent_window); | 753 wizard_.SetParent(parent_window); |
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1207 // is initialized, all enabled data types are consistent with one | 1215 // is initialized, all enabled data types are consistent with one |
1208 // another, and no unrecoverable error has transpired. | 1216 // another, and no unrecoverable error has transpired. |
1209 if (unrecoverable_error_detected_) | 1217 if (unrecoverable_error_detected_) |
1210 return false; | 1218 return false; |
1211 | 1219 |
1212 if (!data_type_manager_.get()) | 1220 if (!data_type_manager_.get()) |
1213 return false; | 1221 return false; |
1214 | 1222 |
1215 return data_type_manager_->state() == DataTypeManager::CONFIGURED; | 1223 return data_type_manager_->state() == DataTypeManager::CONFIGURED; |
1216 } | 1224 } |
OLD | NEW |