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