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

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

Issue 9295044: Start moving signin code out of browser/sync. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Cleaned up unnecessary inclusions of signin_manager.h Created 8 years, 10 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_wizard.h ('k') | chrome/browser/sync/sync_setup_wizard_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sync/sync_setup_wizard.cc
diff --git a/chrome/browser/sync/sync_setup_wizard.cc b/chrome/browser/sync/sync_setup_wizard.cc
index 80d892ffa3fa085890e15c7a794b16691450aaff..97b501af1a5daf180282e6091c4a93e1d256cf40 100644
--- a/chrome/browser/sync/sync_setup_wizard.cc
+++ b/chrome/browser/sync/sync_setup_wizard.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -18,33 +18,10 @@
namespace {
-// If we just need to pop open an individual dialog, say to collect
-// gaia credentials in the event of a steady-state auth failure, this is
-// a "discrete" run (as in not a continuous wizard flow). This returns
-// the end state to pass to Run for a given |start_state|.
-SyncSetupWizard::State GetEndStateForDiscreteRun(
- SyncSetupWizard::State start_state) {
- SyncSetupWizard::State result = SyncSetupWizard::FATAL_ERROR;
- if (start_state == SyncSetupWizard::GAIA_LOGIN ||
- start_state == SyncSetupWizard::OAUTH_LOGIN) {
- result = SyncSetupWizard::GAIA_SUCCESS;
- } else if (start_state == SyncSetupWizard::ENTER_PASSPHRASE ||
- start_state == SyncSetupWizard::NONFATAL_ERROR ||
- start_state == SyncSetupWizard::SYNC_EVERYTHING ||
- start_state == SyncSetupWizard::CONFIGURE) {
- result = SyncSetupWizard::DONE;
- }
- DCHECK_NE(SyncSetupWizard::FATAL_ERROR, result) <<
- "Invalid start state for discrete run: " << start_state;
- return result;
-}
-
// Helper to return whether |state| warrants starting a new flow.
bool IsTerminalState(SyncSetupWizard::State state) {
- return state == SyncSetupWizard::GAIA_SUCCESS ||
- state == SyncSetupWizard::DONE ||
- state == SyncSetupWizard::FATAL_ERROR ||
- state == SyncSetupWizard::SETUP_ABORTED_BY_PENDING_CLEAR;
+ return state == SyncSetupWizard::DONE ||
+ state == SyncSetupWizard::FATAL_ERROR;
}
} // namespace
@@ -63,28 +40,15 @@ void SyncSetupWizard::Step(State advance_state) {
if (flow) {
// A setup flow is in progress and dialog is currently showing.
flow->Advance(advance_state);
- } else if (!service_->HasSyncSetupCompleted()) {
- if (IsTerminalState(advance_state))
- return;
- // No flow is in progress, and we have never escorted the user all the
- // way through the wizard flow.
- // TODO(atwilson): Make sure this works on all autostart_enabled platforms.
- State end_state = DONE;
- if (service_->auto_start_enabled() &&
- !service_->profile()->GetPrefs()->GetBoolean(
- prefs::kSyncSuppressStart)) {
- end_state = GAIA_SUCCESS;
- }
- flow_container_->set_flow(
- SyncSetupFlow::Run(service_, flow_container_, advance_state,
- end_state));
} else {
- // No flow in progress, but we've finished the wizard flow once before.
- // This is just a discrete run.
if (IsTerminalState(advance_state))
return;
- flow_container_->set_flow(SyncSetupFlow::Run(service_, flow_container_,
- advance_state, GetEndStateForDiscreteRun(advance_state)));
+ // Starting a new flow - make sure we're at a valid starting state.
+ DCHECK(advance_state == ENTER_PASSPHRASE ||
+ advance_state == SYNC_EVERYTHING ||
+ advance_state == CONFIGURE);
+ flow_container_->set_flow(
+ SyncSetupFlow::Run(service_, flow_container_, advance_state, DONE));
}
}
@@ -93,13 +57,6 @@ bool SyncSetupWizard::IsVisible() const {
flow_container_->get_flow()->IsAttached();
}
-// static
-SyncSetupWizard::State SyncSetupWizard::GetLoginState() {
- return browser_sync::IsUsingOAuth() ?
- SyncSetupWizard::OAUTH_LOGIN :
- SyncSetupWizard::GAIA_LOGIN;
-}
-
void SyncSetupWizard::Focus() {
SyncSetupFlow* flow = flow_container_->get_flow();
if (flow)
« no previous file with comments | « chrome/browser/sync/sync_setup_wizard.h ('k') | chrome/browser/sync/sync_setup_wizard_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698