OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 APPS_APP_RESTORE_SERVICE_FACTORY_H_ | 5 #ifndef APPS_APP_RESTORE_SERVICE_FACTORY_H_ |
6 #define APPS_APP_RESTORE_SERVICE_FACTORY_H_ | 6 #define APPS_APP_RESTORE_SERVICE_FACTORY_H_ |
7 | 7 |
8 #include "base/memory/singleton.h" | 8 #include "base/memory/singleton.h" |
9 #include "components/keyed_service/content/browser_context_keyed_service_factory
.h" | 9 #include "components/keyed_service/content/browser_context_keyed_service_factory
.h" |
10 | 10 |
11 class Profile; | 11 namespace content { |
| 12 class BrowserContext; |
| 13 } |
12 | 14 |
13 namespace apps { | 15 namespace apps { |
14 | 16 |
15 class AppRestoreService; | 17 class AppRestoreService; |
16 | 18 |
17 // Singleton that owns all AppRestoreServices and associates them with | 19 // Singleton that owns all AppRestoreServices and associates them with |
18 // Profiles. Listens for the Profile's destruction notification and cleans up | 20 // BrowserContexts. Listens for the BrowserContext's destruction notification |
| 21 // and cleans up |
19 // the associated AppRestoreService. | 22 // the associated AppRestoreService. |
20 class AppRestoreServiceFactory : public BrowserContextKeyedServiceFactory { | 23 class AppRestoreServiceFactory : public BrowserContextKeyedServiceFactory { |
21 public: | 24 public: |
22 static AppRestoreService* GetForProfile(Profile* profile); | 25 static AppRestoreService* GetForBrowserContext( |
| 26 content::BrowserContext* context); |
23 | 27 |
24 static AppRestoreServiceFactory* GetInstance(); | 28 static AppRestoreServiceFactory* GetInstance(); |
25 | 29 |
26 private: | 30 private: |
27 friend struct base::DefaultSingletonTraits<AppRestoreServiceFactory>; | 31 friend struct base::DefaultSingletonTraits<AppRestoreServiceFactory>; |
28 | 32 |
29 AppRestoreServiceFactory(); | 33 AppRestoreServiceFactory(); |
30 ~AppRestoreServiceFactory() override; | 34 ~AppRestoreServiceFactory() override; |
31 | 35 |
32 // BrowserContextKeyedServiceFactory: | 36 // BrowserContextKeyedServiceFactory: |
33 KeyedService* BuildServiceInstanceFor( | 37 KeyedService* BuildServiceInstanceFor( |
34 content::BrowserContext* profile) const override; | 38 content::BrowserContext* context) const override; |
35 bool ServiceIsCreatedWithBrowserContext() const override; | 39 bool ServiceIsCreatedWithBrowserContext() const override; |
36 }; | 40 }; |
37 | 41 |
38 } // namespace apps | 42 } // namespace apps |
39 | 43 |
40 #endif // APPS_APP_RESTORE_SERVICE_FACTORY_H_ | 44 #endif // APPS_APP_RESTORE_SERVICE_FACTORY_H_ |
OLD | NEW |