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

Unified Diff: chrome/browser/chromeos/login/login_utils.cc

Issue 7639004: [ChromeOS] Always fetch oauth cooken when signing in via extension. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix chromeos trybot Created 9 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/chromeos/login/login_utils.h ('k') | chrome/browser/chromeos/login/mock_authenticator.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/login/login_utils.cc
diff --git a/chrome/browser/chromeos/login/login_utils.cc b/chrome/browser/chromeos/login/login_utils.cc
index 192136c337dc1e1b9795066348522b75aabd54c4..a1ff068fffbed4ccf931e735f3e467db3f42b786 100644
--- a/chrome/browser/chromeos/login/login_utils.cc
+++ b/chrome/browser/chromeos/login/login_utils.cc
@@ -247,6 +247,7 @@ class LoginUtilsImpl : public LoginUtils,
: background_view_(NULL),
pending_requests_(false),
using_oauth_(false),
+ has_cookies_(false),
delegate_(NULL) {
}
@@ -256,6 +257,7 @@ class LoginUtilsImpl : public LoginUtils,
const GaiaAuthConsumer::ClientLoginResult& credentials,
bool pending_requests,
bool using_oauth,
+ bool has_cookies,
LoginUtils::Delegate* delegate) OVERRIDE;
// Invoked after the tmpfs is successfully mounted.
@@ -363,6 +365,7 @@ class LoginUtilsImpl : public LoginUtils,
GaiaAuthConsumer::ClientLoginResult credentials_;
bool pending_requests_;
bool using_oauth_;
+ bool has_cookies_;
// Has to be scoped_refptr, see comment for CreateAuthenticator(...).
scoped_refptr<Authenticator> authenticator_;
scoped_ptr<GaiaOAuthFetcher> oauth_fetcher_;
@@ -409,6 +412,7 @@ void LoginUtilsImpl::PrepareProfile(
const GaiaAuthConsumer::ClientLoginResult& credentials,
bool pending_requests,
bool using_oauth,
+ bool has_cookies,
LoginUtils::Delegate* delegate) {
BootTimesLoader* btl = BootTimesLoader::Get();
@@ -433,6 +437,7 @@ void LoginUtilsImpl::PrepareProfile(
credentials_ = credentials;
pending_requests_ = pending_requests;
using_oauth_ = using_oauth;
+ has_cookies_ = has_cookies;
delegate_ = delegate;
// The default profile will have been changed because the ProfileManager
@@ -471,8 +476,8 @@ void LoginUtilsImpl::OnProfileCreated(Profile* user_profile, Status status) {
btl->AddLoginTimeMarker("UserProfileGotten", false);
if (using_oauth_) {
- // Transfer cookies for the new user login.
- if (!pending_requests_) {
+ // Transfer cookies when user signs in using extension.
+ if (has_cookies_) {
// Transfer cookies from the profile that was used for authentication.
// This profile contains cookies that auth extension should have already
// put in place that will ensure that the newly created session is
@@ -485,10 +490,10 @@ void LoginUtilsImpl::OnProfileCreated(Profile* user_profile, Status status) {
}
std::string oauth1_token;
std::string oauth1_secret;
- if (ReadOAuth1AccessToken(user_profile, &oauth1_token, &oauth1_secret) ||
- pending_requests_) {
- // Verify OAuth access token when we find it in the profile and always if
- // we are performing parallel authentication.
+ if (!has_cookies_ &&
+ ReadOAuth1AccessToken(user_profile, &oauth1_token, &oauth1_secret)) {
+ // Verify OAuth access token when we find it in the profile and no cookies
+ // available because user is not signing in using extension.
authenticator_->VerifyOAuth1AccessToken(oauth1_token, oauth1_secret);
} else {
// If we don't have it, fetch OAuth1 access token.
« no previous file with comments | « chrome/browser/chromeos/login/login_utils.h ('k') | chrome/browser/chromeos/login/mock_authenticator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698