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 {SYNC_WITH_DEFAULT_SETTINGS, CONFIGURE_SYNC_FIRST }; | 19 enum StartSyncMode { |
20 // Starts the process of signing the user in with the SigninManager, and | |
21 // once completed automatically starts sync with all data types enabled. | |
22 SYNC_WITH_DEFAULT_SETTINGS, | |
23 | |
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 | |
26 // to configure which data types to sync before sync is enabled. | |
27 CONFIGURE_SYNC_FIRST, | |
28 | |
29 // Starts the process of signing the user in with the SigninManager, and | |
30 // once completed don't do anything wrt sync. This mode is used when using | |
31 // the web-based sign in flow directly from the settings page. This mode | |
Andrew T Wilson (Slow)
2012/12/03 13:19:02
I guess SyncSetupHandler uses SigninTracker to det
Roger Tawa OOO till Jul 10th
2012/12/03 19:08:28
I tried it again and the state is OK. I suspect wh
| |
32 // is distinct from the previous one because redirecting to the settings | |
33 // page from here messes up the internal state of SyncSetupHander. | |
34 SIGNIN_ONLY}; | |
Andrew T Wilson (Slow)
2012/12/03 13:19:02
nit: close paren on its own line.
Roger Tawa OOO till Jul 10th
2012/12/03 19:08:28
Done.
| |
20 | 35 |
21 OneClickSigninSyncStarter(Browser* browser, | 36 OneClickSigninSyncStarter(Browser* browser, |
22 const std::string& session_index, | 37 const std::string& session_index, |
23 const std::string& email, | 38 const std::string& email, |
24 const std::string& password, | 39 const std::string& password, |
25 StartSyncMode start_mode); | 40 StartSyncMode start_mode); |
26 | 41 |
27 private: | 42 private: |
28 virtual ~OneClickSigninSyncStarter(); | 43 virtual ~OneClickSigninSyncStarter(); |
29 | 44 |
30 // SigninTracker::Observer override. | 45 // SigninTracker::Observer override. |
31 virtual void GaiaCredentialsValid() OVERRIDE; | 46 virtual void GaiaCredentialsValid() OVERRIDE; |
32 virtual void SigninFailed(const GoogleServiceAuthError& error) OVERRIDE; | 47 virtual void SigninFailed(const GoogleServiceAuthError& error) OVERRIDE; |
33 virtual void SigninSuccess() OVERRIDE; | 48 virtual void SigninSuccess() OVERRIDE; |
34 | 49 |
35 Browser* browser_; | 50 Browser* browser_; |
36 SigninTracker signin_tracker_; | 51 SigninTracker signin_tracker_; |
37 StartSyncMode start_mode_; | 52 StartSyncMode start_mode_; |
38 | 53 |
39 DISALLOW_COPY_AND_ASSIGN(OneClickSigninSyncStarter); | 54 DISALLOW_COPY_AND_ASSIGN(OneClickSigninSyncStarter); |
40 }; | 55 }; |
41 | 56 |
42 | 57 |
43 #endif // CHROME_BROWSER_UI_SYNC_ONE_CLICK_SIGNIN_SYNC_STARTER_H_ | 58 #endif // CHROME_BROWSER_UI_SYNC_ONE_CLICK_SIGNIN_SYNC_STARTER_H_ |
OLD | NEW |