Index: chrome/browser/component_updater/component_unpacker.h |
diff --git a/chrome/browser/component_updater/component_unpacker.h b/chrome/browser/component_updater/component_unpacker.h |
index ffd69dd9c4adf21c1fa16a385dfdeb3c5d19207f..6cb929bd9d875eedf912d5e133e4a1933a3fd974 100644 |
--- a/chrome/browser/component_updater/component_unpacker.h |
+++ b/chrome/browser/component_updater/component_unpacker.h |
@@ -91,7 +91,7 @@ class ComponentUnpacker : public base::RefCountedThreadSafe<ComponentUnpacker> { |
typedef base::Callback<void(Error, int)> Callback; |
// Constructs an unpacker for a specific component unpacking operation. |
- // |pk_hash| is the expected/ public key SHA256 hash. |path| is the current |
+ // |pk_hash| is the expected public key SHA256 hash. |path| is the current |
// location of the CRX. |
ComponentUnpacker(const std::vector<uint8>& pk_hash, |
const base::FilePath& path, |
@@ -104,8 +104,24 @@ class ComponentUnpacker : public base::RefCountedThreadSafe<ComponentUnpacker> { |
// package is a differential update. Calls |callback| with the result. |
void Unpack(const Callback& callback); |
+ // Set the base directory where the unpack directory will be created. |
+ // If this is not set, files will be unzipped to temporary dir. |
+ void set_unpack_base_dir(const base::FilePath& path); |
+ |
+ // Creates a ComponentUnpacker by loading CRX and related install information |
+ // from |backup_path| that was previously saved by SaveInstallSource(). This |
+ // is to retry failed component installation. |pk_hash| is the expected public |
+ // key SHA256 hash. |
+ static scoped_refptr<ComponentUnpacker> CreateFromBackup( |
+ const base::FilePath& backup_path, |
+ const std::vector<uint8>& pk_hash, |
+ ComponentInstaller* installer, |
+ scoped_refptr<base::SequencedTaskRunner> task_runner); |
+ |
+ |
private: |
friend class base::RefCountedThreadSafe<ComponentUnpacker>; |
+ friend class ComponentUnpackerTest; |
virtual ~ComponentUnpacker(); |
@@ -138,6 +154,16 @@ class ComponentUnpacker : public base::RefCountedThreadSafe<ComponentUnpacker> { |
// Finish is responsible for calling the callback provided in Start(). |
void Finish(); |
+ // Saves the original CRX file, along with |fingerprint_|, |pk_hash_| and |
+ // |in_process_|, to |backup_path|. This is to re-create ComponentUnpacker for |
+ // retrying failed component patching. |
+ bool SaveInstallSource(const base::FilePath& backup_path) const; |
+ |
+ // Creates the directory for unzip. |new_dir| will be the full path to the |
+ // directory. |
+ bool CreateUnpackDirectory(base::FilePath* new_dir); |
+ |
+ base::FilePath unpack_base_dir_; |
std::vector<uint8> pk_hash_; |
base::FilePath path_; |
base::FilePath unpack_path_; |