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 // The signin manager encapsulates some functionality tracking | 5 // The signin manager encapsulates some functionality tracking |
6 // which user is signed in. See SigninManagerBase for full description of | 6 // which user is signed in. See SigninManagerBase for full description of |
7 // responsibilities. The class defined in this file provides functionality | 7 // responsibilities. The class defined in this file provides functionality |
8 // required by all platforms except Chrome OS. | 8 // required by all platforms except Chrome OS. |
9 // | 9 // |
10 // When a user is signed in, a ClientLogin request is run on their behalf. | 10 // When a user is signed in, a ClientLogin request is run on their behalf. |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 // If true, signout is prohibited for this profile (calls to SignOut() are | 167 // If true, signout is prohibited for this profile (calls to SignOut() are |
168 // ignored). | 168 // ignored). |
169 bool IsSignoutProhibited() const; | 169 bool IsSignoutProhibited() const; |
170 | 170 |
171 // Checks if signin is allowed for the profile that owns |io_data|. This must | 171 // Checks if signin is allowed for the profile that owns |io_data|. This must |
172 // be invoked on the IO thread, and can be used to check if signin is enabled | 172 // be invoked on the IO thread, and can be used to check if signin is enabled |
173 // on that thread. | 173 // on that thread. |
174 static bool IsSigninAllowedOnIOThread(ProfileIOData* io_data); | 174 static bool IsSigninAllowedOnIOThread(ProfileIOData* io_data); |
175 | 175 |
176 // Allows the SigninManager to track the privileged signin process | 176 // Allows the SigninManager to track the privileged signin process |
177 // identified by |process_id| so that we can later ask (via IsSigninProcess) | 177 // identified by |host_id| so that we can later ask (via IsSigninProcess) |
178 // if it is safe to sign the user in from the current context (see | 178 // if it is safe to sign the user in from the current context (see |
179 // OneClickSigninHelper). All of this tracking state is reset once the | 179 // OneClickSigninHelper). All of this tracking state is reset once the |
180 // renderer process terminates. | 180 // renderer process terminates. |
181 void SetSigninProcess(int process_id); | 181 // |
| 182 // N.B. This is the id returned by RenderProcessHost::GetID(). |
| 183 void SetSigninProcess(int host_id); |
182 void ClearSigninProcess(); | 184 void ClearSigninProcess(); |
183 bool IsSigninProcess(int process_id) const; | 185 bool IsSigninProcess(int host_id) const; |
184 bool HasSigninProcess() const; | 186 bool HasSigninProcess() const; |
185 | 187 |
186 protected: | 188 protected: |
187 // Flag saying whether signing out is allowed. | 189 // Flag saying whether signing out is allowed. |
188 bool prohibit_signout_; | 190 bool prohibit_signout_; |
189 | 191 |
190 private: | 192 private: |
191 enum SigninType { | 193 enum SigninType { |
192 SIGNIN_TYPE_NONE, | 194 SIGNIN_TYPE_NONE, |
193 SIGNIN_TYPE_WITH_CREDENTIALS, | 195 SIGNIN_TYPE_WITH_CREDENTIALS, |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 | 269 |
268 // Temporarily saves the oauth2 refresh and access tokens when signing in | 270 // Temporarily saves the oauth2 refresh and access tokens when signing in |
269 // with credentials. These will be passed to TokenService so that it does | 271 // with credentials. These will be passed to TokenService so that it does |
270 // not need to mint new ones. | 272 // not need to mint new ones. |
271 ClientOAuthResult temp_oauth_login_tokens_; | 273 ClientOAuthResult temp_oauth_login_tokens_; |
272 | 274 |
273 base::WeakPtrFactory<SigninManager> weak_pointer_factory_; | 275 base::WeakPtrFactory<SigninManager> weak_pointer_factory_; |
274 | 276 |
275 // See SetSigninProcess. Tracks the currently active signin process | 277 // See SetSigninProcess. Tracks the currently active signin process |
276 // by ID, if there is one. | 278 // by ID, if there is one. |
277 int signin_process_id_; | 279 int signin_host_id_; |
278 | 280 |
279 // Callback invoked during signin after an OAuth token has been fetched | 281 // Callback invoked during signin after an OAuth token has been fetched |
280 // but before signin is complete. | 282 // but before signin is complete. |
281 OAuthTokenFetchedCallback oauth_token_fetched_callback_; | 283 OAuthTokenFetchedCallback oauth_token_fetched_callback_; |
282 | 284 |
283 scoped_ptr<SigninManagerDelegate> delegate_; | 285 scoped_ptr<SigninManagerDelegate> delegate_; |
284 | 286 |
285 // Helper object to listen for changes to signin preferences stored in non- | 287 // Helper object to listen for changes to signin preferences stored in non- |
286 // profile-specific local prefs (like kGoogleServicesUsernamePattern). | 288 // profile-specific local prefs (like kGoogleServicesUsernamePattern). |
287 PrefChangeRegistrar local_state_pref_registrar_; | 289 PrefChangeRegistrar local_state_pref_registrar_; |
288 | 290 |
289 // Helper object to listen for changes to the signin allowed preference. | 291 // Helper object to listen for changes to the signin allowed preference. |
290 BooleanPrefMember signin_allowed_; | 292 BooleanPrefMember signin_allowed_; |
291 | 293 |
292 DISALLOW_COPY_AND_ASSIGN(SigninManager); | 294 DISALLOW_COPY_AND_ASSIGN(SigninManager); |
293 }; | 295 }; |
294 | 296 |
295 #endif // !defined(OS_CHROMEOS) | 297 #endif // !defined(OS_CHROMEOS) |
296 | 298 |
297 #endif // CHROME_BROWSER_SIGNIN_SIGNIN_MANAGER_H_ | 299 #endif // CHROME_BROWSER_SIGNIN_SIGNIN_MANAGER_H_ |
OLD | NEW |