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

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

Issue 1096293003: Move screenlock_bridge to components/proximity_auth (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 7 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/signin/easy_unlock_service_signin_chromeos.h" 5 #include "chrome/browser/signin/easy_unlock_service_signin_chromeos.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/location.h" 9 #include "base/location.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/stl_util.h" 11 #include "base/stl_util.h"
12 #include "base/sys_info.h" 12 #include "base/sys_info.h"
13 #include "base/thread_task_runner_handle.h" 13 #include "base/thread_task_runner_handle.h"
14 #include "base/time/time.h" 14 #include "base/time/time.h"
15 #include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_key_manager.h" 15 #include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_key_manager.h"
16 #include "chrome/browser/chromeos/login/session/user_session_manager.h" 16 #include "chrome/browser/chromeos/login/session/user_session_manager.h"
17 #include "chrome/browser/signin/easy_unlock_app_manager.h" 17 #include "chrome/browser/signin/easy_unlock_app_manager.h"
18 #include "chrome/browser/signin/easy_unlock_metrics.h" 18 #include "chrome/browser/signin/easy_unlock_metrics.h"
19 #include "chrome/browser/signin/proximity_auth_facade.h"
19 #include "chromeos/login/auth/user_context.h" 20 #include "chromeos/login/auth/user_context.h"
20 #include "chromeos/tpm/tpm_token_loader.h" 21 #include "chromeos/tpm/tpm_token_loader.h"
21 22
22 namespace { 23 namespace {
23 24
24 // The maximum allowed backoff interval when waiting for cryptohome to start. 25 // The maximum allowed backoff interval when waiting for cryptohome to start.
25 uint32 kMaxCryptohomeBackoffIntervalMs = 10000u; 26 uint32 kMaxCryptohomeBackoffIntervalMs = 10000u;
26 27
27 // If the data load fails, the initial interval after which the load will be 28 // If the data load fails, the initial interval after which the load will be
28 // retried. Further intervals will exponentially increas by factor 2. 29 // retried. Further intervals will exponentially increas by factor 2.
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 NOTREACHED(); 216 NOTREACHED();
216 } 217 }
217 218
218 void EasyUnlockServiceSignin::InitializeInternal() { 219 void EasyUnlockServiceSignin::InitializeInternal() {
219 if (chromeos::LoginState::Get()->IsUserLoggedIn()) 220 if (chromeos::LoginState::Get()->IsUserLoggedIn())
220 return; 221 return;
221 222
222 service_active_ = true; 223 service_active_ = true;
223 224
224 chromeos::LoginState::Get()->AddObserver(this); 225 chromeos::LoginState::Get()->AddObserver(this);
225 ScreenlockBridge* screenlock_bridge = ScreenlockBridge::Get(); 226 proximity_auth::ScreenlockBridge* screenlock_bridge =
227 GetScreenlockBridgeInstance();
226 screenlock_bridge->AddObserver(this); 228 screenlock_bridge->AddObserver(this);
227 if (!screenlock_bridge->focused_user_id().empty()) 229 if (!screenlock_bridge->focused_user_id().empty())
228 OnFocusedUserChanged(screenlock_bridge->focused_user_id()); 230 OnFocusedUserChanged(screenlock_bridge->focused_user_id());
229 } 231 }
230 232
231 void EasyUnlockServiceSignin::ShutdownInternal() { 233 void EasyUnlockServiceSignin::ShutdownInternal() {
232 if (!service_active_) 234 if (!service_active_)
233 return; 235 return;
234 service_active_ = false; 236 service_active_ = false;
235 237
236 weak_ptr_factory_.InvalidateWeakPtrs(); 238 weak_ptr_factory_.InvalidateWeakPtrs();
237 ScreenlockBridge::Get()->RemoveObserver(this); 239 GetScreenlockBridgeInstance()->RemoveObserver(this);
238 chromeos::LoginState::Get()->RemoveObserver(this); 240 chromeos::LoginState::Get()->RemoveObserver(this);
239 STLDeleteContainerPairSecondPointers(user_data_.begin(), user_data_.end()); 241 STLDeleteContainerPairSecondPointers(user_data_.begin(), user_data_.end());
240 user_data_.clear(); 242 user_data_.clear();
241 } 243 }
242 244
243 bool EasyUnlockServiceSignin::IsAllowedInternal() const { 245 bool EasyUnlockServiceSignin::IsAllowedInternal() const {
244 return service_active_ && 246 return service_active_ &&
245 !user_id_.empty() && 247 !user_id_.empty() &&
246 !chromeos::LoginState::Get()->IsUserLoggedIn(); 248 !chromeos::LoginState::Get()->IsUserLoggedIn();
247 } 249 }
248 250
249 void EasyUnlockServiceSignin::OnWillFinalizeUnlock(bool success) { 251 void EasyUnlockServiceSignin::OnWillFinalizeUnlock(bool success) {
250 // This code path should only be exercised for the lock screen, not for the 252 // This code path should only be exercised for the lock screen, not for the
251 // sign-in screen. 253 // sign-in screen.
252 NOTREACHED(); 254 NOTREACHED();
253 } 255 }
254 256
255 void EasyUnlockServiceSignin::OnSuspendDone() { 257 void EasyUnlockServiceSignin::OnSuspendDone() {
256 // Ignored. 258 // Ignored.
257 } 259 }
258 260
259 void EasyUnlockServiceSignin::OnScreenDidLock( 261 void EasyUnlockServiceSignin::OnScreenDidLock(
260 ScreenlockBridge::LockHandler::ScreenType screen_type) { 262 proximity_auth::ScreenlockBridge::LockHandler::ScreenType screen_type) {
261 // In production code, the screen type should always be the signin screen; but 263 // In production code, the screen type should always be the signin screen; but
262 // in tests, the screen type might be different. 264 // in tests, the screen type might be different.
263 if (screen_type != ScreenlockBridge::LockHandler::SIGNIN_SCREEN) 265 if (screen_type !=
266 proximity_auth::ScreenlockBridge::LockHandler::SIGNIN_SCREEN)
264 return; 267 return;
265 268
266 // Update initial UI is when the account picker on login screen is ready. 269 // Update initial UI is when the account picker on login screen is ready.
267 ShowInitialUserState(); 270 ShowInitialUserState();
268 user_pod_last_focused_timestamp_ = base::TimeTicks::Now(); 271 user_pod_last_focused_timestamp_ = base::TimeTicks::Now();
269 } 272 }
270 273
271 void EasyUnlockServiceSignin::OnScreenDidUnlock( 274 void EasyUnlockServiceSignin::OnScreenDidUnlock(
272 ScreenlockBridge::LockHandler::ScreenType screen_type) { 275 proximity_auth::ScreenlockBridge::LockHandler::ScreenType screen_type) {
273 // In production code, the screen type should always be the signin screen; but 276 // In production code, the screen type should always be the signin screen; but
274 // in tests, the screen type might be different. 277 // in tests, the screen type might be different.
275 if (screen_type != ScreenlockBridge::LockHandler::SIGNIN_SCREEN) 278 if (screen_type !=
279 proximity_auth::ScreenlockBridge::LockHandler::SIGNIN_SCREEN)
276 return; 280 return;
277 281
278 DisableAppWithoutResettingScreenlockState(); 282 DisableAppWithoutResettingScreenlockState();
279 283
280 Shutdown(); 284 Shutdown();
281 } 285 }
282 286
283 void EasyUnlockServiceSignin::OnFocusedUserChanged(const std::string& user_id) { 287 void EasyUnlockServiceSignin::OnFocusedUserChanged(const std::string& user_id) {
284 if (user_id_ == user_id) 288 if (user_id_ == user_id)
285 return; 289 return;
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 return NULL; 386 return NULL;
383 387
384 std::map<std::string, UserData*>::const_iterator it = 388 std::map<std::string, UserData*>::const_iterator it =
385 user_data_.find(user_id_); 389 user_data_.find(user_id_);
386 if (it == user_data_.end()) 390 if (it == user_data_.end())
387 return NULL; 391 return NULL;
388 if (it->second->state != USER_DATA_STATE_LOADED) 392 if (it->second->state != USER_DATA_STATE_LOADED)
389 return NULL; 393 return NULL;
390 return it->second; 394 return it->second;
391 } 395 }
OLDNEW
« no previous file with comments | « chrome/browser/signin/easy_unlock_service_signin_chromeos.h ('k') | chrome/browser/signin/proximity_auth_facade.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698