Chromium Code Reviews| 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 <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| 11 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
| 12 #include "chrome/browser/signin/signin_tracker.h" | 12 #include "chrome/browser/signin/signin_tracker.h" |
| 13 #include "chrome/browser/ui/browser_list_observer.h" | |
| 13 #include "chrome/browser/ui/host_desktop.h" | 14 #include "chrome/browser/ui/host_desktop.h" |
| 14 | 15 |
| 15 class Browser; | 16 class Browser; |
| 16 class ProfileSyncService; | 17 class ProfileSyncService; |
| 17 | 18 |
| 18 namespace policy { | 19 namespace policy { |
| 19 class CloudPolicyClient; | 20 class CloudPolicyClient; |
| 20 } | 21 } |
| 21 | 22 |
| 22 // Waits for successful singin notification from the signin manager and then | 23 // Waits for successful singin notification from the signin manager and then |
| 23 // starts the sync machine. Instances of this class delete themselves once | 24 // starts the sync machine. Instances of this class delete themselves once |
| 24 // the job is done. | 25 // the job is done. |
| 25 class OneClickSigninSyncStarter : public SigninTracker::Observer { | 26 class OneClickSigninSyncStarter : public SigninTracker::Observer, |
| 27 public chrome::BrowserListObserver { | |
| 26 public: | 28 public: |
| 27 enum StartSyncMode { | 29 enum StartSyncMode { |
| 28 // Starts the process of signing the user in with the SigninManager, and | 30 // Starts the process of signing the user in with the SigninManager, and |
| 29 // once completed automatically starts sync with all data types enabled. | 31 // once completed automatically starts sync with all data types enabled. |
| 30 SYNC_WITH_DEFAULT_SETTINGS, | 32 SYNC_WITH_DEFAULT_SETTINGS, |
| 31 | 33 |
| 32 // Starts the process of signing the user in with the SigninManager, and | 34 // Starts the process of signing the user in with the SigninManager, and |
| 33 // once completed redirects the user to the settings page to allow them | 35 // once completed redirects the user to the settings page to allow them |
| 34 // to configure which data types to sync before sync is enabled. | 36 // to configure which data types to sync before sync is enabled. |
| 35 CONFIGURE_SYNC_FIRST, | 37 CONFIGURE_SYNC_FIRST, |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 57 // signin before signin completes. | 59 // signin before signin completes. |
| 58 OneClickSigninSyncStarter(Profile* profile, | 60 OneClickSigninSyncStarter(Profile* profile, |
| 59 Browser* browser, | 61 Browser* browser, |
| 60 const std::string& session_index, | 62 const std::string& session_index, |
| 61 const std::string& email, | 63 const std::string& email, |
| 62 const std::string& password, | 64 const std::string& password, |
| 63 StartSyncMode start_mode, | 65 StartSyncMode start_mode, |
| 64 bool force_same_tab_navigation, | 66 bool force_same_tab_navigation, |
| 65 ConfirmationRequired display_confirmation); | 67 ConfirmationRequired display_confirmation); |
| 66 | 68 |
| 69 // chrome::BrowserListObserver override. | |
| 70 virtual void OnBrowserRemoved(Browser* browser); | |
|
Roger Tawa OOO till Jul 10th
2013/05/30 18:14:49
Add OVERRIDE macro.
| |
| 71 | |
| 67 private: | 72 private: |
| 68 virtual ~OneClickSigninSyncStarter(); | 73 virtual ~OneClickSigninSyncStarter(); |
| 69 | 74 |
| 70 // Initializes the internals of the OneClickSigninSyncStarter object. Can also | 75 // Initializes the internals of the OneClickSigninSyncStarter object. Can also |
| 71 // be used to re-initialize the object to refer to a newly created profile. | 76 // be used to re-initialize the object to refer to a newly created profile. |
| 72 void Initialize(Profile* profile, Browser* browser); | 77 void Initialize(Profile* profile, Browser* browser); |
| 73 | 78 |
| 74 // SigninTracker::Observer override. | 79 // SigninTracker::Observer override. |
| 75 virtual void GaiaCredentialsValid() OVERRIDE; | 80 virtual void GaiaCredentialsValid() OVERRIDE; |
| 76 virtual void SigninFailed(const GoogleServiceAuthError& error) OVERRIDE; | 81 virtual void SigninFailed(const GoogleServiceAuthError& error) OVERRIDE; |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 144 // CloudPolicyClient reference we keep while determining whether to create | 149 // CloudPolicyClient reference we keep while determining whether to create |
| 145 // a new profile for an enterprise user or not. | 150 // a new profile for an enterprise user or not. |
| 146 scoped_ptr<policy::CloudPolicyClient> policy_client_; | 151 scoped_ptr<policy::CloudPolicyClient> policy_client_; |
| 147 #endif | 152 #endif |
| 148 | 153 |
| 149 DISALLOW_COPY_AND_ASSIGN(OneClickSigninSyncStarter); | 154 DISALLOW_COPY_AND_ASSIGN(OneClickSigninSyncStarter); |
| 150 }; | 155 }; |
| 151 | 156 |
| 152 | 157 |
| 153 #endif // CHROME_BROWSER_UI_SYNC_ONE_CLICK_SIGNIN_SYNC_STARTER_H_ | 158 #endif // CHROME_BROWSER_UI_SYNC_ONE_CLICK_SIGNIN_SYNC_STARTER_H_ |
| OLD | NEW |