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 #include "chrome/browser/captive_portal/captive_portal_service_factory.h" | 5 #include "chrome/browser/captive_portal/captive_portal_service_factory.h" |
6 | 6 |
7 #include "chrome/browser/captive_portal/captive_portal_service.h" | 7 #include "chrome/browser/captive_portal/captive_portal_service.h" |
8 #include "chrome/browser/profiles/incognito_helpers.h" | 8 #include "chrome/browser/profiles/incognito_helpers.h" |
9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
10 #include "components/browser_context_keyed_service/browser_context_dependency_ma
nager.h" | 10 #include "components/browser_context_keyed_service/browser_context_dependency_ma
nager.h" |
11 | 11 |
12 namespace captive_portal { | 12 namespace captive_portal { |
13 | 13 |
14 // static | 14 // static |
15 CaptivePortalService* CaptivePortalServiceFactory::GetForProfile( | 15 CaptivePortalService* CaptivePortalServiceFactory::GetForProfile( |
16 Profile* profile) { | 16 Profile* profile) { |
17 return static_cast<CaptivePortalService*>( | 17 return static_cast<CaptivePortalService*>( |
18 GetInstance()->GetServiceForProfile(profile, true)); | 18 GetInstance()->GetServiceForBrowserContext(profile, true)); |
19 } | 19 } |
20 | 20 |
21 // static | 21 // static |
22 CaptivePortalServiceFactory* CaptivePortalServiceFactory::GetInstance() { | 22 CaptivePortalServiceFactory* CaptivePortalServiceFactory::GetInstance() { |
23 return Singleton<CaptivePortalServiceFactory>::get(); | 23 return Singleton<CaptivePortalServiceFactory>::get(); |
24 } | 24 } |
25 | 25 |
26 CaptivePortalServiceFactory::CaptivePortalServiceFactory() | 26 CaptivePortalServiceFactory::CaptivePortalServiceFactory() |
27 : ProfileKeyedServiceFactory("CaptivePortalService", | 27 : BrowserContextKeyedServiceFactory( |
28 ProfileDependencyManager::GetInstance()) { | 28 "CaptivePortalService", |
| 29 BrowserContextDependencyManager::GetInstance()) { |
29 } | 30 } |
30 | 31 |
31 CaptivePortalServiceFactory::~CaptivePortalServiceFactory() { | 32 CaptivePortalServiceFactory::~CaptivePortalServiceFactory() { |
32 } | 33 } |
33 | 34 |
34 ProfileKeyedService* CaptivePortalServiceFactory::BuildServiceInstanceFor( | 35 BrowserContextKeyedService* |
| 36 CaptivePortalServiceFactory::BuildServiceInstanceFor( |
35 content::BrowserContext* profile) const { | 37 content::BrowserContext* profile) const { |
36 return new CaptivePortalService(static_cast<Profile*>(profile)); | 38 return new CaptivePortalService(static_cast<Profile*>(profile)); |
37 } | 39 } |
38 | 40 |
39 content::BrowserContext* CaptivePortalServiceFactory::GetBrowserContextToUse( | 41 content::BrowserContext* CaptivePortalServiceFactory::GetBrowserContextToUse( |
40 content::BrowserContext* context) const { | 42 content::BrowserContext* context) const { |
41 return chrome::GetBrowserContextOwnInstanceInIncognito(context); | 43 return chrome::GetBrowserContextOwnInstanceInIncognito(context); |
42 } | 44 } |
43 | 45 |
44 } // namespace captive_portal | 46 } // namespace captive_portal |
OLD | NEW |