Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Side by Side Diff: chrome/browser/signin/signin_manager.h

Issue 9466022: Changes to the sign in manager in preparation for one-click sign in. This CL (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Merge after sync, no new changes Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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. When a user is signed in, a ClientLogin 6 // which user is signed in. When a user is signed in, a ClientLogin
7 // request is run on their behalf. Auth tokens are fetched from Google 7 // request is run on their behalf. Auth tokens are fetched from Google
8 // and the results are stored in the TokenService. 8 // and the results are stored in the TokenService.
9 // 9 //
10 // **NOTE** on semantics of SigninManager: 10 // **NOTE** on semantics of SigninManager:
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 // requests. 75 // requests.
76 virtual void StartSignIn(const std::string& username, 76 virtual void StartSignIn(const std::string& username,
77 const std::string& password, 77 const std::string& password,
78 const std::string& login_token, 78 const std::string& login_token,
79 const std::string& login_captcha); 79 const std::string& login_captcha);
80 80
81 // Used when a second factor access code was required to complete a signin 81 // Used when a second factor access code was required to complete a signin
82 // attempt. 82 // attempt.
83 void ProvideSecondFactorAccessCode(const std::string& access_code); 83 void ProvideSecondFactorAccessCode(const std::string& access_code);
84 84
85 // Attempt to sign in this user with existing credentials from the cookie jar.
86 // Otherwise the result is the same as StartSignIn().
87 virtual void StartSignInWithCredentials(const std::string& username,
88 const std::string& password);
89
85 // Sign a user out, removing the preference, erasing all keys 90 // Sign a user out, removing the preference, erasing all keys
86 // associated with the user, and canceling all auth in progress. 91 // associated with the user, and canceling all auth in progress.
87 virtual void SignOut(); 92 virtual void SignOut();
88 93
89 // Returns the auth error associated with the last login attempt, or None if 94 // Returns the auth error associated with the last login attempt, or None if
90 // there have been no login failures. 95 // there have been no login failures.
91 virtual const GoogleServiceAuthError& GetLoginAuthError() const; 96 virtual const GoogleServiceAuthError& GetLoginAuthError() const;
92 97
93 // Returns true if there's a signin in progress. 98 // Returns true if there's a signin in progress.
94 bool AuthInProgress() const; 99 bool AuthInProgress() const;
95 100
96 // Handles errors if a required user info key is not returned from the 101 // Handles errors if a required user info key is not returned from the
97 // GetUserInfo call. 102 // GetUserInfo call.
98 void OnGetUserInfoKeyNotFound(const std::string& key); 103 void OnGetUserInfoKeyNotFound(const std::string& key);
99 104
100 // GaiaAuthConsumer 105 // GaiaAuthConsumer
101 virtual void OnClientLoginSuccess(const ClientLoginResult& result) OVERRIDE; 106 virtual void OnClientLoginSuccess(const ClientLoginResult& result) OVERRIDE;
102 virtual void OnClientLoginFailure( 107 virtual void OnClientLoginFailure(
103 const GoogleServiceAuthError& error) OVERRIDE; 108 const GoogleServiceAuthError& error) OVERRIDE;
109 virtual void OnOAuthLoginTokenSuccess(const std::string& refresh_token,
110 const std::string& access_token,
111 int expires_in_secs) OVERRIDE;
112 virtual void OnOAuthLoginTokenFailure(
113 const GoogleServiceAuthError& error) OVERRIDE;
104 virtual void OnGetUserInfoSuccess(const UserInfoMap& data) OVERRIDE; 114 virtual void OnGetUserInfoSuccess(const UserInfoMap& data) OVERRIDE;
105 virtual void OnGetUserInfoFailure( 115 virtual void OnGetUserInfoFailure(
106 const GoogleServiceAuthError& error) OVERRIDE; 116 const GoogleServiceAuthError& error) OVERRIDE;
117 virtual void OnTokenAuthSuccess(const net::ResponseCookies& cookies,
118 const std::string& data) OVERRIDE;
107 virtual void OnTokenAuthFailure(const GoogleServiceAuthError& error) OVERRIDE; 119 virtual void OnTokenAuthFailure(const GoogleServiceAuthError& error) OVERRIDE;
120 virtual void OnUberAuthTokenSuccess(const std::string& token) OVERRIDE;
121 virtual void OnUberAuthTokenFailure(
122 const GoogleServiceAuthError& error) OVERRIDE;
108 123
109 // content::NotificationObserver 124 // content::NotificationObserver
110 virtual void Observe(int type, 125 virtual void Observe(int type,
111 const content::NotificationSource& source, 126 const content::NotificationSource& source,
112 const content::NotificationDetails& details) OVERRIDE; 127 const content::NotificationDetails& details) OVERRIDE;
113 128
114 private: 129 private:
115 friend class FakeSigninManager; 130 friend class FakeSigninManager;
116 FRIEND_TEST_ALL_PREFIXES(SigninManagerTest, ClearTransientSigninData); 131 FRIEND_TEST_ALL_PREFIXES(SigninManagerTest, ClearTransientSigninData);
117 FRIEND_TEST_ALL_PREFIXES(SigninManagerTest, ProvideSecondFactorSuccess); 132 FRIEND_TEST_ALL_PREFIXES(SigninManagerTest, ProvideSecondFactorSuccess);
118 FRIEND_TEST_ALL_PREFIXES(SigninManagerTest, ProvideSecondFactorFailure); 133 FRIEND_TEST_ALL_PREFIXES(SigninManagerTest, ProvideSecondFactorFailure);
119 void PrepareForSignin(); 134 void PrepareForSignin();
120 135
121 // Called when a new request to re-authenticate a user is in progress. 136 // Called when a new request to re-authenticate a user is in progress.
122 // Will clear in memory data but leaves the db as such so when the browser 137 // Will clear in memory data but leaves the db as such so when the browser
123 // restarts we can use the old token(which might throw a password error). 138 // restarts we can use the old token(which might throw a password error).
124 void ClearTransientSigninData(); 139 void ClearTransientSigninData();
125 140
141 // Called to handle an error from a GAIA auth fetch. Sets the last error
142 // to |error|, sends out a notification of login failure, and clears the
143 // transient signin data.
144 void HandleAuthError(const GoogleServiceAuthError& error);
145
126 Profile* profile_; 146 Profile* profile_;
127 147
128 // ClientLogin identity. 148 // ClientLogin identity.
129 std::string possibly_invalid_username_; 149 std::string possibly_invalid_username_;
130 std::string password_; // This is kept empty whenever possible. 150 std::string password_; // This is kept empty whenever possible.
131 bool had_two_factor_error_; 151 bool had_two_factor_error_;
132 152
133 void CleanupNotificationRegistration(); 153 void CleanupNotificationRegistration();
134 154
135 // Result of the last client login, kept pending the lookup of the 155 // Result of the last client login, kept pending the lookup of the
136 // canonical email. 156 // canonical email.
137 ClientLoginResult last_result_; 157 ClientLoginResult last_result_;
138 158
139 // Actual client login handler. 159 // Actual client login handler.
140 scoped_ptr<GaiaAuthFetcher> client_login_; 160 scoped_ptr<GaiaAuthFetcher> client_login_;
141 161
142 // Register for notifications from the TokenService. 162 // Register for notifications from the TokenService.
143 content::NotificationRegistrar registrar_; 163 content::NotificationRegistrar registrar_;
144 164
145 // The last error we received when logging in (used to retrieve details like 165 // The last error we received when logging in (used to retrieve details like
146 // captchas, etc). 166 // captchas, etc).
147 GoogleServiceAuthError last_login_auth_error_; 167 GoogleServiceAuthError last_login_auth_error_;
148 168
149 std::string authenticated_username_; 169 std::string authenticated_username_;
150 170
151 DISALLOW_COPY_AND_ASSIGN(SigninManager); 171 DISALLOW_COPY_AND_ASSIGN(SigninManager);
152 }; 172 };
153 173
154 #endif // CHROME_BROWSER_SIGNIN_SIGNIN_MANAGER_H_ 174 #endif // CHROME_BROWSER_SIGNIN_SIGNIN_MANAGER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/signin/signin_manager.cc » ('j') | chrome/browser/signin/signin_manager.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698