[email protected] | e6d1c4f | 2013-06-12 17:37:40 | [diff] [blame] | 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 | |
droger | 888be0b | 2015-10-01 14:28:52 | [diff] [blame] | 5 | #ifndef COMPONENTS_FLAGS_UI_FLAGS_STORAGE_H_ |
| 6 | #define COMPONENTS_FLAGS_UI_FLAGS_STORAGE_H_ |
[email protected] | e6d1c4f | 2013-06-12 17:37:40 | [diff] [blame] | 7 | |
| 8 | #include <set> |
| 9 | #include <string> |
| 10 | |
droger | 888be0b | 2015-10-01 14:28:52 | [diff] [blame] | 11 | namespace flags_ui { |
[email protected] | e6d1c4f | 2013-06-12 17:37:40 | [diff] [blame] | 12 | |
| 13 | // Base class for flags storage implementations. Enables the about_flags |
| 14 | // functions to store and retrieve data from various sources like PrefService |
| 15 | // and CrosSettings. |
| 16 | class FlagsStorage { |
| 17 | public: |
| 18 | virtual ~FlagsStorage() {} |
| 19 | |
| 20 | // Retrieves the flags as a set of strings. |
Mustafa Emre Acer | a1a7fb1 | 2019-07-24 17:36:50 | [diff] [blame] | 21 | virtual std::set<std::string> GetFlags() const = 0; |
[email protected] | e6d1c4f | 2013-06-12 17:37:40 | [diff] [blame] | 22 | // Stores the |flags| and returns true on success. |
[email protected] | 89f19af0 | 2013-09-19 05:22:35 | [diff] [blame] | 23 | virtual bool SetFlags(const std::set<std::string>& flags) = 0; |
Mustafa Emre Acer | a1a7fb1 | 2019-07-24 17:36:50 | [diff] [blame] | 24 | |
| 25 | // Retrieves the serialized origin list corresponding to |
| 26 | // |internal_entry_name|. Does not check if the return value is well formed. |
| 27 | virtual std::string GetOriginListFlag( |
| 28 | const std::string& internal_entry_name) const = 0; |
| 29 | // Sets the serialized |origin_list_value| corresponding to |
| 30 | // |internal_entry_name|. Does not check if |origin_list_value| is well |
| 31 | // formed. |
| 32 | virtual void SetOriginListFlag(const std::string& internal_entry_name, |
| 33 | const std::string& origin_list_value) = 0; |
| 34 | |
Jean-François Geyelin | 69df1456d | 2017-08-25 16:05:45 | [diff] [blame] | 35 | // Lands pending changes to disk immediately. |
| 36 | virtual void CommitPendingWrites() = 0; |
[email protected] | e6d1c4f | 2013-06-12 17:37:40 | [diff] [blame] | 37 | }; |
| 38 | |
droger | 888be0b | 2015-10-01 14:28:52 | [diff] [blame] | 39 | } // namespace flags_ui |
[email protected] | e6d1c4f | 2013-06-12 17:37:40 | [diff] [blame] | 40 | |
droger | 888be0b | 2015-10-01 14:28:52 | [diff] [blame] | 41 | #endif // COMPONENTS_FLAGS_UI_FLAGS_STORAGE_H_ |