summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorrsimha@chromium.org <rsimha@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-21 03:52:58 +0000
committerrsimha@chromium.org <rsimha@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-21 03:52:58 +0000
commit1d05b9ba055c07d9984db0db5f1bf5b468a508b5 (patch)
treeaf0b68a0b67a09d45c7b133f036a197a0e65d98a /chrome
parentd0f370b05f04275efe94fa35d0f8208f7921f1cc (diff)
downloadchromium_src-1d05b9ba055c07d9984db0db5f1bf5b468a508b5.zip
chromium_src-1d05b9ba055c07d9984db0db5f1bf5b468a508b5.tar.gz
chromium_src-1d05b9ba055c07d9984db0db5f1bf5b468a508b5.tar.bz2
Trigger NotifyPassphraseAccepted from the UI thread when a correct passphrase is entered
As of today, when a user enters a passphrase for decryption while signing in to sync, the passphrase is tested against the cached pending keys, and then sent down to the syncer thread so that the cryptographer can use it for decryption. At the end of decryption, OnPassphraseAccepted is called. The problem with this is that in the meantime, if the user brings up the advanced settings dialog, we might unnecessarily prompt the user for a passphrase even though the correct one was entered. This patch adds a call to NotifyPassphraseAccepted in SyncBackendHost::SetDecryptionPassphrase if the correct passphrase is entered. This gives the UI immediate feedback when a passphrase is accepted, and will pave the way for a snappier user experience. BUG=119191 TEST=sync_unit_tests, sync_integration_tests, Enter a passphrase and immediately open the advanced setup dialog Review URL: http://codereview.chromium.org/9794007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@127895 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/sync/glue/sync_backend_host.cc11
1 files changed, 11 insertions, 0 deletions
diff --git a/chrome/browser/sync/glue/sync_backend_host.cc b/chrome/browser/sync/glue/sync_backend_host.cc
index c75ffe9..3e0100f 100644
--- a/chrome/browser/sync/glue/sync_backend_host.cc
+++ b/chrome/browser/sync/glue/sync_backend_host.cc
@@ -434,6 +434,17 @@ bool SyncBackendHost::SetDecryptionPassphrase(const std::string& passphrase) {
sync_thread_.message_loop()->PostTask(FROM_HERE,
base::Bind(&SyncBackendHost::Core::DoSetDecryptionPassphrase, core_.get(),
passphrase));
+
+ // Since we were able to decrypt the cached pending keys with the passphrase
+ // provided, we immediately alert the UI layer that the passphrase was
+ // accepted. This will avoid the situation where a user enters a passphrase,
+ // clicks OK, immediately reopens the advanced settings dialog, and gets an
+ // unnecessary prompt for a passphrase.
+ // Note: It is not guaranteed that the passphrase will be accepted by the
+ // syncer thread, since we could receive a new nigori node while the task is
+ // pending. This scenario is a valid race, and SetDecryptionPassphrase can
+ // trigger a new OnPassphraseRequired if it needs to.
+ NotifyPassphraseAccepted();
return true;
}