summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authoratwilson@chromium.org <atwilson@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-16 17:59:35 +0000
committeratwilson@chromium.org <atwilson@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-16 17:59:35 +0000
commit7d855571d93760388020b3621169b6690e86060a (patch)
tree75d6acc8b6537d2d853d3967bb6f8a7cf4221c62 /chrome
parent7ca9c3f63a1b4b66d6c04520a42ceb4f4178508b (diff)
downloadchromium_src-7d855571d93760388020b3621169b6690e86060a.zip
chromium_src-7d855571d93760388020b3621169b6690e86060a.tar.gz
chromium_src-7d855571d93760388020b3621169b6690e86060a.tar.bz2
Moved UI state from ProfileSyncService to SyncUserFlow so it doesn't inappropriately persist.
BUG=74645 TEST=see instructions in bug Review URL: http://codereview.chromium.org/6686023 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@78392 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/sync/profile_sync_service.cc8
-rw-r--r--chrome/browser/sync/profile_sync_service.h16
-rw-r--r--chrome/browser/sync/sync_setup_flow.cc22
-rw-r--r--chrome/browser/sync/sync_setup_flow.h8
4 files changed, 23 insertions, 31 deletions
diff --git a/chrome/browser/sync/profile_sync_service.cc b/chrome/browser/sync/profile_sync_service.cc
index 19f6836..f4121b7 100644
--- a/chrome/browser/sync/profile_sync_service.cc
+++ b/chrome/browser/sync/profile_sync_service.cc
@@ -65,8 +65,6 @@ ProfileSyncService::ProfileSyncService(ProfileSyncFactory* factory,
Profile* profile,
const std::string& cros_user)
: last_auth_error_(AuthError::None()),
- tried_creating_explicit_passphrase_(false),
- tried_setting_explicit_passphrase_(false),
observed_passphrase_required_(false),
passphrase_required_for_decryption_(false),
passphrase_migration_in_progress_(false),
@@ -680,8 +678,6 @@ void ProfileSyncService::OnPassphraseAccepted() {
NotifyObservers();
observed_passphrase_required_ = false;
- tried_setting_explicit_passphrase_ = false;
- tried_creating_explicit_passphrase_ = false;
wizard_.Step(SyncSetupWizard::DONE);
}
@@ -1118,10 +1114,6 @@ void ProfileSyncService::SetPassphrase(const std::string& passphrase,
cached_passphrase_.is_creation = is_creation;
}
- if (is_explicit && is_creation)
- tried_creating_explicit_passphrase_ = true;
- else if (is_explicit)
- tried_setting_explicit_passphrase_ = true;
}
void ProfileSyncService::EncryptDataTypes(
diff --git a/chrome/browser/sync/profile_sync_service.h b/chrome/browser/sync/profile_sync_service.h
index 6cb830e..34056c4 100644
--- a/chrome/browser/sync/profile_sync_service.h
+++ b/chrome/browser/sync/profile_sync_service.h
@@ -266,14 +266,6 @@ class ProfileSyncService : public browser_sync::SyncFrontend,
return is_auth_in_progress_;
}
- bool tried_creating_explicit_passphrase() const {
- return tried_creating_explicit_passphrase_;
- }
-
- bool tried_setting_explicit_passphrase() const {
- return tried_setting_explicit_passphrase_;
- }
-
bool observed_passphrase_required() const {
return observed_passphrase_required_;
}
@@ -509,14 +501,6 @@ class ProfileSyncService : public browser_sync::SyncFrontend,
// Cache of the last name the client attempted to authenticate.
std::string last_attempted_user_email_;
- // Whether the user has tried creating an explicit passphrase on this
- // machine.
- bool tried_creating_explicit_passphrase_;
-
- // Whether the user has tried setting an explicit passphrase on this
- // machine.
- bool tried_setting_explicit_passphrase_;
-
// Whether we have seen a SYNC_PASSPHRASE_REQUIRED since initializing the
// backend, telling us that it is safe to send a passphrase down ASAP.
bool observed_passphrase_required_;
diff --git a/chrome/browser/sync/sync_setup_flow.cc b/chrome/browser/sync/sync_setup_flow.cc
index bc69654..5d20ee7 100644
--- a/chrome/browser/sync/sync_setup_flow.cc
+++ b/chrome/browser/sync/sync_setup_flow.cc
@@ -390,7 +390,9 @@ SyncSetupFlow::SyncSetupFlow(SyncSetupWizard::State start_state,
flow_handler_(new FlowHandler()),
owns_flow_handler_(true),
service_(service),
- html_dialog_window_(NULL) {
+ html_dialog_window_(NULL),
+ tried_creating_explicit_passphrase_(false),
+ tried_setting_explicit_passphrase_(false) {
flow_handler_->set_flow(this);
}
@@ -509,12 +511,14 @@ void SyncSetupFlow::GetArgsForGaiaLogin(const ProfileSyncService* service,
// static
void SyncSetupFlow::GetArgsForEnterPassphrase(
- const ProfileSyncService* service, DictionaryValue* args) {
+ bool tried_creating_explicit_passphrase,
+ bool tried_setting_explicit_passphrase,
+ DictionaryValue* args) {
args->SetString("iframeToShow", "passphrase");
args->SetBoolean("passphrase_creation_rejected",
- service->tried_creating_explicit_passphrase());
+ tried_creating_explicit_passphrase);
args->SetBoolean("passphrase_setting_rejected",
- service->tried_setting_explicit_passphrase());
+ tried_setting_explicit_passphrase);
}
// static
@@ -639,7 +643,10 @@ void SyncSetupFlow::Advance(SyncSetupWizard::State advance_state) {
}
case SyncSetupWizard::ENTER_PASSPHRASE: {
DictionaryValue args;
- SyncSetupFlow::GetArgsForEnterPassphrase(service_, &args);
+ SyncSetupFlow::GetArgsForEnterPassphrase(
+ tried_creating_explicit_passphrase_,
+ tried_setting_explicit_passphrase_,
+ &args);
flow_handler_->ShowPassphraseEntry(args);
break;
}
@@ -712,7 +719,7 @@ SyncSetupFlow* SyncSetupFlow::Run(ProfileSyncService* service,
else if (start == SyncSetupWizard::CONFIGURE)
SyncSetupFlow::GetArgsForConfigure(service, &args);
else if (start == SyncSetupWizard::ENTER_PASSPHRASE)
- SyncSetupFlow::GetArgsForEnterPassphrase(service, &args);
+ SyncSetupFlow::GetArgsForEnterPassphrase(false, false, &args);
else if (start == SyncSetupWizard::PASSPHRASE_MIGRATION)
args.SetString("iframeToShow", "firstpassphrase");
@@ -760,6 +767,7 @@ void SyncSetupFlow::OnUserConfigured(const SyncConfiguration& configuration) {
if (configuration.use_secondary_passphrase &&
!service_->IsUsingSecondaryPassphrase()) {
service_->SetPassphrase(configuration.secondary_passphrase, true, true);
+ tried_creating_explicit_passphrase_ = true;
}
service_->OnUserChoseDatatypes(configuration.sync_everything,
@@ -769,6 +777,7 @@ void SyncSetupFlow::OnUserConfigured(const SyncConfiguration& configuration) {
void SyncSetupFlow::OnPassphraseEntry(const std::string& passphrase) {
Advance(SyncSetupWizard::SETTING_UP);
service_->SetPassphrase(passphrase, true, false);
+ tried_setting_explicit_passphrase_ = true;
}
void SyncSetupFlow::OnPassphraseCancel() {
@@ -786,6 +795,7 @@ void SyncSetupFlow::OnFirstPassphraseEntry(const std::string& option,
if (option == "explicit") {
service_->SetPassphrase(passphrase, true, true);
+ tried_creating_explicit_passphrase_ = true;
} else if (option == "nothanks") {
// User opted out of encrypted sync, need to turn off encrypted
// data types.
diff --git a/chrome/browser/sync/sync_setup_flow.h b/chrome/browser/sync/sync_setup_flow.h
index 90ddf95..fb7b713 100644
--- a/chrome/browser/sync/sync_setup_flow.h
+++ b/chrome/browser/sync/sync_setup_flow.h
@@ -62,7 +62,8 @@ class SyncSetupFlow : public HtmlDialogUIDelegate {
// Fills |args| for the enter passphrase screen.
static void GetArgsForEnterPassphrase(
- const ProfileSyncService* service,
+ bool tried_creating_explicit_passphrase,
+ bool tried_setting_explicit_passphrase,
DictionaryValue* args);
// Triggers a state machine transition to advance_state.
@@ -169,6 +170,11 @@ class SyncSetupFlow : public HtmlDialogUIDelegate {
// this for them.
gfx::NativeWindow html_dialog_window_;
+ // Set to true if we've tried creating/setting an explicit passphrase, so we
+ // can appropriately reflect this in the UI.
+ bool tried_creating_explicit_passphrase_;
+ bool tried_setting_explicit_passphrase_;
+
DISALLOW_COPY_AND_ASSIGN(SyncSetupFlow);
};