1 // Copyright 2017 The Chromium Authors. All rights reserved.
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/incognito_helpers.h"
9 #include "chrome/browser/profiles/profile.h"
10 #include "components/keyed_service/content/browser_context_dependency_manager.h"
12 FontPrefChangeNotifierFactory::FontPrefChangeNotifierFactory()
13 : BrowserContextKeyedServiceFactory(
14 "FontPrefChangeNotifier",
15 BrowserContextDependencyManager::GetInstance()) {}
17 FontPrefChangeNotifierFactory::~FontPrefChangeNotifierFactory() = default;
20 FontPrefChangeNotifier* FontPrefChangeNotifierFactory::GetForProfile(
22 return static_cast<FontPrefChangeNotifier*>(
23 GetInstance()->GetServiceForBrowserContext(profile, true));
27 FontPrefChangeNotifierFactory* FontPrefChangeNotifierFactory::GetInstance() {
28 return base::Singleton<FontPrefChangeNotifierFactory>::get();
31 KeyedService* FontPrefChangeNotifierFactory::BuildServiceInstanceFor(
32 content::BrowserContext* context) const {
33 return new FontPrefChangeNotifier(
34 Profile::FromBrowserContext(context)->GetPrefs());
37 content::BrowserContext* FontPrefChangeNotifierFactory::GetBrowserContextToUse(
38 content::BrowserContext* context) const {
39 return chrome::GetBrowserContextRedirectedInIncognito(context);