| 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 "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
| 9 #include "chrome/browser/chromeos/policy/policy_cert_service.h" | 9 #include "chrome/browser/chromeos/policy/policy_cert_service.h" |
| 10 #include "chrome/browser/chromeos/policy/policy_cert_verifier.h" | 10 #include "chrome/browser/chromeos/policy/policy_cert_verifier.h" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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); |
| 56 } | 56 } |
| 57 | 57 |
| 58 // static | 58 // static |
| 59 void PolicyCertServiceFactory::ClearUsedPolicyCertificates( | 59 void PolicyCertServiceFactory::ClearUsedPolicyCertificates( |
| 60 const std::string& user_id) { | 60 const std::string& user_id) { |
| 61 ListPrefUpdate update(g_browser_process->local_state(), | 61 ListPrefUpdate update(g_browser_process->local_state(), |
| 62 prefs::kUsedPolicyCertificates); | 62 prefs::kUsedPolicyCertificates); |
| 63 update->Remove(base::StringValue(user_id), NULL); | 63 update->Remove(base::Value(user_id), NULL); |
| 64 } | 64 } |
| 65 | 65 |
| 66 // static | 66 // static |
| 67 bool PolicyCertServiceFactory::UsedPolicyCertificates( | 67 bool PolicyCertServiceFactory::UsedPolicyCertificates( |
| 68 const std::string& user_id) { | 68 const std::string& user_id) { |
| 69 base::StringValue value(user_id); | 69 base::Value value(user_id); |
| 70 const base::ListValue* list = | 70 const base::ListValue* list = |
| 71 g_browser_process->local_state()->GetList(prefs::kUsedPolicyCertificates); | 71 g_browser_process->local_state()->GetList(prefs::kUsedPolicyCertificates); |
| 72 if (!list) { | 72 if (!list) { |
| 73 NOTREACHED(); | 73 NOTREACHED(); |
| 74 return false; | 74 return false; |
| 75 } | 75 } |
| 76 return list->Find(value) != list->end(); | 76 return list->Find(value) != list->end(); |
| 77 } | 77 } |
| 78 | 78 |
| 79 // static | 79 // static |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 // TODO(joaodasilva): this is used for backwards compatibility. | 142 // TODO(joaodasilva): this is used for backwards compatibility. |
| 143 // Remove once it's not necessary anymore. | 143 // Remove once it's not necessary anymore. |
| 144 registry->RegisterBooleanPref(prefs::kUsedPolicyCertificatesOnce, false); | 144 registry->RegisterBooleanPref(prefs::kUsedPolicyCertificatesOnce, false); |
| 145 } | 145 } |
| 146 | 146 |
| 147 bool PolicyCertServiceFactory::ServiceIsNULLWhileTesting() const { | 147 bool PolicyCertServiceFactory::ServiceIsNULLWhileTesting() const { |
| 148 return true; | 148 return true; |
| 149 } | 149 } |
| 150 | 150 |
| 151 } // namespace policy | 151 } // namespace policy |
| OLD | NEW |