| 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_client.h" | 5 #include "components/policy/core/common/cloud/cloud_policy_client.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 | 207 |
| 208 void CloudPolicyClient::FetchPolicy() { | 208 void CloudPolicyClient::FetchPolicy() { |
| 209 CHECK(is_registered()); | 209 CHECK(is_registered()); |
| 210 CHECK(!types_to_fetch_.empty()); | 210 CHECK(!types_to_fetch_.empty()); |
| 211 | 211 |
| 212 policy_fetch_request_job_.reset( | 212 policy_fetch_request_job_.reset( |
| 213 service_->CreateJob(DeviceManagementRequestJob::TYPE_POLICY_FETCH, | 213 service_->CreateJob(DeviceManagementRequestJob::TYPE_POLICY_FETCH, |
| 214 GetRequestContext())); | 214 GetRequestContext())); |
| 215 policy_fetch_request_job_->SetDMToken(dm_token_); | 215 policy_fetch_request_job_->SetDMToken(dm_token_); |
| 216 policy_fetch_request_job_->SetClientID(client_id_); | 216 policy_fetch_request_job_->SetClientID(client_id_); |
| 217 if (!public_key_version_valid_) |
| 218 policy_fetch_request_job_->SetCritical(true); |
| 217 | 219 |
| 218 em::DeviceManagementRequest* request = | 220 em::DeviceManagementRequest* request = |
| 219 policy_fetch_request_job_->GetRequest(); | 221 policy_fetch_request_job_->GetRequest(); |
| 220 | 222 |
| 221 // Build policy fetch requests. | 223 // Build policy fetch requests. |
| 222 em::DevicePolicyRequest* policy_request = request->mutable_policy_request(); | 224 em::DevicePolicyRequest* policy_request = request->mutable_policy_request(); |
| 223 for (const auto& type_to_fetch : types_to_fetch_) { | 225 for (const auto& type_to_fetch : types_to_fetch_) { |
| 224 em::PolicyFetchRequest* fetch_request = policy_request->add_request(); | 226 em::PolicyFetchRequest* fetch_request = policy_request->add_request(); |
| 225 fetch_request->set_policy_type(type_to_fetch.first); | 227 fetch_request->set_policy_type(type_to_fetch.first); |
| 226 if (!type_to_fetch.second.empty()) | 228 if (!type_to_fetch.second.empty()) |
| (...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 781 for (auto& observer : observers_) | 783 for (auto& observer : observers_) |
| 782 observer.OnRobotAuthCodesFetched(this); | 784 observer.OnRobotAuthCodesFetched(this); |
| 783 } | 785 } |
| 784 | 786 |
| 785 void CloudPolicyClient::NotifyClientError() { | 787 void CloudPolicyClient::NotifyClientError() { |
| 786 for (auto& observer : observers_) | 788 for (auto& observer : observers_) |
| 787 observer.OnClientError(this); | 789 observer.OnClientError(this); |
| 788 } | 790 } |
| 789 | 791 |
| 790 } // namespace policy | 792 } // namespace policy |
| OLD | NEW |