| 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 "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/timer.h" | 10 #include "base/timer/timer.h" |
| 11 #include "chrome/browser/sync/sync_startup_tracker.h" | 11 #include "chrome/browser/sync/sync_startup_tracker.h" |
| 12 #include "chrome/browser/ui/webui/options/options_ui.h" | 12 #include "chrome/browser/ui/webui/options/options_ui.h" |
| 13 #include "chrome/browser/ui/webui/signin/login_ui_service.h" | 13 #include "chrome/browser/ui/webui/signin/login_ui_service.h" |
| 14 | 14 |
| 15 class LoginUIService; | 15 class LoginUIService; |
| 16 class ProfileSyncService; | 16 class ProfileSyncService; |
| 17 class SigninManagerBase; | 17 class SigninManagerBase; |
| 18 | 18 |
| 19 namespace content { | 19 namespace content { |
| 20 class WebContents; | 20 class WebContents; |
| 21 } | 21 } |
| 22 | 22 |
| 23 namespace signin_metrics { |
| 24 enum class AccessPoint; |
| 25 } |
| 26 |
| 23 class SyncSetupHandler : public options::OptionsPageUIHandler, | 27 class SyncSetupHandler : public options::OptionsPageUIHandler, |
| 24 public SyncStartupTracker::Observer, | 28 public SyncStartupTracker::Observer, |
| 25 public LoginUIService::LoginUI { | 29 public LoginUIService::LoginUI { |
| 26 public: | 30 public: |
| 27 SyncSetupHandler(); | 31 SyncSetupHandler(); |
| 28 ~SyncSetupHandler() override; | 32 ~SyncSetupHandler() override; |
| 29 | 33 |
| 30 // OptionsPageUIHandler implementation. | 34 // OptionsPageUIHandler implementation. |
| 31 void GetLocalizedValues(base::DictionaryValue* localized_strings) override; | 35 void GetLocalizedValues(base::DictionaryValue* localized_strings) override; |
| 32 void RegisterMessages() override; | 36 void RegisterMessages() override; |
| 33 | 37 |
| 34 // SyncStartupTracker::Observer implementation; | 38 // SyncStartupTracker::Observer implementation; |
| 35 void SyncStartupCompleted() override; | 39 void SyncStartupCompleted() override; |
| 36 void SyncStartupFailed() override; | 40 void SyncStartupFailed() override; |
| 37 | 41 |
| 38 // LoginUIService::LoginUI implementation. | 42 // LoginUIService::LoginUI implementation. |
| 39 void FocusUI() override; | 43 void FocusUI() override; |
| 40 void CloseUI() override; | 44 void CloseUI() override; |
| 41 | 45 |
| 42 static void GetStaticLocalizedValues( | 46 static void GetStaticLocalizedValues( |
| 43 base::DictionaryValue* localized_strings, | 47 base::DictionaryValue* localized_strings, |
| 44 content::WebUI* web_ui); | 48 content::WebUI* web_ui); |
| 45 | 49 |
| 46 // Initializes the sync setup flow and shows the setup UI. | 50 // Initializes the sync setup flow and shows the setup UI. |
| 47 void OpenSyncSetup(); | 51 void OpenSyncSetup(const base::ListValue* args); |
| 48 | 52 |
| 49 // Shows advanced configuration dialog without going through sign in dialog. | 53 // Shows advanced configuration dialog without going through sign in dialog. |
| 50 // Kicks the sync backend if necessary with showing spinner dialog until it | 54 // Kicks the sync backend if necessary with showing spinner dialog until it |
| 51 // gets ready. | 55 // gets ready. |
| 52 void OpenConfigureSync(); | 56 void OpenConfigureSync(); |
| 53 | 57 |
| 54 // Terminates the sync setup flow. | 58 // Terminates the sync setup flow. |
| 55 void CloseSyncSetup(); | 59 void CloseSyncSetup(); |
| 56 | 60 |
| 57 protected: | 61 protected: |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 void HandleConfigure(const base::ListValue* args); | 102 void HandleConfigure(const base::ListValue* args); |
| 99 void HandlePassphraseEntry(const base::ListValue* args); | 103 void HandlePassphraseEntry(const base::ListValue* args); |
| 100 void HandlePassphraseCancel(const base::ListValue* args); | 104 void HandlePassphraseCancel(const base::ListValue* args); |
| 101 void HandleShowSetupUI(const base::ListValue* args); | 105 void HandleShowSetupUI(const base::ListValue* args); |
| 102 void HandleDoSignOutOnAuthError(const base::ListValue* args); | 106 void HandleDoSignOutOnAuthError(const base::ListValue* args); |
| 103 void HandleStartSignin(const base::ListValue* args); | 107 void HandleStartSignin(const base::ListValue* args); |
| 104 void HandleStopSyncing(const base::ListValue* args); | 108 void HandleStopSyncing(const base::ListValue* args); |
| 105 void HandleCloseTimeout(const base::ListValue* args); | 109 void HandleCloseTimeout(const base::ListValue* args); |
| 106 #if !defined(OS_CHROMEOS) | 110 #if !defined(OS_CHROMEOS) |
| 107 // Displays the GAIA login form. | 111 // Displays the GAIA login form. |
| 108 void DisplayGaiaLogin(); | 112 void DisplayGaiaLogin(signin_metrics::AccessPoint access_point); |
| 109 | 113 |
| 110 // When web-flow is enabled, displays the Gaia login form in a new tab. | 114 // When web-flow is enabled, displays the Gaia login form in a new tab. |
| 111 // This function is virtual so that tests can override. | 115 // This function is virtual so that tests can override. |
| 112 virtual void DisplayGaiaLoginInNewTabOrWindow(); | 116 virtual void DisplayGaiaLoginInNewTabOrWindow( |
| 117 signin_metrics::AccessPoint access_point); |
| 113 #endif | 118 #endif |
| 114 | 119 |
| 115 // Helper routine that gets the Profile associated with this object (virtual | 120 // Helper routine that gets the Profile associated with this object (virtual |
| 116 // so tests can override). | 121 // so tests can override). |
| 117 virtual Profile* GetProfile() const; | 122 virtual Profile* GetProfile() const; |
| 118 | 123 |
| 119 // A utility function to call before actually showing setup dialog. Makes sure | 124 // A utility function to call before actually showing setup dialog. Makes sure |
| 120 // that a new dialog can be shown and sets flag that setup is in progress. | 125 // that a new dialog can be shown and sets flag that setup is in progress. |
| 121 bool PrepareSyncSetup(); | 126 bool PrepareSyncSetup(); |
| 122 | 127 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 151 bool configuring_sync_; | 156 bool configuring_sync_; |
| 152 | 157 |
| 153 // The OneShotTimer object used to timeout of starting the sync backend | 158 // The OneShotTimer object used to timeout of starting the sync backend |
| 154 // service. | 159 // service. |
| 155 scoped_ptr<base::OneShotTimer> backend_start_timer_; | 160 scoped_ptr<base::OneShotTimer> backend_start_timer_; |
| 156 | 161 |
| 157 DISALLOW_COPY_AND_ASSIGN(SyncSetupHandler); | 162 DISALLOW_COPY_AND_ASSIGN(SyncSetupHandler); |
| 158 }; | 163 }; |
| 159 | 164 |
| 160 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_SYNC_SETUP_HANDLER_H_ | 165 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_SYNC_SETUP_HANDLER_H_ |
| OLD | NEW |