Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / chromeos / app_mode / kiosk_app_manager.h
index 30caf12..eca1bcb 100644 (file)
@@ -37,6 +37,7 @@ namespace chromeos {
 class KioskAppData;
 class KioskAppExternalLoader;
 class KioskAppManagerObserver;
+class KioskExternalUpdater;
 
 // KioskAppManager manages cached app data.
 class KioskAppManager : public KioskAppDataDelegate,
@@ -85,6 +86,10 @@ class KioskAppManager : public KioskAppDataDelegate,
   // Sub directory under DIR_USER_DATA to store cached crx files.
   static const char kCrxCacheDir[];
 
+  // Sub directory under DIR_USER_DATA to store unpacked crx file for validating
+  // its signature.
+  static const char kCrxUnpackDir[];
+
   // Gets the KioskAppManager instance, which is lazily created on first call..
   static KioskAppManager* Get();
 
@@ -157,6 +162,12 @@ class KioskAppManager : public KioskAppDataDelegate,
   // Returns true if the app is found in cache.
   bool HasCachedCrx(const std::string& app_id) const;
 
+  // Gets the path and version of the cached crx with |app_id|.
+  // Returns true if the app is found in cache.
+  bool GetCachedCrx(const std::string& app_id,
+                    base::FilePath* file_path,
+                    std::string* version) const;
+
   void AddObserver(KioskAppManagerObserver* observer);
   void RemoveObserver(KioskAppManagerObserver* observer);
 
@@ -169,6 +180,23 @@ class KioskAppManager : public KioskAppDataDelegate,
 
   void UpdateExternalCache();
 
+  // Monitors kiosk external update from usb stick.
+  void MonitorKioskExternalUpdate();
+
+  // Invoked when kiosk app cache has been updated.
+  void OnKioskAppCacheUpdated(const std::string& app_id);
+
+  // Invoked when kiosk app updating from usb stick has been completed.
+  // |success| indicates if all the updates are completed successfully.
+  void OnKioskAppExternalUpdateComplete(bool success);
+
+  // Installs the validated external extension into cache.
+  void PutValidatedExternalExtension(
+      const std::string& app_id,
+      const base::FilePath& crx_path,
+      const std::string& version,
+      const ExternalCache::PutExternalExtensionCallback& callback);
+
   bool external_loader_created() const { return external_loader_created_; }
 
  private:
@@ -232,12 +260,7 @@ class KioskAppManager : public KioskAppDataDelegate,
   void SetAutoLoginState(AutoLoginState state);
 
   void GetCrxCacheDir(base::FilePath* cache_dir);
-
-  // Gets the file path and version information of the cached crx with |app_id|.
-  // Returns true if the app is found in cache.
-  bool GetCachedCrx(const std::string& app_id,
-                    base::FilePath* file_path,
-                    std::string* version) const;
+  void GetCrxUnpackDir(base::FilePath* unpack_dir);
 
   // True if machine ownership is already established.
   bool ownership_established_;
@@ -251,6 +274,7 @@ class KioskAppManager : public KioskAppDataDelegate,
       local_account_auto_login_id_subscription_;
 
   scoped_ptr<ExternalCache> external_cache_;
+  scoped_ptr<KioskExternalUpdater> usb_stick_updater_;
 
   // The extension external loader for installing kiosk app.
   bool external_loader_created_;