| 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_SYNC_SETUP_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_SYNC_SETUP_HANDLER_H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_SYNC_SETUP_HANDLER_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_SYNC_SETUP_HANDLER_H_ |
| 7 | 7 |
| 8 #include "base/gtest_prod_util.h" | 8 #include "base/gtest_prod_util.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/timer.h" | 10 #include "base/timer.h" |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 // Called when configuring sync is done to close the dialog and start syncing. | 93 // Called when configuring sync is done to close the dialog and start syncing. |
| 94 void ConfigureSyncDone(); | 94 void ConfigureSyncDone(); |
| 95 | 95 |
| 96 // Helper routine that gets the ProfileSyncService associated with the parent | 96 // Helper routine that gets the ProfileSyncService associated with the parent |
| 97 // profile. | 97 // profile. |
| 98 ProfileSyncService* GetSyncService() const; | 98 ProfileSyncService* GetSyncService() const; |
| 99 | 99 |
| 100 // Returns the LoginUIService for the parent profile. | 100 // Returns the LoginUIService for the parent profile. |
| 101 LoginUIService* GetLoginUIService() const; | 101 LoginUIService* GetLoginUIService() const; |
| 102 | 102 |
| 103 // Returns true if this object is the active login object. |
| 104 bool IsActiveLogin() const; |
| 105 |
| 106 // Displays the GAIA login form. If |fatal_error| is true, displays the fatal |
| 107 // error UI. |
| 108 void DisplayGaiaLogin(bool fatal_error); |
| 109 |
| 103 private: | 110 private: |
| 104 // Callbacks from the page. | 111 // Callbacks from the page. |
| 105 void OnDidClosePage(const base::ListValue* args); | 112 void OnDidClosePage(const base::ListValue* args); |
| 106 void HandleSubmitAuth(const base::ListValue* args); | 113 void HandleSubmitAuth(const base::ListValue* args); |
| 107 void HandleConfigure(const base::ListValue* args); | 114 void HandleConfigure(const base::ListValue* args); |
| 108 void HandlePassphraseEntry(const base::ListValue* args); | 115 void HandlePassphraseEntry(const base::ListValue* args); |
| 109 void HandlePassphraseCancel(const base::ListValue* args); | 116 void HandlePassphraseCancel(const base::ListValue* args); |
| 110 void HandleAttachHandler(const base::ListValue* args); | 117 void HandleAttachHandler(const base::ListValue* args); |
| 111 void HandleShowErrorUI(const base::ListValue* args); | 118 void HandleShowErrorUI(const base::ListValue* args); |
| 112 void HandleShowSetupUI(const base::ListValue* args); | 119 void HandleShowSetupUI(const base::ListValue* args); |
| 113 void HandleShowSetupUIWithoutLogin(const base::ListValue* args); | 120 void HandleShowSetupUIWithoutLogin(const base::ListValue* args); |
| 114 void HandleDoSignOutOnAuthError(const base::ListValue* args); | 121 void HandleDoSignOutOnAuthError(const base::ListValue* args); |
| 115 void HandleStopSyncing(const base::ListValue* args); | 122 void HandleStopSyncing(const base::ListValue* args); |
| 116 void HandleCloseTimeout(const base::ListValue* args); | 123 void HandleCloseTimeout(const base::ListValue* args); |
| 117 | 124 |
| 118 // Helper routine that gets the Profile associated with this object (virtual | 125 // Helper routine that gets the Profile associated with this object (virtual |
| 119 // so tests can override). | 126 // so tests can override). |
| 120 virtual Profile* GetProfile() const; | 127 virtual Profile* GetProfile() const; |
| 121 | 128 |
| 122 // Shows the GAIA login success page then exits. | 129 // Shows the GAIA login success page then exits. |
| 123 void DisplayGaiaSuccessAndClose(); | 130 void DisplayGaiaSuccessAndClose(); |
| 124 | 131 |
| 125 // Displays the GAIA login success page then transitions to sync setup. | 132 // Displays the GAIA login success page then transitions to sync setup. |
| 126 void DisplayGaiaSuccessAndSettingUp(); | 133 void DisplayGaiaSuccessAndSettingUp(); |
| 127 | 134 |
| 128 // Displays the GAIA login form. If |fatal_error| is true, displays the fatal | |
| 129 // error UI. | |
| 130 void DisplayGaiaLogin(bool fatal_error); | |
| 131 | |
| 132 // Displays the GAIA login form with a custom error message (used for errors | 135 // Displays the GAIA login form with a custom error message (used for errors |
| 133 // like "email address already in use by another profile"). No message | 136 // like "email address already in use by another profile"). No message |
| 134 // displayed if |error_message| is empty. Displays fatal error UI if | 137 // displayed if |error_message| is empty. Displays fatal error UI if |
| 135 // |fatal_error| = true. | 138 // |fatal_error| = true. |
| 136 void DisplayGaiaLoginWithErrorMessage(const string16& error_message, | 139 void DisplayGaiaLoginWithErrorMessage(const string16& error_message, |
| 137 bool fatal_error); | 140 bool fatal_error); |
| 138 | 141 |
| 139 // A utility function to call before actually showing setup dialog. Makes sure | 142 // A utility function to call before actually showing setup dialog. Makes sure |
| 140 // that a new dialog can be shown and sets flag that setup is in progress. | 143 // that a new dialog can be shown and sets flag that setup is in progress. |
| 141 bool PrepareSyncSetup(); | 144 bool PrepareSyncSetup(); |
| 142 | 145 |
| 143 // Displays spinner-only UI indicating that something is going on in the | 146 // Displays spinner-only UI indicating that something is going on in the |
| 144 // background. | 147 // background. |
| 145 // TODO(kochi): better to show some message that the user can understand what | 148 // TODO(kochi): better to show some message that the user can understand what |
| 146 // is running in the background. | 149 // is running in the background. |
| 147 void DisplaySpinner(); | 150 void DisplaySpinner(); |
| 148 | 151 |
| 149 // Displays an error dialog which shows timeout of starting the sync backend. | 152 // Displays an error dialog which shows timeout of starting the sync backend. |
| 150 void DisplayTimeout(); | 153 void DisplayTimeout(); |
| 151 | 154 |
| 152 // Returns true if this object is the active login object. | |
| 153 bool IsActiveLogin() const; | |
| 154 | |
| 155 // Initiates a login via the signin manager. | 155 // Initiates a login via the signin manager. |
| 156 void TryLogin(const std::string& username, | 156 void TryLogin(const std::string& username, |
| 157 const std::string& password, | 157 const std::string& password, |
| 158 const std::string& captcha, | 158 const std::string& captcha, |
| 159 const std::string& access_code); | 159 const std::string& access_code); |
| 160 | 160 |
| 161 // If a wizard already exists, focus it and return true. | 161 // If a wizard already exists, focus it and return true. |
| 162 bool FocusExistingWizardIfPresent(); | 162 bool FocusExistingWizardIfPresent(); |
| 163 | 163 |
| 164 // Invokes the javascript call to close the setup overlay. | 164 // Invokes the javascript call to close the setup overlay. |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 bool retry_on_signin_failure_; | 198 bool retry_on_signin_failure_; |
| 199 | 199 |
| 200 // The OneShotTimer object used to timeout of starting the sync backend | 200 // The OneShotTimer object used to timeout of starting the sync backend |
| 201 // service. | 201 // service. |
| 202 scoped_ptr<base::OneShotTimer<SyncSetupHandler> > backend_start_timer_; | 202 scoped_ptr<base::OneShotTimer<SyncSetupHandler> > backend_start_timer_; |
| 203 | 203 |
| 204 DISALLOW_COPY_AND_ASSIGN(SyncSetupHandler); | 204 DISALLOW_COPY_AND_ASSIGN(SyncSetupHandler); |
| 205 }; | 205 }; |
| 206 | 206 |
| 207 #endif // CHROME_BROWSER_UI_WEBUI_SYNC_SETUP_HANDLER_H_ | 207 #endif // CHROME_BROWSER_UI_WEBUI_SYNC_SETUP_HANDLER_H_ |
| OLD | NEW |