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