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> |
| 9 |
8 #include "base/gtest_prod_util.h" | 10 #include "base/gtest_prod_util.h" |
9 #include "base/macros.h" | 11 #include "base/macros.h" |
10 #include "base/memory/scoped_ptr.h" | |
11 #include "base/scoped_observer.h" | 12 #include "base/scoped_observer.h" |
12 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
13 #include "base/timer/timer.h" | 14 #include "base/timer/timer.h" |
14 #include "build/build_config.h" | 15 #include "build/build_config.h" |
15 #include "chrome/browser/profiles/profile_attributes_storage.h" | 16 #include "chrome/browser/profiles/profile_attributes_storage.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" |
19 #include "components/prefs/pref_change_registrar.h" | 20 #include "components/prefs/pref_change_registrar.h" |
20 #include "components/signin/core/browser/signin_manager_base.h" | 21 #include "components/signin/core/browser/signin_manager_base.h" |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 // Shows advanced configuration dialog without going through sign in dialog. | 93 // Shows advanced configuration dialog without going through sign in dialog. |
93 // Kicks the sync backend if necessary with showing spinner dialog until it | 94 // Kicks the sync backend if necessary with showing spinner dialog until it |
94 // gets ready. | 95 // gets ready. |
95 void OpenConfigureSync(); | 96 void OpenConfigureSync(); |
96 | 97 |
97 // Terminates the sync setup flow. | 98 // Terminates the sync setup flow. |
98 void CloseSyncSetup(); | 99 void CloseSyncSetup(); |
99 | 100 |
100 // Returns a newly created dictionary with a number of properties that | 101 // Returns a newly created dictionary with a number of properties that |
101 // correspond to the status of sync. | 102 // correspond to the status of sync. |
102 scoped_ptr<base::DictionaryValue> GetSyncStateDictionary(); | 103 std::unique_ptr<base::DictionaryValue> GetSyncStateDictionary(); |
103 | 104 |
104 protected: | 105 protected: |
105 friend class PeopleHandlerTest; | 106 friend class PeopleHandlerTest; |
106 FRIEND_TEST_ALL_PREFIXES(PeopleHandlerTest, | 107 FRIEND_TEST_ALL_PREFIXES(PeopleHandlerTest, |
107 DisplayConfigureWithBackendDisabledAndCancel); | 108 DisplayConfigureWithBackendDisabledAndCancel); |
108 FRIEND_TEST_ALL_PREFIXES(PeopleHandlerTest, HandleSetupUIWhenSyncDisabled); | 109 FRIEND_TEST_ALL_PREFIXES(PeopleHandlerTest, HandleSetupUIWhenSyncDisabled); |
109 FRIEND_TEST_ALL_PREFIXES(PeopleHandlerTest, SelectCustomEncryption); | 110 FRIEND_TEST_ALL_PREFIXES(PeopleHandlerTest, SelectCustomEncryption); |
110 FRIEND_TEST_ALL_PREFIXES(PeopleHandlerTest, ShowSyncSetupWhenNotSignedIn); | 111 FRIEND_TEST_ALL_PREFIXES(PeopleHandlerTest, ShowSyncSetupWhenNotSignedIn); |
111 FRIEND_TEST_ALL_PREFIXES(PeopleHandlerTest, SuccessfullySetPassphrase); | 112 FRIEND_TEST_ALL_PREFIXES(PeopleHandlerTest, SuccessfullySetPassphrase); |
112 FRIEND_TEST_ALL_PREFIXES(PeopleHandlerTest, TestSyncEverything); | 113 FRIEND_TEST_ALL_PREFIXES(PeopleHandlerTest, TestSyncEverything); |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 // Sends the current sync status to the JavaScript WebUI code. | 193 // Sends the current sync status to the JavaScript WebUI code. |
193 void UpdateSyncState(); | 194 void UpdateSyncState(); |
194 | 195 |
195 // Will be called when the kSigninAllowed pref has changed. | 196 // Will be called when the kSigninAllowed pref has changed. |
196 void OnSigninAllowedPrefChange(); | 197 void OnSigninAllowedPrefChange(); |
197 | 198 |
198 // Weak pointer. | 199 // Weak pointer. |
199 Profile* profile_; | 200 Profile* profile_; |
200 | 201 |
201 // Helper object used to wait for the sync backend to startup. | 202 // Helper object used to wait for the sync backend to startup. |
202 scoped_ptr<SyncStartupTracker> sync_startup_tracker_; | 203 std::unique_ptr<SyncStartupTracker> sync_startup_tracker_; |
203 | 204 |
204 // Set to true whenever the sync configure UI is visible. This is used to tell | 205 // Set to true whenever the sync configure UI is visible. This is used to tell |
205 // what stage of the setup wizard the user was in and to update the UMA | 206 // what stage of the setup wizard the user was in and to update the UMA |
206 // histograms in the case that the user cancels out. | 207 // histograms in the case that the user cancels out. |
207 bool configuring_sync_; | 208 bool configuring_sync_; |
208 | 209 |
209 // The OneShotTimer object used to timeout of starting the sync backend | 210 // The OneShotTimer object used to timeout of starting the sync backend |
210 // service. | 211 // service. |
211 scoped_ptr<base::OneShotTimer> backend_start_timer_; | 212 std::unique_ptr<base::OneShotTimer> backend_start_timer_; |
212 | 213 |
213 // Used to listen for pref changes to allow or disallow signin. | 214 // Used to listen for pref changes to allow or disallow signin. |
214 PrefChangeRegistrar profile_pref_registrar_; | 215 PrefChangeRegistrar profile_pref_registrar_; |
215 | 216 |
216 #if defined(OS_CHROMEOS) | 217 #if defined(OS_CHROMEOS) |
217 // Used to listen to ChromeOS user image changes. | 218 // Used to listen to ChromeOS user image changes. |
218 content::NotificationRegistrar registrar_; | 219 content::NotificationRegistrar registrar_; |
219 #endif | 220 #endif |
220 | 221 |
221 // Manages observer lifetime. | 222 // Manages observer lifetime. |
222 ScopedObserver<ProfileSyncService, PeopleHandler> sync_service_observer_; | 223 ScopedObserver<ProfileSyncService, PeopleHandler> sync_service_observer_; |
223 | 224 |
224 DISALLOW_COPY_AND_ASSIGN(PeopleHandler); | 225 DISALLOW_COPY_AND_ASSIGN(PeopleHandler); |
225 }; | 226 }; |
226 | 227 |
227 } // namespace settings | 228 } // namespace settings |
228 | 229 |
229 #endif // CHROME_BROWSER_UI_WEBUI_SETTINGS_PEOPLE_HANDLER_H_ | 230 #endif // CHROME_BROWSER_UI_WEBUI_SETTINGS_PEOPLE_HANDLER_H_ |
OLD | NEW |