Add new certificateProvider extension API.
[chromium-blink-merge.git] / chrome / browser / ui / webui / chromeos / login / demo_mode_detector.h
blob8c27c0e90fc52111bf55decc0303eb4317492cfc
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_
8 #include <string>
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;
17 namespace chromeos {
19 // Helper for idle state and demo-mode detection.
20 // Should be initialized on OOBE start.
21 class DemoModeDetector {
22 public:
23 DemoModeDetector();
24 virtual ~DemoModeDetector();
26 void InitDetection();
27 void StopDetection();
29 // Registers the preference for derelict state.
30 static void RegisterPrefs(PrefRegistrySimple* registry);
32 private:
33 void StartIdleDetection();
34 void StartOobeTimer();
35 void OnIdle();
36 void OnOobeTimerUpdate();
37 void SetupTimeouts();
38 bool IsDerelict();
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_;
56 bool demo_launched_;
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_