| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #include "chrome/browser/android/webapk/webapk_install_service_factory.h" | 5 #include "chrome/browser/android/webapk/webapk_install_service_factory.h" |
| 6 | 6 |
| 7 #include "chrome/browser/android/webapk/webapk_install_service.h" | 7 #include "chrome/browser/android/webapk/webapk_install_service.h" |
| 8 #include "chrome/browser/profiles/incognito_helpers.h" |
| 8 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 9 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
| 9 | 10 |
| 10 // static | 11 // static |
| 11 WebApkInstallServiceFactory* WebApkInstallServiceFactory::GetInstance() { | 12 WebApkInstallServiceFactory* WebApkInstallServiceFactory::GetInstance() { |
| 12 return base::Singleton<WebApkInstallServiceFactory>::get(); | 13 return base::Singleton<WebApkInstallServiceFactory>::get(); |
| 13 } | 14 } |
| 14 | 15 |
| 15 // static | 16 // static |
| 16 WebApkInstallService* WebApkInstallServiceFactory::GetForBrowserContext( | 17 WebApkInstallService* WebApkInstallServiceFactory::GetForBrowserContext( |
| 17 content::BrowserContext* context) { | 18 content::BrowserContext* context) { |
| 18 return static_cast<WebApkInstallService*>( | 19 return static_cast<WebApkInstallService*>( |
| 19 GetInstance()->GetServiceForBrowserContext(context, true)); | 20 GetInstance()->GetServiceForBrowserContext(context, true)); |
| 20 } | 21 } |
| 21 | 22 |
| 22 WebApkInstallServiceFactory::WebApkInstallServiceFactory() | 23 WebApkInstallServiceFactory::WebApkInstallServiceFactory() |
| 23 : BrowserContextKeyedServiceFactory( | 24 : BrowserContextKeyedServiceFactory( |
| 24 "WebApkInstallService", | 25 "WebApkInstallService", |
| 25 BrowserContextDependencyManager::GetInstance()) {} | 26 BrowserContextDependencyManager::GetInstance()) {} |
| 26 | 27 |
| 27 WebApkInstallServiceFactory::~WebApkInstallServiceFactory() {} | 28 WebApkInstallServiceFactory::~WebApkInstallServiceFactory() {} |
| 28 | 29 |
| 29 KeyedService* WebApkInstallServiceFactory::BuildServiceInstanceFor( | 30 KeyedService* WebApkInstallServiceFactory::BuildServiceInstanceFor( |
| 30 content::BrowserContext* context) const { | 31 content::BrowserContext* context) const { |
| 31 return new WebApkInstallService(context); | 32 return new WebApkInstallService(context); |
| 32 } | 33 } |
| 34 |
| 35 content::BrowserContext* WebApkInstallServiceFactory::GetBrowserContextToUse( |
| 36 content::BrowserContext* context) const { |
| 37 return chrome::GetBrowserContextRedirectedInIncognito(context); |
| 38 } |
| OLD | NEW |