OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_UI_APP_LIST_APP_LIST_SYNCABLE_SERVICE_FACTORY_H_ | 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_ | 6 #define CHROME_BROWSER_UI_APP_LIST_APP_LIST_SYNCABLE_SERVICE_FACTORY_H_ |
7 | 7 |
| 8 #include <memory> |
| 9 |
8 #include "base/macros.h" | 10 #include "base/macros.h" |
9 #include "base/memory/scoped_ptr.h" | |
10 #include "base/memory/singleton.h" | 11 #include "base/memory/singleton.h" |
11 #include "components/keyed_service/content/browser_context_keyed_service_factory
.h" | 12 #include "components/keyed_service/content/browser_context_keyed_service_factory
.h" |
12 | 13 |
13 class Profile; | 14 class Profile; |
14 | 15 |
15 namespace app_list { | 16 namespace app_list { |
16 | 17 |
17 class AppListSyncableService; | 18 class AppListSyncableService; |
18 | 19 |
19 // Singleton that owns all AppListSyncableServices and associates them with | 20 // Singleton that owns all AppListSyncableServices and associates them with |
20 // Profiles. Listens for the Profile's destruction notification and cleans up | 21 // Profiles. Listens for the Profile's destruction notification and cleans up |
21 // the associated AppListSyncableService. | 22 // the associated AppListSyncableService. |
22 class AppListSyncableServiceFactory : public BrowserContextKeyedServiceFactory { | 23 class AppListSyncableServiceFactory : public BrowserContextKeyedServiceFactory { |
23 public: | 24 public: |
24 static AppListSyncableService* GetForProfile(Profile* profile); | 25 static AppListSyncableService* GetForProfile(Profile* profile); |
25 | 26 |
26 static AppListSyncableServiceFactory* GetInstance(); | 27 static AppListSyncableServiceFactory* GetInstance(); |
27 | 28 |
28 static scoped_ptr<KeyedService> BuildInstanceFor( | 29 static std::unique_ptr<KeyedService> BuildInstanceFor( |
29 content::BrowserContext* browser_context); | 30 content::BrowserContext* browser_context); |
30 | 31 |
31 private: | 32 private: |
32 friend struct base::DefaultSingletonTraits<AppListSyncableServiceFactory>; | 33 friend struct base::DefaultSingletonTraits<AppListSyncableServiceFactory>; |
33 | 34 |
34 AppListSyncableServiceFactory(); | 35 AppListSyncableServiceFactory(); |
35 ~AppListSyncableServiceFactory() override; | 36 ~AppListSyncableServiceFactory() override; |
36 | 37 |
37 // BrowserContextKeyedServiceFactory: | 38 // BrowserContextKeyedServiceFactory: |
38 KeyedService* BuildServiceInstanceFor( | 39 KeyedService* BuildServiceInstanceFor( |
39 content::BrowserContext* profile) const override; | 40 content::BrowserContext* profile) const override; |
40 void RegisterProfilePrefs( | 41 void RegisterProfilePrefs( |
41 user_prefs::PrefRegistrySyncable* registry) override; | 42 user_prefs::PrefRegistrySyncable* registry) override; |
42 content::BrowserContext* GetBrowserContextToUse( | 43 content::BrowserContext* GetBrowserContextToUse( |
43 content::BrowserContext* context) const override; | 44 content::BrowserContext* context) const override; |
44 bool ServiceIsCreatedWithBrowserContext() const override; | 45 bool ServiceIsCreatedWithBrowserContext() const override; |
45 bool ServiceIsNULLWhileTesting() const override; | 46 bool ServiceIsNULLWhileTesting() const override; |
46 | 47 |
47 DISALLOW_COPY_AND_ASSIGN(AppListSyncableServiceFactory); | 48 DISALLOW_COPY_AND_ASSIGN(AppListSyncableServiceFactory); |
48 }; | 49 }; |
49 | 50 |
50 } // namespace app_list | 51 } // namespace app_list |
51 | 52 |
52 #endif // CHROME_BROWSER_UI_APP_LIST_APP_LIST_SYNCABLE_SERVICE_FACTORY_H_ | 53 #endif // CHROME_BROWSER_UI_APP_LIST_APP_LIST_SYNCABLE_SERVICE_FACTORY_H_ |
OLD | NEW |