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 "chrome/browser/signin/signin_tracker.h" | 10 #include "chrome/browser/signin/signin_tracker.h" |
11 | 11 |
12 class Browser; | 12 class Browser; |
13 | 13 |
14 // Waits for successful singin notification from the signin manager and then | 14 // Waits for successful singin notification from the signin manager and then |
15 // starts the sync machine. Instances of this class delete themselves once | 15 // starts the sync machine. Instances of this class delete themselves once |
16 // the job is done. | 16 // the job is done. |
17 class OneClickSigninSyncStarter : public SigninTracker::Observer { | 17 class OneClickSigninSyncStarter : public SigninTracker::Observer { |
18 public: | 18 public: |
19 enum StartSyncMode { | 19 enum StartSyncMode { |
20 // Starts the process of signing the user in with the SigninManager, and | 20 // Starts the process of signing the user in with the SigninManager, and |
21 // once completed automatically starts sync with all data types enabled. | 21 // once completed automatically starts sync with all data types enabled. |
22 SYNC_WITH_DEFAULT_SETTINGS, | 22 SYNC_WITH_DEFAULT_SETTINGS, |
23 | 23 |
24 // Starts the process of signing the user in with the SigninManager, and | 24 // Starts the process of signing the user in with the SigninManager, and |
25 // once completed redirects the user to the settings page to allow them | 25 // once completed redirects the user to the settings page to allow them |
26 // to configure which data types to sync before sync is enabled. | 26 // to configure which data types to sync before sync is enabled. |
27 CONFIGURE_SYNC_FIRST | 27 CONFIGURE_SYNC_FIRST |
28 }; | 28 }; |
29 | 29 |
30 // |profile| must not be NULL, however |browser| can be. When using the | 30 OneClickSigninSyncStarter(Browser* browser, |
31 // OneClickSigninSyncStarter from a browser, provide both. | |
32 OneClickSigninSyncStarter(Profile* profile, | |
33 Browser* browser, | |
34 const std::string& session_index, | 31 const std::string& session_index, |
35 const std::string& email, | 32 const std::string& email, |
36 const std::string& password, | 33 const std::string& password, |
37 StartSyncMode start_mode); | 34 StartSyncMode start_mode); |
38 | 35 |
39 private: | 36 private: |
40 virtual ~OneClickSigninSyncStarter(); | 37 virtual ~OneClickSigninSyncStarter(); |
41 | 38 |
42 // SigninTracker::Observer override. | 39 // SigninTracker::Observer override. |
43 virtual void GaiaCredentialsValid() OVERRIDE; | 40 virtual void GaiaCredentialsValid() OVERRIDE; |
44 virtual void SigninFailed(const GoogleServiceAuthError& error) OVERRIDE; | 41 virtual void SigninFailed(const GoogleServiceAuthError& error) OVERRIDE; |
45 virtual void SigninSuccess() OVERRIDE; | 42 virtual void SigninSuccess() OVERRIDE; |
46 | 43 |
47 Profile* profile_; | |
48 Browser* browser_; | 44 Browser* browser_; |
49 SigninTracker signin_tracker_; | 45 SigninTracker signin_tracker_; |
50 StartSyncMode start_mode_; | 46 StartSyncMode start_mode_; |
51 | 47 |
52 DISALLOW_COPY_AND_ASSIGN(OneClickSigninSyncStarter); | 48 DISALLOW_COPY_AND_ASSIGN(OneClickSigninSyncStarter); |
53 }; | 49 }; |
54 | 50 |
55 | 51 |
56 #endif // CHROME_BROWSER_UI_SYNC_ONE_CLICK_SIGNIN_SYNC_STARTER_H_ | 52 #endif // CHROME_BROWSER_UI_SYNC_ONE_CLICK_SIGNIN_SYNC_STARTER_H_ |
OLD | NEW |