e26c714b035a85cd8a6ae22e1efeaf5834778284
[platform/framework/web/crosswalk.git] / src / chrome / browser / ui / app_list / app_list_syncable_service_factory.h
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.
4
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_
7
8 #include "base/basictypes.h"
9 #include "base/memory/singleton.h"
10 #include "components/keyed_service/content/browser_context_keyed_service_factory.h"
11
12 class Profile;
13
14 namespace app_list {
15
16 class AppListSyncableService;
17
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 {
22  public:
23   static AppListSyncableService* GetForProfile(Profile* profile);
24
25   static AppListSyncableServiceFactory* GetInstance();
26
27  private:
28   friend struct DefaultSingletonTraits<AppListSyncableServiceFactory>;
29
30   AppListSyncableServiceFactory();
31   virtual ~AppListSyncableServiceFactory();
32
33   // BrowserContextKeyedServiceFactory:
34   virtual KeyedService* BuildServiceInstanceFor(
35       content::BrowserContext* profile) const OVERRIDE;
36   virtual void RegisterProfilePrefs(
37       user_prefs::PrefRegistrySyncable* registry) OVERRIDE;
38   virtual content::BrowserContext* GetBrowserContextToUse(
39       content::BrowserContext* context) const OVERRIDE;
40
41   DISALLOW_COPY_AND_ASSIGN(AppListSyncableServiceFactory);
42 };
43
44 }  // namespace app_list
45
46 #endif  // CHROME_BROWSER_UI_APP_LIST_APP_LIST_SYNCABLE_SERVICE_FACTORY_H_