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/idle.h" | 5 #include "chrome/browser/idle.h" |
6 | 6 |
7 #include "ash/session/session_state_delegate.h" | |
8 #include "ash/shell.h" | |
9 #include "base/time/time.h" | 7 #include "base/time/time.h" |
8 #include "chromeos/dbus/dbus_thread_manager.h" | |
Daniel Erat
2015/01/13 00:04:07
if ui/base/ shouldn't be able to depend on chromeo
stevenjb
2015/01/13 17:30:12
I have no particular problem with ui/base relying
| |
9 #include "chromeos/dbus/session_manager_client.h" | |
10 #include "ui/base/user_activity/user_activity_detector.h" | 10 #include "ui/base/user_activity/user_activity_detector.h" |
11 | 11 |
12 void CalculateIdleTime(IdleTimeCallback notify) { | 12 void CalculateIdleTime(IdleTimeCallback notify) { |
13 base::TimeDelta idle_time = base::TimeTicks::Now() - | 13 base::TimeDelta idle_time = base::TimeTicks::Now() - |
14 ui::UserActivityDetector::Get()->last_activity_time(); | 14 ui::UserActivityDetector::Get()->last_activity_time(); |
15 notify.Run(static_cast<int>(idle_time.InSeconds())); | 15 notify.Run(static_cast<int>(idle_time.InSeconds())); |
16 } | 16 } |
17 | 17 |
18 bool CheckIdleStateIsLocked() { | 18 bool CheckIdleStateIsLocked() { |
19 #if defined(USE_ATHENA) | 19 return chromeos::DBusThreadManager::Get()->GetSessionManagerClient()-> |
20 return false; | 20 IsScreenLocked(); |
21 #else | |
22 return ash::Shell::GetInstance()->session_state_delegate()->IsScreenLocked(); | |
23 #endif | |
24 } | 21 } |
OLD | NEW |