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" |
(...skipping 20 matching lines...) Expand all Loading... |
31 | 31 |
32 // Starts the process of signing the user in with the SigninManager, and | 32 // 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 | 33 // once completed redirects the user to the settings page to allow them |
34 // to configure which data types to sync before sync is enabled. | 34 // to configure which data types to sync before sync is enabled. |
35 CONFIGURE_SYNC_FIRST, | 35 CONFIGURE_SYNC_FIRST, |
36 | 36 |
37 // The process should be aborted because the undo button has been pressed. | 37 // The process should be aborted because the undo button has been pressed. |
38 UNDO_SYNC | 38 UNDO_SYNC |
39 }; | 39 }; |
40 | 40 |
| 41 enum ConfirmationRequired { |
| 42 // No need to display a "post-signin" confirmation bubble (for example, if |
| 43 // the user was doing a re-auth flow). |
| 44 NO_CONFIRMATION, |
| 45 |
| 46 // Signin flow redirected outside of trusted domains, so ask the user to |
| 47 // confirm before signing in. |
| 48 CONFIRM_UNTRUSTED_SIGNIN, |
| 49 |
| 50 // Display a confirmation after signing in. |
| 51 CONFIRM_AFTER_SIGNIN |
| 52 }; |
| 53 |
41 // |profile| must not be NULL, however |browser| can be. When using the | 54 // |profile| must not be NULL, however |browser| can be. When using the |
42 // OneClickSigninSyncStarter from a browser, provide both. | 55 // OneClickSigninSyncStarter from a browser, provide both. |
43 // If |display_confirmation| is true, the user will be prompted to confirm the | 56 // If |display_confirmation| is true, the user will be prompted to confirm the |
44 // signin before signin completes. | 57 // signin before signin completes. |
45 OneClickSigninSyncStarter(Profile* profile, | 58 OneClickSigninSyncStarter(Profile* profile, |
46 Browser* browser, | 59 Browser* browser, |
47 const std::string& session_index, | 60 const std::string& session_index, |
48 const std::string& email, | 61 const std::string& email, |
49 const std::string& password, | 62 const std::string& password, |
50 StartSyncMode start_mode, | 63 StartSyncMode start_mode, |
51 bool force_same_tab_navigation, | 64 bool force_same_tab_navigation, |
52 bool display_confirmation); | 65 ConfirmationRequired display_confirmation); |
53 | 66 |
54 private: | 67 private: |
55 virtual ~OneClickSigninSyncStarter(); | 68 virtual ~OneClickSigninSyncStarter(); |
56 | 69 |
57 // Initializes the internals of the OneClickSigninSyncStarter object. Can also | 70 // Initializes the internals of the OneClickSigninSyncStarter object. Can also |
58 // be used to re-initialize the object to refer to a newly created profile. | 71 // be used to re-initialize the object to refer to a newly created profile. |
59 void Initialize(Profile* profile, Browser* browser); | 72 void Initialize(Profile* profile, Browser* browser); |
60 | 73 |
61 // SigninTracker::Observer override. | 74 // SigninTracker::Observer override. |
62 virtual void GaiaCredentialsValid() OVERRIDE; | 75 virtual void GaiaCredentialsValid() OVERRIDE; |
(...skipping 24 matching lines...) Expand all Loading... |
87 Profile::CreateStatus status); | 100 Profile::CreateStatus status); |
88 | 101 |
89 // Cancels the in-progress signin for this profile. | 102 // Cancels the in-progress signin for this profile. |
90 void CancelSigninAndDelete(); | 103 void CancelSigninAndDelete(); |
91 #endif // defined(ENABLE_CONFIGURATION_POLICY) | 104 #endif // defined(ENABLE_CONFIGURATION_POLICY) |
92 | 105 |
93 // Callback invoked to check whether the user needs policy or if a | 106 // Callback invoked to check whether the user needs policy or if a |
94 // confirmation is required (in which case we have to prompt the user first). | 107 // confirmation is required (in which case we have to prompt the user first). |
95 void ConfirmSignin(const std::string& oauth_token); | 108 void ConfirmSignin(const std::string& oauth_token); |
96 | 109 |
97 // Displays confirmation UI to the user if confirmation_required_ is true, | 110 // Displays confirmation UI to the user if confirmation_required_ == |
98 // otherwise completes the pending signin process. | 111 // CONFIRM_UNTRUSTED_SIGNIN, otherwise completes the pending signin process. |
99 void SigninAfterSAMLConfirmation(); | 112 void ConfirmAndSignin(); |
100 | 113 |
101 // Callback invoked once the user has responded to the signin confirmation UI. | 114 // Callback invoked once the user has responded to the signin confirmation UI. |
102 // If response == UNDO_SYNC, the signin is cancelled, otherwise the pending | 115 // If response == UNDO_SYNC, the signin is cancelled, otherwise the pending |
103 // signin is completed. | 116 // signin is completed. |
104 void SigninConfirmationComplete(StartSyncMode response); | 117 void UntrustedSigninConfirmed(StartSyncMode response); |
105 | 118 |
106 ProfileSyncService* GetProfileSyncService(); | 119 ProfileSyncService* GetProfileSyncService(); |
107 | 120 |
108 // Displays the sync configuration UI, then frees this object. | 121 // Displays the sync configuration UI. |
109 void ConfigureSync(); | 122 void ConfigureSync(); |
110 void ShowSyncSettingsPageOnSameTab(); | 123 void ShowSyncSettingsPageOnSameTab(); |
111 | 124 |
| 125 // Shows the post-signin confirmation bubble. If |custom_message| is empty, |
| 126 // the default "You are signed in" message is displayed. |
| 127 void DisplayFinalConfirmationBubble(const string16& custom_message); |
| 128 |
| 129 // Makes sure browser_ points to a valid browser (opens a new browser if |
| 130 // necessary). Useful in the case where the user has created a new Profile as |
| 131 // part of the signin process. |
| 132 void EnsureBrowser(); |
| 133 |
112 Profile* profile_; | 134 Profile* profile_; |
113 Browser* browser_; | 135 Browser* browser_; |
114 scoped_ptr<SigninTracker> signin_tracker_; | 136 scoped_ptr<SigninTracker> signin_tracker_; |
115 StartSyncMode start_mode_; | 137 StartSyncMode start_mode_; |
116 chrome::HostDesktopType desktop_type_; | 138 chrome::HostDesktopType desktop_type_; |
117 bool force_same_tab_navigation_; | 139 bool force_same_tab_navigation_; |
118 bool confirmation_required_; | 140 ConfirmationRequired confirmation_required_; |
119 base::WeakPtrFactory<OneClickSigninSyncStarter> weak_pointer_factory_; | 141 base::WeakPtrFactory<OneClickSigninSyncStarter> weak_pointer_factory_; |
120 | 142 |
121 #if defined(ENABLE_CONFIGURATION_POLICY) | 143 #if defined(ENABLE_CONFIGURATION_POLICY) |
122 // CloudPolicyClient reference we keep while determining whether to create | 144 // CloudPolicyClient reference we keep while determining whether to create |
123 // a new profile for an enterprise user or not. | 145 // a new profile for an enterprise user or not. |
124 scoped_ptr<policy::CloudPolicyClient> policy_client_; | 146 scoped_ptr<policy::CloudPolicyClient> policy_client_; |
125 #endif | 147 #endif |
126 | 148 |
127 DISALLOW_COPY_AND_ASSIGN(OneClickSigninSyncStarter); | 149 DISALLOW_COPY_AND_ASSIGN(OneClickSigninSyncStarter); |
128 }; | 150 }; |
129 | 151 |
130 | 152 |
131 #endif // CHROME_BROWSER_UI_SYNC_ONE_CLICK_SIGNIN_SYNC_STARTER_H_ | 153 #endif // CHROME_BROWSER_UI_SYNC_ONE_CLICK_SIGNIN_SYNC_STARTER_H_ |
OLD | NEW |