| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2014 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 #ifndef CHROME_BROWSER_CHROMEOS_IDLE_DETECTOR_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_IDLE_DETECTOR_H_ |
| 7 |
| 8 #include "ash/wm/user_activity_observer.h" |
| 9 #include "base/basictypes.h" |
| 10 #include "base/compiler_specific.h" |
| 11 #include "base/timer/timer.h" |
| 12 |
| 13 namespace chromeos { |
| 14 |
| 15 class IdleDetector : public ash::UserActivityObserver { |
| 16 public: |
| 17 IdleDetector(const base::Closure& on_active_callback, |
| 18 const base::Closure& on_idle_callback); |
| 19 virtual ~IdleDetector(); |
| 20 |
| 21 void Start(const base::TimeDelta& timeout); |
| 22 |
| 23 private: |
| 24 // UserActivityObserver overrides: |
| 25 virtual void OnUserActivity(const ui::Event* event) OVERRIDE; |
| 26 |
| 27 // Resets |timer_| to fire when we reach our idle timeout. |
| 28 void ResetTimer(); |
| 29 |
| 30 base::OneShotTimer<IdleDetector> timer_; |
| 31 |
| 32 base::Closure active_callback_; |
| 33 base::Closure idle_callback_; |
| 34 |
| 35 base::TimeDelta timeout_; |
| 36 |
| 37 DISALLOW_COPY_AND_ASSIGN(IdleDetector); |
| 38 }; |
| 39 |
| 40 } // namespace chromeos |
| 41 |
| 42 #endif // CHROME_BROWSER_CHROMEOS_IDLE_DETECTOR_H_ |
| OLD | NEW |