| 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 19 matching lines...) Expand all Loading... |
| 30 // KioskAppManager manages cached app data. | 30 // KioskAppManager manages cached app data. |
| 31 class KioskAppManager : public content::NotificationObserver, | 31 class KioskAppManager : public content::NotificationObserver, |
| 32 public KioskAppDataDelegate { | 32 public KioskAppDataDelegate { |
| 33 public: | 33 public: |
| 34 // Struct to hold app info returned from GetApps() call. | 34 // Struct to hold app info returned from GetApps() call. |
| 35 struct App { | 35 struct App { |
| 36 explicit App(const KioskAppData& data); | 36 explicit App(const KioskAppData& data); |
| 37 App(); | 37 App(); |
| 38 ~App(); | 38 ~App(); |
| 39 | 39 |
| 40 std::string id; | 40 std::string app_id; |
| 41 std::string user_id; |
| 41 std::string name; | 42 std::string name; |
| 42 gfx::ImageSkia icon; | 43 gfx::ImageSkia icon; |
| 43 bool is_loading; | 44 bool is_loading; |
| 44 }; | 45 }; |
| 45 typedef std::vector<App> Apps; | 46 typedef std::vector<App> Apps; |
| 46 | 47 |
| 47 // Name of a dictionary that holds kiosk app info. | 48 // Name of a dictionary that holds kiosk app info. |
| 48 // Sample layout: | 49 // Sample layout: |
| 49 // "kiosk": { | 50 // "kiosk": { |
| 50 // "auto_launch": "app_id1", // Exists if using local state pref | 51 // "auto_launch": "app_id1", // Exists if using local state pref |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 | 112 |
| 112 KioskAppManager(); | 113 KioskAppManager(); |
| 113 virtual ~KioskAppManager(); | 114 virtual ~KioskAppManager(); |
| 114 | 115 |
| 115 // Stop all data loading and remove its dependency on CrosSettings. | 116 // Stop all data loading and remove its dependency on CrosSettings. |
| 116 void CleanUp(); | 117 void CleanUp(); |
| 117 | 118 |
| 118 // Gets KioskAppData for the given app id. | 119 // Gets KioskAppData for the given app id. |
| 119 const KioskAppData* GetAppData(const std::string& app_id) const; | 120 const KioskAppData* GetAppData(const std::string& app_id) const; |
| 120 | 121 |
| 121 // Update app data |apps_| based on |prefs_|. | 122 // Update app data |apps_| based on CrosSettings. |
| 122 void UpdateAppData(); | 123 void UpdateAppData(); |
| 123 | 124 |
| 124 // content::NotificationObserver overrides: | 125 // content::NotificationObserver overrides: |
| 125 virtual void Observe(int type, | 126 virtual void Observe(int type, |
| 126 const content::NotificationSource& source, | 127 const content::NotificationSource& source, |
| 127 const content::NotificationDetails& details) OVERRIDE; | 128 const content::NotificationDetails& details) OVERRIDE; |
| 128 | 129 |
| 129 // KioskAppDataDelegate overrides: | 130 // KioskAppDataDelegate overrides: |
| 130 virtual void GetKioskAppIconCacheDir(base::FilePath* cache_dir) OVERRIDE; | 131 virtual void GetKioskAppIconCacheDir(base::FilePath* cache_dir) OVERRIDE; |
| 131 virtual void OnKioskAppDataChanged(const std::string& app_id) OVERRIDE; | 132 virtual void OnKioskAppDataChanged(const std::string& app_id) OVERRIDE; |
| 132 virtual void OnKioskAppDataLoadFailure(const std::string& app_id) OVERRIDE; | 133 virtual void OnKioskAppDataLoadFailure(const std::string& app_id) OVERRIDE; |
| 133 | 134 |
| 134 ScopedVector<KioskAppData> apps_; | 135 ScopedVector<KioskAppData> apps_; |
| 135 std::string auto_launch_app_id_; | 136 std::string auto_launch_app_id_; |
| 136 ObserverList<KioskAppManagerObserver, true> observers_; | 137 ObserverList<KioskAppManagerObserver, true> observers_; |
| 137 | 138 |
| 138 DISALLOW_COPY_AND_ASSIGN(KioskAppManager); | 139 DISALLOW_COPY_AND_ASSIGN(KioskAppManager); |
| 139 }; | 140 }; |
| 140 | 141 |
| 141 } // namespace chromeos | 142 } // namespace chromeos |
| 142 | 143 |
| 143 #endif // CHROME_BROWSER_CHROMEOS_APP_MODE_KIOSK_APP_MANAGER_H_ | 144 #endif // CHROME_BROWSER_CHROMEOS_APP_MODE_KIOSK_APP_MANAGER_H_ |
| OLD | NEW |