Print Preview: Changing displayed error message when PDF Viewer is missing.
[chromium-blink-merge.git] / chrome / browser / sync / sync_setup_wizard.h
blob4e28d8c4e585bc1d8b0a2d53165a355639a82b14
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_
7 #pragma once
9 #include "base/basictypes.h"
11 class SyncSetupFlow;
12 class SyncSetupFlowContainer;
13 class SyncSetupFlowHandler;
15 class ProfileSyncService;
17 class SyncSetupWizard {
18 public:
19 enum State {
20 // Show the Google Account login UI.
21 GAIA_LOGIN = 0,
22 // A login attempt succeeded. This will wait for an explicit transition
23 // (via Step) to the next state.
24 GAIA_SUCCESS,
25 // Show the screen that confirms everything will be synced.
26 SYNC_EVERYTHING,
27 // Show the screen that lets you configure sync.
28 // There are two tabs:
29 // Data Types --
30 // Choose either "Keep everything synced" or
31 // "Choose which data types to sync", and checkboxes for each data type.
32 // Encryption --
33 // Choose what to encrypt and whether to use a passphrase.
34 CONFIGURE,
35 // Show the screen that prompts for your passphrase
36 ENTER_PASSPHRASE,
37 // The panic switch. Something went terribly wrong during setup and we
38 // can't recover.
39 FATAL_ERROR,
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.
44 SETTING_UP,
45 // A catch-all done case for any setup process.
46 DONE
49 explicit SyncSetupWizard(ProfileSyncService* service);
50 ~SyncSetupWizard();
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
64 // not visible.
65 void Focus();
67 SyncSetupFlow* AttachSyncSetupHandler(SyncSetupFlowHandler* handler);
69 private:
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_