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

Side by Side Diff: chrome/browser/chromeos/login/easy_unlock/bootstrap_user_context_initializer.cc

Issue 1693383003: ChromeOS cryptohome should be able to use gaia id as user identifier. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add missing files. Created 4 years, 10 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
OLDNEW
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"
11 #include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_key_manager.h" 11 #include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_key_manager.h"
12 #include "chrome/browser/chromeos/login/session/user_session_manager.h" 12 #include "chrome/browser/chromeos/login/session/user_session_manager.h"
13 #include "chrome/browser/chromeos/profiles/profile_helper.h" 13 #include "chrome/browser/chromeos/profiles/profile_helper.h"
14 #include "chrome/browser/signin/easy_unlock_service_signin_chromeos.h" 14 #include "chrome/browser/signin/easy_unlock_service_signin_chromeos.h"
15 #include "chromeos/login/user_names.h"
16 #include "components/user_manager/known_user.h"
15 #include "components/user_manager/user_manager.h" 17 #include "components/user_manager/user_manager.h"
16 #include "crypto/random.h" 18 #include "crypto/random.h"
17 #include "google_apis/gaia/gaia_constants.h" 19 #include "google_apis/gaia/gaia_constants.h"
18 #include "google_apis/gaia/gaia_urls.h" 20 #include "google_apis/gaia/gaia_urls.h"
19 21
20 namespace chromeos { 22 namespace chromeos {
21 23
22 namespace { 24 namespace {
23 25
24 const int kMaxGaiaRetries = 5; 26 const int kMaxGaiaRetries = 5;
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 scoped_ptr<base::DictionaryValue> user_info) { 170 scoped_ptr<base::DictionaryValue> user_info) {
169 std::string email; 171 std::string email;
170 std::string gaia_id; 172 std::string gaia_id;
171 if (!user_info->GetString("email", &email) || 173 if (!user_info->GetString("email", &email) ||
172 !user_info->GetString("id", &gaia_id)) { 174 !user_info->GetString("id", &gaia_id)) {
173 LOG(ERROR) << "Bad user info."; 175 LOG(ERROR) << "Bad user info.";
174 Notify(false); 176 Notify(false);
175 return; 177 return;
176 } 178 }
177 179
178 user_context_.SetUserID(email); 180 user_context_.SetAccountId(user_manager::known_user::GetAccountId(
179 user_context_.SetGaiaID(gaia_id); 181 login::CanonicalizeUserID(email), gaia_id));
180 StartCheckExistingKeys(); 182 StartCheckExistingKeys();
181 } 183 }
182 184
183 void BootstrapUserContextInitializer::OnOAuthError() { 185 void BootstrapUserContextInitializer::OnOAuthError() {
184 LOG(ERROR) << "Auth error."; 186 LOG(ERROR) << "Auth error.";
185 Notify(false); 187 Notify(false);
186 } 188 }
187 189
188 void BootstrapUserContextInitializer::OnNetworkError(int response_code) { 190 void BootstrapUserContextInitializer::OnNetworkError(int response_code) {
189 LOG(ERROR) << "Network error."; 191 LOG(ERROR) << "Network error.";
(...skipping 11 matching lines...) Expand all
201 EasyUnlockService::Get(ProfileHelper::GetSigninProfile()); 203 EasyUnlockService::Get(ProfileHelper::GetSigninProfile());
202 service->RemoveObserver(this); 204 service->RemoveObserver(this);
203 205
204 service->AttemptAuth( 206 service->AttemptAuth(
205 user_context_.GetAccountId(), 207 user_context_.GetAccountId(),
206 base::Bind(&BootstrapUserContextInitializer::OnEasyUnlockAuthenticated, 208 base::Bind(&BootstrapUserContextInitializer::OnEasyUnlockAuthenticated,
207 weak_ptr_factory_.GetWeakPtr())); 209 weak_ptr_factory_.GetWeakPtr()));
208 } 210 }
209 211
210 } // namespace chromeos 212 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698