Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_CHROMEOS_APP_MODE_KIOSK_EXTERNAL_UPDATE_VALIDATOR_H_ | |
| 6 #define CHROME_BROWSER_CHROMEOS_APP_MODE_KIOSK_EXTERNAL_UPDATE_VALIDATOR_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 | |
| 10 #include "base/files/file_path.h" | |
| 11 #include "base/sequenced_task_runner.h" | |
| 12 #include "chrome/browser/extensions/sandboxed_unpacker.h" | |
| 13 | |
| 14 namespace extensions { | |
| 15 class Extension; | |
| 16 } | |
| 17 | |
| 18 namespace chromeos { | |
| 19 | |
| 20 // Delegate class for KioskExternalUpdateValidator. | |
| 21 class KioskExternalUpdateValidatorDelegate | |
| 22 : 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
| |
| 23 public: | |
| 24 virtual void OnExtenalUpdateUnpackSuccess( | |
| 25 const std::string& app_id, | |
| 26 const base::FilePath& temp_dir, | |
| 27 const extensions::Extension* extension) = 0; | |
| 28 virtual void OnExternalUpdateUnpackFailure(const std::string& app_id) = 0; | |
| 29 | |
| 30 protected: | |
| 31 friend class base::RefCountedThreadSafe<KioskExternalUpdateValidatorDelegate>; | |
| 32 | |
| 33 virtual ~KioskExternalUpdateValidatorDelegate() {} | |
| 34 }; | |
| 35 | |
| 36 // Unpacks the crx file of the kiosk app and validates its signature. | |
| 37 class KioskExternalUpdateValidator | |
| 38 : public extensions::SandboxedUnpackerClient { | |
| 39 public: | |
| 40 KioskExternalUpdateValidator( | |
| 41 const scoped_refptr<base::SequencedTaskRunner>& backend_task_runner, | |
| 42 const std::string& app_id, | |
| 43 const base::FilePath& crx_path, | |
| 44 const base::FilePath& crx_unpack_dir, | |
| 45 KioskExternalUpdateValidatorDelegate* delegate); | |
| 46 | |
| 47 // Starts validating the external crx file. | |
| 48 void Start(); | |
| 49 | |
| 50 private: | |
| 51 virtual ~KioskExternalUpdateValidator(); | |
| 52 | |
| 53 // SandboxedUnpackerClient overrides. | |
| 54 virtual void OnUnpackFailure(const base::string16& error_message) OVERRIDE; | |
| 55 virtual void OnUnpackSuccess(const base::FilePath& temp_dir, | |
| 56 const base::FilePath& extension_dir, | |
| 57 const base::DictionaryValue* original_manifest, | |
| 58 const extensions::Extension* extension, | |
| 59 const SkBitmap& install_icon) OVERRIDE; | |
| 60 | |
| 61 // Task runner for executing file I/O tasks. | |
| 62 const scoped_refptr<base::SequencedTaskRunner> backend_task_runner_; | |
| 63 std::string app_id_; | |
| 64 // The directory where the external crx file resides. | |
| 65 base::FilePath crx_dir_; | |
| 66 // The directory used by SandBoxedUnpacker for unpacking extensions. | |
| 67 const base::FilePath crx_unpack_dir_; | |
| 68 scoped_refptr<KioskExternalUpdateValidatorDelegate> delegate_; | |
| 69 | |
| 70 DISALLOW_COPY_AND_ASSIGN(KioskExternalUpdateValidator); | |
| 71 }; | |
| 72 | |
| 73 } // namespace chromeos | |
| 74 | |
| 75 #endif // CHROME_BROWSER_CHROMEOS_APP_MODE_KIOSK_EXTERNAL_UPDATE_VALIDATOR_H_ | |
| OLD | NEW |