blob: accbcce270e88de298f372785470d9dcfe6f0af3 [file] [log] [blame]
Avi Drissmand878a5012022-09-12 19:13:301// Copyright 2014 The Chromium Authors
byungchulba8252562014-12-05 21:01:272// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4//
5// Helper to initialize PrefService for cast shell.
6
derekjchowe54ff592016-01-06 01:05:507#ifndef CHROMECAST_BROWSER_PREF_SERVICE_HELPER_H_
8#define CHROMECAST_BROWSER_PREF_SERVICE_HELPER_H_
byungchulba8252562014-12-05 21:01:279
dcheng3c3c93d52016-04-08 05:12:3110#include <memory>
Ken MacKay3beca952021-04-21 18:41:0211#include <set>
derekjchowe54ff592016-01-06 01:05:5012#include <string>
13
derekjchowe54ff592016-01-06 01:05:5014#include "base/memory/ref_counted.h"
derekjchowe54ff592016-01-06 01:05:5015#include "base/threading/thread_checker.h"
Junbo Ke8c484e72021-12-08 02:26:2216#include "chromecast/base/process_types.h"
brettw066508682016-02-03 08:22:0217#include "components/prefs/pref_service.h"
byungchulba8252562014-12-05 21:01:2718
19class PrefRegistrySimple;
20
21namespace chromecast {
derekjchowe54ff592016-01-06 01:05:5022namespace shell {
byungchulba8252562014-12-05 21:01:2723
24// It uses JsonPrefStore internally and/so the format of config file is same to
25// that of JsonPrefStore.
26class PrefServiceHelper {
27 public:
28 // Loads configs from config file. Returns true if successful.
dcheng3c3c93d52016-04-08 05:12:3129 static std::unique_ptr<PrefService> CreatePrefService(
Junbo Ke8c484e72021-12-08 02:26:2230 PrefRegistrySimple* registry,
Junbo Keca6dc202021-12-14 01:07:2731 ProcessType process_type = ProcessType::kCastService);
byungchulba8252562014-12-05 21:01:2732
Ken MacKay3beca952021-04-21 18:41:0233 // Provides names of prefs that take a large amount of storage, and are
34 // therefore stored in a different file.
35 static std::set<std::string> LargePrefNames() __attribute__((weak));
36
byungchulba8252562014-12-05 21:01:2737 private:
38 // Registers any needed preferences for the current platform.
39 static void RegisterPlatformPrefs(PrefRegistrySimple* registry);
40
41 // Called after the pref file has been loaded.
42 static void OnPrefsLoaded(PrefService* pref_service);
43};
44
derekjchowe54ff592016-01-06 01:05:5045} // namespace shell
byungchulba8252562014-12-05 21:01:2746} // namespace chromecast
47
derekjchowe54ff592016-01-06 01:05:5048#endif // CHROMECAST_BROWSER_PREF_SERVICE_HELPER_H_