Fix infinite recursion on hiding panel when created during fullscreen mode.
[chromium-blink-merge.git] / chrome / browser / chromeos / idle_detector.h
blobe585c405491654f480856e1020ad7ab8381837e0
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 "ash/wm/user_activity_observer.h"
9 #include "base/basictypes.h"
10 #include "base/compiler_specific.h"
11 #include "base/timer/timer.h"
13 namespace chromeos {
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();
21 void Start(const base::TimeDelta& timeout);
23 private:
24 // UserActivityObserver overrides:
25 virtual void OnUserActivity(const ui::Event* event) OVERRIDE;
27 // Resets |timer_| to fire when we reach our idle timeout.
28 void ResetTimer();
30 base::OneShotTimer<IdleDetector> timer_;
32 base::Closure active_callback_;
33 base::Closure idle_callback_;
35 base::TimeDelta timeout_;
37 DISALLOW_COPY_AND_ASSIGN(IdleDetector);
40 } // namespace chromeos
42 #endif // CHROME_BROWSER_CHROMEOS_IDLE_DETECTOR_H_