Commit f0718a39 authored by johnnyg@chromium.org's avatar johnnyg@chromium.org

Stop using browser signin for passphrase migration, just use the normal signin...

Stop using browser signin for passphrase migration, just use the normal signin flow which is accessible from all parts of the sync UI.  Create the correct state transition from login -> initial passphrase selection.

BUG=70429
TEST=upgrade a sync-everything profile to latest chrome

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@72236 0039d316-1c4b-4281-b951-d872f2087c98
parent 90b67d69
...@@ -70,6 +70,7 @@ ProfileSyncService::ProfileSyncService(ProfileSyncFactory* factory, ...@@ -70,6 +70,7 @@ ProfileSyncService::ProfileSyncService(ProfileSyncFactory* factory,
tried_setting_explicit_passphrase_(false), tried_setting_explicit_passphrase_(false),
observed_passphrase_required_(false), observed_passphrase_required_(false),
passphrase_required_for_decryption_(false), passphrase_required_for_decryption_(false),
passphrase_migration_in_progress_(false),
factory_(factory), factory_(factory),
profile_(profile), profile_(profile),
cros_user_(cros_user), cros_user_(cros_user),
...@@ -749,7 +750,7 @@ void ProfileSyncService::ShowErrorUI(gfx::NativeWindow parent_window) { ...@@ -749,7 +750,7 @@ void ProfileSyncService::ShowErrorUI(gfx::NativeWindow parent_window) {
if (IsUsingSecondaryPassphrase()) if (IsUsingSecondaryPassphrase())
PromptForExistingPassphrase(parent_window); PromptForExistingPassphrase(parent_window);
else else
ShowLoginDialog(parent_window); SigninForPassphraseMigration(parent_window);
return; return;
} }
const GoogleServiceAuthError& error = GetAuthError(); const GoogleServiceAuthError& error = GetAuthError();
...@@ -782,19 +783,10 @@ void ProfileSyncService::PromptForExistingPassphrase( ...@@ -782,19 +783,10 @@ void ProfileSyncService::PromptForExistingPassphrase(
wizard_.Step(SyncSetupWizard::ENTER_PASSPHRASE); wizard_.Step(SyncSetupWizard::ENTER_PASSPHRASE);
} }
void ProfileSyncService::ShowPassphraseMigration( void ProfileSyncService::SigninForPassphraseMigration(
gfx::NativeWindow parent_window) { gfx::NativeWindow parent_window) {
wizard_.SetParent(parent_window); passphrase_migration_in_progress_ = true;
wizard_.Step(SyncSetupWizard::PASSPHRASE_MIGRATION); ShowLoginDialog(parent_window);
}
void ProfileSyncService::SigninForPassphrase(TabContents* container) {
string16 prefilled_username = GetAuthenticatedUsername();
string16 login_message = sync_ui_util::GetLoginMessageForEncryption();
profile_->GetBrowserSignin()->RequestSignin(container,
prefilled_username,
login_message,
this);
} }
SyncBackendHost::StatusSummary ProfileSyncService::QuerySyncStatusSummary() { SyncBackendHost::StatusSummary ProfileSyncService::QuerySyncStatusSummary() {
...@@ -1135,6 +1127,15 @@ void ProfileSyncService::Observe(NotificationType type, ...@@ -1135,6 +1127,15 @@ void ProfileSyncService::Observe(NotificationType type,
// becomes a no-op. // becomes a no-op.
tried_implicit_gaia_remove_when_bug_62103_fixed_ = true; tried_implicit_gaia_remove_when_bug_62103_fixed_ = true;
SetPassphrase(successful->password, false, true); SetPassphrase(successful->password, false, true);
// 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_for_decryption_) {
wizard_.Step(SyncSetupWizard::PASSPHRASE_MIGRATION);
passphrase_migration_in_progress_ = false;
}
break; break;
} }
case NotificationType::GOOGLE_SIGNIN_FAILED: { case NotificationType::GOOGLE_SIGNIN_FAILED: {
...@@ -1170,27 +1171,6 @@ void ProfileSyncService::Observe(NotificationType type, ...@@ -1170,27 +1171,6 @@ void ProfileSyncService::Observe(NotificationType type,
} }
} }
// This is the delegate callback from BrowserSigin.
void ProfileSyncService::OnLoginSuccess() {
// The reason for the browser signin was a non-explicit passphrase
// required signal. If this is the first time through the passphrase
// process, we want to show the migration UI and offer an explicit
// passphrase. Otherwise, we're done because the implicit is enough.
if (passphrase_required_for_decryption_) {
// NOT first time (decrypting something encrypted elsewhere).
// Do nothing.
} else {
ShowPassphraseMigration(NULL);
}
}
// This is the delegate callback from BrowserSigin.
void ProfileSyncService::OnLoginFailure(const GoogleServiceAuthError& error) {
// Do nothing. The UI will already reflect the fact that the
// user is not signed in.
}
void ProfileSyncService::AddObserver(Observer* observer) { void ProfileSyncService::AddObserver(Observer* observer) {
observers_.AddObserver(observer); observers_.AddObserver(observer);
} }
......
...@@ -15,7 +15,6 @@ ...@@ -15,7 +15,6 @@
#include "base/string16.h" #include "base/string16.h"
#include "base/time.h" #include "base/time.h"
#include "base/timer.h" #include "base/timer.h"
#include "chrome/browser/browser_signin.h"
#include "chrome/browser/prefs/pref_member.h" #include "chrome/browser/prefs/pref_member.h"
#include "chrome/browser/sync/engine/syncapi.h" #include "chrome/browser/sync/engine/syncapi.h"
#include "chrome/browser/sync/glue/data_type_controller.h" #include "chrome/browser/sync/glue/data_type_controller.h"
...@@ -85,7 +84,6 @@ class TokenMigrator; ...@@ -85,7 +84,6 @@ class TokenMigrator;
// //
class ProfileSyncService : public browser_sync::SyncFrontend, class ProfileSyncService : public browser_sync::SyncFrontend,
public browser_sync::UnrecoverableErrorHandler, public browser_sync::UnrecoverableErrorHandler,
public BrowserSignin::SigninDelegate,
public NotificationObserver { public NotificationObserver {
public: public:
typedef ProfileSyncServiceObserver Observer; typedef ProfileSyncServiceObserver Observer;
...@@ -234,8 +232,7 @@ class ProfileSyncService : public browser_sync::SyncFrontend, ...@@ -234,8 +232,7 @@ class ProfileSyncService : public browser_sync::SyncFrontend,
void ShowConfigure(gfx::NativeWindow parent_window); void ShowConfigure(gfx::NativeWindow parent_window);
void PromptForExistingPassphrase(gfx::NativeWindow parent_window); void PromptForExistingPassphrase(gfx::NativeWindow parent_window);
void SigninForPassphrase(TabContents* container); void SigninForPassphraseMigration(gfx::NativeWindow parent_window);
void ShowPassphraseMigration(gfx::NativeWindow parent_window);
// Pretty-printed strings for a given StatusSummary. // Pretty-printed strings for a given StatusSummary.
static std::string BuildSyncStatusSummaryText( static std::string BuildSyncStatusSummaryText(
...@@ -340,10 +337,6 @@ class ProfileSyncService : public browser_sync::SyncFrontend, ...@@ -340,10 +337,6 @@ class ProfileSyncService : public browser_sync::SyncFrontend,
const NotificationSource& source, const NotificationSource& source,
const NotificationDetails& details); const NotificationDetails& details);
// BrowserSignin::SigninDelegate interface.
virtual void OnLoginSuccess();
virtual void OnLoginFailure(const GoogleServiceAuthError& error);
// Changes which data types we're going to be syncing to |preferred_types|. // Changes which data types we're going to be syncing to |preferred_types|.
// If it is running, the DataTypeManager will be instructed to reconfigure // If it is running, the DataTypeManager will be instructed to reconfigure
// the sync backend so that exactly these datatypes are actively synced. See // the sync backend so that exactly these datatypes are actively synced. See
...@@ -453,6 +446,9 @@ class ProfileSyncService : public browser_sync::SyncFrontend, ...@@ -453,6 +446,9 @@ class ProfileSyncService : public browser_sync::SyncFrontend,
// was required for decryption? // was required for decryption?
bool passphrase_required_for_decryption_; bool passphrase_required_for_decryption_;
// Is the user in a passphrase migration?
bool passphrase_migration_in_progress_;
private: private:
friend class ProfileSyncServiceTest; friend class ProfileSyncServiceTest;
friend class ProfileSyncServicePasswordTest; friend class ProfileSyncServicePasswordTest;
......
...@@ -555,6 +555,8 @@ bool SyncSetupFlow::ShouldAdvance(SyncSetupWizard::State state) { ...@@ -555,6 +555,8 @@ bool SyncSetupFlow::ShouldAdvance(SyncSetupWizard::State state) {
case SyncSetupWizard::ENTER_PASSPHRASE: case SyncSetupWizard::ENTER_PASSPHRASE:
return current_state_ == SyncSetupWizard::CONFIGURE || return current_state_ == SyncSetupWizard::CONFIGURE ||
current_state_ == SyncSetupWizard::SETTING_UP; current_state_ == SyncSetupWizard::SETTING_UP;
case SyncSetupWizard::PASSPHRASE_MIGRATION:
return current_state_ == SyncSetupWizard::GAIA_LOGIN;
case SyncSetupWizard::SETUP_ABORTED_BY_PENDING_CLEAR: case SyncSetupWizard::SETUP_ABORTED_BY_PENDING_CLEAR:
return current_state_ == SyncSetupWizard::CONFIGURE; return current_state_ == SyncSetupWizard::CONFIGURE;
case SyncSetupWizard::SETTING_UP: case SyncSetupWizard::SETTING_UP:
...@@ -739,6 +741,7 @@ void SyncSetupFlow::OnPassphraseEntry(const std::string& passphrase) { ...@@ -739,6 +741,7 @@ void SyncSetupFlow::OnPassphraseEntry(const std::string& passphrase) {
void SyncSetupFlow::OnFirstPassphraseEntry(const std::string& option, void SyncSetupFlow::OnFirstPassphraseEntry(const std::string& option,
const std::string& passphrase) { const std::string& passphrase) {
Advance(SyncSetupWizard::SETTING_UP); Advance(SyncSetupWizard::SETTING_UP);
if (option == "explicit") { if (option == "explicit") {
service_->SetPassphrase(passphrase, true, true); service_->SetPassphrase(passphrase, true, true);
} else if (option == "nothanks") { } else if (option == "nothanks") {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment