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 <map> | 8 #include <map> |
9 #include <memory> | 9 #include <memory> |
10 #include <string> | 10 #include <string> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/callback_forward.h" | 13 #include "base/callback_forward.h" |
14 #include "base/lazy_instance.h" | 14 #include "base/lazy_instance.h" |
15 #include "base/macros.h" | 15 #include "base/macros.h" |
16 #include "base/memory/scoped_ptr.h" | |
17 #include "base/observer_list.h" | 16 #include "base/observer_list.h" |
18 #include "base/time/time.h" | 17 #include "base/time/time.h" |
19 #include "chrome/browser/chromeos/app_mode/kiosk_app_data_delegate.h" | 18 #include "chrome/browser/chromeos/app_mode/kiosk_app_data_delegate.h" |
20 #include "chrome/browser/chromeos/extensions/external_cache.h" | 19 #include "chrome/browser/chromeos/extensions/external_cache.h" |
21 #include "chrome/browser/chromeos/policy/enterprise_install_attributes.h" | 20 #include "chrome/browser/chromeos/policy/enterprise_install_attributes.h" |
22 #include "chrome/browser/chromeos/settings/cros_settings.h" | 21 #include "chrome/browser/chromeos/settings/cros_settings.h" |
23 #include "components/signin/core/account_id/account_id.h" | 22 #include "components/signin/core/account_id/account_id.h" |
24 #include "ui/gfx/image/image_skia.h" | 23 #include "ui/gfx/image/image_skia.h" |
25 | 24 |
26 class PrefRegistrySimple; | 25 class PrefRegistrySimple; |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 | 255 |
257 // Gets KioskAppData for the given app id. | 256 // Gets KioskAppData for the given app id. |
258 const KioskAppData* GetAppData(const std::string& app_id) const; | 257 const KioskAppData* GetAppData(const std::string& app_id) const; |
259 KioskAppData* GetAppDataMutable(const std::string& app_id); | 258 KioskAppData* GetAppDataMutable(const std::string& app_id); |
260 | 259 |
261 // Updates app data |apps_| based on CrosSettings. | 260 // Updates app data |apps_| based on CrosSettings. |
262 void UpdateAppData(); | 261 void UpdateAppData(); |
263 | 262 |
264 // Clear cached data and crx of the removed apps. | 263 // Clear cached data and crx of the removed apps. |
265 void ClearRemovedApps( | 264 void ClearRemovedApps( |
266 const std::map<std::string, scoped_ptr<KioskAppData>>& old_apps); | 265 const std::map<std::string, std::unique_ptr<KioskAppData>>& old_apps); |
267 | 266 |
268 // Updates the prefs of |external_cache_| from |apps_|. | 267 // Updates the prefs of |external_cache_| from |apps_|. |
269 void UpdateExternalCachePrefs(); | 268 void UpdateExternalCachePrefs(); |
270 | 269 |
271 // KioskAppDataDelegate overrides: | 270 // KioskAppDataDelegate overrides: |
272 void GetKioskAppIconCacheDir(base::FilePath* cache_dir) override; | 271 void GetKioskAppIconCacheDir(base::FilePath* cache_dir) override; |
273 void OnKioskAppDataChanged(const std::string& app_id) override; | 272 void OnKioskAppDataChanged(const std::string& app_id) override; |
274 void OnKioskAppDataLoadFailure(const std::string& app_id) override; | 273 void OnKioskAppDataLoadFailure(const std::string& app_id) override; |
275 | 274 |
276 // ExternalCache::Delegate: | 275 // ExternalCache::Delegate: |
(...skipping 24 matching lines...) Expand all Loading... |
301 void SetAutoLoginState(AutoLoginState state); | 300 void SetAutoLoginState(AutoLoginState state); |
302 | 301 |
303 void GetCrxCacheDir(base::FilePath* cache_dir); | 302 void GetCrxCacheDir(base::FilePath* cache_dir); |
304 void GetCrxUnpackDir(base::FilePath* unpack_dir); | 303 void GetCrxUnpackDir(base::FilePath* unpack_dir); |
305 | 304 |
306 // Returns the auto launch delay. | 305 // Returns the auto launch delay. |
307 base::TimeDelta GetAutoLaunchDelay() const; | 306 base::TimeDelta GetAutoLaunchDelay() const; |
308 | 307 |
309 // True if machine ownership is already established. | 308 // True if machine ownership is already established. |
310 bool ownership_established_; | 309 bool ownership_established_; |
311 std::vector<scoped_ptr<KioskAppData>> apps_; | 310 std::vector<std::unique_ptr<KioskAppData>> apps_; |
312 std::string auto_launch_app_id_; | 311 std::string auto_launch_app_id_; |
313 std::string currently_auto_launched_with_zero_delay_app_; | 312 std::string currently_auto_launched_with_zero_delay_app_; |
314 base::ObserverList<KioskAppManagerObserver, true> observers_; | 313 base::ObserverList<KioskAppManagerObserver, true> observers_; |
315 | 314 |
316 scoped_ptr<CrosSettings::ObserverSubscription> | 315 std::unique_ptr<CrosSettings::ObserverSubscription> |
317 local_accounts_subscription_; | 316 local_accounts_subscription_; |
318 scoped_ptr<CrosSettings::ObserverSubscription> | 317 std::unique_ptr<CrosSettings::ObserverSubscription> |
319 local_account_auto_login_id_subscription_; | 318 local_account_auto_login_id_subscription_; |
320 | 319 |
321 scoped_ptr<ExternalCache> external_cache_; | 320 std::unique_ptr<ExternalCache> external_cache_; |
322 | 321 |
323 scoped_ptr<KioskExternalUpdater> usb_stick_updater_; | 322 std::unique_ptr<KioskExternalUpdater> usb_stick_updater_; |
324 | 323 |
325 // The extension external loader for deploying primary app. | 324 // The extension external loader for deploying primary app. |
326 bool external_loader_created_; | 325 bool external_loader_created_; |
327 base::WeakPtr<KioskAppExternalLoader> external_loader_; | 326 base::WeakPtr<KioskAppExternalLoader> external_loader_; |
328 | 327 |
329 // The extension external loader for deploying secondary apps. | 328 // The extension external loader for deploying secondary apps. |
330 bool secondary_app_external_loader_created_; | 329 bool secondary_app_external_loader_created_; |
331 base::WeakPtr<KioskAppExternalLoader> secondary_app_external_loader_; | 330 base::WeakPtr<KioskAppExternalLoader> secondary_app_external_loader_; |
332 | 331 |
333 scoped_ptr<AppSession> app_session_; | 332 std::unique_ptr<AppSession> app_session_; |
334 | 333 |
335 DISALLOW_COPY_AND_ASSIGN(KioskAppManager); | 334 DISALLOW_COPY_AND_ASSIGN(KioskAppManager); |
336 }; | 335 }; |
337 | 336 |
338 } // namespace chromeos | 337 } // namespace chromeos |
339 | 338 |
340 #endif // CHROME_BROWSER_CHROMEOS_APP_MODE_KIOSK_APP_MANAGER_H_ | 339 #endif // CHROME_BROWSER_CHROMEOS_APP_MODE_KIOSK_APP_MANAGER_H_ |
OLD | NEW |