OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_CHROMEOS_KIOSK_MODE_KIOSK_MODE_SETTINGS_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_KIOSK_MODE_KIOSK_MODE_SETTINGS_H_ |
| 7 #pragma once |
| 8 |
| 9 #include <string> |
| 10 |
| 11 #include "base/basictypes.h" |
| 12 #include "base/callback_forward.h" |
| 13 #include "base/time.h" |
| 14 |
| 15 namespace base { |
| 16 template <typename T> struct DefaultLazyInstanceTraits; |
| 17 } |
| 18 |
| 19 namespace { |
| 20 |
| 21 const int kMaxIdleLogoutTimeout = 600000; // ms = 600s = 10m. |
| 22 const int kMinIdleLogoutTimeout = 5000; // ms = 5s. |
| 23 |
| 24 const int kMaxIdleLogoutWarningDuration = 60000; // ms = 60s. |
| 25 const int kMinIdleLogoutWarningDuration = 1000; // ms = 1s. |
| 26 |
| 27 } // namespace |
| 28 |
| 29 namespace chromeos { |
| 30 |
| 31 // This class centralizes all our code to get KioskMode settings; since |
| 32 // KioskMode interferes with normal operations all over Chrome, having all |
| 33 // data about it pulled from a central location would make future |
| 34 // refactorings easier. This class also handles getting trust for the policies |
| 35 // via it's init method. |
| 36 // |
| 37 // Note: If Initialize is not called before the various Getters, we'll return |
| 38 // invalid values. |
| 39 class KioskModeSettings { |
| 40 public: |
| 41 // This method checks if Kiosk Mode is enabled or not. |
| 42 virtual bool IsKioskModeEnabled(); |
| 43 |
| 44 static KioskModeSettings* Get(); |
| 45 |
| 46 // Initialize the settings; this will call the callback once trust is |
| 47 // established with the policy settings provider. |
| 48 virtual void Initialize(const base::Closure& notify_initialized); |
| 49 virtual bool is_initialized() const; |
| 50 |
| 51 // The path to the screensaver extension. |
| 52 virtual std::string GetScreensaverPath() const; |
| 53 // The timeout before which we'll start showing the screensaver. |
| 54 virtual base::TimeDelta GetScreensaverTimeout() const; |
| 55 |
| 56 // NOTE: The idle logout timeout is the time 'till' we show the idle dialog |
| 57 // box. After we show the dialog box, it remains up for an 'additional' |
| 58 // IdleLogoutWarningTimeout seconds, which adds to the total time before the |
| 59 // user is logged out. |
| 60 // The time to logout the user in on idle. |
| 61 virtual base::TimeDelta GetIdleLogoutTimeout() const; |
| 62 // The time to show the countdown timer for. |
| 63 virtual base::TimeDelta GetIdleLogoutWarningDuration() const; |
| 64 |
| 65 protected: |
| 66 // Needed here so MockKioskModeSettings can inherit from us. |
| 67 KioskModeSettings(); |
| 68 virtual ~KioskModeSettings(); |
| 69 |
| 70 private: |
| 71 friend struct base::DefaultLazyInstanceTraits<KioskModeSettings>; |
| 72 friend class KioskModeSettingsTest; |
| 73 |
| 74 bool is_initialized_; |
| 75 |
| 76 // Used for testing. |
| 77 void set_initialized(bool value) { is_initialized_ = value; } |
| 78 |
| 79 std::string screensaver_id_; |
| 80 std::string screensaver_path_; |
| 81 base::TimeDelta screensaver_timeout_; |
| 82 base::TimeDelta idle_logout_timeout_; |
| 83 base::TimeDelta idle_logout_warning_duration_; |
| 84 |
| 85 DISALLOW_COPY_AND_ASSIGN(KioskModeSettings); |
| 86 }; |
| 87 |
| 88 } // namespace chromeos |
| 89 |
| 90 #endif // CHROME_BROWSER_CHROMEOS_KIOSK_MODE_KIOSK_MODE_SETTINGS_H_ |
OLD | NEW |