Index: chrome/browser/chromeos/app_mode/kiosk_external_update_validator.h |
diff --git a/chrome/browser/chromeos/app_mode/kiosk_external_update_validator.h b/chrome/browser/chromeos/app_mode/kiosk_external_update_validator.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..432b8a7cbe14a9831aaafead9d9f6afc92c92c68 |
--- /dev/null |
+++ b/chrome/browser/chromeos/app_mode/kiosk_external_update_validator.h |
@@ -0,0 +1,75 @@ |
+// Copyright 2014 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CHROME_BROWSER_CHROMEOS_APP_MODE_KIOSK_EXTERNAL_UPDATE_VALIDATOR_H_ |
+#define CHROME_BROWSER_CHROMEOS_APP_MODE_KIOSK_EXTERNAL_UPDATE_VALIDATOR_H_ |
+ |
+#include <string> |
+ |
+#include "base/files/file_path.h" |
+#include "base/sequenced_task_runner.h" |
+#include "chrome/browser/extensions/sandboxed_unpacker.h" |
+ |
+namespace extensions { |
+class Extension; |
+} |
+ |
+namespace chromeos { |
+ |
+// Delegate class for KioskExternalUpdateValidator. |
+class KioskExternalUpdateValidatorDelegate |
+ : public base::RefCountedThreadSafe<KioskExternalUpdateValidatorDelegate> { |
xiyuan
2014/08/23 18:11:57
KioskExternalUpdateValidatorDelegate probably shou
jennyz
2014/08/27 00:58:41
Changed, KioskExternalUpdateValidator is no longer
|
+ public: |
+ virtual void OnExtenalUpdateUnpackSuccess( |
+ const std::string& app_id, |
+ const base::FilePath& temp_dir, |
+ const extensions::Extension* extension) = 0; |
+ virtual void OnExternalUpdateUnpackFailure(const std::string& app_id) = 0; |
+ |
+ protected: |
+ friend class base::RefCountedThreadSafe<KioskExternalUpdateValidatorDelegate>; |
+ |
+ virtual ~KioskExternalUpdateValidatorDelegate() {} |
+}; |
+ |
+// Unpacks the crx file of the kiosk app and validates its signature. |
+class KioskExternalUpdateValidator |
+ : public extensions::SandboxedUnpackerClient { |
+ public: |
+ KioskExternalUpdateValidator( |
+ const scoped_refptr<base::SequencedTaskRunner>& backend_task_runner, |
+ const std::string& app_id, |
+ const base::FilePath& crx_path, |
+ const base::FilePath& crx_unpack_dir, |
+ KioskExternalUpdateValidatorDelegate* delegate); |
+ |
+ // Starts validating the external crx file. |
+ void Start(); |
+ |
+ private: |
+ virtual ~KioskExternalUpdateValidator(); |
+ |
+ // SandboxedUnpackerClient overrides. |
+ virtual void OnUnpackFailure(const base::string16& error_message) OVERRIDE; |
+ virtual void OnUnpackSuccess(const base::FilePath& temp_dir, |
+ const base::FilePath& extension_dir, |
+ const base::DictionaryValue* original_manifest, |
+ const extensions::Extension* extension, |
+ const SkBitmap& install_icon) OVERRIDE; |
+ |
+ // Task runner for executing file I/O tasks. |
+ const scoped_refptr<base::SequencedTaskRunner> backend_task_runner_; |
+ std::string app_id_; |
+ // The directory where the external crx file resides. |
+ base::FilePath crx_dir_; |
+ // The directory used by SandBoxedUnpacker for unpacking extensions. |
+ const base::FilePath crx_unpack_dir_; |
+ scoped_refptr<KioskExternalUpdateValidatorDelegate> delegate_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(KioskExternalUpdateValidator); |
+}; |
+ |
+} // namespace chromeos |
+ |
+#endif // CHROME_BROWSER_CHROMEOS_APP_MODE_KIOSK_EXTERNAL_UPDATE_VALIDATOR_H_ |