NaCl: Update revision in DEPS, r12770 -> r12773
[chromium-blink-merge.git] / chrome / browser / captive_portal / captive_portal_service_factory.cc
blob53b4483c0563117b9a6de1cd33b6a33db8fe19c0
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.
5 #include "chrome/browser/captive_portal/captive_portal_service_factory.h"
7 #include "chrome/browser/captive_portal/captive_portal_service.h"
8 #include "chrome/browser/profiles/incognito_helpers.h"
9 #include "chrome/browser/profiles/profile.h"
10 #include "components/browser_context_keyed_service/browser_context_dependency_manager.h"
12 namespace captive_portal {
14 // static
15 CaptivePortalService* CaptivePortalServiceFactory::GetForProfile(
16 Profile* profile) {
17 return static_cast<CaptivePortalService*>(
18 GetInstance()->GetServiceForBrowserContext(profile, true));
21 // static
22 CaptivePortalServiceFactory* CaptivePortalServiceFactory::GetInstance() {
23 return Singleton<CaptivePortalServiceFactory>::get();
26 CaptivePortalServiceFactory::CaptivePortalServiceFactory()
27 : BrowserContextKeyedServiceFactory(
28 "CaptivePortalService",
29 BrowserContextDependencyManager::GetInstance()) {
32 CaptivePortalServiceFactory::~CaptivePortalServiceFactory() {
35 BrowserContextKeyedService*
36 CaptivePortalServiceFactory::BuildServiceInstanceFor(
37 content::BrowserContext* profile) const {
38 return new CaptivePortalService(static_cast<Profile*>(profile));
41 content::BrowserContext* CaptivePortalServiceFactory::GetBrowserContextToUse(
42 content::BrowserContext* context) const {
43 return chrome::GetBrowserContextOwnInstanceInIncognito(context);
46 } // namespace captive_portal