1 // Copyright (c) 2011 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.
5 #ifndef CHROME_BROWSER_SYNC_SYNC_SETUP_WIZARD_H_
6 #define CHROME_BROWSER_SYNC_SYNC_SETUP_WIZARD_H_
9 #include "base/basictypes.h"
12 class SyncSetupFlowContainer
;
13 class SyncSetupFlowHandler
;
15 class ProfileSyncService
;
17 class SyncSetupWizard
{
20 // Show the Google Account login UI.
22 // A login attempt succeeded. This will wait for an explicit transition
23 // (via Step) to the next state.
25 // Show the screen that confirms everything will be synced.
27 // Show the screen that lets you configure sync.
28 // There are two tabs:
30 // Choose either "Keep everything synced" or
31 // "Choose which data types to sync", and checkboxes for each data type.
33 // Choose what to encrypt and whether to use a passphrase.
35 // Show the screen that prompts for your passphrase
37 // The panic switch. Something went terribly wrong during setup and we
40 // The client can't set up sync at the moment due to a concurrent operation
41 // to clear cloud data being in progress on the server.
42 SETUP_ABORTED_BY_PENDING_CLEAR
,
43 // Loading screen with spinny throbber.
45 // A catch-all done case for any setup process.
49 explicit SyncSetupWizard(ProfileSyncService
* service
);
52 // Advances the wizard to the specified state if possible, or opens a
53 // new dialog starting at |advance_state|. If the wizard has never ran
54 // through to completion, it will always attempt to do so. Otherwise, e.g
55 // for a transient auth failure, it will just run as far as is necessary
56 // based on |advance_state| (so for auth failure, up to GAIA_SUCCESS).
57 void Step(State advance_state
);
59 // Whether or not a dialog is currently showing. Useful to determine
60 // if various buttons in the UI should be enabled or disabled.
61 bool IsVisible() const;
63 // Focus the dialog if it is already open. Does nothing if the dialog is
67 SyncSetupFlow
* AttachSyncSetupHandler(SyncSetupFlowHandler
* handler
);
70 // If we just need to pop open an individual dialog, say to collect
71 // gaia credentials in the event of a steady-state auth failure, this is
72 // a "discrete" run (as in not a continuous wizard flow). This returns
73 // the end state to pass to Run for a given |start_state|.
74 static State
GetEndStateForDiscreteRun(State start_state
);
76 // Helper to return whether |state| warrants starting a new flow.
77 static bool IsTerminalState(State state
);
79 ProfileSyncService
* service_
;
81 SyncSetupFlowContainer
* flow_container_
;
83 DISALLOW_COPY_AND_ASSIGN(SyncSetupWizard
);
86 #endif // CHROME_BROWSER_SYNC_SYNC_SETUP_WIZARD_H_