blob: 3d20e98a7206659c33511ad7f7a684a1077ad9b1 [file] [log] [blame]
[email protected]e6d1c4f2013-06-12 17:37:401// 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
droger888be0b2015-10-01 14:28:525#ifndef COMPONENTS_FLAGS_UI_FLAGS_STORAGE_H_
6#define COMPONENTS_FLAGS_UI_FLAGS_STORAGE_H_
[email protected]e6d1c4f2013-06-12 17:37:407
8#include <set>
9#include <string>
10
droger888be0b2015-10-01 14:28:5211namespace flags_ui {
[email protected]e6d1c4f2013-06-12 17:37:4012
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.
16class FlagsStorage {
17 public:
18 virtual ~FlagsStorage() {}
19
20 // Retrieves the flags as a set of strings.
Mustafa Emre Acera1a7fb12019-07-24 17:36:5021 virtual std::set<std::string> GetFlags() const = 0;
[email protected]e6d1c4f2013-06-12 17:37:4022 // Stores the |flags| and returns true on success.
[email protected]89f19af02013-09-19 05:22:3523 virtual bool SetFlags(const std::set<std::string>& flags) = 0;
Mustafa Emre Acera1a7fb12019-07-24 17:36:5024
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 Geyelin69df1456d2017-08-25 16:05:4535 // Lands pending changes to disk immediately.
36 virtual void CommitPendingWrites() = 0;
[email protected]e6d1c4f2013-06-12 17:37:4037};
38
droger888be0b2015-10-01 14:28:5239} // namespace flags_ui
[email protected]e6d1c4f2013-06-12 17:37:4040
droger888be0b2015-10-01 14:28:5241#endif // COMPONENTS_FLAGS_UI_FLAGS_STORAGE_H_