| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_OPTIONS_SYNC_SETUP_HANDLER_H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_SYNC_SETUP_HANDLER_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_SYNC_SETUP_HANDLER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/gtest_prod_util.h" | 10 #include "base/gtest_prod_util.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 void FocusUI() override; | 48 void FocusUI() override; |
| 49 | 49 |
| 50 static void GetStaticLocalizedValues( | 50 static void GetStaticLocalizedValues( |
| 51 base::DictionaryValue* localized_strings, | 51 base::DictionaryValue* localized_strings, |
| 52 content::WebUI* web_ui); | 52 content::WebUI* web_ui); |
| 53 | 53 |
| 54 // Initializes the sync setup flow and shows the setup UI. | 54 // Initializes the sync setup flow and shows the setup UI. |
| 55 void OpenSyncSetup(bool creating_supervised_user); | 55 void OpenSyncSetup(bool creating_supervised_user); |
| 56 | 56 |
| 57 // Shows advanced configuration dialog without going through sign in dialog. | 57 // Shows advanced configuration dialog without going through sign in dialog. |
| 58 // Kicks the sync backend if necessary with showing spinner dialog until it | 58 // Kicks the sync engine if necessary with showing spinner dialog until it |
| 59 // gets ready. | 59 // gets ready. |
| 60 void OpenConfigureSync(); | 60 void OpenConfigureSync(); |
| 61 | 61 |
| 62 // Terminates the sync setup flow. | 62 // Terminates the sync setup flow. |
| 63 void CloseSyncSetup(); | 63 void CloseSyncSetup(); |
| 64 | 64 |
| 65 protected: | 65 protected: |
| 66 friend class SyncSetupHandlerTest; | 66 friend class SyncSetupHandlerTest; |
| 67 FRIEND_TEST_ALL_PREFIXES(SyncSetupHandlerTest, | 67 FRIEND_TEST_ALL_PREFIXES(SyncSetupHandlerTest, |
| 68 DisplayConfigureWithBackendDisabledAndCancel); | 68 DisplayConfigureWithEngineDisabledAndCancel); |
| 69 FRIEND_TEST_ALL_PREFIXES(SyncSetupHandlerTest, HandleSetupUIWhenSyncDisabled); | 69 FRIEND_TEST_ALL_PREFIXES(SyncSetupHandlerTest, HandleSetupUIWhenSyncDisabled); |
| 70 FRIEND_TEST_ALL_PREFIXES(SyncSetupHandlerTest, SelectCustomEncryption); | 70 FRIEND_TEST_ALL_PREFIXES(SyncSetupHandlerTest, SelectCustomEncryption); |
| 71 FRIEND_TEST_ALL_PREFIXES(SyncSetupHandlerTest, ShowSyncSetupWhenNotSignedIn); | 71 FRIEND_TEST_ALL_PREFIXES(SyncSetupHandlerTest, ShowSyncSetupWhenNotSignedIn); |
| 72 FRIEND_TEST_ALL_PREFIXES(SyncSetupHandlerTest, SuccessfullySetPassphrase); | 72 FRIEND_TEST_ALL_PREFIXES(SyncSetupHandlerTest, SuccessfullySetPassphrase); |
| 73 FRIEND_TEST_ALL_PREFIXES(SyncSetupHandlerTest, TestSyncEverything); | 73 FRIEND_TEST_ALL_PREFIXES(SyncSetupHandlerTest, TestSyncEverything); |
| 74 FRIEND_TEST_ALL_PREFIXES(SyncSetupHandlerTest, TestSyncNothing); | 74 FRIEND_TEST_ALL_PREFIXES(SyncSetupHandlerTest, TestSyncNothing); |
| 75 FRIEND_TEST_ALL_PREFIXES(SyncSetupHandlerTest, TestSyncAllManually); | 75 FRIEND_TEST_ALL_PREFIXES(SyncSetupHandlerTest, TestSyncAllManually); |
| 76 FRIEND_TEST_ALL_PREFIXES(SyncSetupHandlerTest, TestPassphraseStillRequired); | 76 FRIEND_TEST_ALL_PREFIXES(SyncSetupHandlerTest, TestPassphraseStillRequired); |
| 77 FRIEND_TEST_ALL_PREFIXES(SyncSetupHandlerTest, TestSyncIndividualTypes); | 77 FRIEND_TEST_ALL_PREFIXES(SyncSetupHandlerTest, TestSyncIndividualTypes); |
| 78 FRIEND_TEST_ALL_PREFIXES(SyncSetupHandlerTest, TurnOnEncryptAll); | 78 FRIEND_TEST_ALL_PREFIXES(SyncSetupHandlerTest, TurnOnEncryptAll); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 // A utility function to call before actually showing setup dialog. Makes sure | 128 // A utility function to call before actually showing setup dialog. Makes sure |
| 129 // that a new dialog can be shown and sets flag that setup is in progress. | 129 // that a new dialog can be shown and sets flag that setup is in progress. |
| 130 bool PrepareSyncSetup(); | 130 bool PrepareSyncSetup(); |
| 131 | 131 |
| 132 // Displays spinner-only UI indicating that something is going on in the | 132 // Displays spinner-only UI indicating that something is going on in the |
| 133 // background. | 133 // background. |
| 134 // TODO(kochi): better to show some message that the user can understand what | 134 // TODO(kochi): better to show some message that the user can understand what |
| 135 // is running in the background. | 135 // is running in the background. |
| 136 void DisplaySpinner(); | 136 void DisplaySpinner(); |
| 137 | 137 |
| 138 // Displays an error dialog which shows timeout of starting the sync backend. | 138 // Displays an error dialog which shows timeout of starting the sync engine. |
| 139 void DisplayTimeout(); | 139 void DisplayTimeout(); |
| 140 | 140 |
| 141 // Closes the associated sync settings page. | 141 // Closes the associated sync settings page. |
| 142 void CloseUI(); | 142 void CloseUI(); |
| 143 | 143 |
| 144 // Returns true if this object is the active login object. | 144 // Returns true if this object is the active login object. |
| 145 bool IsActiveLogin() const; | 145 bool IsActiveLogin() const; |
| 146 | 146 |
| 147 // If a wizard already exists, return true. Otherwise, return false. | 147 // If a wizard already exists, return true. Otherwise, return false. |
| 148 bool IsExistingWizardPresent(); | 148 bool IsExistingWizardPresent(); |
| 149 | 149 |
| 150 // If a wizard already exists, focus it and return true. | 150 // If a wizard already exists, focus it and return true. |
| 151 bool FocusExistingWizardIfPresent(); | 151 bool FocusExistingWizardIfPresent(); |
| 152 | 152 |
| 153 // Display the configure sync UI. If |passphrase_failed| is true, the account | 153 // Display the configure sync UI. If |passphrase_failed| is true, the account |
| 154 // requires a passphrase and one hasn't been provided or it was invalid. | 154 // requires a passphrase and one hasn't been provided or it was invalid. |
| 155 void DisplayConfigureSync(bool passphrase_failed); | 155 void DisplayConfigureSync(bool passphrase_failed); |
| 156 | 156 |
| 157 // Helper object used to wait for the sync backend to startup. | 157 // Helper object used to wait for the sync engine to startup. |
| 158 std::unique_ptr<SyncStartupTracker> sync_startup_tracker_; | 158 std::unique_ptr<SyncStartupTracker> sync_startup_tracker_; |
| 159 | 159 |
| 160 // Prevents Sync from running until configuration is complete. | 160 // Prevents Sync from running until configuration is complete. |
| 161 std::unique_ptr<syncer::SyncSetupInProgressHandle> sync_blocker_; | 161 std::unique_ptr<syncer::SyncSetupInProgressHandle> sync_blocker_; |
| 162 | 162 |
| 163 // Set to true whenever the sync configure UI is visible. This is used to tell | 163 // Set to true whenever the sync configure UI is visible. This is used to tell |
| 164 // what stage of the setup wizard the user was in and to update the UMA | 164 // what stage of the setup wizard the user was in and to update the UMA |
| 165 // histograms in the case that the user cancels out. | 165 // histograms in the case that the user cancels out. |
| 166 bool configuring_sync_; | 166 bool configuring_sync_; |
| 167 | 167 |
| 168 // The OneShotTimer object used to timeout of starting the sync backend | 168 // The OneShotTimer object used to timeout of starting the sync engine |
| 169 // service. | 169 // service. |
| 170 std::unique_ptr<base::OneShotTimer> backend_start_timer_; | 170 std::unique_ptr<base::OneShotTimer> engine_start_timer_; |
| 171 | 171 |
| 172 DISALLOW_COPY_AND_ASSIGN(SyncSetupHandler); | 172 DISALLOW_COPY_AND_ASSIGN(SyncSetupHandler); |
| 173 }; | 173 }; |
| 174 | 174 |
| 175 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_SYNC_SETUP_HANDLER_H_ | 175 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_SYNC_SETUP_HANDLER_H_ |
| OLD | NEW |