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
3 // found in the LICENSE file.
5 #include "ui/base/idle/idle.h"
7 #include "base/time/time.h"
8 #include "chromeos/dbus/dbus_thread_manager.h"
9 #include "chromeos/dbus/session_manager_client.h"
10 #include "ui/base/user_activity/user_activity_detector.h"
14 void CalculateIdleTime(IdleTimeCallback notify
) {
15 base::TimeDelta idle_time
= base::TimeTicks::Now() -
16 ui::UserActivityDetector::Get()->last_activity_time();
17 notify
.Run(static_cast<int>(idle_time
.InSeconds()));
20 bool CheckIdleStateIsLocked() {
21 return chromeos::DBusThreadManager::Get()->GetSessionManagerClient()->