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..24b3b5b97038c43786bc5d9c201e71119d712413 100644 |
--- a/chrome/browser/extensions/extension_creator.cc |
+++ b/chrome/browser/extensions/extension_creator.cc |
@@ -14,10 +14,11 @@ |
#include "base/files/file_util.h" |
#include "base/files/scoped_file.h" |
#include "base/files/scoped_temp_dir.h" |
+#include "base/memory/ptr_util.h" |
Sorin Jianu
2017/05/16 20:54:50
we don't need this anymore now.
waffles
2017/05/16 22:34:52
Done.
|
#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 +253,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; |
+ auto 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 +286,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; |
} |
} |