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

Side by Side Diff: chrome/browser/views/sync/sync_setup_wizard.cc

Issue 160598: Add files to browser/sync. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 4 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 unified diff | Download patch | Annotate | Revision Log
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifdef CHROME_PERSONALIZATION
6
7 #include "chrome/browser/views/sync/sync_setup_wizard.h"
8
9 #include "chrome/common/pref_service.h"
10 #include "chrome/browser/sync/profile_sync_service.h"
11 #include "chrome/browser/views/sync/sync_setup_flow.h"
12
13 SyncSetupWizard::SyncSetupWizard(ProfileSyncService* service)
14 : service_(service), flow_container_(new SyncSetupFlowContainer()) {
15 }
16
17 SyncSetupWizard::~SyncSetupWizard() {
18 delete flow_container_;
19 }
20
21 void SyncSetupWizard::Step(State advance_state) {
22 SyncSetupFlow* flow = flow_container_->get_flow();
23 if (flow) {
24 // A setup flow is in progress and dialog is currently showing.
25 flow->Advance(advance_state);
26 } else if (!service_->profile()->GetPrefs()->GetBoolean(
27 prefs::kSyncHasSetupCompleted)) {
28 if (advance_state == DONE || advance_state == GAIA_SUCCESS)
29 return;
30 // No flow is in progress, and we have never escorted the user all the
31 // way through the wizard flow.
32 flow_container_->set_flow(
33 SyncSetupFlow::Run(service_, flow_container_, advance_state, DONE));
34 } else {
35 // No flow in in progress, but we've finished the wizard flow once before.
36 // This is just a discrete run.
37 if (advance_state == DONE || advance_state == GAIA_SUCCESS)
38 return; // Nothing to do.
39 flow_container_->set_flow(SyncSetupFlow::Run(service_, flow_container_,
40 advance_state, GetEndStateForDiscreteRun(advance_state)));
41 }
42 }
43
44 bool SyncSetupWizard::IsVisible() const {
45 return flow_container_->get_flow() != NULL;
46 }
47
48 // static
49 SyncSetupWizard::State SyncSetupWizard::GetEndStateForDiscreteRun(
50 State start_state) {
51 State result = start_state == GAIA_LOGIN ? GAIA_SUCCESS : DONE;
52 DCHECK_NE(DONE, result) <<
53 "Invalid start state for discrete run: " << start_state;
54 return result;
55 }
56
57 #endif // CHROME_PERSONALIZATION
OLDNEW
« no previous file with comments | « chrome/browser/views/sync/sync_setup_wizard.h ('k') | chrome/browser/views/sync/sync_setup_wizard_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698