OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_CHROMEOS_KIOSK_MODE_KIOSK_MODE_HELPER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_KIOSK_MODE_KIOSK_MODE_HELPER_H_ |
6 #define CHROME_BROWSER_CHROMEOS_KIOSK_MODE_KIOSK_MODE_HELPER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_KIOSK_MODE_KIOSK_MODE_HELPER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/callback_forward.h" | 12 #include "base/callback_forward.h" |
13 #include "base/time.h" | |
13 | 14 |
14 namespace base { | 15 namespace base { |
15 template <typename T> struct DefaultLazyInstanceTraits; | 16 template <typename T> struct DefaultLazyInstanceTraits; |
16 } | 17 } |
17 | 18 |
18 // This class centralizes all our code to get KioskMode settings; since | 19 // This class centralizes all our code to get KioskMode settings; since |
19 // KioskMode interferes with normal operations all over Chrome, having all | 20 // KioskMode interferes with normal operations all over Chrome, having all |
20 // data about it pulled from a central location would make future | 21 // data about it pulled from a central location would make future |
21 // refactorings easier. This class also handles getting trust for the policies | 22 // refactorings easier. This class also handles getting trust for the policies |
22 // via it's init method. | 23 // via it's init method. |
23 // | 24 // |
24 // Note: If Initialize is not called before the various Getters, we'll return | 25 // Note: If Initialize is not called before the various Getters, we'll return |
25 // invalid values. | 26 // invalid values. |
26 // | 27 // |
27 // TODO(rkc): Once the enterprise policy side of this code is checked in, add | 28 // TODO(rkc): Once the enterprise policy side of this code is checked in, add |
28 // code to pull from the enterprise policy instead of flags and constants. | 29 // code to pull from the enterprise policy instead of flags and constants. |
Mattias Nissler (ping if slow)
2012/03/16 09:56:46
remove the TODO, as this is exactly what this CL i
rkc
2012/03/19 23:59:48
Done.
| |
29 namespace chromeos { | 30 namespace chromeos { |
30 | 31 |
31 class KioskModeHelper { | 32 class KioskModeHelper { |
32 public: | 33 public: |
33 // This method checks if Kiosk Mode is enabled or not. | 34 // This method checks if Kiosk Mode is enabled or not. |
34 static bool IsKioskModeEnabled(); | 35 static bool IsKioskModeEnabled(); |
35 | 36 |
36 static KioskModeHelper* Get(); | 37 static KioskModeHelper* Get(); |
37 | 38 |
38 // Initialize the settings helper; this will wait till trust is established | 39 // Initialize the settings helper; this will wait till trust is established |
Mattias Nissler (ping if slow)
2012/03/16 09:56:46
nit: I hope it actually doesn't wait :)
rkc
2012/03/19 23:59:48
Done.
| |
39 // for the enterprise policies then call the callback to notify the caller. | 40 // for the enterprise policies then call the callback to notify the caller. |
40 void Initialize(const base::Closure& notify_initialized); | 41 void Initialize(const base::Closure& notify_initialized); |
41 bool is_initialized() const { return is_initialized_; } | 42 bool is_initialized() const { return is_initialized_; } |
42 | 43 |
43 // The path to the screensaver extension. | 44 // The path to the screensaver extension. |
44 std::string GetScreensaverPath() const; | 45 std::string GetScreensaverPath() const; |
45 // The timeout before which we'll start showing the screensaver. | 46 // The timeout before which we'll start showing the screensaver. |
46 int64 GetScreensaverTimeout() const; | 47 base::TimeDelta GetScreensaverTimeout() const; |
48 | |
49 // NOTE: The idle logout timeout is the time 'till' we show the idle dialog | |
50 // box. After we show the dialog box, it remains up for an 'additional' | |
51 // IdleLogoutWarningTimeout seconds, which adds to the total time before the | |
52 // user is logged out. | |
53 | |
47 // The time to logout the user in on idle. | 54 // The time to logout the user in on idle. |
48 int64 GetIdleLogoutTimeout() const; | 55 base::TimeDelta GetIdleLogoutTimeout() const; |
49 // The time to show the countdown timer for. | 56 // The time to show the countdown timer for. |
50 int64 GetIdleLogoutWarningTimeout() const; | 57 base::TimeDelta GetIdleLogoutWarningTimeout() const; |
51 | 58 |
52 private: | 59 private: |
53 friend struct base::DefaultLazyInstanceTraits<KioskModeHelper>; | 60 friend struct base::DefaultLazyInstanceTraits<KioskModeHelper>; |
54 KioskModeHelper(); | 61 KioskModeHelper(); |
55 | 62 |
56 bool is_initialized_; | 63 bool is_initialized_; |
57 | 64 |
65 std::string screensaver_id_; | |
66 std::string screensaver_path_; | |
67 base::TimeDelta screensaver_timeout_; | |
68 base::TimeDelta idle_logout_timeout_; | |
69 base::TimeDelta idle_logout_warning_timeout_; | |
70 | |
58 DISALLOW_COPY_AND_ASSIGN(KioskModeHelper); | 71 DISALLOW_COPY_AND_ASSIGN(KioskModeHelper); |
59 }; | 72 }; |
60 | 73 |
61 | |
62 } // namespace chromeos | 74 } // namespace chromeos |
63 | 75 |
64 #endif // CHROME_BROWSER_CHROMEOS_KIOSK_MODE_KIOSK_MODE_HELPER_H_ | 76 #endif // CHROME_BROWSER_CHROMEOS_KIOSK_MODE_KIOSK_MODE_HELPER_H_ |
OLD | NEW |