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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
45 | 45 |
46 std::vector<std::pair<std::string, bool> > accounts; | 46 std::vector<std::pair<std::string, bool> > accounts; |
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 cookie_manager_service_->AddAccountToCookieWithToken(primary_account_id_, |
56 // TODO(xiyuan,mlerman): Use |access_token_| to cut down one round trip. | 56 access_token_); |
xiyuan
2015/05/19 20:15:30
Sorry, missed this.
|access_token_| could be empt
Mike Lerman
2015/05/20 15:33:07
Ah, I thought there always was one. Thanks! Done.
| |
57 // See http://crbug.com/483596 | |
58 cookie_manager_service_->AddAccountToCookie(primary_account_id_); | |
59 } | 57 } |
60 | 58 |
61 void OAuth2LoginVerifier::OnAddAccountToCookieCompleted( | 59 void OAuth2LoginVerifier::OnAddAccountToCookieCompleted( |
62 const std::string& account_id, | 60 const std::string& account_id, |
63 const GoogleServiceAuthError& error) { | 61 const GoogleServiceAuthError& error) { |
64 if (account_id != primary_account_id_) | 62 if (account_id != primary_account_id_) |
65 return; | 63 return; |
66 | 64 |
67 if (error.state() == GoogleServiceAuthError::State::NONE) { | 65 if (error.state() == GoogleServiceAuthError::State::NONE) { |
68 VLOG(1) << "MergeSession successful."; | 66 VLOG(1) << "MergeSession successful."; |
(...skipping 14 matching lines...) Expand all Loading... | |
83 delegate_->OnListAccountsSuccess(accounts); | 81 delegate_->OnListAccountsSuccess(accounts); |
84 return; | 82 return; |
85 } | 83 } |
86 | 84 |
87 LOG(WARNING) << "Failed to get list of session accounts, " | 85 LOG(WARNING) << "Failed to get list of session accounts, " |
88 << " error: " << error.state(); | 86 << " error: " << error.state(); |
89 delegate_->OnListAccountsFailure(IsConnectionOrServiceError(error)); | 87 delegate_->OnListAccountsFailure(IsConnectionOrServiceError(error)); |
90 } | 88 } |
91 | 89 |
92 } // namespace chromeos | 90 } // namespace chromeos |
OLD | NEW |