OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/policy/cloud_policy_cache_base.h" | 5 #include "chrome/browser/policy/cloud_policy_cache_base.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 if (timestamp) { | 165 if (timestamp) { |
166 *timestamp = base::Time::UnixEpoch() + | 166 *timestamp = base::Time::UnixEpoch() + |
167 base::TimeDelta::FromMilliseconds(policy_data.timestamp()); | 167 base::TimeDelta::FromMilliseconds(policy_data.timestamp()); |
168 } | 168 } |
169 if (public_key_version) { | 169 if (public_key_version) { |
170 public_key_version->valid = policy_data.has_public_key_version(); | 170 public_key_version->valid = policy_data.has_public_key_version(); |
171 if (public_key_version->valid) | 171 if (public_key_version->valid) |
172 public_key_version->version = policy_data.public_key_version(); | 172 public_key_version->version = policy_data.public_key_version(); |
173 } | 173 } |
174 | 174 |
175 return DecodePolicyData(policy_data, mandatory, recommended); | 175 if (policy_data.state() == em::PolicyData::ACTIVE) |
| 176 return DecodePolicyData(policy_data, mandatory, recommended); |
| 177 |
| 178 return true; |
176 } | 179 } |
177 | 180 |
178 void CloudPolicyCacheBase::InformNotifier( | 181 void CloudPolicyCacheBase::InformNotifier( |
179 CloudPolicySubsystem::PolicySubsystemState state, | 182 CloudPolicySubsystem::PolicySubsystemState state, |
180 CloudPolicySubsystem::ErrorDetails error_details) { | 183 CloudPolicySubsystem::ErrorDetails error_details) { |
181 // TODO(jkummerow): To obsolete this NULL-check, make all uses of | 184 // TODO(jkummerow): To obsolete this NULL-check, make all uses of |
182 // UserPolicyCache explicitly set a notifier using |set_policy_notifier()|. | 185 // UserPolicyCache explicitly set a notifier using |set_policy_notifier()|. |
183 if (notifier_) | 186 if (notifier_) |
184 notifier_->Inform(state, error_details, PolicyNotifier::POLICY_CACHE); | 187 notifier_->Inform(state, error_details, PolicyNotifier::POLICY_CACHE); |
185 } | 188 } |
186 | 189 |
187 } // namespace policy | 190 } // namespace policy |
OLD | NEW |