Skip to content

Commit

Permalink
Only trigger OnPassphrsaeRequired if we have encrypted types that are…
Browse files Browse the repository at this point in the history
… enabled.

BUG=83176
TEST=First time sync without passwords enabled.


Review URL: http://codereview.chromium.org/7029051

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@85973 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
zea@chromium.org committed May 19, 2011
1 parent 2418b02 commit cfc81e1
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions chrome/browser/sync/engine/syncapi.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2546,7 +2546,14 @@ void SyncManager::SyncInternal::OnSyncEngineEvent(
const sync_pb::NigoriSpecifics& nigori = node.GetNigoriSpecifics();
syncable::ModelTypeSet encrypted_types =
syncable::GetEncryptedDataTypesFromNigori(nigori);
if (!encrypted_types.empty()) {
syncable::ModelTypeSet encrypted_and_enabled_types;
for (syncable::ModelTypeSet::iterator iter = encrypted_types.begin();
iter != encrypted_types.end();
++iter) {
if (enabled_types.count(*iter) > 0)
encrypted_and_enabled_types.insert(*iter);
}
if (!encrypted_and_enabled_types.empty()) {
Cryptographer* cryptographer = trans.GetCryptographer();
if (!cryptographer->is_ready() && !cryptographer->has_pending_keys()) {
if (!nigori.encrypted().blob().empty()) {
Expand All @@ -2568,7 +2575,7 @@ void SyncManager::SyncInternal::OnSyncEngineEvent(
OnPassphraseRequired(sync_api::REASON_ENCRYPTION));
} else {
FOR_EACH_OBSERVER(SyncManager::Observer, observers_,
OnEncryptionComplete(encrypted_types));
OnEncryptionComplete(encrypted_and_enabled_types));
}
}
}
Expand Down

0 comments on commit cfc81e1

Please sign in to comment.