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" |
(...skipping 24 matching lines...) Expand all Loading... |
35 DCHECK(!GetInstance()->GetServiceForBrowserContext(profile, false)); | 35 DCHECK(!GetInstance()->GetServiceForBrowserContext(profile, false)); |
36 PolicyCertService* service = static_cast<PolicyCertService*>( | 36 PolicyCertService* service = static_cast<PolicyCertService*>( |
37 GetInstance()->GetServiceForBrowserContext(profile, true)); | 37 GetInstance()->GetServiceForBrowserContext(profile, true)); |
38 if (!service) | 38 if (!service) |
39 return scoped_ptr<PolicyCertVerifier>(); | 39 return scoped_ptr<PolicyCertVerifier>(); |
40 return service->CreatePolicyCertVerifier(); | 40 return service->CreatePolicyCertVerifier(); |
41 } | 41 } |
42 | 42 |
43 // static | 43 // static |
44 PolicyCertServiceFactory* PolicyCertServiceFactory::GetInstance() { | 44 PolicyCertServiceFactory* PolicyCertServiceFactory::GetInstance() { |
45 return Singleton<PolicyCertServiceFactory>::get(); | 45 return base::Singleton<PolicyCertServiceFactory>::get(); |
46 } | 46 } |
47 | 47 |
48 // static | 48 // static |
49 void PolicyCertServiceFactory::SetUsedPolicyCertificates( | 49 void PolicyCertServiceFactory::SetUsedPolicyCertificates( |
50 const std::string& user_id) { | 50 const std::string& user_id) { |
51 if (UsedPolicyCertificates(user_id)) | 51 if (UsedPolicyCertificates(user_id)) |
52 return; | 52 return; |
53 ListPrefUpdate update(g_browser_process->local_state(), | 53 ListPrefUpdate update(g_browser_process->local_state(), |
54 prefs::kUsedPolicyCertificates); | 54 prefs::kUsedPolicyCertificates); |
55 update->AppendString(user_id); | 55 update->AppendString(user_id); |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 // TODO(joaodasilva): this is used for backwards compatibility. | 141 // TODO(joaodasilva): this is used for backwards compatibility. |
142 // Remove once it's not necessary anymore. | 142 // Remove once it's not necessary anymore. |
143 registry->RegisterBooleanPref(prefs::kUsedPolicyCertificatesOnce, false); | 143 registry->RegisterBooleanPref(prefs::kUsedPolicyCertificatesOnce, false); |
144 } | 144 } |
145 | 145 |
146 bool PolicyCertServiceFactory::ServiceIsNULLWhileTesting() const { | 146 bool PolicyCertServiceFactory::ServiceIsNULLWhileTesting() const { |
147 return true; | 147 return true; |
148 } | 148 } |
149 | 149 |
150 } // namespace policy | 150 } // namespace policy |
OLD | NEW |