Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1934)

Side by Side Diff: chrome/browser/chromeos/app_mode/kiosk_app_manager.h

Issue 491403003: Update cached kiosk app crx from usb stick. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Minor optimization in test. Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
30 namespace extensions { 30 namespace extensions {
31 class Extension; 31 class Extension;
32 class ExternalLoader; 32 class ExternalLoader;
33 } 33 }
34 34
35 namespace chromeos { 35 namespace chromeos {
36 36
37 class KioskAppData; 37 class KioskAppData;
38 class KioskAppExternalLoader; 38 class KioskAppExternalLoader;
39 class KioskAppManagerObserver; 39 class KioskAppManagerObserver;
40 class KioskExternalUpdater;
40 41
41 // KioskAppManager manages cached app data. 42 // KioskAppManager manages cached app data.
42 class KioskAppManager : public KioskAppDataDelegate, 43 class KioskAppManager : public KioskAppDataDelegate,
43 public ExternalCache::Delegate { 44 public ExternalCache::Delegate {
44 public: 45 public:
45 enum ConsumerKioskAutoLaunchStatus { 46 enum ConsumerKioskAutoLaunchStatus {
46 // Consumer kiosk mode auto-launch feature can be enabled on this machine. 47 // Consumer kiosk mode auto-launch feature can be enabled on this machine.
47 CONSUMER_KIOSK_AUTO_LAUNCH_CONFIGURABLE, 48 CONSUMER_KIOSK_AUTO_LAUNCH_CONFIGURABLE,
48 // Consumer kiosk auto-launch feature is enabled on this machine. 49 // Consumer kiosk auto-launch feature is enabled on this machine.
49 CONSUMER_KIOSK_AUTO_LAUNCH_ENABLED, 50 CONSUMER_KIOSK_AUTO_LAUNCH_ENABLED,
(...skipping 28 matching lines...) Expand all
78 static const char kKioskDictionaryName[]; 79 static const char kKioskDictionaryName[];
79 static const char kKeyApps[]; 80 static const char kKeyApps[];
80 static const char kKeyAutoLoginState[]; 81 static const char kKeyAutoLoginState[];
81 82
82 // Sub directory under DIR_USER_DATA to store cached icon files. 83 // Sub directory under DIR_USER_DATA to store cached icon files.
83 static const char kIconCacheDir[]; 84 static const char kIconCacheDir[];
84 85
85 // Sub directory under DIR_USER_DATA to store cached crx files. 86 // Sub directory under DIR_USER_DATA to store cached crx files.
86 static const char kCrxCacheDir[]; 87 static const char kCrxCacheDir[];
87 88
89 // Sub directory under DIR_USER_DATA to store unpacked crx file for validating
90 // its signature.
91 static const char kCrxUnpackDir[];
92
88 // Gets the KioskAppManager instance, which is lazily created on first call.. 93 // Gets the KioskAppManager instance, which is lazily created on first call..
89 static KioskAppManager* Get(); 94 static KioskAppManager* Get();
90 95
91 // Prepares for shutdown and calls CleanUp() if needed. 96 // Prepares for shutdown and calls CleanUp() if needed.
92 static void Shutdown(); 97 static void Shutdown();
93 98
94 // Registers kiosk app entries in local state. 99 // Registers kiosk app entries in local state.
95 static void RegisterPrefs(PrefRegistrySimple* registry); 100 static void RegisterPrefs(PrefRegistrySimple* registry);
96 101
97 // Initiates reading of consumer kiosk mode auto-launch status. 102 // Initiates reading of consumer kiosk mode auto-launch status.
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 // used. 155 // used.
151 void UpdateAppDataFromProfile(const std::string& app_id, 156 void UpdateAppDataFromProfile(const std::string& app_id,
152 Profile* profile, 157 Profile* profile,
153 const extensions::Extension* app); 158 const extensions::Extension* app);
154 159
155 void RetryFailedAppDataFetch(); 160 void RetryFailedAppDataFetch();
156 161
157 // Returns true if the app is found in cache. 162 // Returns true if the app is found in cache.
158 bool HasCachedCrx(const std::string& app_id) const; 163 bool HasCachedCrx(const std::string& app_id) const;
159 164
165 // Gets the path and version of the cached crx with |app_id|.
166 // Returns true if the app is found in cache.
167 bool GetCachedCrx(const std::string& app_id,
168 base::FilePath* file_path,
169 std::string* version) const;
170
160 void AddObserver(KioskAppManagerObserver* observer); 171 void AddObserver(KioskAppManagerObserver* observer);
161 void RemoveObserver(KioskAppManagerObserver* observer); 172 void RemoveObserver(KioskAppManagerObserver* observer);
162 173
163 // Creates extensions::ExternalLoader for installing kiosk apps during their 174 // Creates extensions::ExternalLoader for installing kiosk apps during their
164 // first time launch. 175 // first time launch.
165 extensions::ExternalLoader* CreateExternalLoader(); 176 extensions::ExternalLoader* CreateExternalLoader();
166 177
167 // Installs kiosk app with |id| from cache. 178 // Installs kiosk app with |id| from cache.
168 void InstallFromCache(const std::string& id); 179 void InstallFromCache(const std::string& id);
169 180
170 void UpdateExternalCache(); 181 void UpdateExternalCache();
171 182
183 // Monitors kiosk external update from usb stick.
184 void MonitorKioskExternalUpdate();
185
186 // Invoked when kiosk app cache has been updated.
187 void OnKioskAppCacheUpdated(const std::string& app_id);
188
189 // Installs the validated external extension into cache.
190 void PutValidatedExternalExtension(
191 const std::string& app_id,
192 const base::FilePath& crx_path,
193 const std::string& version,
194 const ExternalCache::PutExternalExtensionCallback& callback);
195
172 bool external_loader_created() const { return external_loader_created_; } 196 bool external_loader_created() const { return external_loader_created_; }
173 197
174 private: 198 private:
175 friend struct base::DefaultLazyInstanceTraits<KioskAppManager>; 199 friend struct base::DefaultLazyInstanceTraits<KioskAppManager>;
176 friend struct base::DefaultDeleter<KioskAppManager>; 200 friend struct base::DefaultDeleter<KioskAppManager>;
177 friend class KioskAppManagerTest; 201 friend class KioskAppManagerTest;
178 friend class KioskTest; 202 friend class KioskTest;
179 friend class KioskUpdateTest; 203 friend class KioskUpdateTest;
180 204
181 enum AutoLoginState { 205 enum AutoLoginState {
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 // Callback for reading handling checks of the owner public. 249 // Callback for reading handling checks of the owner public.
226 void OnOwnerFileChecked( 250 void OnOwnerFileChecked(
227 const GetConsumerKioskAutoLaunchStatusCallback& callback, 251 const GetConsumerKioskAutoLaunchStatusCallback& callback,
228 bool* owner_present); 252 bool* owner_present);
229 253
230 // Reads/writes auto login state from/to local state. 254 // Reads/writes auto login state from/to local state.
231 AutoLoginState GetAutoLoginState() const; 255 AutoLoginState GetAutoLoginState() const;
232 void SetAutoLoginState(AutoLoginState state); 256 void SetAutoLoginState(AutoLoginState state);
233 257
234 void GetCrxCacheDir(base::FilePath* cache_dir); 258 void GetCrxCacheDir(base::FilePath* cache_dir);
235 259 void GetCrxUnpackDir(base::FilePath* unpack_dir);
236 // Gets the file path and version information of the cached crx with |app_id|.
237 // Returns true if the app is found in cache.
238 bool GetCachedCrx(const std::string& app_id,
239 base::FilePath* file_path,
240 std::string* version) const;
241 260
242 // True if machine ownership is already established. 261 // True if machine ownership is already established.
243 bool ownership_established_; 262 bool ownership_established_;
244 ScopedVector<KioskAppData> apps_; 263 ScopedVector<KioskAppData> apps_;
245 std::string auto_launch_app_id_; 264 std::string auto_launch_app_id_;
246 ObserverList<KioskAppManagerObserver, true> observers_; 265 ObserverList<KioskAppManagerObserver, true> observers_;
247 266
248 scoped_ptr<CrosSettings::ObserverSubscription> 267 scoped_ptr<CrosSettings::ObserverSubscription>
249 local_accounts_subscription_; 268 local_accounts_subscription_;
250 scoped_ptr<CrosSettings::ObserverSubscription> 269 scoped_ptr<CrosSettings::ObserverSubscription>
251 local_account_auto_login_id_subscription_; 270 local_account_auto_login_id_subscription_;
252 271
253 scoped_ptr<ExternalCache> external_cache_; 272 scoped_ptr<ExternalCache> external_cache_;
273 scoped_ptr<KioskExternalUpdater> usb_stick_updater_;
254 274
255 // The extension external loader for installing kiosk app. 275 // The extension external loader for installing kiosk app.
256 bool external_loader_created_; 276 bool external_loader_created_;
257 base::WeakPtr<KioskAppExternalLoader> external_loader_; 277 base::WeakPtr<KioskAppExternalLoader> external_loader_;
258 278
259 DISALLOW_COPY_AND_ASSIGN(KioskAppManager); 279 DISALLOW_COPY_AND_ASSIGN(KioskAppManager);
260 }; 280 };
261 281
262 } // namespace chromeos 282 } // namespace chromeos
263 283
264 #endif // CHROME_BROWSER_CHROMEOS_APP_MODE_KIOSK_APP_MANAGER_H_ 284 #endif // CHROME_BROWSER_CHROMEOS_APP_MODE_KIOSK_APP_MANAGER_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/app_mode/app_session_lifetime.cc ('k') | chrome/browser/chromeos/app_mode/kiosk_app_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698