crx_creator.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. // Copyright 2017 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. #ifndef COMPONENTS_CRX_FILE_CRX_CREATOR_H_
  5. #define COMPONENTS_CRX_FILE_CRX_CREATOR_H_
  6. #include <string>
  7. namespace base {
  8. class FilePath;
  9. } // namespace base
  10. namespace crypto {
  11. class RSAPrivateKey;
  12. } // namespace crypto
  13. namespace crx_file {
  14. enum class CreatorResult {
  15. OK, // The CRX file was successfully created.
  16. ERROR_SIGNING_FAILURE,
  17. ERROR_FILE_NOT_READABLE,
  18. ERROR_FILE_NOT_WRITABLE,
  19. ERROR_FILE_WRITE_FAILURE,
  20. };
  21. // Similar to `Create` method but also injects `verified_contents` into the
  22. // header.
  23. CreatorResult CreateCrxWithVerifiedContentsInHeader(
  24. const base::FilePath& output_path,
  25. const base::FilePath& zip_path,
  26. crypto::RSAPrivateKey* signing_key,
  27. const std::string& verified_contents);
  28. // Create a CRX3 file at |output_path|, using the contents of the ZIP archive
  29. // located at |zip_path| and signing with (and deriving the CRX ID from)
  30. // |signing_key|.
  31. CreatorResult Create(const base::FilePath& output_path,
  32. const base::FilePath& zip_path,
  33. crypto::RSAPrivateKey* signing_key);
  34. } // namespace crx_file
  35. #endif // COMPONENTS_CRX_FILE_CRX_CREATOR_H_