| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_SETTINGS_SYNC_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_SETTINGS_SYNC_HANDLER_H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_SETTINGS_SYNC_HANDLER_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_SETTINGS_SYNC_HANDLER_H_ |
| 7 | 7 |
| 8 #include "base/gtest_prod_util.h" | 8 #include "base/gtest_prod_util.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "base/prefs/pref_change_registrar.h" | 11 #include "base/prefs/pref_change_registrar.h" |
| 12 #include "base/scoped_observer.h" | 12 #include "base/scoped_observer.h" |
| 13 #include "base/strings/utf_string_conversions.h" |
| 13 #include "base/timer/timer.h" | 14 #include "base/timer/timer.h" |
| 14 #include "chrome/browser/sync/sync_startup_tracker.h" | 15 #include "chrome/browser/sync/sync_startup_tracker.h" |
| 15 #include "chrome/browser/ui/webui/signin/login_ui_service.h" | 16 #include "chrome/browser/ui/webui/signin/login_ui_service.h" |
| 16 #include "components/signin/core/browser/signin_manager_base.h" | 17 #include "components/signin/core/browser/signin_manager_base.h" |
| 18 #include "components/signin/core/browser/signin_metrics.h" |
| 17 #include "components/sync_driver/sync_service_observer.h" | 19 #include "components/sync_driver/sync_service_observer.h" |
| 18 #include "content/public/browser/web_ui_message_handler.h" | 20 #include "content/public/browser/web_ui_message_handler.h" |
| 19 | 21 |
| 20 class LoginUIService; | 22 class LoginUIService; |
| 21 class ProfileSyncService; | 23 class ProfileSyncService; |
| 22 class SigninManagerBase; | 24 class SigninManagerBase; |
| 23 | 25 |
| 24 namespace content { | 26 namespace content { |
| 25 class WebContents; | 27 class WebContents; |
| 26 class WebUI; | 28 class WebUI; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 52 void GoogleSigninSucceeded(const std::string& account_id, | 54 void GoogleSigninSucceeded(const std::string& account_id, |
| 53 const std::string& username, | 55 const std::string& username, |
| 54 const std::string& password) override; | 56 const std::string& password) override; |
| 55 void GoogleSignedOut(const std::string& account_id, | 57 void GoogleSignedOut(const std::string& account_id, |
| 56 const std::string& username) override; | 58 const std::string& username) override; |
| 57 | 59 |
| 58 // sync_driver::SyncServiceObserver implementation. | 60 // sync_driver::SyncServiceObserver implementation. |
| 59 void OnStateChanged() override; | 61 void OnStateChanged() override; |
| 60 | 62 |
| 61 // Initializes the sync setup flow and shows the setup UI. | 63 // Initializes the sync setup flow and shows the setup UI. |
| 62 void OpenSyncSetup(); | 64 void OpenSyncSetup(const base::ListValue* args); |
| 63 | 65 |
| 64 // Shows advanced configuration dialog without going through sign in dialog. | 66 // Shows advanced configuration dialog without going through sign in dialog. |
| 65 // Kicks the sync backend if necessary with showing spinner dialog until it | 67 // Kicks the sync backend if necessary with showing spinner dialog until it |
| 66 // gets ready. | 68 // gets ready. |
| 67 void OpenConfigureSync(); | 69 void OpenConfigureSync(); |
| 68 | 70 |
| 69 // Terminates the sync setup flow. | 71 // Terminates the sync setup flow. |
| 70 void CloseSyncSetup(); | 72 void CloseSyncSetup(); |
| 71 | 73 |
| 72 // Returns a newly created dictionary with a number of properties that | 74 // Returns a newly created dictionary with a number of properties that |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 void HandlePassphraseCancel(const base::ListValue* args); | 121 void HandlePassphraseCancel(const base::ListValue* args); |
| 120 void HandleShowSetupUI(const base::ListValue* args); | 122 void HandleShowSetupUI(const base::ListValue* args); |
| 121 void HandleDoSignOutOnAuthError(const base::ListValue* args); | 123 void HandleDoSignOutOnAuthError(const base::ListValue* args); |
| 122 void HandleStartSignin(const base::ListValue* args); | 124 void HandleStartSignin(const base::ListValue* args); |
| 123 void HandleStopSyncing(const base::ListValue* args); | 125 void HandleStopSyncing(const base::ListValue* args); |
| 124 void HandleCloseTimeout(const base::ListValue* args); | 126 void HandleCloseTimeout(const base::ListValue* args); |
| 125 void HandleGetSyncStatus(const base::ListValue* args); | 127 void HandleGetSyncStatus(const base::ListValue* args); |
| 126 | 128 |
| 127 #if !defined(OS_CHROMEOS) | 129 #if !defined(OS_CHROMEOS) |
| 128 // Displays the GAIA login form. | 130 // Displays the GAIA login form. |
| 129 void DisplayGaiaLogin(); | 131 void DisplayGaiaLogin(signin_metrics::AccessPoint access_point); |
| 130 | 132 |
| 131 // When web-flow is enabled, displays the Gaia login form in a new tab. | 133 // When web-flow is enabled, displays the Gaia login form in a new tab. |
| 132 // This function is virtual so that tests can override. | 134 // This function is virtual so that tests can override. |
| 133 virtual void DisplayGaiaLoginInNewTabOrWindow(); | 135 virtual void DisplayGaiaLoginInNewTabOrWindow( |
| 136 signin_metrics::AccessPoint access_point); |
| 134 #endif | 137 #endif |
| 135 | 138 |
| 136 // A utility function to call before actually showing setup dialog. Makes sure | 139 // A utility function to call before actually showing setup dialog. Makes sure |
| 137 // that a new dialog can be shown and sets flag that setup is in progress. | 140 // that a new dialog can be shown and sets flag that setup is in progress. |
| 138 bool PrepareSyncSetup(); | 141 bool PrepareSyncSetup(); |
| 139 | 142 |
| 140 // Displays spinner-only UI indicating that something is going on in the | 143 // Displays spinner-only UI indicating that something is going on in the |
| 141 // background. | 144 // background. |
| 142 // TODO(kochi): better to show some message that the user can understand what | 145 // TODO(kochi): better to show some message that the user can understand what |
| 143 // is running in the background. | 146 // is running in the background. |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 | 188 |
| 186 // Manages observer lifetime. | 189 // Manages observer lifetime. |
| 187 ScopedObserver<ProfileSyncService, SyncHandler> sync_service_observer_; | 190 ScopedObserver<ProfileSyncService, SyncHandler> sync_service_observer_; |
| 188 | 191 |
| 189 DISALLOW_COPY_AND_ASSIGN(SyncHandler); | 192 DISALLOW_COPY_AND_ASSIGN(SyncHandler); |
| 190 }; | 193 }; |
| 191 | 194 |
| 192 } // namespace settings | 195 } // namespace settings |
| 193 | 196 |
| 194 #endif // CHROME_BROWSER_UI_WEBUI_SETTINGS_SYNC_HANDLER_H_ | 197 #endif // CHROME_BROWSER_UI_WEBUI_SETTINGS_SYNC_HANDLER_H_ |
| OLD | NEW |