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

Unified Diff: chrome/browser/sync/glue/sync_backend_host.cc

Issue 6902101: Refactor sync passphrase setup flow and fix passphrase tests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: de Morgan's law simplification. 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
Index: chrome/browser/sync/glue/sync_backend_host.cc
diff --git a/chrome/browser/sync/glue/sync_backend_host.cc b/chrome/browser/sync/glue/sync_backend_host.cc
index ed56a2e0c46ced14bdb6044beae7aabaf9fd3265..688a4fa18b3f1e425e26d3911fbb64e71805fc16 100644
--- a/chrome/browser/sync/glue/sync_backend_host.cc
+++ b/chrome/browser/sync/glue/sync_backend_host.cc
@@ -528,30 +528,24 @@ bool SyncBackendHost::RequestClearServerData() {
SyncBackendHost::Core::~Core() {
}
-void SyncBackendHost::Core::NotifyPassphraseRequired(bool for_decryption) {
+void SyncBackendHost::Core::NotifyPassphraseRequired(
+ sync_api::PassphraseRequiredReason reason) {
if (!host_ || !host_->frontend_)
return;
DCHECK_EQ(MessageLoop::current(), host_->frontend_loop_);
+ // When setting a passphrase fails, unset our waiting flag.
+ if (reason == sync_api::REASON_SET_PASSPHRASE_FAILED)
+ processing_passphrase_ = false;
+
if (processing_passphrase_) {
VLOG(1) << "Core received OnPassphraseRequired while processing a "
<< "passphrase. Silently dropping.";
return;
}
- host_->frontend_->OnPassphraseRequired(for_decryption);
-}
-
-void SyncBackendHost::Core::NotifyPassphraseFailed() {
- if (!host_ || !host_->frontend_)
- return;
- DCHECK_EQ(MessageLoop::current(), host_->frontend_loop_);
-
- // When a passphrase fails, we just unset our waiting flag and trigger a
- // OnPassphraseRequired(true).
- processing_passphrase_ = false;
- host_->frontend_->OnPassphraseRequired(true);
+ host_->frontend_->OnPassphraseRequired(reason);
}
void SyncBackendHost::Core::NotifyPassphraseAccepted(
@@ -972,14 +966,10 @@ void SyncBackendHost::Core::OnAuthError(const AuthError& auth_error) {
auth_error));
}
-void SyncBackendHost::Core::OnPassphraseRequired(bool for_decryption) {
- host_->frontend_loop_->PostTask(FROM_HERE,
- NewRunnableMethod(this, &Core::NotifyPassphraseRequired, for_decryption));
-}
-
-void SyncBackendHost::Core::OnPassphraseFailed() {
+void SyncBackendHost::Core::OnPassphraseRequired(
+ sync_api::PassphraseRequiredReason reason) {
host_->frontend_loop_->PostTask(FROM_HERE,
- NewRunnableMethod(this, &Core::NotifyPassphraseFailed));
+ NewRunnableMethod(this, &Core::NotifyPassphraseRequired, reason));
}
void SyncBackendHost::Core::OnPassphraseAccepted(

Powered by Google App Engine
This is Rietveld 408576698