1 // Copyright (c) 2012 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 #ifndef CHROME_BROWSER_FAVICON_FAVICON_SERVICE_FACTORY_H_
6 #define CHROME_BROWSER_FAVICON_FAVICON_SERVICE_FACTORY_H_
8 #include "components/keyed_service/content/browser_context_keyed_service_factory.h"
9 #include "components/keyed_service/core/service_access_type.h"
12 template <typename T
> struct DefaultSingletonTraits
;
21 // Singleton that owns all FaviconService and associates them with
23 class FaviconServiceFactory
: public BrowserContextKeyedServiceFactory
{
25 // |sat| defines what the caller plans to do with the service. See
26 // the ServiceAccessType definition in profile.h.
27 static favicon::FaviconService
* GetForProfile(Profile
* profile
,
28 ServiceAccessType sat
);
30 // Returns the FaviconServiceFactory singleton.
31 static FaviconServiceFactory
* GetInstance();
33 // Returns the default factory used to build FaviconService. Can be registered
34 // with SetTestingFactory to use the FaviconService instance during testing.
35 static TestingFactoryFunction
GetDefaultFactory();
38 friend struct base::DefaultSingletonTraits
<FaviconServiceFactory
>;
40 FaviconServiceFactory();
41 ~FaviconServiceFactory() override
;
43 // BrowserContextKeyedServiceFactory:
44 KeyedService
* BuildServiceInstanceFor(
45 content::BrowserContext
* profile
) const override
;
46 bool ServiceIsNULLWhileTesting() const override
;
48 DISALLOW_COPY_AND_ASSIGN(FaviconServiceFactory
);
51 #endif // CHROME_BROWSER_FAVICON_FAVICON_SERVICE_FACTORY_H_