summaryrefslogtreecommitdiffstats
path: root/components/flags_ui/pref_service_flags_storage.h
blob: b230ac11eedf2de9fc4dedf1f6b9311d206f1070 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef COMPONENTS_FLAGS_UI_PREF_SERVICE_FLAGS_STORAGE_H_
#define COMPONENTS_FLAGS_UI_PREF_SERVICE_FLAGS_STORAGE_H_

#include "base/macros.h"
#include "build/build_config.h"
#include "components/flags_ui/flags_storage.h"

class PrefService;
class PrefRegistrySimple;

namespace user_prefs {
class PrefRegistrySyncable;
}

namespace flags_ui {

// Implements the FlagsStorage interface with a PrefService backend.
// This is the implementation used on desktop Chrome for all users.
class PrefServiceFlagsStorage : public FlagsStorage {
 public:
  explicit PrefServiceFlagsStorage(PrefService* prefs);
  ~PrefServiceFlagsStorage() override;

  std::set<std::string> GetFlags() override;
  bool SetFlags(const std::set<std::string>& flags) override;

  static void RegisterPrefs(PrefRegistrySimple* registry);

#if defined(OS_CHROMEOS)
  static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
#endif  // defined(OS_CHROMEOS)

 private:
  PrefService* prefs_;

  DISALLOW_COPY_AND_ASSIGN(PrefServiceFlagsStorage);
};

}  // namespace flags_ui

#endif  // COMPONENTS_FLAGS_UI_PREF_SERVICE_FLAGS_STORAGE_H_