unzipper.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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. #ifndef COMPONENTS_UPDATE_CLIENT_UNZIPPER_H_
  5. #define COMPONENTS_UPDATE_CLIENT_UNZIPPER_H_
  6. #include "base/callback_forward.h"
  7. #include "base/memory/ref_counted.h"
  8. namespace base {
  9. class FilePath;
  10. } // namespace base
  11. namespace update_client {
  12. class Unzipper {
  13. public:
  14. using UnzipCompleteCallback = base::OnceCallback<void(bool success)>;
  15. Unzipper(const Unzipper&) = delete;
  16. Unzipper& operator=(const Unzipper&) = delete;
  17. virtual ~Unzipper() = default;
  18. virtual void Unzip(const base::FilePath& zip_file,
  19. const base::FilePath& destination,
  20. UnzipCompleteCallback callback) = 0;
  21. protected:
  22. Unzipper() = default;
  23. };
  24. class UnzipperFactory : public base::RefCountedThreadSafe<UnzipperFactory> {
  25. public:
  26. UnzipperFactory(const UnzipperFactory&) = delete;
  27. UnzipperFactory& operator=(const UnzipperFactory&) = delete;
  28. virtual std::unique_ptr<Unzipper> Create() const = 0;
  29. protected:
  30. friend class base::RefCountedThreadSafe<UnzipperFactory>;
  31. UnzipperFactory() = default;
  32. virtual ~UnzipperFactory() = default;
  33. };
  34. } // namespace update_client
  35. #endif // COMPONENTS_UPDATE_CLIENT_UNZIPPER_H_