| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/component_updater/component_unpacker.h" | 5 #include "chrome/browser/component_updater/component_unpacker.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| 11 #include "base/json/json_file_value_serializer.h" | 11 #include "base/json/json_file_value_serializer.h" |
| 12 #include "base/memory/scoped_handle.h" | 12 #include "base/memory/scoped_handle.h" |
| 13 #include "base/stringprintf.h" | 13 #include "base/stringprintf.h" |
| 14 #include "base/strings/string_number_conversions.h" | 14 #include "base/strings/string_number_conversions.h" |
| 15 #include "chrome/browser/component_updater/component_updater_service.h" | 15 #include "chrome/browser/component_updater/component_updater_service.h" |
| 16 #include "chrome/browser/extensions/crx_file.h" | |
| 17 #include "chrome/common/extensions/extension_constants.h" | 16 #include "chrome/common/extensions/extension_constants.h" |
| 18 #include "chrome/common/zip.h" | 17 #include "chrome/common/zip.h" |
| 19 #include "crypto/secure_hash.h" | 18 #include "crypto/secure_hash.h" |
| 20 #include "crypto/signature_verifier.h" | 19 #include "crypto/signature_verifier.h" |
| 20 #include "extensions/common/crx_file.h" |
| 21 | 21 |
| 22 using crypto::SecureHash; | 22 using crypto::SecureHash; |
| 23 | 23 |
| 24 namespace { | 24 namespace { |
| 25 // This class makes sure that the CRX digital signature is valid | 25 // This class makes sure that the CRX digital signature is valid |
| 26 // and well formed. | 26 // and well formed. |
| 27 class CRXValidator { | 27 class CRXValidator { |
| 28 public: | 28 public: |
| 29 explicit CRXValidator(FILE* crx_file) : valid_(false) { | 29 explicit CRXValidator(FILE* crx_file) : valid_(false) { |
| 30 extensions::CrxFile::Header header; | 30 extensions::CrxFile::Header header; |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 } | 166 } |
| 167 // Installation successful. The directory is not our concern now. | 167 // Installation successful. The directory is not our concern now. |
| 168 unpack_path_.clear(); | 168 unpack_path_.clear(); |
| 169 } | 169 } |
| 170 | 170 |
| 171 ComponentUnpacker::~ComponentUnpacker() { | 171 ComponentUnpacker::~ComponentUnpacker() { |
| 172 if (!unpack_path_.empty()) { | 172 if (!unpack_path_.empty()) { |
| 173 file_util::Delete(unpack_path_, true); | 173 file_util::Delete(unpack_path_, true); |
| 174 } | 174 } |
| 175 } | 175 } |
| OLD | NEW |