EME test page application.
[chromium-blink-merge.git] / chrome / browser / chromeos / idle_detector.h
blob3b9ce779d18702edc0512c66a011d55e8143f3b8
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.
5 #ifndef CHROME_BROWSER_CHROMEOS_IDLE_DETECTOR_H_
6 #define CHROME_BROWSER_CHROMEOS_IDLE_DETECTOR_H_
8 #include "base/basictypes.h"
9 #include "base/callback.h"
10 #include "base/compiler_specific.h"
11 #include "base/time/time.h"
12 #include "base/timer/timer.h"
13 #include "ui/wm/core/user_activity_observer.h"
15 namespace chromeos {
17 class IdleDetector : public wm::UserActivityObserver {
18 public:
19 IdleDetector(const base::Closure& on_active_callback,
20 const base::Closure& on_idle_callback);
21 virtual ~IdleDetector();
23 void Start(const base::TimeDelta& timeout);
25 private:
26 // wm::UserActivityObserver overrides:
27 virtual void OnUserActivity(const ui::Event* event) OVERRIDE;
29 // Resets |timer_| to fire when we reach our idle timeout.
30 void ResetTimer();
32 base::OneShotTimer<IdleDetector> timer_;
34 base::Closure active_callback_;
35 base::Closure idle_callback_;
37 base::TimeDelta timeout_;
39 DISALLOW_COPY_AND_ASSIGN(IdleDetector);
42 } // namespace chromeos
44 #endif // CHROME_BROWSER_CHROMEOS_IDLE_DETECTOR_H_