1 // Copyright 2013 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_UI_APP_LIST_APP_LIST_SYNCABLE_SERVICE_FACTORY_H_
6 #define CHROME_BROWSER_UI_APP_LIST_APP_LIST_SYNCABLE_SERVICE_FACTORY_H_
8 #include "base/basictypes.h"
9 #include "base/memory/singleton.h"
10 #include "components/keyed_service/content/browser_context_keyed_service_factory.h"
16 class AppListSyncableService;
18 // Singleton that owns all AppListSyncableServices and associates them with
19 // Profiles. Listens for the Profile's destruction notification and cleans up
20 // the associated AppListSyncableService.
21 class AppListSyncableServiceFactory : public BrowserContextKeyedServiceFactory {
23 static AppListSyncableService* GetForProfile(Profile* profile);
25 static AppListSyncableServiceFactory* GetInstance();
27 static KeyedService* BuildInstanceFor(
28 content::BrowserContext* browser_context);
31 friend struct DefaultSingletonTraits<AppListSyncableServiceFactory>;
33 AppListSyncableServiceFactory();
34 ~AppListSyncableServiceFactory() override;
36 // BrowserContextKeyedServiceFactory:
37 KeyedService* BuildServiceInstanceFor(
38 content::BrowserContext* profile) const override;
39 void RegisterProfilePrefs(
40 user_prefs::PrefRegistrySyncable* registry) override;
41 content::BrowserContext* GetBrowserContextToUse(
42 content::BrowserContext* context) const override;
43 bool ServiceIsCreatedWithBrowserContext() const override;
44 bool ServiceIsNULLWhileTesting() const override;
46 DISALLOW_COPY_AND_ASSIGN(AppListSyncableServiceFactory);
49 } // namespace app_list
51 #endif // CHROME_BROWSER_UI_APP_LIST_APP_LIST_SYNCABLE_SERVICE_FACTORY_H_