Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2013 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 | |
| 5 #include "chrome/browser/chromeos/policy/network_policy_service_factory.h" | |
| 6 | |
| 7 #include "base/memory/singleton.h" | |
| 8 #include "base/prefs/pref_service.h" | |
|
Joao da Silva
2013/09/20 13:00:01
Not used
pneubeck (no reviews)
2013/10/15 13:23:11
Done.
| |
| 9 #include "chrome/browser/chromeos/policy/network_policy_service.h" | |
| 10 #include "chrome/browser/policy/profile_policy_connector.h" | |
| 11 #include "chrome/browser/policy/profile_policy_connector_factory.h" | |
| 12 #include "chrome/browser/profiles/incognito_helpers.h" | |
| 13 #include "chrome/browser/profiles/profile.h" | |
| 14 #include "chrome/common/pref_names.h" | |
|
Joao da Silva
2013/09/20 13:00:01
Not used
pneubeck (no reviews)
2013/10/15 13:23:11
Done.
| |
| 15 #include "components/browser_context_keyed_service/browser_context_dependency_ma nager.h" | |
| 16 | |
| 17 namespace policy { | |
| 18 | |
| 19 // static | |
| 20 NetworkPolicyService* NetworkPolicyServiceFactory::GetForProfile( | |
| 21 Profile* profile) { | |
| 22 return static_cast<NetworkPolicyService*>( | |
| 23 GetInstance()->GetServiceForBrowserContext(profile, true)); | |
| 24 } | |
| 25 | |
| 26 // static | |
| 27 NetworkPolicyServiceFactory* NetworkPolicyServiceFactory::GetInstance() { | |
| 28 return Singleton<NetworkPolicyServiceFactory>::get(); | |
| 29 } | |
| 30 | |
| 31 NetworkPolicyServiceFactory::NetworkPolicyServiceFactory() | |
| 32 : BrowserContextKeyedServiceFactory( | |
| 33 "NetworkPolicyService", | |
| 34 BrowserContextDependencyManager::GetInstance()) { | |
| 35 DependsOn(ProfilePolicyConnectorFactory::GetInstance()); | |
| 36 } | |
| 37 | |
| 38 NetworkPolicyServiceFactory::~NetworkPolicyServiceFactory() {} | |
| 39 | |
| 40 content::BrowserContext* NetworkPolicyServiceFactory::GetBrowserContextToUse( | |
| 41 content::BrowserContext* context) const { | |
| 42 return chrome::GetBrowserContextRedirectedInIncognito(context); | |
| 43 } | |
| 44 | |
| 45 BrowserContextKeyedService* | |
| 46 NetworkPolicyServiceFactory::BuildServiceInstanceFor( | |
| 47 content::BrowserContext* context) const { | |
| 48 Profile* profile = static_cast<Profile*>(context); | |
| 49 ProfilePolicyConnector* connector = | |
| 50 ProfilePolicyConnectorFactory::GetForProfile(profile); | |
| 51 return new NetworkPolicyService(profile, connector->policy_service()); | |
| 52 } | |
| 53 | |
| 54 } // namespace policy | |
| OLD | NEW |