Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_COMPONENT_UPDATER_COMPONENT_UNPACKER_H_ | 5 #ifndef CHROME_BROWSER_COMPONENT_UPDATER_COMPONENT_UNPACKER_H_ |
| 6 #define CHROME_BROWSER_COMPONENT_UPDATER_COMPONENT_UNPACKER_H_ | 6 #define CHROME_BROWSER_COMPONENT_UPDATER_COMPONENT_UNPACKER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 87 kDeltaMissingExistingFile, | 87 kDeltaMissingExistingFile, |
| 88 kFingerprintWriteFailed, | 88 kFingerprintWriteFailed, |
| 89 }; | 89 }; |
| 90 | 90 |
| 91 // Constructs an unpacker for a specific component unpacking operation. | 91 // Constructs an unpacker for a specific component unpacking operation. |
| 92 // |pk_hash| is the expected/ public key SHA256 hash. |path| is the current | 92 // |pk_hash| is the expected/ public key SHA256 hash. |path| is the current |
| 93 // location of the CRX. | 93 // location of the CRX. |
| 94 ComponentUnpacker(const std::vector<uint8>& pk_hash, | 94 ComponentUnpacker(const std::vector<uint8>& pk_hash, |
| 95 const base::FilePath& path, | 95 const base::FilePath& path, |
| 96 const std::string& fingerprint, | 96 const std::string& fingerprint, |
| 97 ComponentPatcher* patcher, | |
| 98 ComponentInstaller* installer, | 97 ComponentInstaller* installer, |
| 98 bool in_process, | |
| 99 scoped_refptr<base::SequencedTaskRunner> task_runner); | 99 scoped_refptr<base::SequencedTaskRunner> task_runner); |
| 100 | 100 |
| 101 virtual ~ComponentUnpacker(); | 101 virtual ~ComponentUnpacker(); |
| 102 | 102 |
| 103 // Begins the actual unpacking of the files. May invoke a patcher if the | 103 // Begins the actual unpacking of the files. May invoke a patcher if the |
| 104 // package is a differential update. Calls |callback| with the result. | 104 // package is a differential update. Calls |callback| with the result. |
| 105 void Unpack( | 105 void Unpack(const base::Callback<void(Error, int)>& callback); |
| 106 const base::Callback<void(Error, int)>& callback); | |
| 107 | 106 |
| 108 private: | 107 private: |
| 109 bool UnpackInternal(); | 108 bool UnpackInternal(); |
| 110 | 109 |
| 111 // The first step of unpacking is to verify the file. Returns false if an | 110 // The first step of unpacking is to verify the file. Returns false if an |
| 112 // error is encountered, the file is malformed, or the file is incorrectly | 111 // error is encountered, the file is malformed, or the file is incorrectly |
| 113 // signed. | 112 // signed. |
| 114 bool Verify(); | 113 bool Verify(); |
| 115 | 114 |
| 116 // The second step of unpacking is to unzip. Returns false if an error | 115 // The second step of unpacking is to unzip. Returns false if an error |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 137 | 136 |
| 138 // Returns a weak pointer to this object. | 137 // Returns a weak pointer to this object. |
| 139 base::WeakPtr<ComponentUnpacker> GetWeakPtr(); | 138 base::WeakPtr<ComponentUnpacker> GetWeakPtr(); |
| 140 | 139 |
| 141 std::vector<uint8> pk_hash_; | 140 std::vector<uint8> pk_hash_; |
| 142 base::FilePath path_; | 141 base::FilePath path_; |
| 143 base::FilePath unpack_path_; | 142 base::FilePath unpack_path_; |
| 144 base::FilePath unpack_diff_path_; | 143 base::FilePath unpack_diff_path_; |
| 145 bool is_delta_; | 144 bool is_delta_; |
| 146 std::string fingerprint_; | 145 std::string fingerprint_; |
| 147 ComponentPatcher* patcher_; | 146 scoped_ptr<ComponentPatcher> patcher_; |
| 148 ComponentInstaller* installer_; | 147 ComponentInstaller* installer_; |
| 149 base::Callback<void(Error, int)> callback_; | 148 base::Callback<void(Error, int)> callback_; |
| 149 bool in_process_; | |
|
Sorin Jianu
2014/02/03 20:57:57
const?
waffles
2014/02/07 01:00:59
Done.
| |
| 150 Error error_; | 150 Error error_; |
| 151 int extended_error_; | 151 int extended_error_; |
| 152 base::WeakPtrFactory<ComponentUnpacker> ptr_factory_; | 152 base::WeakPtrFactory<ComponentUnpacker> ptr_factory_; |
| 153 scoped_refptr<base::SequencedTaskRunner> task_runner_; | 153 scoped_refptr<base::SequencedTaskRunner> task_runner_; |
| 154 | 154 |
| 155 DISALLOW_COPY_AND_ASSIGN(ComponentUnpacker); | 155 DISALLOW_COPY_AND_ASSIGN(ComponentUnpacker); |
| 156 }; | 156 }; |
| 157 | 157 |
| 158 } // namespace component_updater | 158 } // namespace component_updater |
| 159 | 159 |
| 160 #endif // CHROME_BROWSER_COMPONENT_UPDATER_COMPONENT_UNPACKER_H_ | 160 #endif // CHROME_BROWSER_COMPONENT_UPDATER_COMPONENT_UNPACKER_H_ |
| OLD | NEW |