OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_DEMO_MODE_DETECTOR_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_DEMO_MODE_DETECTOR_H_ |
6 #define CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_DEMO_MODE_DETECTOR_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_DEMO_MODE_DETECTOR_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
11 #include "base/time/time.h" | 11 #include "base/time/time.h" |
12 #include "base/timer/timer.h" | 12 #include "base/timer/timer.h" |
13 #include "chrome/browser/chromeos/idle_detector.h" | 13 #include "chrome/browser/chromeos/idle_detector.h" |
14 | 14 |
| 15 class PrefRegistrySimple; |
| 16 |
15 namespace chromeos { | 17 namespace chromeos { |
16 | 18 |
17 // Helper for idle state and demo-mode detection. | 19 // Helper for idle state and demo-mode detection. |
18 // Should be initialized on OOBE start. | 20 // Should be initialized on OOBE start. |
19 class DemoModeDetector { | 21 class DemoModeDetector { |
20 public: | 22 public: |
21 DemoModeDetector(); | 23 DemoModeDetector(); |
22 virtual ~DemoModeDetector(); | 24 virtual ~DemoModeDetector(); |
23 | 25 |
24 void InitDetection(); | 26 void InitDetection(); |
25 void StopDetection(); | 27 void StopDetection(); |
26 | 28 |
| 29 // Registers the preference for derelict state. |
| 30 static void RegisterPrefs(PrefRegistrySimple* registry); |
| 31 |
27 private: | 32 private: |
28 void StartIdleDetection(); | 33 void StartIdleDetection(); |
29 void StartOobeTimer(); | 34 void StartOobeTimer(); |
30 void OnIdle(); | 35 void OnIdle(); |
31 void OnOobeTimerUpdate(); | 36 void OnOobeTimerUpdate(); |
32 void SetupTimeouts(); | 37 void SetupTimeouts(); |
33 bool IsDerelict(); | 38 bool IsDerelict(); |
34 | 39 |
35 // Total time this machine has spent on OOBE. | 40 // Total time this machine has spent on OOBE. |
36 base::TimeDelta time_on_oobe_; | 41 base::TimeDelta time_on_oobe_; |
(...skipping 14 matching lines...) Expand all Loading... |
51 bool demo_launched_; | 56 bool demo_launched_; |
52 | 57 |
53 base::WeakPtrFactory<DemoModeDetector> weak_ptr_factory_; | 58 base::WeakPtrFactory<DemoModeDetector> weak_ptr_factory_; |
54 | 59 |
55 DISALLOW_COPY_AND_ASSIGN(DemoModeDetector); | 60 DISALLOW_COPY_AND_ASSIGN(DemoModeDetector); |
56 }; | 61 }; |
57 | 62 |
58 } // namespace chromeos | 63 } // namespace chromeos |
59 | 64 |
60 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_DEMO_MODE_DETECTOR_H_ | 65 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_DEMO_MODE_DETECTOR_H_ |
OLD | NEW |