OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/attestation/attestation_policy_observer.h" | 5 #include "chrome/browser/chromeos/attestation/attestation_policy_observer.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
11 #include "base/location.h" | 11 #include "base/location.h" |
12 #include "base/time/time.h" | 12 #include "base/time/time.h" |
13 #include "chrome/browser/chrome_notification_types.h" | 13 #include "chrome/browser/chrome_notification_types.h" |
14 #include "chrome/browser/chromeos/attestation/attestation_ca_client.h" | 14 #include "chrome/browser/chromeos/attestation/attestation_ca_client.h" |
15 #include "chrome/browser/chromeos/attestation/attestation_key_payload.pb.h" | 15 #include "chrome/browser/chromeos/attestation/attestation_key_payload.pb.h" |
16 #include "chrome/browser/chromeos/settings/cros_settings.h" | 16 #include "chrome/browser/chromeos/settings/cros_settings.h" |
17 #include "chrome/browser/policy/cloud/cloud_policy_client.h" | |
18 #include "chrome/browser/policy/cloud/cloud_policy_manager.h" | |
19 #include "chromeos/attestation/attestation_flow.h" | 17 #include "chromeos/attestation/attestation_flow.h" |
20 #include "chromeos/cryptohome/async_method_caller.h" | 18 #include "chromeos/cryptohome/async_method_caller.h" |
21 #include "chromeos/dbus/cryptohome_client.h" | 19 #include "chromeos/dbus/cryptohome_client.h" |
22 #include "chromeos/dbus/dbus_method_call_status.h" | 20 #include "chromeos/dbus/dbus_method_call_status.h" |
23 #include "chromeos/dbus/dbus_thread_manager.h" | 21 #include "chromeos/dbus/dbus_thread_manager.h" |
| 22 #include "components/policy/core/common/cloud/cloud_policy_client.h" |
| 23 #include "components/policy/core/common/cloud/cloud_policy_manager.h" |
24 #include "content/public/browser/browser_thread.h" | 24 #include "content/public/browser/browser_thread.h" |
25 #include "content/public/browser/notification_details.h" | 25 #include "content/public/browser/notification_details.h" |
26 #include "net/cert/x509_certificate.h" | 26 #include "net/cert/x509_certificate.h" |
27 | 27 |
28 namespace { | 28 namespace { |
29 | 29 |
30 // The number of days before a certificate expires during which it is | 30 // The number of days before a certificate expires during which it is |
31 // considered 'expiring soon' and replacement is initiated. The Chrome OS CA | 31 // considered 'expiring soon' and replacement is initiated. The Chrome OS CA |
32 // issues certificates with an expiry of at least two years. This value has | 32 // issues certificates with an expiry of at least two years. This value has |
33 // been set large enough so that the majority of users will have gone through | 33 // been set large enough so that the majority of users will have gone through |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 base::Bind(DBusStringCallback, | 262 base::Bind(DBusStringCallback, |
263 callback, | 263 callback, |
264 base::Bind(&AttestationPolicyObserver::Reschedule, | 264 base::Bind(&AttestationPolicyObserver::Reschedule, |
265 weak_factory_.GetWeakPtr()), | 265 weak_factory_.GetWeakPtr()), |
266 FROM_HERE)); | 266 FROM_HERE)); |
267 } | 267 } |
268 | 268 |
269 void AttestationPolicyObserver::OnUploadComplete(bool status) { | 269 void AttestationPolicyObserver::OnUploadComplete(bool status) { |
270 if (!status) | 270 if (!status) |
271 return; | 271 return; |
272 LOG(INFO) << "Enterprise Machine Certificate uploaded to DMServer."; | 272 VLOG(1) << "Enterprise Machine Certificate uploaded to DMServer."; |
273 GetKeyPayload(base::Bind(&AttestationPolicyObserver::MarkAsUploaded, | 273 GetKeyPayload(base::Bind(&AttestationPolicyObserver::MarkAsUploaded, |
274 weak_factory_.GetWeakPtr())); | 274 weak_factory_.GetWeakPtr())); |
275 } | 275 } |
276 | 276 |
277 void AttestationPolicyObserver::MarkAsUploaded(const std::string& key_payload) { | 277 void AttestationPolicyObserver::MarkAsUploaded(const std::string& key_payload) { |
278 AttestationKeyPayload payload_pb; | 278 AttestationKeyPayload payload_pb; |
279 if (!key_payload.empty()) | 279 if (!key_payload.empty()) |
280 payload_pb.ParseFromString(key_payload); | 280 payload_pb.ParseFromString(key_payload); |
281 payload_pb.set_is_certificate_uploaded(true); | 281 payload_pb.set_is_certificate_uploaded(true); |
282 std::string new_payload; | 282 std::string new_payload; |
(...skipping 20 matching lines...) Expand all Loading... |
303 base::Bind(&AttestationPolicyObserver::Start, | 303 base::Bind(&AttestationPolicyObserver::Start, |
304 weak_factory_.GetWeakPtr()), | 304 weak_factory_.GetWeakPtr()), |
305 base::TimeDelta::FromSeconds(retry_delay_)); | 305 base::TimeDelta::FromSeconds(retry_delay_)); |
306 } else { | 306 } else { |
307 LOG(WARNING) << "AttestationPolicyObserver: Retry limit exceeded."; | 307 LOG(WARNING) << "AttestationPolicyObserver: Retry limit exceeded."; |
308 } | 308 } |
309 } | 309 } |
310 | 310 |
311 } // namespace attestation | 311 } // namespace attestation |
312 } // namespace chromeos | 312 } // namespace chromeos |
OLD | NEW |