| 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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 | 143 |
| 144 // Updates app data from the |app| in |profile|. |app| is provided to cover | 144 // Updates app data from the |app| in |profile|. |app| is provided to cover |
| 145 // the case of app update case where |app| is the new version and is not | 145 // the case of app update case where |app| is the new version and is not |
| 146 // finished installing (e.g. because old version is still running). Otherwise, | 146 // finished installing (e.g. because old version is still running). Otherwise, |
| 147 // |app| could be NULL and the current installed app in |profile| will be | 147 // |app| could be NULL and the current installed app in |profile| will be |
| 148 // used. | 148 // used. |
| 149 void UpdateAppDataFromProfile(const std::string& app_id, | 149 void UpdateAppDataFromProfile(const std::string& app_id, |
| 150 Profile* profile, | 150 Profile* profile, |
| 151 const extensions::Extension* app); | 151 const extensions::Extension* app); |
| 152 | 152 |
| 153 // Gets the file path and version information of the cached crx with |app_id|. |
| 154 // Returns true if the app is found in cache. |
| 155 bool GetCachedCrx(const std::string& app_id, |
| 156 base::FilePath* file_path, |
| 157 std::string* version); |
| 158 |
| 159 // Returns true if the extension with |id| is pending for caching crx file |
| 160 // for the first time. |
| 161 bool IsExtensionPendingForCache(const std::string& id); |
| 162 |
| 163 // Returns true if the extensions with |id| is pending for update check. |
| 164 // The crx file fo the extension has been cached previously. |
| 165 bool IsExtensionPendingForUpdateCheck(const std::string& id); |
| 166 |
| 153 void AddObserver(KioskAppManagerObserver* observer); | 167 void AddObserver(KioskAppManagerObserver* observer); |
| 154 void RemoveObserver(KioskAppManagerObserver* observer); | 168 void RemoveObserver(KioskAppManagerObserver* observer); |
| 155 | 169 |
| 156 private: | 170 private: |
| 157 friend struct base::DefaultLazyInstanceTraits<KioskAppManager>; | 171 friend struct base::DefaultLazyInstanceTraits<KioskAppManager>; |
| 158 friend struct base::DefaultDeleter<KioskAppManager>; | 172 friend struct base::DefaultDeleter<KioskAppManager>; |
| 159 friend class KioskAppManagerTest; | 173 friend class KioskAppManagerTest; |
| 160 friend class KioskTest; | 174 friend class KioskTest; |
| 161 | 175 |
| 162 enum AutoLoginState { | 176 enum AutoLoginState { |
| 163 AUTOLOGIN_NONE = 0, | 177 AUTOLOGIN_NONE = 0, |
| 164 AUTOLOGIN_REQUESTED = 1, | 178 AUTOLOGIN_REQUESTED = 1, |
| 165 AUTOLOGIN_APPROVED = 2, | 179 AUTOLOGIN_APPROVED = 2, |
| 166 AUTOLOGIN_REJECTED = 3, | 180 AUTOLOGIN_REJECTED = 3, |
| 167 }; | 181 }; |
| 168 | 182 |
| 169 KioskAppManager(); | 183 KioskAppManager(); |
| 170 virtual ~KioskAppManager(); | 184 virtual ~KioskAppManager(); |
| 171 | 185 |
| 172 // Stop all data loading and remove its dependency on CrosSettings. | 186 // Stop all data loading and remove its dependency on CrosSettings. |
| 173 void CleanUp(); | 187 void CleanUp(); |
| 174 | 188 |
| 175 // Gets KioskAppData for the given app id. | 189 // Gets KioskAppData for the given app id. |
| 176 const KioskAppData* GetAppData(const std::string& app_id) const; | 190 const KioskAppData* GetAppData(const std::string& app_id) const; |
| 177 KioskAppData* GetAppDataMutable(const std::string& app_id); | 191 KioskAppData* GetAppDataMutable(const std::string& app_id); |
| 178 | 192 |
| 179 // Update app data |apps_| based on CrosSettings. | 193 // Updates app data |apps_| based on CrosSettings. |
| 180 void UpdateAppData(); | 194 void UpdateAppData(); |
| 181 | 195 |
| 182 // KioskAppDataDelegate overrides: | 196 // KioskAppDataDelegate overrides: |
| 183 virtual void GetKioskAppIconCacheDir(base::FilePath* cache_dir) OVERRIDE; | 197 virtual void GetKioskAppIconCacheDir(base::FilePath* cache_dir) OVERRIDE; |
| 184 virtual void OnKioskAppDataChanged(const std::string& app_id) OVERRIDE; | 198 virtual void OnKioskAppDataChanged(const std::string& app_id) OVERRIDE; |
| 185 virtual void OnKioskAppDataLoadFailure(const std::string& app_id) OVERRIDE; | 199 virtual void OnKioskAppDataLoadFailure(const std::string& app_id) OVERRIDE; |
| 186 | 200 |
| 187 // ExternalCache::Delegate: | 201 // ExternalCache::Delegate: |
| 188 virtual void OnExtensionListsUpdated( | 202 virtual void OnExtensionListsUpdated( |
| 189 const base::DictionaryValue* prefs) OVERRIDE; | 203 const base::DictionaryValue* prefs) OVERRIDE; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 207 void OnOwnerFileChecked( | 221 void OnOwnerFileChecked( |
| 208 const GetConsumerKioskAutoLaunchStatusCallback& callback, | 222 const GetConsumerKioskAutoLaunchStatusCallback& callback, |
| 209 bool* owner_present); | 223 bool* owner_present); |
| 210 | 224 |
| 211 // Reads/writes auto login state from/to local state. | 225 // Reads/writes auto login state from/to local state. |
| 212 AutoLoginState GetAutoLoginState() const; | 226 AutoLoginState GetAutoLoginState() const; |
| 213 void SetAutoLoginState(AutoLoginState state); | 227 void SetAutoLoginState(AutoLoginState state); |
| 214 | 228 |
| 215 void GetCrxCacheDir(base::FilePath* cache_dir); | 229 void GetCrxCacheDir(base::FilePath* cache_dir); |
| 216 | 230 |
| 217 bool GetCachedCrx(const std::string& app_id, | |
| 218 base::FilePath* file_path, | |
| 219 std::string* version); | |
| 220 | |
| 221 // True if machine ownership is already established. | 231 // True if machine ownership is already established. |
| 222 bool ownership_established_; | 232 bool ownership_established_; |
| 223 ScopedVector<KioskAppData> apps_; | 233 ScopedVector<KioskAppData> apps_; |
| 224 std::string auto_launch_app_id_; | 234 std::string auto_launch_app_id_; |
| 225 ObserverList<KioskAppManagerObserver, true> observers_; | 235 ObserverList<KioskAppManagerObserver, true> observers_; |
| 226 | 236 |
| 227 scoped_ptr<CrosSettings::ObserverSubscription> | 237 scoped_ptr<CrosSettings::ObserverSubscription> |
| 228 local_accounts_subscription_; | 238 local_accounts_subscription_; |
| 229 scoped_ptr<CrosSettings::ObserverSubscription> | 239 scoped_ptr<CrosSettings::ObserverSubscription> |
| 230 local_account_auto_login_id_subscription_; | 240 local_account_auto_login_id_subscription_; |
| 231 | 241 |
| 232 scoped_ptr<ExternalCache> external_cache_; | 242 scoped_ptr<ExternalCache> external_cache_; |
| 233 | 243 |
| 234 DISALLOW_COPY_AND_ASSIGN(KioskAppManager); | 244 DISALLOW_COPY_AND_ASSIGN(KioskAppManager); |
| 235 }; | 245 }; |
| 236 | 246 |
| 237 } // namespace chromeos | 247 } // namespace chromeos |
| 238 | 248 |
| 239 #endif // CHROME_BROWSER_CHROMEOS_APP_MODE_KIOSK_APP_MANAGER_H_ | 249 #endif // CHROME_BROWSER_CHROMEOS_APP_MODE_KIOSK_APP_MANAGER_H_ |
| OLD | NEW |