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/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 if (timestamp) { | 131 if (timestamp) { |
132 *timestamp = base::Time::UnixEpoch() + | 132 *timestamp = base::Time::UnixEpoch() + |
133 base::TimeDelta::FromMilliseconds(policy_data.timestamp()); | 133 base::TimeDelta::FromMilliseconds(policy_data.timestamp()); |
134 } | 134 } |
135 if (public_key_version) { | 135 if (public_key_version) { |
136 public_key_version->valid = policy_data.has_public_key_version(); | 136 public_key_version->valid = policy_data.has_public_key_version(); |
137 if (public_key_version->valid) | 137 if (public_key_version->valid) |
138 public_key_version->version = policy_data.public_key_version(); | 138 public_key_version->version = policy_data.public_key_version(); |
139 } | 139 } |
140 | 140 |
141 return DecodePolicyData(policy_data, mandatory, recommended); | 141 if (policy_data.state() == em::PolicyData::ACTIVE) |
| 142 return DecodePolicyData(policy_data, mandatory, recommended); |
| 143 |
| 144 return true; |
142 } | 145 } |
143 | 146 |
144 void CloudPolicyCacheBase::InformNotifier( | 147 void CloudPolicyCacheBase::InformNotifier( |
145 CloudPolicySubsystem::PolicySubsystemState state, | 148 CloudPolicySubsystem::PolicySubsystemState state, |
146 CloudPolicySubsystem::ErrorDetails error_details) { | 149 CloudPolicySubsystem::ErrorDetails error_details) { |
147 // TODO(jkummerow): To obsolete this NULL-check, make all uses of | 150 // TODO(jkummerow): To obsolete this NULL-check, make all uses of |
148 // UserPolicyCache explicitly set a notifier using |set_policy_notifier()|. | 151 // UserPolicyCache explicitly set a notifier using |set_policy_notifier()|. |
149 if (notifier_) | 152 if (notifier_) |
150 notifier_->Inform(state, error_details, PolicyNotifier::POLICY_CACHE); | 153 notifier_->Inform(state, error_details, PolicyNotifier::POLICY_CACHE); |
151 } | 154 } |
152 | 155 |
153 } // namespace policy | 156 } // namespace policy |
OLD | NEW |