in_process_unzipper.cc 973 B

12345678910111213141516171819202122232425262728293031323334353637
  1. // Copyright 2019 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. #include "components/update_client/unzip/in_process_unzipper.h"
  5. #include <utility>
  6. #include "base/files/file_path.h"
  7. #include "third_party/zlib/google/zip.h"
  8. namespace update_client {
  9. namespace {
  10. class InProcessUnzipper : public Unzipper {
  11. public:
  12. InProcessUnzipper() = default;
  13. void Unzip(const base::FilePath& zip_path,
  14. const base::FilePath& output_path,
  15. UnzipCompleteCallback callback) override {
  16. std::move(callback).Run(zip::Unzip(zip_path, output_path));
  17. }
  18. };
  19. } // namespace
  20. InProcessUnzipperFactory::InProcessUnzipperFactory() = default;
  21. std::unique_ptr<Unzipper> InProcessUnzipperFactory::Create() const {
  22. return std::make_unique<InProcessUnzipper>();
  23. }
  24. InProcessUnzipperFactory::~InProcessUnzipperFactory() = default;
  25. } // namespace update_client