OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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/chromeos/policy/policy_cert_service_factory.h" | 5 #include "chrome/browser/chromeos/policy/policy_cert_service_factory.h" |
6 | 6 |
7 #include "base/memory/singleton.h" | 7 #include "base/memory/singleton.h" |
8 #include "base/prefs/pref_registry_simple.h" | 8 #include "base/prefs/pref_registry_simple.h" |
9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
10 #include "base/prefs/scoped_user_pref_update.h" | 10 #include "base/prefs/scoped_user_pref_update.h" |
11 #include "chrome/browser/browser_process.h" | 11 #include "chrome/browser/browser_process.h" |
12 #include "chrome/browser/chromeos/login/users/user_manager.h" | |
13 #include "chrome/browser/chromeos/policy/policy_cert_service.h" | 12 #include "chrome/browser/chromeos/policy/policy_cert_service.h" |
14 #include "chrome/browser/chromeos/policy/policy_cert_verifier.h" | 13 #include "chrome/browser/chromeos/policy/policy_cert_verifier.h" |
15 #include "chrome/browser/chromeos/policy/user_network_configuration_updater_fact
ory.h" | 14 #include "chrome/browser/chromeos/policy/user_network_configuration_updater_fact
ory.h" |
16 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 15 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
17 #include "chrome/browser/lifetime/application_lifetime.h" | 16 #include "chrome/browser/lifetime/application_lifetime.h" |
18 #include "chrome/browser/profiles/incognito_helpers.h" | 17 #include "chrome/browser/profiles/incognito_helpers.h" |
19 #include "chrome/browser/profiles/profile.h" | 18 #include "chrome/browser/profiles/profile.h" |
20 #include "chrome/common/pref_names.h" | 19 #include "chrome/common/pref_names.h" |
21 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 20 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
22 #include "components/pref_registry/pref_registry_syncable.h" | 21 #include "components/pref_registry/pref_registry_syncable.h" |
| 22 #include "components/user_manager/user_manager.h" |
23 | 23 |
24 namespace policy { | 24 namespace policy { |
25 | 25 |
26 // static | 26 // static |
27 PolicyCertService* PolicyCertServiceFactory::GetForProfile(Profile* profile) { | 27 PolicyCertService* PolicyCertServiceFactory::GetForProfile(Profile* profile) { |
28 return static_cast<PolicyCertService*>( | 28 return static_cast<PolicyCertService*>( |
29 GetInstance()->GetServiceForBrowserContext(profile, false)); | 29 GetInstance()->GetServiceForBrowserContext(profile, false)); |
30 } | 30 } |
31 | 31 |
32 // static | 32 // static |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 BrowserContextDependencyManager::GetInstance()) { | 87 BrowserContextDependencyManager::GetInstance()) { |
88 DependsOn(UserNetworkConfigurationUpdaterFactory::GetInstance()); | 88 DependsOn(UserNetworkConfigurationUpdaterFactory::GetInstance()); |
89 } | 89 } |
90 | 90 |
91 PolicyCertServiceFactory::~PolicyCertServiceFactory() {} | 91 PolicyCertServiceFactory::~PolicyCertServiceFactory() {} |
92 | 92 |
93 KeyedService* PolicyCertServiceFactory::BuildServiceInstanceFor( | 93 KeyedService* PolicyCertServiceFactory::BuildServiceInstanceFor( |
94 content::BrowserContext* context) const { | 94 content::BrowserContext* context) const { |
95 Profile* profile = static_cast<Profile*>(context); | 95 Profile* profile = static_cast<Profile*>(context); |
96 | 96 |
97 chromeos::UserManager* user_manager = chromeos::UserManager::Get(); | 97 user_manager::UserManager* user_manager = user_manager::UserManager::Get(); |
98 user_manager::User* user = chromeos::ProfileHelper::Get()->GetUserByProfile( | 98 user_manager::User* user = chromeos::ProfileHelper::Get()->GetUserByProfile( |
99 profile->GetOriginalProfile()); | 99 profile->GetOriginalProfile()); |
100 if (!user) | 100 if (!user) |
101 return NULL; | 101 return NULL; |
102 | 102 |
103 // Backwards compatibility: profiles that used policy-pushed certificates used | 103 // Backwards compatibility: profiles that used policy-pushed certificates used |
104 // to have this condition marked in their prefs. This signal has moved to | 104 // to have this condition marked in their prefs. This signal has moved to |
105 // local_state though, to support checking it before the profile is loaded. | 105 // local_state though, to support checking it before the profile is loaded. |
106 // Check the profile here and update the local_state, if appropriate. | 106 // Check the profile here and update the local_state, if appropriate. |
107 // TODO(joaodasilva): remove this, eventually. | 107 // TODO(joaodasilva): remove this, eventually. |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 prefs::kUsedPolicyCertificatesOnce, | 143 prefs::kUsedPolicyCertificatesOnce, |
144 false, | 144 false, |
145 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | 145 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
146 } | 146 } |
147 | 147 |
148 bool PolicyCertServiceFactory::ServiceIsNULLWhileTesting() const { | 148 bool PolicyCertServiceFactory::ServiceIsNULLWhileTesting() const { |
149 return true; | 149 return true; |
150 } | 150 } |
151 | 151 |
152 } // namespace policy | 152 } // namespace policy |
OLD | NEW |