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

Unified Diff: chrome/browser/sync/sync_setup_flow.cc

Issue 6364009: From the enter-passphrase screen in sync setup, canceling should only disable... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 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
« no previous file with comments | « chrome/browser/sync/sync_setup_flow.h ('k') | chrome/browser/sync/sync_setup_wizard.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sync/sync_setup_flow.cc
===================================================================
--- chrome/browser/sync/sync_setup_flow.cc (revision 72509)
+++ chrome/browser/sync/sync_setup_flow.cc (working copy)
@@ -45,6 +45,8 @@
NewCallback(this, &FlowHandler::HandleConfigure));
dom_ui_->RegisterMessageCallback("Passphrase",
NewCallback(this, &FlowHandler::HandlePassphraseEntry));
+ dom_ui_->RegisterMessageCallback("PassphraseCancel",
+ NewCallback(this, &FlowHandler::HandlePassphraseCancel));
dom_ui_->RegisterMessageCallback("FirstPassphrase",
NewCallback(this, &FlowHandler::HandleFirstPassphrase));
dom_ui_->RegisterMessageCallback("GoToDashboard",
@@ -167,6 +169,13 @@
return true;
}
+static void DisablePasswordSync(ProfileSyncService* service) {
tim (not reviewing) 2011/01/26 18:41:31 at first I didn't like this, then I spent 10 minut
+ syncable::ModelTypeSet types;
+ service->GetPreferredDataTypes(&types);
+ types.erase(syncable::PASSWORDS);
+ service->OnUserChoseDatatypes(false, types);
+}
+
void FlowHandler::HandleSubmitAuth(const ListValue* args) {
std::string json(dom_ui_util::GetJsonResponseFromFirstArgumentInList(args));
std::string username, password, captcha, access_code;
@@ -221,6 +230,11 @@
flow_->OnPassphraseEntry(passphrase);
}
+void FlowHandler::HandlePassphraseCancel(const ListValue* args) {
+ DCHECK(flow_);
+ flow_->OnPassphraseCancel();
+}
+
void FlowHandler::HandleFirstPassphrase(const ListValue* args) {
std::string json(dom_ui_util::GetJsonResponseFromFirstArgumentInList(args));
@@ -738,6 +752,15 @@
service_->SetPassphrase(passphrase, true, false);
}
+void SyncSetupFlow::OnPassphraseCancel() {
+ // If the user cancels when being asked for the passphrase,
+ // just disable encrypted sync and continue setting up.
+ if (current_state_ == SyncSetupWizard::ENTER_PASSPHRASE)
+ DisablePasswordSync(service_);
+
+ Advance(SyncSetupWizard::SETTING_UP);
+}
+
void SyncSetupFlow::OnFirstPassphraseEntry(const std::string& option,
const std::string& passphrase) {
Advance(SyncSetupWizard::SETTING_UP);
@@ -747,10 +770,7 @@
} else if (option == "nothanks") {
// User opted out of encrypted sync, need to turn off encrypted
// data types.
- syncable::ModelTypeSet registered_types;
- service_->GetRegisteredDataTypes(&registered_types);
- registered_types.erase(syncable::PASSWORDS);
- service_->OnUserChoseDatatypes(false, registered_types);
+ DisablePasswordSync(service_);
} else if (option == "google") {
// Implicit passphrase already set up.
Advance(SyncSetupWizard::DONE);
« no previous file with comments | « chrome/browser/sync/sync_setup_flow.h ('k') | chrome/browser/sync/sync_setup_wizard.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698