Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1467)

Unified Diff: chrome/browser/sync/profile_sync_service.cc

Issue 6910012: Add method IsPassphraseRequiredForDecryption to ProfileSyncService (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Re-enable failing test. Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/sync/profile_sync_service.h ('k') | chrome/browser/sync/profile_sync_service_harness.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sync/profile_sync_service.cc
diff --git a/chrome/browser/sync/profile_sync_service.cc b/chrome/browser/sync/profile_sync_service.cc
index db2fd104478180dec30f414e498cf970f1e466d6..a8606cbc1d941f30f703a58f6f6350cd183f045f 100644
--- a/chrome/browser/sync/profile_sync_service.cc
+++ b/chrome/browser/sync/profile_sync_service.cc
@@ -616,16 +616,12 @@ void ProfileSyncService::OnPassphraseRequired(
// We will skip the passphrase prompt and suppress the warning if the
// passphrase is needed for decryption but the user is not syncing an
// encrypted data type on this machine. Otherwise we prompt.
- if (!IsEncryptedDatatypeEnabled() &&
- (reason == sync_api::REASON_DECRYPTION ||
- reason == sync_api::REASON_SET_PASSPHRASE_FAILED)) {
+ if (!IsEncryptedDatatypeEnabled() && IsPassphraseRequiredForDecryption()) {
OnPassphraseAccepted();
return;
}
- if (WizardIsVisible() &&
- (reason == sync_api::REASON_DECRYPTION ||
- reason == sync_api::REASON_SET_PASSPHRASE_FAILED)) {
+ if (WizardIsVisible() && IsPassphraseRequiredForDecryption()) {
wizard_.Step(SyncSetupWizard::ENTER_PASSPHRASE);
}
@@ -689,7 +685,7 @@ void ProfileSyncService::ShowLoginDialog(gfx::NativeWindow parent_window) {
}
void ProfileSyncService::ShowErrorUI(gfx::NativeWindow parent_window) {
- if (ObservedPassphraseRequired()) {
+ if (IsPassphraseRequired()) {
if (IsUsingSecondaryPassphrase())
PromptForExistingPassphrase(parent_window);
else
@@ -945,7 +941,7 @@ void ProfileSyncService::GetRegisteredDataTypes(
bool ProfileSyncService::IsUsingSecondaryPassphrase() const {
return backend_.get() && (backend_->IsUsingExplicitPassphrase() ||
(tried_implicit_gaia_remove_when_bug_62103_fixed_ &&
- ObservedPassphraseRequired()));
+ IsPassphraseRequired()));
}
bool ProfileSyncService::IsCryptographerReady(
@@ -986,8 +982,7 @@ void ProfileSyncService::ConfigureDataTypeManager() {
encrypted_types_.clear();
if (types.count(syncable::PASSWORDS) > 0)
encrypted_types_.insert(syncable::PASSWORDS);
- if (passphrase_required_reason_ == sync_api::REASON_DECRYPTION ||
- passphrase_required_reason_ == sync_api::REASON_SET_PASSPHRASE_FAILED) {
+ if (IsPassphraseRequiredForDecryption()) {
if (IsEncryptedDatatypeEnabled()) {
// We need a passphrase still. Prompt the user for a passphrase, and
// DataTypeManager::Configure() will get called once the passphrase is
@@ -1105,7 +1100,7 @@ void ProfileSyncService::DeactivateDataType(
void ProfileSyncService::SetPassphrase(const std::string& passphrase,
bool is_explicit,
bool is_creation) {
- if (ShouldPushChanges() || ObservedPassphraseRequired()) {
+ if (ShouldPushChanges() || IsPassphraseRequired()) {
backend_->SetPassphrase(passphrase, is_explicit);
} else {
cached_passphrase_.value = passphrase;
@@ -1160,11 +1155,9 @@ void ProfileSyncService::Observe(NotificationType type,
}
// We should never get in a state where we have no encrypted datatypes
- // enabled, and yet we still think we require a passphrase.
- DCHECK(passphrase_required_reason_ ==
- sync_api::REASON_PASSPHRASE_NOT_REQUIRED ||
- passphrase_required_reason_ == sync_api::REASON_ENCRYPTION ||
- IsEncryptedDatatypeEnabled());
+ // enabled, and yet we still think we require a passphrase for decryption.
+ DCHECK(!(IsPassphraseRequiredForDecryption() &&
+ !IsEncryptedDatatypeEnabled()));
// TODO(sync): Less wizard, more toast.
wizard_.Step(SyncSetupWizard::DONE);
@@ -1210,9 +1203,7 @@ void ProfileSyncService::Observe(NotificationType type,
// If this signin was to initiate a passphrase migration (on the
// first computer, thus not for decryption), continue the migration.
if (passphrase_migration_in_progress_ &&
- passphrase_required_reason_ != sync_api::REASON_DECRYPTION &&
- passphrase_required_reason_ !=
- sync_api::REASON_SET_PASSPHRASE_FAILED) {
+ !IsPassphraseRequiredForDecryption()) {
wizard_.Step(SyncSetupWizard::PASSPHRASE_MIGRATION);
passphrase_migration_in_progress_ = false;
}
« no previous file with comments | « chrome/browser/sync/profile_sync_service.h ('k') | chrome/browser/sync/profile_sync_service_harness.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698