| Index: chrome/browser/extensions/extension_creator.cc
|
| diff --git a/chrome/browser/extensions/extension_creator.cc b/chrome/browser/extensions/extension_creator.cc
|
| index 5255007a76c2212de59fd907c8a73c8a6fd35881..63fa3257c7385a0ff26a7698dd71cd3072cf95cc 100644
|
| --- a/chrome/browser/extensions/extension_creator.cc
|
| +++ b/chrome/browser/extensions/extension_creator.cc
|
| @@ -17,7 +17,7 @@
|
| #include "base/strings/string_util.h"
|
| #include "chrome/browser/extensions/extension_creator_filter.h"
|
| #include "chrome/grit/generated_resources.h"
|
| -#include "components/crx_file/crx_file.h"
|
| +#include "components/crx_file/crx2_file.h"
|
| #include "components/crx_file/id_util.h"
|
| #include "crypto/rsa_private_key.h"
|
| #include "crypto/signature_creator.h"
|
| @@ -252,24 +252,28 @@ bool ExtensionCreator::WriteCRX(const base::FilePath& zip_path,
|
| std::vector<uint8_t> public_key;
|
| CHECK(private_key->ExportPublicKey(&public_key));
|
|
|
| - crx_file::CrxFile::Error error;
|
| - std::unique_ptr<crx_file::CrxFile> crx(
|
| - crx_file::CrxFile::Create(public_key.size(), signature.size(), &error));
|
| + crx_file::Crx2File::Error error = crx_file::Crx2File::kMaxValue;
|
| + std::unique_ptr<crx_file::Crx2File> crx(
|
| + crx_file::Crx2File::Create(public_key.size(), signature.size(), &error));
|
| if (!crx) {
|
| - LOG(ERROR) << "cannot create CrxFileHeader: " << error;
|
| + LOG(ERROR) << "cannot create Crx2FileHeader: " << error;
|
| + return false;
|
| }
|
| - const crx_file::CrxFile::Header header = crx->header();
|
| + const crx_file::Crx2File::Header header = crx->header();
|
|
|
| if (fwrite(&header, sizeof(header), 1, crx_handle.get()) != 1) {
|
| PLOG(ERROR) << "fwrite failed to write header";
|
| + return false;
|
| }
|
| if (fwrite(&public_key.front(), sizeof(uint8_t), public_key.size(),
|
| crx_handle.get()) != public_key.size()) {
|
| PLOG(ERROR) << "fwrite failed to write public_key.front";
|
| + return false;
|
| }
|
| if (fwrite(&signature.front(), sizeof(uint8_t), signature.size(),
|
| crx_handle.get()) != signature.size()) {
|
| PLOG(ERROR) << "fwrite failed to write signature.front";
|
| + return false;
|
| }
|
|
|
| size_t buffer_size = 1 << 16;
|
| @@ -281,6 +285,7 @@ bool ExtensionCreator::WriteCRX(const base::FilePath& zip_path,
|
| if (fwrite(buffer.get(), sizeof(char), bytes_read, crx_handle.get()) !=
|
| bytes_read) {
|
| PLOG(ERROR) << "fwrite failed to write buffer";
|
| + return false;
|
| }
|
| }
|
|
|
|
|