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) |