value_store_factory.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. // Copyright 2016 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_VALUE_STORE_VALUE_STORE_FACTORY_H_
  5. #define COMPONENTS_VALUE_STORE_VALUE_STORE_FACTORY_H_
  6. #include <memory>
  7. #include <string>
  8. #include "base/memory/ref_counted.h"
  9. namespace base {
  10. class FilePath;
  11. }
  12. namespace value_store {
  13. class ValueStore;
  14. // Manages ValueStore instances.
  15. //
  16. // This factory creates the lower level stores that directly read/write to disk.
  17. class ValueStoreFactory : public base::RefCountedThreadSafe<ValueStoreFactory> {
  18. public:
  19. // Creates a |ValueStore| to contain data for a specific app in the given
  20. // directory.
  21. virtual std::unique_ptr<ValueStore> CreateValueStore(
  22. const base::FilePath& directory,
  23. const std::string& uma_client_name) = 0;
  24. // Deletes the ValueStore in the specified directory.
  25. virtual void DeleteValueStore(const base::FilePath& directory) = 0;
  26. // Returns whether there a ValueStore stored in the specified directory.
  27. virtual bool HasValueStore(const base::FilePath& directory) = 0;
  28. protected:
  29. friend class base::RefCountedThreadSafe<ValueStoreFactory>;
  30. virtual ~ValueStoreFactory() = default;
  31. };
  32. } // namespace value_store
  33. #endif // COMPONENTS_VALUE_STORE_VALUE_STORE_FACTORY_H_