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