OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 } | 116 } |
117 | 117 |
118 return key_pair.release(); | 118 return key_pair.release(); |
119 } | 119 } |
120 | 120 |
121 bool ExtensionCreator::CreateZip(const FilePath& extension_dir, | 121 bool ExtensionCreator::CreateZip(const FilePath& extension_dir, |
122 FilePath* zip_path) { | 122 FilePath* zip_path) { |
123 file_util::CreateNewTempDirectory(FILE_PATH_LITERAL("chrome_"), zip_path); | 123 file_util::CreateNewTempDirectory(FILE_PATH_LITERAL("chrome_"), zip_path); |
124 *zip_path = zip_path->Append(FILE_PATH_LITERAL("extension.zip")); | 124 *zip_path = zip_path->Append(FILE_PATH_LITERAL("extension.zip")); |
125 | 125 |
126 if (!Zip(extension_dir, *zip_path)) { | 126 if (!Zip(extension_dir, *zip_path, false)) { // no hidden files |
127 error_message_ = "Failed to create temporary zip file during packaging."; | 127 error_message_ = "Failed to create temporary zip file during packaging."; |
128 return false; | 128 return false; |
129 } | 129 } |
130 | 130 |
131 return true; | 131 return true; |
132 } | 132 } |
133 | 133 |
134 bool ExtensionCreator::SignZip(const FilePath& zip_path, | 134 bool ExtensionCreator::SignZip(const FilePath& zip_path, |
135 base::RSAPrivateKey* private_key, | 135 base::RSAPrivateKey* private_key, |
136 std::vector<uint8>* signature) { | 136 std::vector<uint8>* signature) { |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 bool result = false; | 227 bool result = false; |
228 if (CreateZip(extension_dir, &zip_path) && | 228 if (CreateZip(extension_dir, &zip_path) && |
229 SignZip(zip_path, key_pair.get(), &signature) && | 229 SignZip(zip_path, key_pair.get(), &signature) && |
230 WriteCRX(zip_path, key_pair.get(), signature, crx_path)) { | 230 WriteCRX(zip_path, key_pair.get(), signature, crx_path)) { |
231 result = true; | 231 result = true; |
232 } | 232 } |
233 | 233 |
234 file_util::Delete(zip_path, false); | 234 file_util::Delete(zip_path, false); |
235 return result; | 235 return result; |
236 } | 236 } |
OLD | NEW |