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_UI_WEBUI_CHROMEOS_LOGIN_DEMO_MODE_DETECTOR_H_
6 #define CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_DEMO_MODE_DETECTOR_H_
10 #include "base/memory/weak_ptr.h"
11 #include "base/time/time.h"
12 #include "base/timer/timer.h"
13 #include "chrome/browser/chromeos/idle_detector.h"
15 class PrefRegistrySimple
;
19 // Helper for idle state and demo-mode detection.
20 // Should be initialized on OOBE start.
21 class DemoModeDetector
{
24 virtual ~DemoModeDetector();
29 // Registers the preference for derelict state.
30 static void RegisterPrefs(PrefRegistrySimple
* registry
);
33 void StartIdleDetection();
34 void StartOobeTimer();
36 void OnOobeTimerUpdate();
40 // Total time this machine has spent on OOBE.
41 base::TimeDelta time_on_oobe_
;
43 scoped_ptr
<IdleDetector
> idle_detector_
;
45 base::RepeatingTimer
<DemoModeDetector
> oobe_timer_
;
47 // Timeout to detect if the machine is in a derelict state.
48 base::TimeDelta derelict_detection_timeout_
;
50 // Timeout before showing our demo app if the machine is in a derelict state.
51 base::TimeDelta derelict_idle_timeout_
;
53 // Time between updating our total time on oobe.
54 base::TimeDelta oobe_timer_update_interval_
;
58 base::WeakPtrFactory
<DemoModeDetector
> weak_ptr_factory_
;
60 DISALLOW_COPY_AND_ASSIGN(DemoModeDetector
);
63 } // namespace chromeos
65 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_DEMO_MODE_DETECTOR_H_