OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_APP_MODE_KIOSK_APP_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_APP_MODE_KIOSK_APP_MANAGER_H_ |
6 #define CHROME_BROWSER_CHROMEOS_APP_MODE_KIOSK_APP_MANAGER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_APP_MODE_KIOSK_APP_MANAGER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 20 matching lines...) Expand all Loading... |
31 } | 31 } |
32 | 32 |
33 namespace chromeos { | 33 namespace chromeos { |
34 | 34 |
35 class KioskAppData; | 35 class KioskAppData; |
36 class KioskAppManagerObserver; | 36 class KioskAppManagerObserver; |
37 | 37 |
38 // KioskAppManager manages cached app data. | 38 // KioskAppManager manages cached app data. |
39 class KioskAppManager : public KioskAppDataDelegate { | 39 class KioskAppManager : public KioskAppDataDelegate { |
40 public: | 40 public: |
41 enum ConsumerKioskModeStatus { | 41 enum ConsumerKioskAutoLaunchStatus { |
42 // Consumer kiosk mode can be enabled on this machine. | 42 // Consumer kiosk mode auto-launch feature can be enabled on this machine. |
43 CONSUMER_KIOSK_MODE_CONFIGURABLE, | 43 CONSUMER_KIOSK_AUTO_LAUNCH_CONFIGURABLE, |
44 // Consumer kiosk is enabled on this machine. | 44 // Consumer kiosk auto-launch feature is enabled on this machine. |
45 CONSUMER_KIOSK_MODE_ENABLED, | 45 CONSUMER_KIOSK_AUTO_LAUNCH_ENABLED, |
46 // Consumer kiosk mode is disabled ans cannot any longer be enabled on | 46 // Consumer kiosk mode auto-launch feature is disabled and cannot any longer |
47 // this machine. | 47 // be enabled on this machine. |
48 CONSUMER_KIOSK_MODE_DISABLED, | 48 CONSUMER_KIOSK_AUTO_LAUNCH_DISABLED, |
49 }; | 49 }; |
50 | 50 |
51 typedef base::Callback<void(bool success)> EnableKioskModeCallback; | 51 typedef base::Callback<void(bool success)> EnableKioskAutoLaunchCallback; |
52 typedef base::Callback<void(ConsumerKioskModeStatus status)> | 52 typedef base::Callback<void(ConsumerKioskAutoLaunchStatus status)> |
53 GetConsumerKioskModeStatusCallback; | 53 GetConsumerKioskAutoLaunchStatusCallback; |
54 | 54 |
55 // Struct to hold app info returned from GetApps() call. | 55 // Struct to hold app info returned from GetApps() call. |
56 struct App { | 56 struct App { |
57 explicit App(const KioskAppData& data); | 57 explicit App(const KioskAppData& data); |
58 App(); | 58 App(); |
59 ~App(); | 59 ~App(); |
60 | 60 |
61 std::string app_id; | 61 std::string app_id; |
62 std::string user_id; | 62 std::string user_id; |
63 std::string name; | 63 std::string name; |
(...skipping 16 matching lines...) Expand all Loading... |
80 | 80 |
81 // Gets the KioskAppManager instance, which is lazily created on first call.. | 81 // Gets the KioskAppManager instance, which is lazily created on first call.. |
82 static KioskAppManager* Get(); | 82 static KioskAppManager* Get(); |
83 | 83 |
84 // Prepares for shutdown and calls CleanUp() if needed. | 84 // Prepares for shutdown and calls CleanUp() if needed. |
85 static void Shutdown(); | 85 static void Shutdown(); |
86 | 86 |
87 // Registers kiosk app entries in local state. | 87 // Registers kiosk app entries in local state. |
88 static void RegisterPrefs(PrefRegistrySimple* registry); | 88 static void RegisterPrefs(PrefRegistrySimple* registry); |
89 | 89 |
90 // Initiates reading of consumer kiosk mode status. | 90 // Initiates reading of consumer kiosk mode auto-launch status. |
91 void GetConsumerKioskModeStatus( | 91 void GetConsumerKioskAutoLaunchStatus( |
92 const GetConsumerKioskModeStatusCallback& callback); | 92 const GetConsumerKioskAutoLaunchStatusCallback& callback); |
93 | 93 |
94 // Enables consumer kiosk mode feature. Upon completion, |callback| will be | 94 // Enables consumer kiosk mode app auto-launch feature. Upon completion, |
95 // invoked with outcome of this operation. | 95 // |callback| will be invoked with outcome of this operation. |
96 void EnableConsumerModeKiosk(const EnableKioskModeCallback& callback); | 96 void EnableConsumerKioskAutoLaunch( |
| 97 const EnableKioskAutoLaunchCallback& callback); |
97 | 98 |
98 // Returns auto launcher app id or an empty string if there is none. | 99 // Returns auto launcher app id or an empty string if there is none. |
99 std::string GetAutoLaunchApp() const; | 100 std::string GetAutoLaunchApp() const; |
100 | 101 |
101 // Sets |app_id| as the app to auto launch at start up. | 102 // Sets |app_id| as the app to auto launch at start up. |
102 void SetAutoLaunchApp(const std::string& app_id); | 103 void SetAutoLaunchApp(const std::string& app_id); |
103 | 104 |
104 // Returns true if there is a pending auto-launch request. | 105 // Returns true if there is a pending auto-launch request. |
105 bool IsAutoLaunchRequested() const; | 106 bool IsAutoLaunchRequested() const; |
106 | 107 |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 void UpdateAppData(); | 172 void UpdateAppData(); |
172 | 173 |
173 // KioskAppDataDelegate overrides: | 174 // KioskAppDataDelegate overrides: |
174 virtual void GetKioskAppIconCacheDir(base::FilePath* cache_dir) OVERRIDE; | 175 virtual void GetKioskAppIconCacheDir(base::FilePath* cache_dir) OVERRIDE; |
175 virtual void OnKioskAppDataChanged(const std::string& app_id) OVERRIDE; | 176 virtual void OnKioskAppDataChanged(const std::string& app_id) OVERRIDE; |
176 virtual void OnKioskAppDataLoadFailure(const std::string& app_id) OVERRIDE; | 177 virtual void OnKioskAppDataLoadFailure(const std::string& app_id) OVERRIDE; |
177 | 178 |
178 // Callback for EnterpriseInstallAttributes::LockDevice() during | 179 // Callback for EnterpriseInstallAttributes::LockDevice() during |
179 // EnableConsumerModeKiosk() call. | 180 // EnableConsumerModeKiosk() call. |
180 void OnLockDevice( | 181 void OnLockDevice( |
181 const EnableKioskModeCallback& callback, | 182 const EnableKioskAutoLaunchCallback& callback, |
182 policy::EnterpriseInstallAttributes::LockResult result); | 183 policy::EnterpriseInstallAttributes::LockResult result); |
183 | 184 |
184 // Callback for EnterpriseInstallAttributes::ReadImmutableAttributes() during | 185 // Callback for EnterpriseInstallAttributes::ReadImmutableAttributes() during |
185 // GetConsumerKioskModeStatus() call. | 186 // GetConsumerKioskModeStatus() call. |
186 void OnReadImmutableAttributes( | 187 void OnReadImmutableAttributes( |
187 const GetConsumerKioskModeStatusCallback& callback); | 188 const GetConsumerKioskAutoLaunchStatusCallback& callback); |
188 | 189 |
189 // Callback for reading handling checks of the owner public. | 190 // Callback for reading handling checks of the owner public. |
190 void OnOwnerFileChecked( | 191 void OnOwnerFileChecked( |
191 const GetConsumerKioskModeStatusCallback& callback, | 192 const GetConsumerKioskAutoLaunchStatusCallback& callback, |
192 bool* owner_present); | 193 bool* owner_present); |
193 | 194 |
194 // Reads/writes auto login state from/to local state. | 195 // Reads/writes auto login state from/to local state. |
195 AutoLoginState GetAutoLoginState() const; | 196 AutoLoginState GetAutoLoginState() const; |
196 void SetAutoLoginState(AutoLoginState state); | 197 void SetAutoLoginState(AutoLoginState state); |
197 | 198 |
198 // True if machine ownership is already established. | 199 // True if machine ownership is already established. |
199 bool ownership_established_; | 200 bool ownership_established_; |
200 ScopedVector<KioskAppData> apps_; | 201 ScopedVector<KioskAppData> apps_; |
201 std::string auto_launch_app_id_; | 202 std::string auto_launch_app_id_; |
202 ObserverList<KioskAppManagerObserver, true> observers_; | 203 ObserverList<KioskAppManagerObserver, true> observers_; |
203 | 204 |
204 scoped_ptr<CrosSettings::ObserverSubscription> | 205 scoped_ptr<CrosSettings::ObserverSubscription> |
205 local_accounts_subscription_; | 206 local_accounts_subscription_; |
206 scoped_ptr<CrosSettings::ObserverSubscription> | 207 scoped_ptr<CrosSettings::ObserverSubscription> |
207 local_account_auto_login_id_subscription_; | 208 local_account_auto_login_id_subscription_; |
208 | 209 |
209 DISALLOW_COPY_AND_ASSIGN(KioskAppManager); | 210 DISALLOW_COPY_AND_ASSIGN(KioskAppManager); |
210 }; | 211 }; |
211 | 212 |
212 } // namespace chromeos | 213 } // namespace chromeos |
213 | 214 |
214 #endif // CHROME_BROWSER_CHROMEOS_APP_MODE_KIOSK_APP_MANAGER_H_ | 215 #endif // CHROME_BROWSER_CHROMEOS_APP_MODE_KIOSK_APP_MANAGER_H_ |
OLD | NEW |