| 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_PEOPLE_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_SETTINGS_PEOPLE_HANDLER_H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_SETTINGS_PEOPLE_HANDLER_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_SETTINGS_PEOPLE_HANDLER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> |
| 9 | 10 |
| 10 #include "base/gtest_prod_util.h" | 11 #include "base/gtest_prod_util.h" |
| 11 #include "base/macros.h" | 12 #include "base/macros.h" |
| 12 #include "base/scoped_observer.h" | 13 #include "base/scoped_observer.h" |
| 13 #include "base/strings/utf_string_conversions.h" | 14 #include "base/strings/utf_string_conversions.h" |
| 14 #include "base/timer/timer.h" | 15 #include "base/timer/timer.h" |
| 15 #include "build/build_config.h" | 16 #include "build/build_config.h" |
| 16 #include "chrome/browser/sync/sync_startup_tracker.h" | 17 #include "chrome/browser/sync/sync_startup_tracker.h" |
| 17 #include "chrome/browser/ui/webui/settings/settings_page_ui_handler.h" | 18 #include "chrome/browser/ui/webui/settings/settings_page_ui_handler.h" |
| 18 #include "chrome/browser/ui/webui/signin/login_ui_service.h" | 19 #include "chrome/browser/ui/webui/signin/login_ui_service.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 29 | 30 |
| 30 namespace content { | 31 namespace content { |
| 31 class WebContents; | 32 class WebContents; |
| 32 class WebUI; | 33 class WebUI; |
| 33 } // namespace content | 34 } // namespace content |
| 34 | 35 |
| 35 namespace signin_metrics { | 36 namespace signin_metrics { |
| 36 enum class AccessPoint; | 37 enum class AccessPoint; |
| 37 } // namespace signin_metrics | 38 } // namespace signin_metrics |
| 38 | 39 |
| 39 namespace sync_driver { | 40 namespace syncer { |
| 40 class SyncSetupInProgressHandle; | 41 class SyncSetupInProgressHandle; |
| 41 } // namespace sync_driver | 42 } // namespace syncer |
| 42 | 43 |
| 43 namespace settings { | 44 namespace settings { |
| 44 | 45 |
| 45 class PeopleHandler : public SettingsPageUIHandler, | 46 class PeopleHandler : public SettingsPageUIHandler, |
| 46 public SigninManagerBase::Observer, | 47 public SigninManagerBase::Observer, |
| 47 public SyncStartupTracker::Observer, | 48 public SyncStartupTracker::Observer, |
| 48 public LoginUIService::LoginUI, | 49 public LoginUIService::LoginUI, |
| 49 public sync_driver::SyncServiceObserver { | 50 public syncer::SyncServiceObserver { |
| 50 public: | 51 public: |
| 51 // TODO(tommycli): Remove these strings and instead use WebUIListener events. | 52 // TODO(tommycli): Remove these strings and instead use WebUIListener events. |
| 52 // These string constants are used from JavaScript (sync_browser_proxy.js). | 53 // These string constants are used from JavaScript (sync_browser_proxy.js). |
| 53 static const char kSpinnerPageStatus[]; | 54 static const char kSpinnerPageStatus[]; |
| 54 static const char kConfigurePageStatus[]; | 55 static const char kConfigurePageStatus[]; |
| 55 static const char kTimeoutPageStatus[]; | 56 static const char kTimeoutPageStatus[]; |
| 56 static const char kDonePageStatus[]; | 57 static const char kDonePageStatus[]; |
| 57 static const char kPassphraseFailedPageStatus[]; | 58 static const char kPassphraseFailedPageStatus[]; |
| 58 | 59 |
| 59 explicit PeopleHandler(Profile* profile); | 60 explicit PeopleHandler(Profile* profile); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 // LoginUIService::LoginUI implementation. | 112 // LoginUIService::LoginUI implementation. |
| 112 void FocusUI() override; | 113 void FocusUI() override; |
| 113 | 114 |
| 114 // SigninManagerBase::Observer implementation. | 115 // SigninManagerBase::Observer implementation. |
| 115 void GoogleSigninSucceeded(const std::string& account_id, | 116 void GoogleSigninSucceeded(const std::string& account_id, |
| 116 const std::string& username, | 117 const std::string& username, |
| 117 const std::string& password) override; | 118 const std::string& password) override; |
| 118 void GoogleSignedOut(const std::string& account_id, | 119 void GoogleSignedOut(const std::string& account_id, |
| 119 const std::string& username) override; | 120 const std::string& username) override; |
| 120 | 121 |
| 121 // sync_driver::SyncServiceObserver implementation. | 122 // syncer::SyncServiceObserver implementation. |
| 122 void OnStateChanged() override; | 123 void OnStateChanged() override; |
| 123 | 124 |
| 124 // Returns a newly created dictionary with a number of properties that | 125 // Returns a newly created dictionary with a number of properties that |
| 125 // correspond to the status of sync. | 126 // correspond to the status of sync. |
| 126 std::unique_ptr<base::DictionaryValue> GetSyncStatusDictionary(); | 127 std::unique_ptr<base::DictionaryValue> GetSyncStatusDictionary(); |
| 127 | 128 |
| 128 // Helper routine that gets the ProfileSyncService associated with the parent | 129 // Helper routine that gets the ProfileSyncService associated with the parent |
| 129 // profile. | 130 // profile. |
| 130 browser_sync::ProfileSyncService* GetSyncService() const; | 131 browser_sync::ProfileSyncService* GetSyncService() const; |
| 131 | 132 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 // Suppresses any further signin promos, since the user has signed in once. | 176 // Suppresses any further signin promos, since the user has signed in once. |
| 176 void MarkFirstSetupComplete(); | 177 void MarkFirstSetupComplete(); |
| 177 | 178 |
| 178 // Weak pointer. | 179 // Weak pointer. |
| 179 Profile* profile_; | 180 Profile* profile_; |
| 180 | 181 |
| 181 // Helper object used to wait for the sync backend to startup. | 182 // Helper object used to wait for the sync backend to startup. |
| 182 std::unique_ptr<SyncStartupTracker> sync_startup_tracker_; | 183 std::unique_ptr<SyncStartupTracker> sync_startup_tracker_; |
| 183 | 184 |
| 184 // Prevents Sync from running until configuration is complete. | 185 // Prevents Sync from running until configuration is complete. |
| 185 std::unique_ptr<sync_driver::SyncSetupInProgressHandle> sync_blocker_; | 186 std::unique_ptr<syncer::SyncSetupInProgressHandle> sync_blocker_; |
| 186 | 187 |
| 187 // Set to true whenever the sync configure UI is visible. This is used to tell | 188 // Set to true whenever the sync configure UI is visible. This is used to tell |
| 188 // what stage of the setup wizard the user was in and to update the UMA | 189 // what stage of the setup wizard the user was in and to update the UMA |
| 189 // histograms in the case that the user cancels out. | 190 // histograms in the case that the user cancels out. |
| 190 bool configuring_sync_; | 191 bool configuring_sync_; |
| 191 | 192 |
| 192 // The OneShotTimer object used to timeout of starting the sync backend | 193 // The OneShotTimer object used to timeout of starting the sync backend |
| 193 // service. | 194 // service. |
| 194 std::unique_ptr<base::OneShotTimer> backend_start_timer_; | 195 std::unique_ptr<base::OneShotTimer> backend_start_timer_; |
| 195 | 196 |
| 196 // Used to listen for pref changes to allow or disallow signin. | 197 // Used to listen for pref changes to allow or disallow signin. |
| 197 PrefChangeRegistrar profile_pref_registrar_; | 198 PrefChangeRegistrar profile_pref_registrar_; |
| 198 | 199 |
| 199 // Manages observer lifetimes. | 200 // Manages observer lifetimes. |
| 200 ScopedObserver<SigninManagerBase, PeopleHandler> signin_observer_; | 201 ScopedObserver<SigninManagerBase, PeopleHandler> signin_observer_; |
| 201 ScopedObserver<browser_sync::ProfileSyncService, PeopleHandler> | 202 ScopedObserver<browser_sync::ProfileSyncService, PeopleHandler> |
| 202 sync_service_observer_; | 203 sync_service_observer_; |
| 203 | 204 |
| 204 DISALLOW_COPY_AND_ASSIGN(PeopleHandler); | 205 DISALLOW_COPY_AND_ASSIGN(PeopleHandler); |
| 205 }; | 206 }; |
| 206 | 207 |
| 207 } // namespace settings | 208 } // namespace settings |
| 208 | 209 |
| 209 #endif // CHROME_BROWSER_UI_WEBUI_SETTINGS_PEOPLE_HANDLER_H_ | 210 #endif // CHROME_BROWSER_UI_WEBUI_SETTINGS_PEOPLE_HANDLER_H_ |
| OLD | NEW |