Fix emulator build error
[platform/framework/web/chromium-efl.git] / components / prefs / pref_service_factory.cc
1 // Copyright 2013 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "components/prefs/pref_service_factory.h"
6
7 #include <memory>
8
9 #include "base/functional/bind.h"
10 #include "base/functional/callback_helpers.h"
11 #include "base/task/sequenced_task_runner.h"
12 #include "components/prefs/default_pref_store.h"
13 #include "components/prefs/json_pref_store.h"
14 #include "components/prefs/pref_filter.h"
15 #include "components/prefs/pref_notifier_impl.h"
16 #include "components/prefs/pref_service.h"
17 #include "components/prefs/pref_value_store.h"
18
19 PrefServiceFactory::PrefServiceFactory()
20     : read_error_callback_(base::DoNothing()), async_(false) {}
21
22 PrefServiceFactory::~PrefServiceFactory() {}
23
24 void PrefServiceFactory::SetUserPrefsFile(
25     const base::FilePath& prefs_file,
26     base::SequencedTaskRunner* task_runner) {
27   user_prefs_ =
28       base::MakeRefCounted<JsonPrefStore>(prefs_file, nullptr, task_runner);
29 }
30
31 std::unique_ptr<PrefService> PrefServiceFactory::Create(
32     scoped_refptr<PrefRegistry> pref_registry) {
33   auto pref_notifier = std::make_unique<PrefNotifierImpl>();
34   auto pref_value_store = std::make_unique<PrefValueStore>(
35       managed_prefs_.get(), supervised_user_prefs_.get(),
36       extension_prefs_.get(), standalone_browser_prefs_.get(),
37       command_line_prefs_.get(), user_prefs_.get(), recommended_prefs_.get(),
38       pref_registry->defaults().get(), pref_notifier.get());
39   return std::make_unique<PrefService>(
40       std::move(pref_notifier), std::move(pref_value_store), user_prefs_.get(),
41       standalone_browser_prefs_.get(), std::move(pref_registry),
42       read_error_callback_, async_);
43 }