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 "chrome/browser/chromeos/settings/session_manager_operation.h" | 5 #include "chrome/browser/chromeos/settings/session_manager_operation.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" |
11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
12 #include "base/memory/ptr_util.h" | 12 #include "base/memory/ptr_util.h" |
13 #include "base/message_loop/message_loop.h" | 13 #include "base/message_loop/message_loop.h" |
14 #include "base/stl_util.h" | 14 #include "base/stl_util.h" |
15 #include "base/task_runner_util.h" | 15 #include "base/task_runner_util.h" |
16 #include "base/task_scheduler/post_task.h" | 16 #include "base/task_scheduler/post_task.h" |
17 #include "base/threading/sequenced_worker_pool.h" | |
18 #include "chrome/browser/chromeos/policy/proto/chrome_device_policy.pb.h" | 17 #include "chrome/browser/chromeos/policy/proto/chrome_device_policy.pb.h" |
19 #include "chrome/browser/net/nss_context.h" | 18 #include "chrome/browser/net/nss_context.h" |
20 #include "components/ownership/owner_key_util.h" | 19 #include "components/ownership/owner_key_util.h" |
21 #include "components/policy/core/common/cloud/cloud_policy_constants.h" | 20 #include "components/policy/core/common/cloud/cloud_policy_constants.h" |
22 #include "components/policy/proto/device_management_backend.pb.h" | 21 #include "components/policy/proto/device_management_backend.pb.h" |
23 #include "content/public/browser/browser_thread.h" | |
24 #include "crypto/rsa_private_key.h" | 22 #include "crypto/rsa_private_key.h" |
25 #include "crypto/signature_creator.h" | 23 #include "crypto/signature_creator.h" |
26 | 24 |
27 using RetrievePolicyResponseType = | 25 using RetrievePolicyResponseType = |
28 chromeos::SessionManagerClient::RetrievePolicyResponseType; | 26 chromeos::SessionManagerClient::RetrievePolicyResponseType; |
29 using ownership::OwnerKeyUtil; | 27 using ownership::OwnerKeyUtil; |
30 using ownership::PublicKey; | 28 using ownership::PublicKey; |
31 | 29 |
32 namespace em = enterprise_management; | 30 namespace em = enterprise_management; |
33 | 31 |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
155 if (policy_blob.empty()) { | 153 if (policy_blob.empty()) { |
156 ReportResult(DeviceSettingsService::STORE_NO_POLICY); | 154 ReportResult(DeviceSettingsService::STORE_NO_POLICY); |
157 return; | 155 return; |
158 } | 156 } |
159 | 157 |
160 if (!policy->ParseFromString(policy_blob) || !policy->IsInitialized()) { | 158 if (!policy->ParseFromString(policy_blob) || !policy->IsInitialized()) { |
161 ReportResult(DeviceSettingsService::STORE_INVALID_POLICY); | 159 ReportResult(DeviceSettingsService::STORE_INVALID_POLICY); |
162 return; | 160 return; |
163 } | 161 } |
164 | 162 |
165 base::SequencedWorkerPool* pool = | |
166 content::BrowserThread::GetBlockingPool(); | |
167 scoped_refptr<base::SequencedTaskRunner> background_task_runner = | 163 scoped_refptr<base::SequencedTaskRunner> background_task_runner = |
168 pool->GetSequencedTaskRunnerWithShutdownBehavior( | 164 base::CreateSequencedTaskRunnerWithTraits( |
169 pool->GetSequenceToken(), | 165 {base::MayBlock(), base::TaskPriority::BACKGROUND, |
bartfab (slow)
2017/06/12 15:05:48
Nit: #include "base/task_scheduler/task_traits.h"
bartfab (slow)
2017/06/12 15:08:07
I think this should be base::TaskPriority::USER_BL
| |
170 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN); | 166 base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN}); |
171 | 167 |
172 std::unique_ptr<policy::DeviceCloudPolicyValidator> validator = | 168 std::unique_ptr<policy::DeviceCloudPolicyValidator> validator = |
173 policy::DeviceCloudPolicyValidator::Create(std::move(policy), | 169 policy::DeviceCloudPolicyValidator::Create(std::move(policy), |
174 background_task_runner); | 170 background_task_runner); |
175 | 171 |
176 if (cloud_validations_) { | 172 if (cloud_validations_) { |
177 // Policy auto-generated by session manager doesn't include a timestamp, so | 173 // Policy auto-generated by session manager doesn't include a timestamp, so |
178 // the timestamp shouldn't be verified in that case. Note that the timestamp | 174 // the timestamp shouldn't be verified in that case. Note that the timestamp |
179 // is still verified during enrollment and when a new policy is fetched from | 175 // is still verified during enrollment and when a new policy is fetched from |
180 // the server. | 176 // the server. |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
267 } | 263 } |
268 | 264 |
269 void StoreSettingsOperation::HandleStoreResult(bool success) { | 265 void StoreSettingsOperation::HandleStoreResult(bool success) { |
270 if (!success) | 266 if (!success) |
271 ReportResult(DeviceSettingsService::STORE_OPERATION_FAILED); | 267 ReportResult(DeviceSettingsService::STORE_OPERATION_FAILED); |
272 else | 268 else |
273 StartLoading(); | 269 StartLoading(); |
274 } | 270 } |
275 | 271 |
276 } // namespace chromeos | 272 } // namespace chromeos |
OLD | NEW |