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/power/user_activity_notifier.h" | 5 #include "chrome/browser/chromeos/power/user_activity_notifier.h" |
6 | 6 |
7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
8 #include "ash/wm/user_activity_detector.h" | 8 #include "ash/wm/user_activity_detector.h" |
9 #include "chromeos/dbus/dbus_thread_manager.h" | 9 #include "chromeos/dbus/dbus_thread_manager.h" |
10 #include "chromeos/dbus/power_manager_client.h" | 10 #include "chromeos/dbus/power_manager_client.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 UserActivityNotifier::~UserActivityNotifier() { | 25 UserActivityNotifier::~UserActivityNotifier() { |
26 ash::Shell::GetInstance()->user_activity_detector()->RemoveObserver(this); | 26 ash::Shell::GetInstance()->user_activity_detector()->RemoveObserver(this); |
27 } | 27 } |
28 | 28 |
29 void UserActivityNotifier::OnUserActivity() { | 29 void UserActivityNotifier::OnUserActivity() { |
30 base::TimeTicks now = base::TimeTicks::Now(); | 30 base::TimeTicks now = base::TimeTicks::Now(); |
31 // InSeconds() truncates rather than rounding, so it's fine for this | 31 // InSeconds() truncates rather than rounding, so it's fine for this |
32 // comparison. | 32 // comparison. |
33 if (last_notify_time_.is_null() || | 33 if (last_notify_time_.is_null() || |
34 (now - last_notify_time_).InSeconds() >= kNotifyIntervalSec) { | 34 (now - last_notify_time_).InSeconds() >= kNotifyIntervalSec) { |
35 DBusThreadManager::Get()->GetPowerManagerClient()->NotifyUserActivity(now); | 35 DBusThreadManager::Get()->GetPowerManagerClient()->NotifyUserActivity(); |
36 last_notify_time_ = now; | 36 last_notify_time_ = now; |
37 } | 37 } |
38 } | 38 } |
39 | 39 |
40 } // namespace chromeos | 40 } // namespace chromeos |
OLD | NEW |