| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "chrome/browser/ui/ash/session_state_delegate.h" | |
| 6 | |
| 7 #include "base/logging.h" | |
| 8 #include "chrome/browser/chromeos/login/screen_locker.h" | |
| 9 #include "chrome/browser/chromeos/login/user_manager.h" | |
| 10 #include "chromeos/dbus/dbus_thread_manager.h" | |
| 11 #include "chromeos/dbus/session_manager_client.h" | |
| 12 | |
| 13 SessionStateDelegate::SessionStateDelegate() { | |
| 14 } | |
| 15 | |
| 16 SessionStateDelegate::~SessionStateDelegate() { | |
| 17 } | |
| 18 | |
| 19 bool SessionStateDelegate::HasActiveUser() const { | |
| 20 return chromeos::UserManager::Get()->IsUserLoggedIn(); | |
| 21 } | |
| 22 | |
| 23 bool SessionStateDelegate::IsActiveUserSessionStarted() const { | |
| 24 return chromeos::UserManager::Get()->IsSessionStarted(); | |
| 25 } | |
| 26 | |
| 27 bool SessionStateDelegate::CanLockScreen() const { | |
| 28 return chromeos::UserManager::Get()->CanCurrentUserLock(); | |
| 29 } | |
| 30 | |
| 31 bool SessionStateDelegate::IsScreenLocked() const { | |
| 32 return chromeos::ScreenLocker::default_screen_locker() && | |
| 33 chromeos::ScreenLocker::default_screen_locker()->locked(); | |
| 34 } | |
| 35 | |
| 36 void SessionStateDelegate::LockScreen() { | |
| 37 if (!CanLockScreen()) | |
| 38 return; | |
| 39 | |
| 40 // TODO(antrim): Additional logging for http://crbug.com/173178. | |
| 41 LOG(WARNING) << "Requesting screen lock from SessionStateDelegate"; | |
| 42 chromeos::DBusThreadManager::Get()->GetSessionManagerClient()-> | |
| 43 RequestLockScreen(); | |
| 44 } | |
| 45 | |
| 46 void SessionStateDelegate::UnlockScreen() { | |
| 47 // This is used only for testing thus far. | |
| 48 NOTIMPLEMENTED(); | |
| 49 } | |
| OLD | NEW |