| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "chrome/browser/extensions/extension_creator.h" | 5 #include "chrome/browser/extensions/extension_creator.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/crypto/rsa_private_key.h" | 10 #include "base/crypto/rsa_private_key.h" |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 error_message_ = | 59 error_message_ = |
| 60 l10n_util::GetStringUTF8(IDS_EXTENSION_PRIVATE_KEY_EXISTS); | 60 l10n_util::GetStringUTF8(IDS_EXTENSION_PRIVATE_KEY_EXISTS); |
| 61 return false; | 61 return false; |
| 62 } | 62 } |
| 63 | 63 |
| 64 // Load the extension once. We don't really need it, but this does a lot of | 64 // Load the extension once. We don't really need it, but this does a lot of |
| 65 // useful validation of the structure. | 65 // useful validation of the structure. |
| 66 scoped_refptr<Extension> extension( | 66 scoped_refptr<Extension> extension( |
| 67 extension_file_util::LoadExtension(absolute_extension_dir, | 67 extension_file_util::LoadExtension(absolute_extension_dir, |
| 68 Extension::INTERNAL, | 68 Extension::INTERNAL, |
| 69 false, // key not required | 69 Extension::STRICT_ERROR_CHECKS, |
| 70 true, // enable strict error checks | |
| 71 &error_message_)); | 70 &error_message_)); |
| 72 if (!extension.get()) | 71 if (!extension.get()) |
| 73 return false; // LoadExtension already set error_message_. | 72 return false; // LoadExtension already set error_message_. |
| 74 | 73 |
| 75 return true; | 74 return true; |
| 76 } | 75 } |
| 77 | 76 |
| 78 base::RSAPrivateKey* ExtensionCreator::ReadInputKey(const FilePath& | 77 base::RSAPrivateKey* ExtensionCreator::ReadInputKey(const FilePath& |
| 79 private_key_path) { | 78 private_key_path) { |
| 80 if (!file_util::PathExists(private_key_path)) { | 79 if (!file_util::PathExists(private_key_path)) { |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 bool result = false; | 264 bool result = false; |
| 266 if (CreateZip(extension_dir, temp_dir.path(), &zip_path) && | 265 if (CreateZip(extension_dir, temp_dir.path(), &zip_path) && |
| 267 SignZip(zip_path, key_pair.get(), &signature) && | 266 SignZip(zip_path, key_pair.get(), &signature) && |
| 268 WriteCRX(zip_path, key_pair.get(), signature, crx_path)) { | 267 WriteCRX(zip_path, key_pair.get(), signature, crx_path)) { |
| 269 result = true; | 268 result = true; |
| 270 } | 269 } |
| 271 | 270 |
| 272 file_util::Delete(zip_path, false); | 271 file_util::Delete(zip_path, false); |
| 273 return result; | 272 return result; |
| 274 } | 273 } |
| OLD | NEW |