OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/screen_locker.h" | 5 #include "chrome/browser/chromeos/login/screen_locker.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 // static | 340 // static |
341 void ScreenLocker::Show() { | 341 void ScreenLocker::Show() { |
342 DVLOG(1) << "In ScreenLocker::Show"; | 342 DVLOG(1) << "In ScreenLocker::Show"; |
343 content::RecordAction(UserMetricsAction("ScreenLocker_Show")); | 343 content::RecordAction(UserMetricsAction("ScreenLocker_Show")); |
344 DCHECK(MessageLoop::current()->type() == MessageLoop::TYPE_UI); | 344 DCHECK(MessageLoop::current()->type() == MessageLoop::TYPE_UI); |
345 | 345 |
346 // Check whether the currently logged in user is a guest account and if so, | 346 // Check whether the currently logged in user is a guest account and if so, |
347 // refuse to lock the screen (crosbug.com/23764). | 347 // refuse to lock the screen (crosbug.com/23764). |
348 // TODO(flackr): We can allow lock screen for guest accounts when | 348 // TODO(flackr): We can allow lock screen for guest accounts when |
349 // unlock_on_input is supported by the WebUI screen locker. | 349 // unlock_on_input is supported by the WebUI screen locker. |
350 if (UserManager::Get()->logged_in_user().email().empty()) { | 350 if (UserManager::Get()->GetLoggedInUser().email().empty()) { |
351 DVLOG(1) << "Show: Refusing to lock screen for guest account."; | 351 DVLOG(1) << "Show: Refusing to lock screen for guest account."; |
352 return; | 352 return; |
353 } | 353 } |
354 | 354 |
355 // Exit fullscreen. | 355 // Exit fullscreen. |
356 Browser* browser = BrowserList::GetLastActive(); | 356 Browser* browser = BrowserList::GetLastActive(); |
357 // browser can be NULL if we receive a lock request before the first browser | 357 // browser can be NULL if we receive a lock request before the first browser |
358 // window is shown. | 358 // window is shown. |
359 if (browser && browser->window()->IsFullscreen()) { | 359 if (browser && browser->window()->IsFullscreen()) { |
360 browser->ToggleFullscreenMode(); | 360 browser->ToggleFullscreenMode(); |
361 } | 361 } |
362 | 362 |
363 if (!screen_locker_) { | 363 if (!screen_locker_) { |
364 DVLOG(1) << "Show: Locking screen"; | 364 DVLOG(1) << "Show: Locking screen"; |
365 ScreenLocker* locker = | 365 ScreenLocker* locker = |
366 new ScreenLocker(UserManager::Get()->logged_in_user()); | 366 new ScreenLocker(UserManager::Get()->GetLoggedInUser()); |
367 locker->Init(); | 367 locker->Init(); |
368 } else { | 368 } else { |
369 // PowerManager re-sends lock screen signal if it doesn't | 369 // PowerManager re-sends lock screen signal if it doesn't |
370 // receive the response within timeout. Just send complete | 370 // receive the response within timeout. Just send complete |
371 // signal. | 371 // signal. |
372 DVLOG(1) << "Show: locker already exists. Just sending completion event."; | 372 DVLOG(1) << "Show: locker already exists. Just sending completion event."; |
373 DBusThreadManager::Get()->GetPowerManagerClient()-> | 373 DBusThreadManager::Get()->GetPowerManagerClient()-> |
374 NotifyScreenLockCompleted(); | 374 NotifyScreenLockCompleted(); |
375 } | 375 } |
376 } | 376 } |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
437 bool state = true; | 437 bool state = true; |
438 content::NotificationService::current()->Notify( | 438 content::NotificationService::current()->Notify( |
439 chrome::NOTIFICATION_SCREEN_LOCK_STATE_CHANGED, | 439 chrome::NOTIFICATION_SCREEN_LOCK_STATE_CHANGED, |
440 content::Source<ScreenLocker>(this), | 440 content::Source<ScreenLocker>(this), |
441 content::Details<bool>(&state)); | 441 content::Details<bool>(&state)); |
442 DBusThreadManager::Get()->GetPowerManagerClient()-> | 442 DBusThreadManager::Get()->GetPowerManagerClient()-> |
443 NotifyScreenLockCompleted(); | 443 NotifyScreenLockCompleted(); |
444 } | 444 } |
445 | 445 |
446 } // namespace chromeos | 446 } // namespace chromeos |
OLD | NEW |