1 // Copyright 2017 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.
5 #include "chrome/browser/font_pref_change_notifier_factory.h"
7 #include "chrome/browser/font_pref_change_notifier.h"
8 #include "chrome/browser/profiles/profile.h"
10 FontPrefChangeNotifierFactory::FontPrefChangeNotifierFactory()
11 : ProfileKeyedServiceFactory(
12 "FontPrefChangeNotifier",
13 ProfileSelections::Builder()
14 .WithRegular(ProfileSelection::kRedirectedToOriginal)
15 // TODO(crbug.com/1418376): Check if this service is needed in
17 .WithGuest(ProfileSelection::kRedirectedToOriginal)
20 FontPrefChangeNotifierFactory::~FontPrefChangeNotifierFactory() = default;
23 FontPrefChangeNotifier* FontPrefChangeNotifierFactory::GetForProfile(
25 return static_cast<FontPrefChangeNotifier*>(
26 GetInstance()->GetServiceForBrowserContext(profile, true));
30 FontPrefChangeNotifierFactory* FontPrefChangeNotifierFactory::GetInstance() {
31 static base::NoDestructor<FontPrefChangeNotifierFactory> instance;
32 return instance.get();
35 std::unique_ptr<KeyedService>
36 FontPrefChangeNotifierFactory::BuildServiceInstanceForBrowserContext(
37 content::BrowserContext* context) const {
38 return std::make_unique<FontPrefChangeNotifier>(
39 Profile::FromBrowserContext(context)->GetPrefs());