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/easy_unlock/bootstrap_user_context_initi
alizer.h" | 5 #include "chrome/browser/chromeos/login/easy_unlock/bootstrap_user_context_initi
alizer.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 kMaxGaiaRetries, this); | 160 kMaxGaiaRetries, this); |
161 } | 161 } |
162 | 162 |
163 void BootstrapUserContextInitializer::OnRefreshTokenResponse( | 163 void BootstrapUserContextInitializer::OnRefreshTokenResponse( |
164 const std::string& access_token, | 164 const std::string& access_token, |
165 int expires_in_seconds) { | 165 int expires_in_seconds) { |
166 token_fetcher_->GetUserInfo(access_token, kMaxGaiaRetries, this); | 166 token_fetcher_->GetUserInfo(access_token, kMaxGaiaRetries, this); |
167 } | 167 } |
168 | 168 |
169 void BootstrapUserContextInitializer::OnGetUserInfoResponse( | 169 void BootstrapUserContextInitializer::OnGetUserInfoResponse( |
170 scoped_ptr<base::DictionaryValue> user_info) { | 170 std::unique_ptr<base::DictionaryValue> user_info) { |
171 std::string email; | 171 std::string email; |
172 std::string gaia_id; | 172 std::string gaia_id; |
173 if (!user_info->GetString("email", &email) || | 173 if (!user_info->GetString("email", &email) || |
174 !user_info->GetString("id", &gaia_id)) { | 174 !user_info->GetString("id", &gaia_id)) { |
175 LOG(ERROR) << "Bad user info."; | 175 LOG(ERROR) << "Bad user info."; |
176 Notify(false); | 176 Notify(false); |
177 return; | 177 return; |
178 } | 178 } |
179 | 179 |
180 user_context_.SetAccountId(user_manager::known_user::GetAccountId( | 180 user_context_.SetAccountId(user_manager::known_user::GetAccountId( |
(...skipping 22 matching lines...) Expand all Loading... |
203 EasyUnlockService::Get(ProfileHelper::GetSigninProfile()); | 203 EasyUnlockService::Get(ProfileHelper::GetSigninProfile()); |
204 service->RemoveObserver(this); | 204 service->RemoveObserver(this); |
205 | 205 |
206 service->AttemptAuth( | 206 service->AttemptAuth( |
207 user_context_.GetAccountId(), | 207 user_context_.GetAccountId(), |
208 base::Bind(&BootstrapUserContextInitializer::OnEasyUnlockAuthenticated, | 208 base::Bind(&BootstrapUserContextInitializer::OnEasyUnlockAuthenticated, |
209 weak_ptr_factory_.GetWeakPtr())); | 209 weak_ptr_factory_.GetWeakPtr())); |
210 } | 210 } |
211 | 211 |
212 } // namespace chromeos | 212 } // namespace chromeos |
OLD | NEW |