ginkage | 553af320 | 2015-02-04 12:39:09 | [diff] [blame] | 1 | // Copyright (c) 2015 The Chromium Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #include "extensions/browser/crx_file_info.h" |
| 6 | |
| 7 | #include "base/logging.h" |
Joshua Pawlicki | fd01b7c | 2019-01-17 16:18:34 | [diff] [blame] | 8 | #include "components/crx_file/crx_verifier.h" |
ginkage | 553af320 | 2015-02-04 12:39:09 | [diff] [blame] | 9 | |
| 10 | namespace extensions { |
| 11 | |
| 12 | CRXFileInfo::CRXFileInfo() : path() { |
| 13 | } |
| 14 | |
| 15 | CRXFileInfo::CRXFileInfo(const std::string& i, |
| 16 | const base::FilePath& p, |
Joshua Pawlicki | fd01b7c | 2019-01-17 16:18:34 | [diff] [blame] | 17 | const std::string& h, |
| 18 | const crx_file::VerifierFormat f) |
| 19 | : extension_id(i), path(p), expected_hash(h), required_format(f) { |
ginkage | 553af320 | 2015-02-04 12:39:09 | [diff] [blame] | 20 | DCHECK(!path.empty()); |
| 21 | } |
| 22 | |
Joshua Pawlicki | fd01b7c | 2019-01-17 16:18:34 | [diff] [blame] | 23 | CRXFileInfo::CRXFileInfo(const std::string& i, |
| 24 | const crx_file::VerifierFormat f, |
| 25 | const base::FilePath& p) |
| 26 | : extension_id(i), path(p), expected_hash(), required_format(f) { |
ginkage | 553af320 | 2015-02-04 12:39:09 | [diff] [blame] | 27 | DCHECK(!path.empty()); |
| 28 | } |
| 29 | |
Joshua Pawlicki | fd01b7c | 2019-01-17 16:18:34 | [diff] [blame] | 30 | CRXFileInfo::CRXFileInfo(const base::FilePath& p, |
| 31 | const crx_file::VerifierFormat f) |
| 32 | : extension_id(), path(p), expected_hash(), required_format(f) { |
| 33 | DCHECK(!path.empty()); |
| 34 | } |
| 35 | |
| 36 | CRXFileInfo::CRXFileInfo(const CRXFileInfo& other) |
| 37 | : extension_id(other.extension_id), |
| 38 | path(other.path), |
| 39 | expected_hash(other.expected_hash), |
| 40 | required_format(other.required_format) { |
ginkage | 553af320 | 2015-02-04 12:39:09 | [diff] [blame] | 41 | DCHECK(!path.empty()); |
| 42 | } |
| 43 | |
| 44 | bool CRXFileInfo::operator==(const CRXFileInfo& that) const { |
| 45 | return extension_id == that.extension_id && path == that.path && |
| 46 | expected_hash == that.expected_hash; |
| 47 | } |
| 48 | |
| 49 | } // namespace extensions |