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_UI_WEBUI_OPTIONS_SYNC_SETUP_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_SYNC_SETUP_HANDLER_H_ |
6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_SYNC_SETUP_HANDLER_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_SYNC_SETUP_HANDLER_H_ |
7 | 7 |
8 #include "chrome/browser/sync/sync_setup_flow_handler.h" | 8 #include "chrome/browser/sync/sync_setup_flow_handler.h" |
9 #include "chrome/browser/ui/webui/options/options_ui.h" | 9 #include "chrome/browser/ui/webui/options/options_ui.h" |
10 | 10 |
11 class SyncSetupFlow; | 11 class SyncSetupFlow; |
12 | 12 |
13 class SyncSetupHandler : public OptionsPageUIHandler, | 13 class SyncSetupHandler : public OptionsPageUIHandler, |
14 public SyncSetupFlowHandler { | 14 public SyncSetupFlowHandler { |
15 public: | 15 public: |
16 SyncSetupHandler(); | 16 SyncSetupHandler(); |
17 virtual ~SyncSetupHandler(); | 17 virtual ~SyncSetupHandler(); |
18 | 18 |
19 // OptionsPageUIHandler implementation. | 19 // OptionsPageUIHandler implementation. |
20 virtual void GetLocalizedValues(DictionaryValue* localized_strings); | 20 virtual void GetLocalizedValues(DictionaryValue* localized_strings); |
21 virtual void Initialize(); | 21 virtual void Initialize(); |
22 virtual void RegisterMessages(); | 22 virtual void RegisterMessages(); |
23 | 23 |
24 // SyncSetupFlowHandler implementation. | 24 // SyncSetupFlowHandler implementation. |
25 virtual void ShowGaiaLogin(const DictionaryValue& args); | 25 virtual void ShowGaiaLogin(const DictionaryValue& args); |
26 virtual void ShowGaiaSuccessAndClose(); | 26 virtual void ShowGaiaSuccessAndClose(); |
27 virtual void ShowGaiaSuccessAndSettingUp(); | 27 virtual void ShowGaiaSuccessAndSettingUp(); |
28 virtual void ShowConfigure(const DictionaryValue& args); | 28 virtual void ShowConfigure(const DictionaryValue& args); |
29 virtual void ShowPassphraseEntry(const DictionaryValue& args); | 29 virtual void ShowPassphraseEntry(const DictionaryValue& args); |
30 virtual void ShowSettingUp(); | 30 virtual void ShowSettingUp(); |
31 virtual void ShowSetupDone(const std::wstring& user); | 31 virtual void ShowSetupDone(const std::wstring& user); |
32 virtual void SetFlow(SyncSetupFlow* flow); | 32 virtual void SetFlow(SyncSetupFlow* flow); |
33 virtual void Focus(); | 33 virtual void Focus(); |
34 | 34 |
| 35 static void GetStaticLocalizedValues(DictionaryValue* localized_strings); |
| 36 |
| 37 // Initializes the sync setup flow and shows the setup UI. |
| 38 void OpenSyncSetup(); |
| 39 |
| 40 // Terminates the sync setup flow. |
| 41 void CloseSyncSetup(); |
| 42 |
35 protected: | 43 protected: |
36 FRIEND_TEST_ALL_PREFIXES(SyncSetupWizardTest, InitialStepLogin); | 44 FRIEND_TEST_ALL_PREFIXES(SyncSetupWizardTest, InitialStepLogin); |
37 FRIEND_TEST_ALL_PREFIXES(SyncSetupWizardTest, ChooseDataTypesSetsPrefs); | 45 FRIEND_TEST_ALL_PREFIXES(SyncSetupWizardTest, ChooseDataTypesSetsPrefs); |
38 FRIEND_TEST_ALL_PREFIXES(SyncSetupWizardTest, DialogCancelled); | 46 FRIEND_TEST_ALL_PREFIXES(SyncSetupWizardTest, DialogCancelled); |
39 FRIEND_TEST_ALL_PREFIXES(SyncSetupWizardTest, InvalidTransitions); | 47 FRIEND_TEST_ALL_PREFIXES(SyncSetupWizardTest, InvalidTransitions); |
40 FRIEND_TEST_ALL_PREFIXES(SyncSetupWizardTest, FullSuccessfulRunSetsPref); | 48 FRIEND_TEST_ALL_PREFIXES(SyncSetupWizardTest, FullSuccessfulRunSetsPref); |
41 FRIEND_TEST_ALL_PREFIXES(SyncSetupWizardTest, AbortedByPendingClear); | 49 FRIEND_TEST_ALL_PREFIXES(SyncSetupWizardTest, AbortedByPendingClear); |
42 FRIEND_TEST_ALL_PREFIXES(SyncSetupWizardTest, DiscreteRunGaiaLogin); | 50 FRIEND_TEST_ALL_PREFIXES(SyncSetupWizardTest, DiscreteRunGaiaLogin); |
43 FRIEND_TEST_ALL_PREFIXES(SyncSetupWizardTest, DiscreteRunChooseDataTypes); | 51 FRIEND_TEST_ALL_PREFIXES(SyncSetupWizardTest, DiscreteRunChooseDataTypes); |
44 FRIEND_TEST_ALL_PREFIXES(SyncSetupWizardTest, | 52 FRIEND_TEST_ALL_PREFIXES(SyncSetupWizardTest, |
45 DiscreteRunChooseDataTypesAbortedByPendingClear); | 53 DiscreteRunChooseDataTypesAbortedByPendingClear); |
46 FRIEND_TEST_ALL_PREFIXES(SyncSetupWizardTest, EnterPassphraseRequired); | 54 FRIEND_TEST_ALL_PREFIXES(SyncSetupWizardTest, EnterPassphraseRequired); |
47 | 55 |
48 // Callbacks from the page. Protected in order to be called by the | 56 // Callbacks from the page. Protected in order to be called by the |
49 // SyncSetupWizardTest. | 57 // SyncSetupWizardTest. |
50 void OnDidClosePage(const ListValue* args); | 58 void OnDidClosePage(const ListValue* args); |
51 void HandleSubmitAuth(const ListValue* args); | 59 void HandleSubmitAuth(const ListValue* args); |
52 void HandleConfigure(const ListValue* args); | 60 void HandleConfigure(const ListValue* args); |
53 void HandlePassphraseEntry(const ListValue* args); | 61 void HandlePassphraseEntry(const ListValue* args); |
54 void HandlePassphraseCancel(const ListValue* args); | 62 void HandlePassphraseCancel(const ListValue* args); |
55 void HandleAttachHandler(const ListValue* args); | 63 void HandleAttachHandler(const ListValue* args); |
56 void HandleShowErrorUI(const ListValue* args); | 64 void HandleShowErrorUI(const ListValue* args); |
57 void HandleShowSetupUI(const ListValue* args); | 65 void HandleShowSetupUI(const ListValue* args); |
58 | 66 |
59 SyncSetupFlow* flow() { return flow_; } | 67 SyncSetupFlow* flow() { return flow_; } |
60 | 68 |
| 69 // Subclasses must implement this to show the setup UI that's appropriate |
| 70 // for the page this is contained in. |
| 71 virtual void ShowSetupUI() = 0; |
| 72 |
61 private: | 73 private: |
62 // Weak reference. | 74 // Weak reference. |
63 SyncSetupFlow* flow_; | 75 SyncSetupFlow* flow_; |
64 | 76 |
65 DISALLOW_COPY_AND_ASSIGN(SyncSetupHandler); | 77 DISALLOW_COPY_AND_ASSIGN(SyncSetupHandler); |
66 }; | 78 }; |
67 | 79 |
68 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_SYNC_SETUP_HANDLER_H_ | 80 #endif // CHROME_BROWSER_UI_WEBUI_SYNC_SETUP_HANDLER_H_ |
OLD | NEW |