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

Side by Side Diff: chrome/browser/signin/easy_unlock_service_regular.cc

Issue 729803002: Easy Sign-in: Use TPM RSA key to sign nonce in sign-in protocol (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 6 years 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/signin/easy_unlock_service_regular.h" 5 #include "chrome/browser/signin/easy_unlock_service_regular.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/metrics/field_trial.h" 9 #include "base/metrics/field_trial.h"
10 #include "base/prefs/pref_service.h" 10 #include "base/prefs/pref_service.h"
11 #include "base/prefs/scoped_user_pref_update.h" 11 #include "base/prefs/scoped_user_pref_update.h"
12 #include "base/values.h" 12 #include "base/values.h"
13 #include "chrome/browser/extensions/extension_service.h" 13 #include "chrome/browser/extensions/extension_service.h"
14 #include "chrome/browser/profiles/profile.h" 14 #include "chrome/browser/profiles/profile.h"
15 #include "chrome/browser/signin/easy_unlock_toggle_flow.h" 15 #include "chrome/browser/signin/easy_unlock_toggle_flow.h"
16 #include "chrome/browser/signin/screenlock_bridge.h" 16 #include "chrome/browser/signin/screenlock_bridge.h"
17 #include "chrome/browser/ui/extensions/application_launch.h" 17 #include "chrome/browser/ui/extensions/application_launch.h"
18 #include "chrome/common/extensions/extension_constants.h" 18 #include "chrome/common/extensions/extension_constants.h"
19 #include "chrome/common/pref_names.h" 19 #include "chrome/common/pref_names.h"
20 #include "components/pref_registry/pref_registry_syncable.h" 20 #include "components/pref_registry/pref_registry_syncable.h"
21 #include "components/proximity_auth/switches.h" 21 #include "components/proximity_auth/switches.h"
22 #include "content/public/browser/browser_thread.h" 22 #include "content/public/browser/browser_thread.h"
23 #include "extensions/browser/extension_system.h" 23 #include "extensions/browser/extension_system.h"
24 24
25 #if defined(OS_CHROMEOS) 25 #if defined(OS_CHROMEOS)
26 #include "apps/app_lifetime_monitor_factory.h" 26 #include "apps/app_lifetime_monitor_factory.h"
27 #include "base/thread_task_runner_handle.h" 27 #include "base/thread_task_runner_handle.h"
28 #include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_key_manager.h" 28 #include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_key_manager.h"
29 #include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_reauth.h" 29 #include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_reauth.h"
30 #include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_tpm_key_manager. h"
31 #include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_tpm_key_manager_ factory.h"
xiyuan 2014/12/02 23:15:58 nit: Seems not used.
tbarzic 2014/12/03 19:10:28 Done.
30 #include "chrome/browser/chromeos/login/session/user_session_manager.h" 32 #include "chrome/browser/chromeos/login/session/user_session_manager.h"
31 #include "chrome/browser/chromeos/profiles/profile_helper.h" 33 #include "chrome/browser/chromeos/profiles/profile_helper.h"
32 #include "components/user_manager/user_manager.h" 34 #include "components/user_manager/user_manager.h"
33 #endif 35 #endif
34 36
35 namespace { 37 namespace {
36 38
37 // Key name of the local device permit record dictonary in kEasyUnlockPairing. 39 // Key name of the local device permit record dictonary in kEasyUnlockPairing.
38 const char kKeyPermitAccess[] = "permitAccess"; 40 const char kKeyPermitAccess[] = "permitAccess";
39 41
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 prefs::kEasyUnlockPairing); 181 prefs::kEasyUnlockPairing);
180 pairing_update->SetWithoutPathExpansion(kKeyDevices, devices.DeepCopy()); 182 pairing_update->SetWithoutPathExpansion(kKeyDevices, devices.DeepCopy());
181 183
182 #if defined(OS_CHROMEOS) 184 #if defined(OS_CHROMEOS)
183 // TODO(tengs): Investigate if we can determine if the remote devices were set 185 // TODO(tengs): Investigate if we can determine if the remote devices were set
184 // from sync or from the setup app. 186 // from sync or from the setup app.
185 if (short_lived_user_context_ && short_lived_user_context_->user_context() && 187 if (short_lived_user_context_ && short_lived_user_context_->user_context() &&
186 !devices.empty()) { 188 !devices.empty()) {
187 // We may already have the password cached, so proceed to create the 189 // We may already have the password cached, so proceed to create the
188 // cryptohome keys for sign-in or the system will be hardlocked. 190 // cryptohome keys for sign-in or the system will be hardlocked.
189 chromeos::UserContext* user_context = 191 chromeos::UserSessionManager::GetInstance()->GetEasyUnlockKeyManager()
190 short_lived_user_context_->user_context(); 192 ->RefreshKeys(
191 chromeos::EasyUnlockKeyManager* key_manager = 193 *short_lived_user_context_->user_context(),
192 chromeos::UserSessionManager::GetInstance()->GetEasyUnlockKeyManager(); 194 devices,
193 195 base::Bind(&EasyUnlockServiceRegular::OnKeysRefreshedForSetDevices,
194 key_manager->RefreshKeys( 196 weak_ptr_factory_.GetWeakPtr()));
195 *user_context, devices,
196 base::Bind(&EasyUnlockServiceRegular::OnKeysRefreshedForSetDevices,
197 weak_ptr_factory_.GetWeakPtr()));
198 } else { 197 } else {
199 CheckCryptohomeKeysAndMaybeHardlock(); 198 CheckCryptohomeKeysAndMaybeHardlock();
200 } 199 }
201 #else 200 #else
202 CheckCryptohomeKeysAndMaybeHardlock(); 201 CheckCryptohomeKeysAndMaybeHardlock();
203 #endif 202 #endif
204 } 203 }
205 204
206 void EasyUnlockServiceRegular::ClearRemoteDevices() { 205 void EasyUnlockServiceRegular::ClearRemoteDevices() {
207 DictionaryPrefUpdate pairing_update(profile()->GetPrefs(), 206 DictionaryPrefUpdate pairing_update(profile()->GetPrefs(),
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 325
327 if (!success) { 326 if (!success) {
328 SetTurnOffFlowStatus(FAIL); 327 SetTurnOffFlowStatus(FAIL);
329 return; 328 return;
330 } 329 }
331 330
332 ClearRemoteDevices(); 331 ClearRemoteDevices();
333 SetTurnOffFlowStatus(IDLE); 332 SetTurnOffFlowStatus(IDLE);
334 ReloadApp(); 333 ReloadApp();
335 } 334 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698