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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
52 // be enabled on this machine. | 52 // be enabled on this machine. |
53 CONSUMER_KIOSK_AUTO_LAUNCH_DISABLED, | 53 CONSUMER_KIOSK_AUTO_LAUNCH_DISABLED, |
54 }; | 54 }; |
55 | 55 |
56 typedef base::Callback<void(bool success)> EnableKioskAutoLaunchCallback; | 56 typedef base::Callback<void(bool success)> EnableKioskAutoLaunchCallback; |
57 typedef base::Callback<void(ConsumerKioskAutoLaunchStatus status)> | 57 typedef base::Callback<void(ConsumerKioskAutoLaunchStatus status)> |
58 GetConsumerKioskAutoLaunchStatusCallback; | 58 GetConsumerKioskAutoLaunchStatusCallback; |
59 | 59 |
60 // Struct to hold app info returned from GetApps() call. | 60 // Struct to hold app info returned from GetApps() call. |
61 struct App { | 61 struct App { |
62 App(const KioskAppData& data, bool is_extension_pending); | 62 App(const KioskAppData& data, bool is_extension_pending, |
bartfab (slow)
2015/02/06 14:14:07
Nit: The style guide says:
"For function declarat
Andrew T Wilson (Slow)
2015/02/06 20:43:50
Done.
| |
63 bool was_auto_launched_with_zero_delay); | |
63 App(); | 64 App(); |
64 ~App(); | 65 ~App(); |
65 | 66 |
66 std::string app_id; | 67 std::string app_id; |
67 std::string user_id; | 68 std::string user_id; |
68 std::string name; | 69 std::string name; |
69 gfx::ImageSkia icon; | 70 gfx::ImageSkia icon; |
70 bool is_loading; | 71 bool is_loading; |
72 bool was_auto_launched_with_zero_delay; | |
71 }; | 73 }; |
72 typedef std::vector<App> Apps; | 74 typedef std::vector<App> Apps; |
73 | 75 |
74 // Name of a dictionary that holds kiosk app info in Local State. | 76 // Name of a dictionary that holds kiosk app info in Local State. |
75 // Sample layout: | 77 // Sample layout: |
76 // "kiosk": { | 78 // "kiosk": { |
77 // "auto_login_enabled": true // | 79 // "auto_login_enabled": true // |
78 // } | 80 // } |
79 static const char kKioskDictionaryName[]; | 81 static const char kKioskDictionaryName[]; |
80 static const char kKeyApps[]; | 82 static const char kKeyApps[]; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
116 | 118 |
117 // Sets |app_id| as the app to auto launch at start up. | 119 // Sets |app_id| as the app to auto launch at start up. |
118 void SetAutoLaunchApp(const std::string& app_id); | 120 void SetAutoLaunchApp(const std::string& app_id); |
119 | 121 |
120 // Returns true if there is a pending auto-launch request. | 122 // Returns true if there is a pending auto-launch request. |
121 bool IsAutoLaunchRequested() const; | 123 bool IsAutoLaunchRequested() const; |
122 | 124 |
123 // Returns true if owner/policy enabled auto launch. | 125 // Returns true if owner/policy enabled auto launch. |
124 bool IsAutoLaunchEnabled() const; | 126 bool IsAutoLaunchEnabled() const; |
125 | 127 |
128 // Returns true if current app was auto launched. | |
bartfab (slow)
2015/02/06 14:14:07
Nit: ... with zero delay.
Andrew T Wilson (Slow)
2015/02/06 20:43:50
Done.
| |
129 bool IsCurrentAppAutoLaunched() const; | |
bartfab (slow)
2015/02/06 14:14:07
Nit: WithZeroDelay.
Andrew T Wilson (Slow)
2015/02/06 20:43:50
Done.
| |
130 | |
126 // Enable auto launch setter. | 131 // Enable auto launch setter. |
127 void SetEnableAutoLaunch(bool value); | 132 void SetEnableAutoLaunch(bool value); |
128 | 133 |
129 // Adds/removes a kiosk app by id. When removed, all locally cached data | 134 // Adds/removes a kiosk app by id. When removed, all locally cached data |
130 // will be removed as well. | 135 // will be removed as well. |
131 void AddApp(const std::string& app_id); | 136 void AddApp(const std::string& app_id); |
132 void RemoveApp(const std::string& app_id); | 137 void RemoveApp(const std::string& app_id); |
133 | 138 |
134 // Gets info of all apps that have no meta data load error. | 139 // Gets info of all apps that have no meta data load error. |
135 void GetApps(Apps* apps) const; | 140 void GetApps(Apps* apps) const; |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
188 | 193 |
189 // Installs the validated external extension into cache. | 194 // Installs the validated external extension into cache. |
190 void PutValidatedExternalExtension( | 195 void PutValidatedExternalExtension( |
191 const std::string& app_id, | 196 const std::string& app_id, |
192 const base::FilePath& crx_path, | 197 const base::FilePath& crx_path, |
193 const std::string& version, | 198 const std::string& version, |
194 const ExternalCache::PutExternalExtensionCallback& callback); | 199 const ExternalCache::PutExternalExtensionCallback& callback); |
195 | 200 |
196 bool external_loader_created() const { return external_loader_created_; } | 201 bool external_loader_created() const { return external_loader_created_; } |
197 | 202 |
203 // Notifies the KioskAppManager that a given app was auto-launched | |
204 // automatically with no delay on startup. Certain privacy-sensitive | |
205 // kiosk-mode behavior (such as network reporting) is only enabled for | |
206 // kiosk apps that are immediately auto-launched on startup. | |
207 void SetAppWasAutoLaunchedWithZeroDelay(const std::string& app_id); | |
208 | |
198 private: | 209 private: |
199 friend struct base::DefaultLazyInstanceTraits<KioskAppManager>; | 210 friend struct base::DefaultLazyInstanceTraits<KioskAppManager>; |
200 friend struct base::DefaultDeleter<KioskAppManager>; | 211 friend struct base::DefaultDeleter<KioskAppManager>; |
201 friend class KioskAppManagerTest; | 212 friend class KioskAppManagerTest; |
202 friend class KioskTest; | 213 friend class KioskTest; |
203 friend class KioskUpdateTest; | 214 friend class KioskUpdateTest; |
204 | 215 |
205 enum AutoLoginState { | 216 enum AutoLoginState { |
206 AUTOLOGIN_NONE = 0, | 217 AUTOLOGIN_NONE = 0, |
207 AUTOLOGIN_REQUESTED = 1, | 218 AUTOLOGIN_REQUESTED = 1, |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
254 AutoLoginState GetAutoLoginState() const; | 265 AutoLoginState GetAutoLoginState() const; |
255 void SetAutoLoginState(AutoLoginState state); | 266 void SetAutoLoginState(AutoLoginState state); |
256 | 267 |
257 void GetCrxCacheDir(base::FilePath* cache_dir); | 268 void GetCrxCacheDir(base::FilePath* cache_dir); |
258 void GetCrxUnpackDir(base::FilePath* unpack_dir); | 269 void GetCrxUnpackDir(base::FilePath* unpack_dir); |
259 | 270 |
260 // True if machine ownership is already established. | 271 // True if machine ownership is already established. |
261 bool ownership_established_; | 272 bool ownership_established_; |
262 ScopedVector<KioskAppData> apps_; | 273 ScopedVector<KioskAppData> apps_; |
263 std::string auto_launch_app_id_; | 274 std::string auto_launch_app_id_; |
275 std::string currently_auto_launched_app_; | |
bartfab (slow)
2015/02/06 14:14:07
Nit: For consistency, _with_zero_delay.
Andrew T Wilson (Slow)
2015/02/06 20:43:50
Done, but this is an incredibly unwieldy 44 charac
| |
264 ObserverList<KioskAppManagerObserver, true> observers_; | 276 ObserverList<KioskAppManagerObserver, true> observers_; |
265 | 277 |
266 scoped_ptr<CrosSettings::ObserverSubscription> | 278 scoped_ptr<CrosSettings::ObserverSubscription> |
267 local_accounts_subscription_; | 279 local_accounts_subscription_; |
268 scoped_ptr<CrosSettings::ObserverSubscription> | 280 scoped_ptr<CrosSettings::ObserverSubscription> |
269 local_account_auto_login_id_subscription_; | 281 local_account_auto_login_id_subscription_; |
270 | 282 |
271 scoped_ptr<ExternalCache> external_cache_; | 283 scoped_ptr<ExternalCache> external_cache_; |
272 | 284 |
273 scoped_ptr<KioskExternalUpdater> usb_stick_updater_; | 285 scoped_ptr<KioskExternalUpdater> usb_stick_updater_; |
274 | 286 |
275 // The extension external loader for installing kiosk app. | 287 // The extension external loader for installing kiosk app. |
276 bool external_loader_created_; | 288 bool external_loader_created_; |
277 base::WeakPtr<KioskAppExternalLoader> external_loader_; | 289 base::WeakPtr<KioskAppExternalLoader> external_loader_; |
278 | 290 |
279 DISALLOW_COPY_AND_ASSIGN(KioskAppManager); | 291 DISALLOW_COPY_AND_ASSIGN(KioskAppManager); |
280 }; | 292 }; |
281 | 293 |
282 } // namespace chromeos | 294 } // namespace chromeos |
283 | 295 |
284 #endif // CHROME_BROWSER_CHROMEOS_APP_MODE_KIOSK_APP_MANAGER_H_ | 296 #endif // CHROME_BROWSER_CHROMEOS_APP_MODE_KIOSK_APP_MANAGER_H_ |
OLD | NEW |