flags_storage.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. // Copyright 2013 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_FLAGS_UI_FLAGS_STORAGE_H_
  5. #define COMPONENTS_FLAGS_UI_FLAGS_STORAGE_H_
  6. #include <set>
  7. #include <string>
  8. namespace flags_ui {
  9. // Base class for flags storage implementations. Enables the about_flags
  10. // functions to store and retrieve data from various sources like PrefService
  11. // and CrosSettings.
  12. class FlagsStorage {
  13. public:
  14. virtual ~FlagsStorage() {}
  15. // Retrieves the flags as a set of strings.
  16. virtual std::set<std::string> GetFlags() const = 0;
  17. // Stores the |flags| and returns true on success.
  18. virtual bool SetFlags(const std::set<std::string>& flags) = 0;
  19. // Retrieves the serialized origin list corresponding to
  20. // |internal_entry_name|. Does not check if the return value is well formed.
  21. virtual std::string GetOriginListFlag(
  22. const std::string& internal_entry_name) const = 0;
  23. // Sets the serialized |origin_list_value| corresponding to
  24. // |internal_entry_name|. Does not check if |origin_list_value| is well
  25. // formed.
  26. virtual void SetOriginListFlag(const std::string& internal_entry_name,
  27. const std::string& origin_list_value) = 0;
  28. // Lands pending changes to disk immediately.
  29. virtual void CommitPendingWrites() = 0;
  30. };
  31. } // namespace flags_ui
  32. #endif // COMPONENTS_FLAGS_UI_FLAGS_STORAGE_H_