| 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 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 // identified by |process_id| so that we can later ask (via IsSigninProcess) | 177 // identified by |process_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 void SetSigninProcess(int process_id); |
| 182 void ClearSigninProcess(); | 182 void ClearSigninProcess(); |
| 183 bool IsSigninProcess(int process_id) const; | 183 bool IsSigninProcess(int process_id) const; |
| 184 bool HasSigninProcess() const; | 184 bool HasSigninProcess() const; |
| 185 | 185 |
| 186 protected: | 186 protected: |
| 187 // If user was signed in, load tokens from DB if available. | |
| 188 virtual void InitTokenService() OVERRIDE; | |
| 189 | |
| 190 // Flag saying whether signing out is allowed. | 187 // Flag saying whether signing out is allowed. |
| 191 bool prohibit_signout_; | 188 bool prohibit_signout_; |
| 192 | 189 |
| 193 private: | 190 private: |
| 194 enum SigninType { | 191 enum SigninType { |
| 195 SIGNIN_TYPE_NONE, | 192 SIGNIN_TYPE_NONE, |
| 196 SIGNIN_TYPE_WITH_CREDENTIALS, | 193 SIGNIN_TYPE_WITH_CREDENTIALS, |
| 197 SIGNIN_TYPE_WITH_OAUTH_CODE | 194 SIGNIN_TYPE_WITH_OAUTH_CODE |
| 198 }; | 195 }; |
| 199 | 196 |
| 200 std::string SigninTypeToString(SigninType type); | 197 std::string SigninTypeToString(SigninType type); |
| 201 friend class FakeSigninManager; | 198 friend class FakeSigninManager; |
| 202 FRIEND_TEST_ALL_PREFIXES(SigninManagerTest, ClearTransientSigninData); | 199 FRIEND_TEST_ALL_PREFIXES(SigninManagerTest, ClearTransientSigninData); |
| 203 FRIEND_TEST_ALL_PREFIXES(SigninManagerTest, ProvideSecondFactorSuccess); | 200 FRIEND_TEST_ALL_PREFIXES(SigninManagerTest, ProvideSecondFactorSuccess); |
| 204 FRIEND_TEST_ALL_PREFIXES(SigninManagerTest, ProvideSecondFactorFailure); | 201 FRIEND_TEST_ALL_PREFIXES(SigninManagerTest, ProvideSecondFactorFailure); |
| 205 | 202 |
| 203 // If user was signed in, load tokens from DB if available. |
| 204 void InitTokenService(); |
| 205 |
| 206 // Called to setup the transient signin data during one of the | 206 // Called to setup the transient signin data during one of the |
| 207 // StartSigninXXX methods. |type| indicates which of the methods is being | 207 // StartSigninXXX methods. |type| indicates which of the methods is being |
| 208 // used to perform the signin while |username| and |password| identify the | 208 // used to perform the signin while |username| and |password| identify the |
| 209 // account to be signed in. Returns false and generates an auth error if the | 209 // account to be signed in. Returns false and generates an auth error if the |
| 210 // passed |username| is not allowed by policy. | 210 // passed |username| is not allowed by policy. |
| 211 bool PrepareForSignin(SigninType type, | 211 bool PrepareForSignin(SigninType type, |
| 212 const std::string& username, | 212 const std::string& username, |
| 213 const std::string& password); | 213 const std::string& password); |
| 214 | 214 |
| 215 // Called to verify GAIA cookies asynchronously before starting auto sign-in | 215 // Called to verify GAIA cookies asynchronously before starting auto sign-in |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 | 285 |
| 286 // Helper object to listen for changes to the signin allowed preference. | 286 // Helper object to listen for changes to the signin allowed preference. |
| 287 BooleanPrefMember signin_allowed_; | 287 BooleanPrefMember signin_allowed_; |
| 288 | 288 |
| 289 DISALLOW_COPY_AND_ASSIGN(SigninManager); | 289 DISALLOW_COPY_AND_ASSIGN(SigninManager); |
| 290 }; | 290 }; |
| 291 | 291 |
| 292 #endif // !defined(OS_CHROMEOS) | 292 #endif // !defined(OS_CHROMEOS) |
| 293 | 293 |
| 294 #endif // CHROME_BROWSER_SIGNIN_SIGNIN_MANAGER_H_ | 294 #endif // CHROME_BROWSER_SIGNIN_SIGNIN_MANAGER_H_ |
| OLD | NEW |