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 | 9 |
10 #include "base/gtest_prod_util.h" | 10 #include "base/gtest_prod_util.h" |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "base/scoped_observer.h" | 12 #include "base/scoped_observer.h" |
13 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
14 #include "base/timer/timer.h" | 14 #include "base/timer/timer.h" |
15 #include "build/build_config.h" | 15 #include "build/build_config.h" |
16 #include "chrome/browser/sync/sync_startup_tracker.h" | 16 #include "chrome/browser/sync/sync_startup_tracker.h" |
17 #include "chrome/browser/ui/webui/settings/settings_page_ui_handler.h" | 17 #include "chrome/browser/ui/webui/settings/settings_page_ui_handler.h" |
18 #include "chrome/browser/ui/webui/signin/login_ui_service.h" | 18 #include "chrome/browser/ui/webui/signin/login_ui_service.h" |
19 #include "components/prefs/pref_change_registrar.h" | 19 #include "components/prefs/pref_change_registrar.h" |
20 #include "components/signin/core/browser/signin_manager_base.h" | 20 #include "components/signin/core/browser/signin_manager_base.h" |
21 #include "components/sync/driver/sync_service_observer.h" | 21 #include "components/sync/driver/sync_service_observer.h" |
22 | 22 |
23 class LoginUIService; | 23 class LoginUIService; |
| 24 class SigninManagerBase; |
| 25 |
| 26 namespace browser_sync { |
24 class ProfileSyncService; | 27 class ProfileSyncService; |
25 class SigninManagerBase; | 28 } // namespace browser_sync |
26 | 29 |
27 namespace content { | 30 namespace content { |
28 class WebContents; | 31 class WebContents; |
29 class WebUI; | 32 class WebUI; |
30 } | 33 } // namespace content |
31 | 34 |
32 namespace signin_metrics { | 35 namespace signin_metrics { |
33 enum class AccessPoint; | 36 enum class AccessPoint; |
34 } | 37 } // namespace signin_metrics |
35 | 38 |
36 namespace sync_driver { | 39 namespace sync_driver { |
37 class SyncSetupInProgressHandle; | 40 class SyncSetupInProgressHandle; |
38 } | 41 } // namespace sync_driver |
39 | 42 |
40 namespace settings { | 43 namespace settings { |
41 | 44 |
42 class PeopleHandler : public SettingsPageUIHandler, | 45 class PeopleHandler : public SettingsPageUIHandler, |
43 public SigninManagerBase::Observer, | 46 public SigninManagerBase::Observer, |
44 public SyncStartupTracker::Observer, | 47 public SyncStartupTracker::Observer, |
45 public LoginUIService::LoginUI, | 48 public LoginUIService::LoginUI, |
46 public sync_driver::SyncServiceObserver { | 49 public sync_driver::SyncServiceObserver { |
47 public: | 50 public: |
48 // TODO(tommycli): Remove these strings and instead use WebUIListener events. | 51 // TODO(tommycli): Remove these strings and instead use WebUIListener events. |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 | 120 |
118 // sync_driver::SyncServiceObserver implementation. | 121 // sync_driver::SyncServiceObserver implementation. |
119 void OnStateChanged() override; | 122 void OnStateChanged() override; |
120 | 123 |
121 // Returns a newly created dictionary with a number of properties that | 124 // Returns a newly created dictionary with a number of properties that |
122 // correspond to the status of sync. | 125 // correspond to the status of sync. |
123 std::unique_ptr<base::DictionaryValue> GetSyncStatusDictionary(); | 126 std::unique_ptr<base::DictionaryValue> GetSyncStatusDictionary(); |
124 | 127 |
125 // Helper routine that gets the ProfileSyncService associated with the parent | 128 // Helper routine that gets the ProfileSyncService associated with the parent |
126 // profile. | 129 // profile. |
127 ProfileSyncService* GetSyncService() const; | 130 browser_sync::ProfileSyncService* GetSyncService() const; |
128 | 131 |
129 // Returns the LoginUIService for the parent profile. | 132 // Returns the LoginUIService for the parent profile. |
130 LoginUIService* GetLoginUIService() const; | 133 LoginUIService* GetLoginUIService() const; |
131 | 134 |
132 // Callbacks from the page. | 135 // Callbacks from the page. |
133 void HandleGetProfileInfo(const base::ListValue* args); | 136 void HandleGetProfileInfo(const base::ListValue* args); |
134 void OnDidClosePage(const base::ListValue* args); | 137 void OnDidClosePage(const base::ListValue* args); |
135 void HandleSetDatatypes(const base::ListValue* args); | 138 void HandleSetDatatypes(const base::ListValue* args); |
136 void HandleSetEncryption(const base::ListValue* args); | 139 void HandleSetEncryption(const base::ListValue* args); |
137 void HandleShowSetupUI(const base::ListValue* args); | 140 void HandleShowSetupUI(const base::ListValue* args); |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 | 191 |
189 // The OneShotTimer object used to timeout of starting the sync backend | 192 // The OneShotTimer object used to timeout of starting the sync backend |
190 // service. | 193 // service. |
191 std::unique_ptr<base::OneShotTimer> backend_start_timer_; | 194 std::unique_ptr<base::OneShotTimer> backend_start_timer_; |
192 | 195 |
193 // Used to listen for pref changes to allow or disallow signin. | 196 // Used to listen for pref changes to allow or disallow signin. |
194 PrefChangeRegistrar profile_pref_registrar_; | 197 PrefChangeRegistrar profile_pref_registrar_; |
195 | 198 |
196 // Manages observer lifetimes. | 199 // Manages observer lifetimes. |
197 ScopedObserver<SigninManagerBase, PeopleHandler> signin_observer_; | 200 ScopedObserver<SigninManagerBase, PeopleHandler> signin_observer_; |
198 ScopedObserver<ProfileSyncService, PeopleHandler> sync_service_observer_; | 201 ScopedObserver<browser_sync::ProfileSyncService, PeopleHandler> |
| 202 sync_service_observer_; |
199 | 203 |
200 DISALLOW_COPY_AND_ASSIGN(PeopleHandler); | 204 DISALLOW_COPY_AND_ASSIGN(PeopleHandler); |
201 }; | 205 }; |
202 | 206 |
203 } // namespace settings | 207 } // namespace settings |
204 | 208 |
205 #endif // CHROME_BROWSER_UI_WEBUI_SETTINGS_PEOPLE_HANDLER_H_ | 209 #endif // CHROME_BROWSER_UI_WEBUI_SETTINGS_PEOPLE_HANDLER_H_ |
OLD | NEW |