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/common/extensions/extension_unpacker.h" | 5 #include "chrome/common/extensions/extension_unpacker.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/memory/scoped_handle.h" | 10 #include "base/memory/scoped_handle.h" |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 | 173 |
174 // NOTE: Since the unpacker doesn't have the extension's public_id, the | 174 // NOTE: Since the unpacker doesn't have the extension's public_id, the |
175 // InitFromValue is allowed to generate a temporary id for the extension. | 175 // InitFromValue is allowed to generate a temporary id for the extension. |
176 // ANY CODE THAT FOLLOWS SHOULD NOT DEPEND ON THE CORRECT ID OF THIS | 176 // ANY CODE THAT FOLLOWS SHOULD NOT DEPEND ON THE CORRECT ID OF THIS |
177 // EXTENSION. | 177 // EXTENSION. |
178 std::string error; | 178 std::string error; |
179 scoped_refptr<Extension> extension(Extension::Create( | 179 scoped_refptr<Extension> extension(Extension::Create( |
180 temp_install_dir_, | 180 temp_install_dir_, |
181 Extension::INVALID, | 181 Extension::INVALID, |
182 *parsed_manifest_, | 182 *parsed_manifest_, |
183 false, // Do not require a key | 183 Extension::NO_FLAGS, |
184 false, // Do not enable strict error checks | |
185 &error)); | 184 &error)); |
186 if (!extension.get()) { | 185 if (!extension.get()) { |
187 SetError(error); | 186 SetError(error); |
188 return false; | 187 return false; |
189 } | 188 } |
190 | 189 |
191 if (!extension_file_util::ValidateExtension(extension.get(), &error)) { | 190 if (!extension_file_util::ValidateExtension(extension.get(), &error)) { |
192 SetError(error); | 191 SetError(error); |
193 return false; | 192 return false; |
194 } | 193 } |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 return false; | 316 return false; |
318 } | 317 } |
319 parsed_catalogs_->Set(dir_name, root.release()); | 318 parsed_catalogs_->Set(dir_name, root.release()); |
320 | 319 |
321 return true; | 320 return true; |
322 } | 321 } |
323 | 322 |
324 void ExtensionUnpacker::SetError(const std::string &error) { | 323 void ExtensionUnpacker::SetError(const std::string &error) { |
325 error_message_ = error; | 324 error_message_ = error; |
326 } | 325 } |
OLD | NEW |