OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_SYNC_SYNC_SETUP_WIZARD_H_ | 5 #ifndef CHROME_BROWSER_SYNC_SYNC_SETUP_WIZARD_H_ |
6 #define CHROME_BROWSER_SYNC_SYNC_SETUP_WIZARD_H_ | 6 #define CHROME_BROWSER_SYNC_SYNC_SETUP_WIZARD_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 | 10 |
(...skipping 16 matching lines...) Expand all Loading... |
27 // Show the screen that lets you configure sync. | 27 // Show the screen that lets you configure sync. |
28 // There are two tabs: | 28 // There are two tabs: |
29 // Data Types -- | 29 // Data Types -- |
30 // Choose either "Keep everything synced" or | 30 // Choose either "Keep everything synced" or |
31 // "Choose which data types to sync", and checkboxes for each data type. | 31 // "Choose which data types to sync", and checkboxes for each data type. |
32 // Encryption -- | 32 // Encryption -- |
33 // Choose what to encrypt and whether to use a passphrase. | 33 // Choose what to encrypt and whether to use a passphrase. |
34 CONFIGURE, | 34 CONFIGURE, |
35 // Show the screen that prompts for your passphrase | 35 // Show the screen that prompts for your passphrase |
36 ENTER_PASSPHRASE, | 36 ENTER_PASSPHRASE, |
37 // The panic switch. Something went terribly wrong during setup and we | 37 // An error has occurred in the backend. The next appropriate step is picked |
38 // can't recover. | 38 // based on which error has occurred. |
| 39 NONFATAL_ERROR, |
| 40 // The panic switch. Something went terribly wrong during setup and we can't |
| 41 // recover. |
39 FATAL_ERROR, | 42 FATAL_ERROR, |
40 // The client can't set up sync at the moment due to a concurrent operation | 43 // 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. | 44 // to clear cloud data being in progress on the server. |
42 SETUP_ABORTED_BY_PENDING_CLEAR, | 45 SETUP_ABORTED_BY_PENDING_CLEAR, |
43 // Loading screen with spinny throbber. | 46 // Loading screen with throbber. |
44 SETTING_UP, | 47 SETTING_UP, |
45 // A catch-all done case for any setup process. | 48 // A catch-all done case for any setup process. |
46 DONE | 49 DONE |
47 }; | 50 }; |
48 | 51 |
49 explicit SyncSetupWizard(ProfileSyncService* service); | 52 explicit SyncSetupWizard(ProfileSyncService* service); |
50 ~SyncSetupWizard(); | 53 ~SyncSetupWizard(); |
51 | 54 |
52 // Advances the wizard to the specified state if possible, or opens a | 55 // 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 | 56 // 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 | 57 // 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 | 58 // 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). | 59 // based on |advance_state| (so for auth failure, up to GAIA_SUCCESS). |
57 void Step(State advance_state); | 60 void Step(State advance_state); |
58 | 61 |
59 // Whether or not a dialog is currently showing. Useful to determine | 62 // Whether or not a dialog is currently showing. Useful to determine |
60 // if various buttons in the UI should be enabled or disabled. | 63 // if various buttons in the UI should be enabled or disabled. |
61 bool IsVisible() const; | 64 bool IsVisible() const; |
62 | 65 |
63 // Focus the dialog if it is already open. Does nothing if the dialog is | 66 // Focus the dialog if it is already open. Does nothing if the dialog is |
64 // not visible. | 67 // not visible. |
65 void Focus(); | 68 void Focus(); |
66 | 69 |
| 70 // TODO(jhawkins): Refactor to take a State parameter and handle the call to |
| 71 // Step() as well as hooking up the handler. |
67 SyncSetupFlow* AttachSyncSetupHandler(SyncSetupFlowHandler* handler); | 72 SyncSetupFlow* AttachSyncSetupHandler(SyncSetupFlowHandler* handler); |
68 | 73 |
69 private: | 74 private: |
70 // If we just need to pop open an individual dialog, say to collect | 75 // 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 | 76 // 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 | 77 // 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|. | 78 // the end state to pass to Run for a given |start_state|. |
74 static State GetEndStateForDiscreteRun(State start_state); | 79 static State GetEndStateForDiscreteRun(State start_state); |
75 | 80 |
76 // Helper to return whether |state| warrants starting a new flow. | 81 // Helper to return whether |state| warrants starting a new flow. |
77 static bool IsTerminalState(State state); | 82 static bool IsTerminalState(State state); |
78 | 83 |
79 ProfileSyncService* service_; | 84 ProfileSyncService* service_; |
80 | 85 |
81 SyncSetupFlowContainer* flow_container_; | 86 SyncSetupFlowContainer* flow_container_; |
82 | 87 |
83 DISALLOW_COPY_AND_ASSIGN(SyncSetupWizard); | 88 DISALLOW_COPY_AND_ASSIGN(SyncSetupWizard); |
84 }; | 89 }; |
85 | 90 |
86 #endif // CHROME_BROWSER_SYNC_SYNC_SETUP_WIZARD_H_ | 91 #endif // CHROME_BROWSER_SYNC_SYNC_SETUP_WIZARD_H_ |
OLD | NEW |