diff options
Diffstat (limited to 'chrome/browser/sync/glue')
-rw-r--r-- | chrome/browser/sync/glue/sync_backend_host.cc | 35 | ||||
-rw-r--r-- | chrome/browser/sync/glue/sync_backend_host.h | 19 |
2 files changed, 18 insertions, 36 deletions
diff --git a/chrome/browser/sync/glue/sync_backend_host.cc b/chrome/browser/sync/glue/sync_backend_host.cc index 151e630..ecbbf11 100644 --- a/chrome/browser/sync/glue/sync_backend_host.cc +++ b/chrome/browser/sync/glue/sync_backend_host.cc @@ -82,8 +82,7 @@ class SyncBackendHost::Core virtual void OnPassphraseRequired( sync_api::PassphraseRequiredReason reason, const sync_pb::EncryptedData& pending_keys) OVERRIDE; - virtual void OnPassphraseAccepted() OVERRIDE; - virtual void OnBootstrapTokenUpdated( + virtual void OnPassphraseAccepted( const std::string& bootstrap_token) OVERRIDE; virtual void OnStopSyncingPermanently() OVERRIDE; virtual void OnUpdatedToken(const std::string& token) OVERRIDE; @@ -126,9 +125,7 @@ class SyncBackendHost::Core // Called to set the passphrase on behalf of // SyncBackendHost::SupplyPassphrase. - void DoSetPassphrase(const std::string& passphrase, - bool is_explicit, - bool user_provided); + void DoSetPassphrase(const std::string& passphrase, bool is_explicit); // Called to turn on encryption of all sync data as well as // reencrypt everything. @@ -324,8 +321,7 @@ void SyncBackendHost::StartSyncingWithServer() { } void SyncBackendHost::SetPassphrase(const std::string& passphrase, - bool is_explicit, - bool user_provided) { + bool is_explicit) { if (!IsNigoriEnabled()) { SLOG(WARNING) << "Silently dropping SetPassphrase request."; return; @@ -337,7 +333,7 @@ void SyncBackendHost::SetPassphrase(const std::string& passphrase, // If encryption is enabled and we've got a SetPassphrase sync_thread_.message_loop()->PostTask(FROM_HERE, base::Bind(&SyncBackendHost::Core::DoSetPassphrase, core_.get(), - passphrase, is_explicit, user_provided)); + passphrase, is_explicit)); } void SyncBackendHost::StopSyncManagerForShutdown( @@ -806,23 +802,14 @@ void SyncBackendHost::Core::OnPassphraseRequired( &SyncBackendHost::NotifyPassphraseRequired, reason, pending_keys); } -void SyncBackendHost::Core::OnPassphraseAccepted() { - if (!sync_loop_) - return; - DCHECK_EQ(MessageLoop::current(), sync_loop_); - host_.Call( - FROM_HERE, - &SyncBackendHost::NotifyPassphraseAccepted); -} - -void SyncBackendHost::Core::OnBootstrapTokenUpdated( +void SyncBackendHost::Core::OnPassphraseAccepted( const std::string& bootstrap_token) { if (!sync_loop_) return; DCHECK_EQ(MessageLoop::current(), sync_loop_); host_.Call( FROM_HERE, - &SyncBackendHost::PersistEncryptionBootstrapToken, bootstrap_token); + &SyncBackendHost::NotifyPassphraseAccepted, bootstrap_token); } void SyncBackendHost::Core::OnStopSyncingPermanently() { @@ -992,10 +979,9 @@ void SyncBackendHost::Core::DoRequestCleanupDisabledTypes() { } void SyncBackendHost::Core::DoSetPassphrase(const std::string& passphrase, - bool is_explicit, - bool user_provided) { + bool is_explicit) { DCHECK_EQ(MessageLoop::current(), sync_loop_); - sync_manager_->SetPassphrase(passphrase, is_explicit, user_provided); + sync_manager_->SetPassphrase(passphrase, is_explicit); } void SyncBackendHost::Core::DoEnableEncryptEverything() { @@ -1196,7 +1182,8 @@ void SyncBackendHost::NotifyPassphraseRequired( frontend_->OnPassphraseRequired(reason, pending_keys); } -void SyncBackendHost::NotifyPassphraseAccepted() { +void SyncBackendHost::NotifyPassphraseAccepted( + const std::string& bootstrap_token) { if (!frontend_) return; @@ -1204,6 +1191,8 @@ void SyncBackendHost::NotifyPassphraseAccepted() { // Clear our cache of the cryptographer's pending keys. cached_pending_keys_.clear_blob(); + + PersistEncryptionBootstrapToken(bootstrap_token); frontend_->OnPassphraseAccepted(); } diff --git a/chrome/browser/sync/glue/sync_backend_host.h b/chrome/browser/sync/glue/sync_backend_host.h index bc2dbbf..1fd547d 100644 --- a/chrome/browser/sync/glue/sync_backend_host.h +++ b/chrome/browser/sync/glue/sync_backend_host.h @@ -178,18 +178,11 @@ class SyncBackendHost { virtual void StartSyncingWithServer(); // Called on |frontend_loop_| to asynchronously set the passphrase. - // |is_explicit| is true if the call is in response to the user setting a - // custom explicit passphrase as opposed to implicitly (from the users' - // perspective) using their Google Account password. An implicit SetPassphrase - // will *not* override an explicit passphrase set previously. Note that - // if the data is encrypted with an old Google Account password, the user - // may still have to provide a "implicit" passphrase. - // |user_provided| corresponds to the user having manually provided this - // passphrase. It should only be false for passphrases intercepted from the - // Google Sign-in Success notification and true otherwise. - void SetPassphrase(const std::string& passphrase, - bool is_explicit, - bool user_provided); + // |is_explicit| is true if the call is in response to the user explicitly + // setting a passphrase as opposed to implicitly (from the users' perspective) + // using their Google Account password. An implicit SetPassphrase will *not* + // *not* override an explicit passphrase set previously. + void SetPassphrase(const std::string& passphrase, bool is_explicit); // Called on |frontend_loop_| to kick off shutdown procedure. After this, // no further sync activity will occur with the sync server and no further @@ -413,7 +406,7 @@ class SyncBackendHost { sync_pb::EncryptedData pending_keys); // Invoked when the passphrase provided by the user has been accepted. - void NotifyPassphraseAccepted(); + void NotifyPassphraseAccepted(const std::string& bootstrap_token); // Invoked when an updated token is available from the sync server. void NotifyUpdatedToken(const std::string& token); |