[email protected] | 28c3eeb | 2012-10-15 05:47:53 | [diff] [blame] | 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. | ||||
4 | |||||
[email protected] | c2e2b6d | 2013-01-22 02:23:29 | [diff] [blame] | 5 | #include "apps/app_restore_service_factory.h" |
[email protected] | 28c3eeb | 2012-10-15 05:47:53 | [diff] [blame] | 6 | |
[email protected] | 4b7111f2 | 2013-06-18 14:22:12 | [diff] [blame] | 7 | #include "apps/app_lifetime_monitor_factory.h" |
[email protected] | c2e2b6d | 2013-01-22 02:23:29 | [diff] [blame] | 8 | #include "apps/app_restore_service.h" |
[email protected] | 12b7af3 | 2014-03-13 05:28:20 | [diff] [blame] | 9 | #include "components/keyed_service/content/browser_context_dependency_manager.h" |
michaelpg | 4d80e56 | 2017-04-04 01:48:14 | [diff] [blame] | 10 | #include "content/public/browser/browser_context.h" |
[email protected] | 28c3eeb | 2012-10-15 05:47:53 | [diff] [blame] | 11 | |
[email protected] | c2e2b6d | 2013-01-22 02:23:29 | [diff] [blame] | 12 | namespace apps { |
[email protected] | 28c3eeb | 2012-10-15 05:47:53 | [diff] [blame] | 13 | |
14 | // static | ||||
michaelpg | 4d80e56 | 2017-04-04 01:48:14 | [diff] [blame] | 15 | AppRestoreService* AppRestoreServiceFactory::GetForBrowserContext( |
16 | content::BrowserContext* context) { | ||||
[email protected] | 28c3eeb | 2012-10-15 05:47:53 | [diff] [blame] | 17 | return static_cast<AppRestoreService*>( |
michaelpg | 4d80e56 | 2017-04-04 01:48:14 | [diff] [blame] | 18 | GetInstance()->GetServiceForBrowserContext(context, true)); |
[email protected] | 28c3eeb | 2012-10-15 05:47:53 | [diff] [blame] | 19 | } |
20 | |||||
[email protected] | 28c3eeb | 2012-10-15 05:47:53 | [diff] [blame] | 21 | AppRestoreServiceFactory* AppRestoreServiceFactory::GetInstance() { |
olli.raula | 36aa8be | 2015-09-10 11:14:22 | [diff] [blame] | 22 | return base::Singleton<AppRestoreServiceFactory>::get(); |
[email protected] | 28c3eeb | 2012-10-15 05:47:53 | [diff] [blame] | 23 | } |
24 | |||||
25 | AppRestoreServiceFactory::AppRestoreServiceFactory() | ||||
[email protected] | f1484c5 | 2013-05-22 23:25:44 | [diff] [blame] | 26 | : BrowserContextKeyedServiceFactory( |
27 | "AppRestoreService", | ||||
28 | BrowserContextDependencyManager::GetInstance()) { | ||||
[email protected] | 4b7111f2 | 2013-06-18 14:22:12 | [diff] [blame] | 29 | DependsOn(AppLifetimeMonitorFactory::GetInstance()); |
[email protected] | 28c3eeb | 2012-10-15 05:47:53 | [diff] [blame] | 30 | } |
31 | |||||
Chris Watkins | ee8488b | 2017-11-27 04:06:56 | [diff] [blame] | 32 | AppRestoreServiceFactory::~AppRestoreServiceFactory() = default; |
[email protected] | 28c3eeb | 2012-10-15 05:47:53 | [diff] [blame] | 33 | |
[email protected] | 12b7af3 | 2014-03-13 05:28:20 | [diff] [blame] | 34 | KeyedService* AppRestoreServiceFactory::BuildServiceInstanceFor( |
michaelpg | 4d80e56 | 2017-04-04 01:48:14 | [diff] [blame] | 35 | content::BrowserContext* context) const { |
36 | return new AppRestoreService(context); | ||||
[email protected] | 28c3eeb | 2012-10-15 05:47:53 | [diff] [blame] | 37 | } |
38 | |||||
[email protected] | f1484c5 | 2013-05-22 23:25:44 | [diff] [blame] | 39 | bool AppRestoreServiceFactory::ServiceIsCreatedWithBrowserContext() const { |
[email protected] | 28c3eeb | 2012-10-15 05:47:53 | [diff] [blame] | 40 | return true; |
41 | } | ||||
42 | |||||
[email protected] | c2e2b6d | 2013-01-22 02:23:29 | [diff] [blame] | 43 | } // namespace apps |