OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_SYNC_ONE_CLICK_SIGNIN_SYNC_STARTER_H_ | 5 #ifndef CHROME_BROWSER_UI_SYNC_ONE_CLICK_SIGNIN_SYNC_STARTER_H_ |
6 #define CHROME_BROWSER_UI_SYNC_ONE_CLICK_SIGNIN_SYNC_STARTER_H_ | 6 #define CHROME_BROWSER_UI_SYNC_ONE_CLICK_SIGNIN_SYNC_STARTER_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/callback_forward.h" | 11 #include "base/callback_forward.h" |
12 #include "base/gtest_prod_util.h" | 12 #include "base/gtest_prod_util.h" |
13 #include "base/macros.h" | 13 #include "base/macros.h" |
14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
15 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
16 #include "chrome/browser/ui/browser_list_observer.h" | 16 #include "chrome/browser/ui/browser_list_observer.h" |
17 #include "chrome/browser/ui/sync/profile_signin_confirmation_helper.h" | 17 #include "chrome/browser/ui/sync/profile_signin_confirmation_helper.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/signin/core/browser/signin_tracker.h" | 19 #include "components/signin/core/browser/signin_tracker.h" |
20 #include "content/public/browser/web_contents_observer.h" | 20 #include "content/public/browser/web_contents_observer.h" |
21 | 21 |
22 class Browser; | 22 class Browser; |
| 23 |
| 24 namespace browser_sync { |
23 class ProfileSyncService; | 25 class ProfileSyncService; |
| 26 } // namespace browser_sync |
24 | 27 |
25 namespace content { | 28 namespace content { |
26 class WebContents; | 29 class WebContents; |
27 } | 30 } // namespace content |
28 | 31 |
29 namespace sync_driver { | 32 namespace sync_driver { |
30 class SyncSetupInProgressHandle; | 33 class SyncSetupInProgressHandle; |
31 } | 34 } // namespace sync_driver |
32 | 35 |
33 // Waits for successful sign-in notification from the signin manager and then | 36 // Waits for successful sign-in notification from the signin manager and then |
34 // starts the sync machine. Instances of this class delete themselves once | 37 // starts the sync machine. Instances of this class delete themselves once |
35 // the job is done. | 38 // the job is done. |
36 class OneClickSigninSyncStarter : public SigninTracker::Observer, | 39 class OneClickSigninSyncStarter : public SigninTracker::Observer, |
37 public chrome::BrowserListObserver, | 40 public chrome::BrowserListObserver, |
38 public content::WebContentsObserver, | 41 public content::WebContentsObserver, |
39 public LoginUIService::Observer { | 42 public LoginUIService::Observer { |
40 public: | 43 public: |
41 enum StartSyncMode { | 44 enum StartSyncMode { |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 // Callback invoked once the user has responded to the signin confirmation UI. | 193 // Callback invoked once the user has responded to the signin confirmation UI. |
191 // If response == UNDO_SYNC, the signin is cancelled, otherwise the pending | 194 // If response == UNDO_SYNC, the signin is cancelled, otherwise the pending |
192 // signin is completed. | 195 // signin is completed. |
193 void UntrustedSigninConfirmed(StartSyncMode response); | 196 void UntrustedSigninConfirmed(StartSyncMode response); |
194 | 197 |
195 // GetProfileSyncService returns non-NULL pointer if sync is enabled. | 198 // GetProfileSyncService returns non-NULL pointer if sync is enabled. |
196 // There is a scenario when when ProfileSyncService discovers that sync is | 199 // There is a scenario when when ProfileSyncService discovers that sync is |
197 // disabled during setup. In this case GetProfileSyncService will return NULL, | 200 // disabled during setup. In this case GetProfileSyncService will return NULL, |
198 // but we still need to call PSS::SetSetupInProgress(false). For this purpose | 201 // but we still need to call PSS::SetSetupInProgress(false). For this purpose |
199 // call FinishProfileSyncServiceSetup() function. | 202 // call FinishProfileSyncServiceSetup() function. |
200 ProfileSyncService* GetProfileSyncService(); | 203 browser_sync::ProfileSyncService* GetProfileSyncService(); |
201 | 204 |
202 void FinishProfileSyncServiceSetup(); | 205 void FinishProfileSyncServiceSetup(); |
203 | 206 |
204 // Displays the settings UI and brings up the advanced sync settings | 207 // Displays the settings UI and brings up the advanced sync settings |
205 // dialog if |configure_sync| is true. The web contents provided to the | 208 // dialog if |configure_sync| is true. The web contents provided to the |
206 // constructor is used if it's showing a blank page and not about to be | 209 // constructor is used if it's showing a blank page and not about to be |
207 // closed. Otherwise, a new tab or an existing settings tab is used. | 210 // closed. Otherwise, a new tab or an existing settings tab is used. |
208 void ShowSettingsPage(bool configure_sync); | 211 void ShowSettingsPage(bool configure_sync); |
209 | 212 |
210 // Displays a settings page in the provided web contents. |sub_page| can be | 213 // Displays a settings page in the provided web contents. |sub_page| can be |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 // Prevents Sync from running until configuration is complete. | 248 // Prevents Sync from running until configuration is complete. |
246 std::unique_ptr<sync_driver::SyncSetupInProgressHandle> sync_blocker_; | 249 std::unique_ptr<sync_driver::SyncSetupInProgressHandle> sync_blocker_; |
247 | 250 |
248 base::WeakPtrFactory<OneClickSigninSyncStarter> weak_pointer_factory_; | 251 base::WeakPtrFactory<OneClickSigninSyncStarter> weak_pointer_factory_; |
249 | 252 |
250 DISALLOW_COPY_AND_ASSIGN(OneClickSigninSyncStarter); | 253 DISALLOW_COPY_AND_ASSIGN(OneClickSigninSyncStarter); |
251 }; | 254 }; |
252 | 255 |
253 | 256 |
254 #endif // CHROME_BROWSER_UI_SYNC_ONE_CLICK_SIGNIN_SYNC_STARTER_H_ | 257 #endif // CHROME_BROWSER_UI_SYNC_ONE_CLICK_SIGNIN_SYNC_STARTER_H_ |
OLD | NEW |