| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "components/policy/core/common/cloud/cloud_policy_service.h" | 5 #include "components/policy/core/common/cloud/cloud_policy_service.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 if (unregister_state_ == UNREGISTER_PENDING) | 106 if (unregister_state_ == UNREGISTER_PENDING) |
| 107 UnregisterCompleted(false); | 107 UnregisterCompleted(false); |
| 108 } | 108 } |
| 109 | 109 |
| 110 void CloudPolicyService::OnStoreLoaded(CloudPolicyStore* store) { | 110 void CloudPolicyService::OnStoreLoaded(CloudPolicyStore* store) { |
| 111 // Update the client with state from the store. | 111 // Update the client with state from the store. |
| 112 const em::PolicyData* policy(store_->policy()); | 112 const em::PolicyData* policy(store_->policy()); |
| 113 | 113 |
| 114 // Timestamp. | 114 // Timestamp. |
| 115 base::Time policy_timestamp; | 115 base::Time policy_timestamp; |
| 116 if (policy && policy->has_timestamp()) { | 116 if (policy && policy->has_timestamp()) |
| 117 policy_timestamp = | 117 policy_timestamp = base::Time::FromJavaTime(policy->timestamp()); |
| 118 base::Time::UnixEpoch() + | |
| 119 base::TimeDelta::FromMilliseconds(policy->timestamp()); | |
| 120 } | |
| 121 client_->set_last_policy_timestamp(policy_timestamp); | 118 client_->set_last_policy_timestamp(policy_timestamp); |
| 122 | 119 |
| 123 // Public key version. | 120 // Public key version. |
| 124 if (policy && policy->has_public_key_version()) | 121 if (policy && policy->has_public_key_version()) |
| 125 client_->set_public_key_version(policy->public_key_version()); | 122 client_->set_public_key_version(policy->public_key_version()); |
| 126 else | 123 else |
| 127 client_->clear_public_key_version(); | 124 client_->clear_public_key_version(); |
| 128 | 125 |
| 129 // Whether to submit the machine ID. | 126 // Whether to submit the machine ID. |
| 130 bool submit_machine_id = false; | 127 bool submit_machine_id = false; |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 | 183 |
| 187 void CloudPolicyService::AddObserver(Observer* observer) { | 184 void CloudPolicyService::AddObserver(Observer* observer) { |
| 188 observers_.AddObserver(observer); | 185 observers_.AddObserver(observer); |
| 189 } | 186 } |
| 190 | 187 |
| 191 void CloudPolicyService::RemoveObserver(Observer* observer) { | 188 void CloudPolicyService::RemoveObserver(Observer* observer) { |
| 192 observers_.RemoveObserver(observer); | 189 observers_.RemoveObserver(observer); |
| 193 } | 190 } |
| 194 | 191 |
| 195 } // namespace policy | 192 } // namespace policy |
| OLD | NEW |