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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 base::TimeDelta::FromMilliseconds(policy->timestamp()); | 119 base::TimeDelta::FromMilliseconds(policy->timestamp()); |
120 } | 120 } |
121 client_->set_last_policy_timestamp(policy_timestamp); | 121 client_->set_last_policy_timestamp(policy_timestamp); |
122 | 122 |
123 // Public key version. | 123 // Public key version. |
124 if (policy && policy->has_public_key_version()) | 124 if (policy && policy->has_public_key_version()) |
125 client_->set_public_key_version(policy->public_key_version()); | 125 client_->set_public_key_version(policy->public_key_version()); |
126 else | 126 else |
127 client_->clear_public_key_version(); | 127 client_->clear_public_key_version(); |
128 | 128 |
129 // Whether to submit the machine ID. | |
130 bool submit_machine_id = false; | |
131 if (policy && policy->has_valid_serial_number_missing()) | |
132 submit_machine_id = policy->valid_serial_number_missing(); | |
133 client_->set_submit_machine_id(submit_machine_id); | |
134 | |
135 // Finally, set up registration if necessary. | 129 // Finally, set up registration if necessary. |
136 if (policy && policy->has_request_token() && policy->has_device_id() && | 130 if (policy && policy->has_request_token() && policy->has_device_id() && |
137 !client_->is_registered()) { | 131 !client_->is_registered()) { |
138 DVLOG(1) << "Setting up registration with request token: " | 132 DVLOG(1) << "Setting up registration with request token: " |
139 << policy->request_token(); | 133 << policy->request_token(); |
140 client_->SetupRegistration(policy->request_token(), | 134 client_->SetupRegistration(policy->request_token(), |
141 policy->device_id()); | 135 policy->device_id()); |
142 } | 136 } |
143 | 137 |
144 if (refresh_state_ == REFRESH_POLICY_STORE) | 138 if (refresh_state_ == REFRESH_POLICY_STORE) |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 | 180 |
187 void CloudPolicyService::AddObserver(Observer* observer) { | 181 void CloudPolicyService::AddObserver(Observer* observer) { |
188 observers_.AddObserver(observer); | 182 observers_.AddObserver(observer); |
189 } | 183 } |
190 | 184 |
191 void CloudPolicyService::RemoveObserver(Observer* observer) { | 185 void CloudPolicyService::RemoveObserver(Observer* observer) { |
192 observers_.RemoveObserver(observer); | 186 observers_.RemoveObserver(observer); |
193 } | 187 } |
194 | 188 |
195 } // namespace policy | 189 } // namespace policy |
OLD | NEW |