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 class ProfileSyncService; | 23 class ProfileSyncService; |
24 | 24 |
25 namespace content { | 25 namespace content { |
26 class WebContents; | 26 class WebContents; |
27 } // namespace content | 27 } |
| 28 |
| 29 namespace sync_driver { |
| 30 class SyncSetupInProgressHandle; |
| 31 } |
28 | 32 |
29 // Waits for successful sign-in notification from the signin manager and then | 33 // Waits for successful sign-in notification from the signin manager and then |
30 // starts the sync machine. Instances of this class delete themselves once | 34 // starts the sync machine. Instances of this class delete themselves once |
31 // the job is done. | 35 // the job is done. |
32 class OneClickSigninSyncStarter : public SigninTracker::Observer, | 36 class OneClickSigninSyncStarter : public SigninTracker::Observer, |
33 public chrome::BrowserListObserver, | 37 public chrome::BrowserListObserver, |
34 public content::WebContentsObserver, | 38 public content::WebContentsObserver, |
35 public LoginUIService::Observer { | 39 public LoginUIService::Observer { |
36 public: | 40 public: |
37 enum StartSyncMode { | 41 enum StartSyncMode { |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 // Policy credentials we keep while determining whether to create | 235 // Policy credentials we keep while determining whether to create |
232 // a new profile for an enterprise user or not. | 236 // a new profile for an enterprise user or not. |
233 std::string dm_token_; | 237 std::string dm_token_; |
234 std::string client_id_; | 238 std::string client_id_; |
235 | 239 |
236 // This only cares about the first AccountAddedToCookie event. Since | 240 // This only cares about the first AccountAddedToCookie event. Since |
237 // SigninTracker always expects an observer, this object will just disregard | 241 // SigninTracker always expects an observer, this object will just disregard |
238 // following AccountAddedToCookie calls triggered by account reconciliation. | 242 // following AccountAddedToCookie calls triggered by account reconciliation. |
239 bool first_account_added_to_cookie_; | 243 bool first_account_added_to_cookie_; |
240 | 244 |
| 245 // Handle preventing Sync from running until configuration is complete. |
| 246 std::unique_ptr<sync_driver::SyncSetupInProgressHandle> setup_handle_; |
| 247 |
241 base::WeakPtrFactory<OneClickSigninSyncStarter> weak_pointer_factory_; | 248 base::WeakPtrFactory<OneClickSigninSyncStarter> weak_pointer_factory_; |
242 | 249 |
243 DISALLOW_COPY_AND_ASSIGN(OneClickSigninSyncStarter); | 250 DISALLOW_COPY_AND_ASSIGN(OneClickSigninSyncStarter); |
244 }; | 251 }; |
245 | 252 |
246 | 253 |
247 #endif // CHROME_BROWSER_UI_SYNC_ONE_CLICK_SIGNIN_SYNC_STARTER_H_ | 254 #endif // CHROME_BROWSER_UI_SYNC_ONE_CLICK_SIGNIN_SYNC_STARTER_H_ |
OLD | NEW |