summaryrefslogtreecommitdiffstats
path: root/chrome/browser/views/sync/sync_setup_wizard.cc
diff options
context:
space:
mode:
authortim@chromium.org <tim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-05 01:18:27 +0000
committertim@chromium.org <tim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-05 01:18:27 +0000
commit132c8565a63ad57d680b6b8d9beaa28786a46ea8 (patch)
tree428425605547842abd6a7ab851bd27132f11efde /chrome/browser/views/sync/sync_setup_wizard.cc
parentf902600776feea6570c876f2349bb4a8746ea95b (diff)
downloadchromium_src-132c8565a63ad57d680b6b8d9beaa28786a46ea8.zip
chromium_src-132c8565a63ad57d680b6b8d9beaa28786a46ea8.tar.gz
chromium_src-132c8565a63ad57d680b6b8d9beaa28786a46ea8.tar.bz2
Add files to browser/sync and tweak includes.
Create browser/sync/glue and /engine. Create sync watchlist and add a few folks. No GYP change here so no build changes should occur. chrome.gyp CL is coming shortly, as well as live_sync tests. Review URL: http://codereview.chromium.org/160598 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@22454 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views/sync/sync_setup_wizard.cc')
-rw-r--r--chrome/browser/views/sync/sync_setup_wizard.cc57
1 files changed, 57 insertions, 0 deletions
diff --git a/chrome/browser/views/sync/sync_setup_wizard.cc b/chrome/browser/views/sync/sync_setup_wizard.cc
new file mode 100644
index 0000000..18ef7b8
--- /dev/null
+++ b/chrome/browser/views/sync/sync_setup_wizard.cc
@@ -0,0 +1,57 @@
+// Copyright (c) 2006-2008 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.
+
+#ifdef CHROME_PERSONALIZATION
+
+#include "chrome/browser/views/sync/sync_setup_wizard.h"
+
+#include "chrome/common/pref_service.h"
+#include "chrome/browser/sync/profile_sync_service.h"
+#include "chrome/browser/views/sync/sync_setup_flow.h"
+
+SyncSetupWizard::SyncSetupWizard(ProfileSyncService* service)
+ : service_(service), flow_container_(new SyncSetupFlowContainer()) {
+}
+
+SyncSetupWizard::~SyncSetupWizard() {
+ delete flow_container_;
+}
+
+void SyncSetupWizard::Step(State advance_state) {
+ SyncSetupFlow* flow = flow_container_->get_flow();
+ if (flow) {
+ // A setup flow is in progress and dialog is currently showing.
+ flow->Advance(advance_state);
+ } else if (!service_->profile()->GetPrefs()->GetBoolean(
+ prefs::kSyncHasSetupCompleted)) {
+ if (advance_state == DONE || advance_state == GAIA_SUCCESS)
+ return;
+ // No flow is in progress, and we have never escorted the user all the
+ // way through the wizard flow.
+ flow_container_->set_flow(
+ SyncSetupFlow::Run(service_, flow_container_, advance_state, DONE));
+ } else {
+ // No flow in in progress, but we've finished the wizard flow once before.
+ // This is just a discrete run.
+ if (advance_state == DONE || advance_state == GAIA_SUCCESS)
+ return; // Nothing to do.
+ flow_container_->set_flow(SyncSetupFlow::Run(service_, flow_container_,
+ advance_state, GetEndStateForDiscreteRun(advance_state)));
+ }
+}
+
+bool SyncSetupWizard::IsVisible() const {
+ return flow_container_->get_flow() != NULL;
+}
+
+// static
+SyncSetupWizard::State SyncSetupWizard::GetEndStateForDiscreteRun(
+ State start_state) {
+ State result = start_state == GAIA_LOGIN ? GAIA_SUCCESS : DONE;
+ DCHECK_NE(DONE, result) <<
+ "Invalid start state for discrete run: " << start_state;
+ return result;
+}
+
+#endif // CHROME_PERSONALIZATION