| 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_vector.h" | 15 #include "base/memory/scoped_vector.h" |
| 15 #include "base/observer_list.h" | 16 #include "base/observer_list.h" |
| 16 #include "chrome/browser/chromeos/app_mode/kiosk_app_data_delegate.h" | 17 #include "chrome/browser/chromeos/app_mode/kiosk_app_data_delegate.h" |
| 17 #include "chrome/browser/chromeos/policy/enterprise_install_attributes.h" | 18 #include "chrome/browser/chromeos/policy/enterprise_install_attributes.h" |
| 18 #include "content/public/browser/notification_observer.h" | 19 #include "chrome/browser/chromeos/settings/cros_settings.h" |
| 19 #include "ui/gfx/image/image_skia.h" | 20 #include "ui/gfx/image/image_skia.h" |
| 20 | 21 |
| 21 class PrefRegistrySimple; | 22 class PrefRegistrySimple; |
| 22 | 23 |
| 23 namespace base { | 24 namespace base { |
| 24 class RefCountedString; | 25 class RefCountedString; |
| 25 } | 26 } |
| 26 | 27 |
| 27 namespace chromeos { | 28 namespace chromeos { |
| 28 | 29 |
| 29 class KioskAppData; | 30 class KioskAppData; |
| 30 class KioskAppManagerObserver; | 31 class KioskAppManagerObserver; |
| 31 | 32 |
| 32 // KioskAppManager manages cached app data. | 33 // KioskAppManager manages cached app data. |
| 33 class KioskAppManager : public content::NotificationObserver, | 34 class KioskAppManager : public KioskAppDataDelegate { |
| 34 public KioskAppDataDelegate { | |
| 35 public: | 35 public: |
| 36 enum ConsumerKioskModeStatus { | 36 enum ConsumerKioskModeStatus { |
| 37 // Consumer kiosk mode can be enabled on this machine. | 37 // Consumer kiosk mode can be enabled on this machine. |
| 38 CONSUMER_KIOSK_MODE_CONFIGURABLE, | 38 CONSUMER_KIOSK_MODE_CONFIGURABLE, |
| 39 // Consumer kiosk is enabled on this machine. | 39 // Consumer kiosk is enabled on this machine. |
| 40 CONSUMER_KIOSK_MODE_ENABLED, | 40 CONSUMER_KIOSK_MODE_ENABLED, |
| 41 // Consumer kiosk mode is disabled ans cannot any longer be enabled on | 41 // Consumer kiosk mode is disabled ans cannot any longer be enabled on |
| 42 // this machine. | 42 // this machine. |
| 43 CONSUMER_KIOSK_MODE_DISABLED, | 43 CONSUMER_KIOSK_MODE_DISABLED, |
| 44 }; | 44 }; |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 | 145 |
| 146 // Stop all data loading and remove its dependency on CrosSettings. | 146 // Stop all data loading and remove its dependency on CrosSettings. |
| 147 void CleanUp(); | 147 void CleanUp(); |
| 148 | 148 |
| 149 // Gets KioskAppData for the given app id. | 149 // Gets KioskAppData for the given app id. |
| 150 const KioskAppData* GetAppData(const std::string& app_id) const; | 150 const KioskAppData* GetAppData(const std::string& app_id) const; |
| 151 | 151 |
| 152 // Update app data |apps_| based on CrosSettings. | 152 // Update app data |apps_| based on CrosSettings. |
| 153 void UpdateAppData(); | 153 void UpdateAppData(); |
| 154 | 154 |
| 155 // content::NotificationObserver overrides: | |
| 156 virtual void Observe(int type, | |
| 157 const content::NotificationSource& source, | |
| 158 const content::NotificationDetails& details) OVERRIDE; | |
| 159 | |
| 160 // KioskAppDataDelegate overrides: | 155 // KioskAppDataDelegate overrides: |
| 161 virtual void GetKioskAppIconCacheDir(base::FilePath* cache_dir) OVERRIDE; | 156 virtual void GetKioskAppIconCacheDir(base::FilePath* cache_dir) OVERRIDE; |
| 162 virtual void OnKioskAppDataChanged(const std::string& app_id) OVERRIDE; | 157 virtual void OnKioskAppDataChanged(const std::string& app_id) OVERRIDE; |
| 163 virtual void OnKioskAppDataLoadFailure(const std::string& app_id) OVERRIDE; | 158 virtual void OnKioskAppDataLoadFailure(const std::string& app_id) OVERRIDE; |
| 164 | 159 |
| 165 // Callback for EnterpriseInstallAttributes::LockDevice() during | 160 // Callback for EnterpriseInstallAttributes::LockDevice() during |
| 166 // EnableConsumerModeKiosk() call. | 161 // EnableConsumerModeKiosk() call. |
| 167 void OnLockDevice( | 162 void OnLockDevice( |
| 168 const EnableKioskModeCallback& callback, | 163 const EnableKioskModeCallback& callback, |
| 169 policy::EnterpriseInstallAttributes::LockResult result); | 164 policy::EnterpriseInstallAttributes::LockResult result); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 181 // Reads/writes auto login state from/to local state. | 176 // Reads/writes auto login state from/to local state. |
| 182 AutoLoginState GetAutoLoginState() const; | 177 AutoLoginState GetAutoLoginState() const; |
| 183 void SetAutoLoginState(AutoLoginState state); | 178 void SetAutoLoginState(AutoLoginState state); |
| 184 | 179 |
| 185 // True if machine ownership is already established. | 180 // True if machine ownership is already established. |
| 186 bool ownership_established_; | 181 bool ownership_established_; |
| 187 ScopedVector<KioskAppData> apps_; | 182 ScopedVector<KioskAppData> apps_; |
| 188 std::string auto_launch_app_id_; | 183 std::string auto_launch_app_id_; |
| 189 ObserverList<KioskAppManagerObserver, true> observers_; | 184 ObserverList<KioskAppManagerObserver, true> observers_; |
| 190 | 185 |
| 186 scoped_ptr<CrosSettings::ObserverSubscription> |
| 187 local_accounts_subscription_; |
| 188 scoped_ptr<CrosSettings::ObserverSubscription> |
| 189 local_account_auto_login_id_subscription_; |
| 190 |
| 191 DISALLOW_COPY_AND_ASSIGN(KioskAppManager); | 191 DISALLOW_COPY_AND_ASSIGN(KioskAppManager); |
| 192 }; | 192 }; |
| 193 | 193 |
| 194 } // namespace chromeos | 194 } // namespace chromeos |
| 195 | 195 |
| 196 #endif // CHROME_BROWSER_CHROMEOS_APP_MODE_KIOSK_APP_MANAGER_H_ | 196 #endif // CHROME_BROWSER_CHROMEOS_APP_MODE_KIOSK_APP_MANAGER_H_ |
| OLD | NEW |