Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "chrome/browser/chromeos/login/signin/oauth2_login_verifier.h" | 5 #include "chrome/browser/chromeos/login/signin/oauth2_login_verifier.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "content/public/browser/browser_thread.h" | 10 #include "content/public/browser/browser_thread.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 47 if (cookie_manager_service_->ListAccounts(&accounts)) { | 47 if (cookie_manager_service_->ListAccounts(&accounts)) { |
| 48 OnGaiaAccountsInCookieUpdated( | 48 OnGaiaAccountsInCookieUpdated( |
| 49 accounts, GoogleServiceAuthError(GoogleServiceAuthError::NONE)); | 49 accounts, GoogleServiceAuthError(GoogleServiceAuthError::NONE)); |
| 50 } | 50 } |
| 51 } | 51 } |
| 52 | 52 |
| 53 void OAuth2LoginVerifier::VerifyProfileTokens(Profile* profile) { | 53 void OAuth2LoginVerifier::VerifyProfileTokens(Profile* profile) { |
| 54 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 54 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 55 | 55 |
| 56 // TODO(xiyuan,mlerman): Use |access_token_| to cut down one round trip. | 56 // TODO(xiyuan,mlerman): Use |access_token_| to cut down one round trip. |
| 57 // See http://crbug.com/483596 | 57 // See http://crbug.com/483596 |
|
xiyuan
2015/05/06 18:43:16
nit: Remove the TODO?
Mike Lerman
2015/05/06 19:24:02
Done.
| |
| 58 cookie_manager_service_->AddAccountToCookie(primary_account_id_); | 58 cookie_manager_service_->AddAccountToCookieWithToken(primary_account_id_, |
| 59 access_token_); | |
| 59 } | 60 } |
| 60 | 61 |
| 61 void OAuth2LoginVerifier::OnAddAccountToCookieCompleted( | 62 void OAuth2LoginVerifier::OnAddAccountToCookieCompleted( |
| 62 const std::string& account_id, | 63 const std::string& account_id, |
| 63 const GoogleServiceAuthError& error) { | 64 const GoogleServiceAuthError& error) { |
| 64 if (account_id != primary_account_id_) | 65 if (account_id != primary_account_id_) |
| 65 return; | 66 return; |
| 66 | 67 |
| 67 if (error.state() == GoogleServiceAuthError::State::NONE) { | 68 if (error.state() == GoogleServiceAuthError::State::NONE) { |
| 68 VLOG(1) << "MergeSession successful."; | 69 VLOG(1) << "MergeSession successful."; |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 83 delegate_->OnListAccountsSuccess(accounts); | 84 delegate_->OnListAccountsSuccess(accounts); |
| 84 return; | 85 return; |
| 85 } | 86 } |
| 86 | 87 |
| 87 LOG(WARNING) << "Failed to get list of session accounts, " | 88 LOG(WARNING) << "Failed to get list of session accounts, " |
| 88 << " error: " << error.state(); | 89 << " error: " << error.state(); |
| 89 delegate_->OnListAccountsFailure(IsConnectionOrServiceError(error)); | 90 delegate_->OnListAccountsFailure(IsConnectionOrServiceError(error)); |
| 90 } | 91 } |
| 91 | 92 |
| 92 } // namespace chromeos | 93 } // namespace chromeos |
| OLD | NEW |