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 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/callback_forward.h" | 12 #include "base/callback_forward.h" |
13 #include "base/lazy_instance.h" | 13 #include "base/lazy_instance.h" |
14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
15 #include "base/memory/scoped_vector.h" | 15 #include "base/memory/scoped_vector.h" |
16 #include "base/observer_list.h" | 16 #include "base/observer_list.h" |
17 #include "chrome/browser/chromeos/app_mode/kiosk_app_data_delegate.h" | 17 #include "chrome/browser/chromeos/app_mode/kiosk_app_data_delegate.h" |
18 #include "chrome/browser/chromeos/extensions/external_cache.h" | |
18 #include "chrome/browser/chromeos/policy/enterprise_install_attributes.h" | 19 #include "chrome/browser/chromeos/policy/enterprise_install_attributes.h" |
19 #include "chrome/browser/chromeos/settings/cros_settings.h" | 20 #include "chrome/browser/chromeos/settings/cros_settings.h" |
20 #include "ui/gfx/image/image_skia.h" | 21 #include "ui/gfx/image/image_skia.h" |
21 | 22 |
22 class PrefRegistrySimple; | 23 class PrefRegistrySimple; |
23 class Profile; | 24 class Profile; |
24 | 25 |
25 namespace base { | 26 namespace base { |
26 class RefCountedString; | 27 class RefCountedString; |
27 } | 28 } |
28 | 29 |
29 namespace extensions { | 30 namespace extensions { |
30 class Extension; | 31 class Extension; |
31 } | 32 } |
32 | 33 |
33 namespace chromeos { | 34 namespace chromeos { |
34 | 35 |
35 class KioskAppData; | 36 class KioskAppData; |
36 class KioskAppManagerObserver; | 37 class KioskAppManagerObserver; |
37 | 38 |
38 // KioskAppManager manages cached app data. | 39 // KioskAppManager manages cached app data. |
39 class KioskAppManager : public KioskAppDataDelegate { | 40 class KioskAppManager : public KioskAppDataDelegate, |
41 public ExternalCache::Delegate { | |
40 public: | 42 public: |
41 enum ConsumerKioskAutoLaunchStatus { | 43 enum ConsumerKioskAutoLaunchStatus { |
42 // Consumer kiosk mode auto-launch feature can be enabled on this machine. | 44 // Consumer kiosk mode auto-launch feature can be enabled on this machine. |
43 CONSUMER_KIOSK_AUTO_LAUNCH_CONFIGURABLE, | 45 CONSUMER_KIOSK_AUTO_LAUNCH_CONFIGURABLE, |
44 // Consumer kiosk auto-launch feature is enabled on this machine. | 46 // Consumer kiosk auto-launch feature is enabled on this machine. |
45 CONSUMER_KIOSK_AUTO_LAUNCH_ENABLED, | 47 CONSUMER_KIOSK_AUTO_LAUNCH_ENABLED, |
46 // Consumer kiosk mode auto-launch feature is disabled and cannot any longer | 48 // Consumer kiosk mode auto-launch feature is disabled and cannot any longer |
47 // be enabled on this machine. | 49 // be enabled on this machine. |
48 CONSUMER_KIOSK_AUTO_LAUNCH_DISABLED, | 50 CONSUMER_KIOSK_AUTO_LAUNCH_DISABLED, |
49 }; | 51 }; |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
153 friend struct base::DefaultDeleter<KioskAppManager>; | 155 friend struct base::DefaultDeleter<KioskAppManager>; |
154 friend class KioskAppManagerTest; | 156 friend class KioskAppManagerTest; |
155 friend class KioskTest; | 157 friend class KioskTest; |
156 | 158 |
157 enum AutoLoginState { | 159 enum AutoLoginState { |
158 AUTOLOGIN_NONE = 0, | 160 AUTOLOGIN_NONE = 0, |
159 AUTOLOGIN_REQUESTED = 1, | 161 AUTOLOGIN_REQUESTED = 1, |
160 AUTOLOGIN_APPROVED = 2, | 162 AUTOLOGIN_APPROVED = 2, |
161 AUTOLOGIN_REJECTED = 3, | 163 AUTOLOGIN_REJECTED = 3, |
162 }; | 164 }; |
165 enum KioskAppCrxCacheStatus { | |
xiyuan
2014/05/02 03:22:12
Seems not used.
jennyz
2014/05/02 17:46:55
woops, forgot to remove. Removed.
| |
166 KIOSK_APP_CACHE_INIT, | |
167 KIOSK_APP_CACHE_LOADING, | |
168 KIOSK_APP_CACHE_INSTALLED, | |
169 KIOSK_APP_CACHE_ERROR, | |
170 }; | |
163 | 171 |
164 KioskAppManager(); | 172 KioskAppManager(); |
165 virtual ~KioskAppManager(); | 173 virtual ~KioskAppManager(); |
166 | 174 |
167 // Stop all data loading and remove its dependency on CrosSettings. | 175 // Stop all data loading and remove its dependency on CrosSettings. |
168 void CleanUp(); | 176 void CleanUp(); |
169 | 177 |
170 // Gets KioskAppData for the given app id. | 178 // Gets KioskAppData for the given app id. |
171 const KioskAppData* GetAppData(const std::string& app_id) const; | 179 const KioskAppData* GetAppData(const std::string& app_id) const; |
172 KioskAppData* GetAppDataMutable(const std::string& app_id); | 180 KioskAppData* GetAppDataMutable(const std::string& app_id); |
173 | 181 |
174 // Update app data |apps_| based on CrosSettings. | 182 // Update app data |apps_| based on CrosSettings. |
175 void UpdateAppData(); | 183 void UpdateAppData(); |
176 | 184 |
177 // KioskAppDataDelegate overrides: | 185 // KioskAppDataDelegate overrides: |
178 virtual void GetKioskAppIconCacheDir(base::FilePath* cache_dir) OVERRIDE; | 186 virtual void GetKioskAppIconCacheDir(base::FilePath* cache_dir) OVERRIDE; |
179 virtual void OnKioskAppDataChanged(const std::string& app_id) OVERRIDE; | 187 virtual void OnKioskAppDataChanged(const std::string& app_id) OVERRIDE; |
180 virtual void OnKioskAppDataLoadFailure(const std::string& app_id) OVERRIDE; | 188 virtual void OnKioskAppDataLoadFailure(const std::string& app_id) OVERRIDE; |
181 | 189 |
190 // ExternalCache::Delegate: | |
191 virtual void OnExtensionListsUpdated( | |
192 const base::DictionaryValue* prefs) OVERRIDE; | |
193 virtual void OnExtensionLoadedInCache(const std::string& id) OVERRIDE; | |
194 virtual void OnExtensionDownloadFailed( | |
195 const std::string& id, | |
196 extensions::ExtensionDownloaderDelegate::Error error) OVERRIDE; | |
197 | |
182 // Callback for EnterpriseInstallAttributes::LockDevice() during | 198 // Callback for EnterpriseInstallAttributes::LockDevice() during |
183 // EnableConsumerModeKiosk() call. | 199 // EnableConsumerModeKiosk() call. |
184 void OnLockDevice( | 200 void OnLockDevice( |
185 const EnableKioskAutoLaunchCallback& callback, | 201 const EnableKioskAutoLaunchCallback& callback, |
186 policy::EnterpriseInstallAttributes::LockResult result); | 202 policy::EnterpriseInstallAttributes::LockResult result); |
187 | 203 |
188 // Callback for EnterpriseInstallAttributes::ReadImmutableAttributes() during | 204 // Callback for EnterpriseInstallAttributes::ReadImmutableAttributes() during |
189 // GetConsumerKioskModeStatus() call. | 205 // GetConsumerKioskModeStatus() call. |
190 void OnReadImmutableAttributes( | 206 void OnReadImmutableAttributes( |
191 const GetConsumerKioskAutoLaunchStatusCallback& callback); | 207 const GetConsumerKioskAutoLaunchStatusCallback& callback); |
(...skipping 11 matching lines...) Expand all Loading... | |
203 bool ownership_established_; | 219 bool ownership_established_; |
204 ScopedVector<KioskAppData> apps_; | 220 ScopedVector<KioskAppData> apps_; |
205 std::string auto_launch_app_id_; | 221 std::string auto_launch_app_id_; |
206 ObserverList<KioskAppManagerObserver, true> observers_; | 222 ObserverList<KioskAppManagerObserver, true> observers_; |
207 | 223 |
208 scoped_ptr<CrosSettings::ObserverSubscription> | 224 scoped_ptr<CrosSettings::ObserverSubscription> |
209 local_accounts_subscription_; | 225 local_accounts_subscription_; |
210 scoped_ptr<CrosSettings::ObserverSubscription> | 226 scoped_ptr<CrosSettings::ObserverSubscription> |
211 local_account_auto_login_id_subscription_; | 227 local_account_auto_login_id_subscription_; |
212 | 228 |
229 base::FilePath cache_dir_; | |
230 scoped_ptr<ExternalCache> external_cache_; | |
231 | |
213 DISALLOW_COPY_AND_ASSIGN(KioskAppManager); | 232 DISALLOW_COPY_AND_ASSIGN(KioskAppManager); |
214 }; | 233 }; |
215 | 234 |
216 } // namespace chromeos | 235 } // namespace chromeos |
217 | 236 |
218 #endif // CHROME_BROWSER_CHROMEOS_APP_MODE_KIOSK_APP_MANAGER_H_ | 237 #endif // CHROME_BROWSER_CHROMEOS_APP_MODE_KIOSK_APP_MANAGER_H_ |
OLD | NEW |