1 // Copyright 2019 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.
4 
5 #ifndef CHROME_BROWSER_HISTORY_DOMAIN_DIVERSITY_REPORTER_FACTORY_H_
6 #define CHROME_BROWSER_HISTORY_DOMAIN_DIVERSITY_REPORTER_FACTORY_H_
7 
8 #include <memory>
9 
10 #include "base/memory/singleton.h"
11 #include "components/keyed_service/content/browser_context_keyed_service_factory.h"
12 
13 class DomainDiversityReporter;
14 class Profile;
15 
16 namespace user_prefs {
17 class PrefRegistrySyncable;
18 }
19 
20 class DomainDiversityReporterFactory
21     : public BrowserContextKeyedServiceFactory {
22  public:
23   static DomainDiversityReporter* GetForProfile(Profile* profile);
24 
25   static DomainDiversityReporterFactory* GetInstance();
26 
27   static std::unique_ptr<KeyedService> BuildInstanceFor(
28       content::BrowserContext* profile);
29 
30  private:
31   friend struct base::DefaultSingletonTraits<DomainDiversityReporterFactory>;
32 
33   DomainDiversityReporterFactory();
34   ~DomainDiversityReporterFactory() override;
35 
36   // BrowserContextKeyedServiceFactory:
37   void RegisterProfilePrefs(
38       user_prefs::PrefRegistrySyncable* registry) override;
39 
40   KeyedService* BuildServiceInstanceFor(
41       content::BrowserContext* profile) const override;
42 
43   content::BrowserContext* GetBrowserContextToUse(
44       content::BrowserContext* context) const override;
45   bool ServiceIsNULLWhileTesting() const override;
46   bool ServiceIsCreatedWithBrowserContext() const override;
47 
48   DISALLOW_COPY_AND_ASSIGN(DomainDiversityReporterFactory);
49 };
50 
51 #endif  // CHROME_BROWSER_HISTORY_DOMAIN_DIVERSITY_REPORTER_FACTORY_H_
52