blob: ee654b6fb2b1aad26daa2b6e9811a5a83c048e1c [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>
derekjchowe54ff592016-01-06 01:05:5011
derekjchowe54ff592016-01-06 01:05:5012#include "base/threading/thread_checker.h"
Junbo Ke8c484e72021-12-08 02:26:2213#include "chromecast/base/process_types.h"
Roland Bock24a7c862022-09-26 07:29:4814#include "components/prefs/pref_name_set.h"
brettw066508682016-02-03 08:22:0215#include "components/prefs/pref_service.h"
byungchulba8252562014-12-05 21:01:2716
17class PrefRegistrySimple;
18
19namespace chromecast {
derekjchowe54ff592016-01-06 01:05:5020namespace shell {
byungchulba8252562014-12-05 21:01:2721
22// It uses JsonPrefStore internally and/so the format of config file is same to
23// that of JsonPrefStore.
24class PrefServiceHelper {
25 public:
26 // Loads configs from config file. Returns true if successful.
dcheng3c3c93d52016-04-08 05:12:3127 static std::unique_ptr<PrefService> CreatePrefService(
Junbo Ke8c484e72021-12-08 02:26:2228 PrefRegistrySimple* registry,
Junbo Keca6dc202021-12-14 01:07:2729 ProcessType process_type = ProcessType::kCastService);
byungchulba8252562014-12-05 21:01:2730
Ken MacKay3beca952021-04-21 18:41:0231 // Provides names of prefs that take a large amount of storage, and are
32 // therefore stored in a different file.
Roland Bock24a7c862022-09-26 07:29:4833 static PrefNameSet LargePrefNames() __attribute__((weak));
Ken MacKay3beca952021-04-21 18:41:0234
byungchulba8252562014-12-05 21:01:2735 private:
36 // Registers any needed preferences for the current platform.
37 static void RegisterPlatformPrefs(PrefRegistrySimple* registry);
38
39 // Called after the pref file has been loaded.
40 static void OnPrefsLoaded(PrefService* pref_service);
41};
42
derekjchowe54ff592016-01-06 01:05:5043} // namespace shell
byungchulba8252562014-12-05 21:01:2744} // namespace chromecast
45
derekjchowe54ff592016-01-06 01:05:5046#endif // CHROMECAST_BROWSER_PREF_SERVICE_HELPER_H_