| 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 #ifndef CHROME_BROWSER_CHROMEOS_ATTESTATION_ATTESTATION_POLICY_OBSERVER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_ATTESTATION_ATTESTATION_POLICY_OBSERVER_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_ATTESTATION_ATTESTATION_POLICY_OBSERVER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_ATTESTATION_ATTESTATION_POLICY_OBSERVER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/callback.h" |
| 11 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
| 13 #include "content/public/browser/notification_observer.h" | 14 #include "content/public/browser/notification_observer.h" |
| 14 | 15 |
| 15 namespace policy { | 16 namespace policy { |
| 16 class CloudPolicyClient; | 17 class CloudPolicyClient; |
| 17 } | 18 } |
| 18 | 19 |
| 19 namespace chromeos { | 20 namespace chromeos { |
| 20 | 21 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 // Gets the existing EMK certificate and sends it to CheckCertificateExpiry. | 62 // Gets the existing EMK certificate and sends it to CheckCertificateExpiry. |
| 62 void GetExistingCertificate(); | 63 void GetExistingCertificate(); |
| 63 | 64 |
| 64 // Checks if the given certificate is expired and, if so, get a new one. | 65 // Checks if the given certificate is expired and, if so, get a new one. |
| 65 void CheckCertificateExpiry(const std::string& certificate); | 66 void CheckCertificateExpiry(const std::string& certificate); |
| 66 | 67 |
| 67 // Uploads a certificate to the policy server. | 68 // Uploads a certificate to the policy server. |
| 68 void UploadCertificate(const std::string& certificate); | 69 void UploadCertificate(const std::string& certificate); |
| 69 | 70 |
| 70 // Checks if a certificate has already been uploaded and, if not, upload. | 71 // Checks if a certificate has already been uploaded and, if not, upload. |
| 71 void CheckIfUploaded(const std::string& certificate); | 72 void CheckIfUploaded(const std::string& certificate, |
| 73 const std::string& key_payload); |
| 74 |
| 75 // Gets the payload associated with the EMK and sends it to |callback|. |
| 76 void GetKeyPayload(base::Callback<void(const std::string&)> callback); |
| 77 |
| 78 // Called when a certificate upload operation completes. On success, |status| |
| 79 // will be true. |
| 80 void OnUploadComplete(bool status); |
| 81 |
| 82 // Marks a key as uploaded in the payload proto. |
| 83 void MarkAsUploaded(const std::string& key_payload); |
| 72 | 84 |
| 73 CrosSettings* cros_settings_; | 85 CrosSettings* cros_settings_; |
| 74 policy::CloudPolicyClient* policy_client_; | 86 policy::CloudPolicyClient* policy_client_; |
| 75 CryptohomeClient* cryptohome_client_; | 87 CryptohomeClient* cryptohome_client_; |
| 76 AttestationFlow* attestation_flow_; | 88 AttestationFlow* attestation_flow_; |
| 77 scoped_ptr<AttestationFlow> default_attestation_flow_; | 89 scoped_ptr<AttestationFlow> default_attestation_flow_; |
| 78 | 90 |
| 79 // Note: This should remain the last member so it'll be destroyed and | 91 // Note: This should remain the last member so it'll be destroyed and |
| 80 // invalidate the weak pointers before any other members are destroyed. | 92 // invalidate the weak pointers before any other members are destroyed. |
| 81 base::WeakPtrFactory<AttestationPolicyObserver> weak_factory_; | 93 base::WeakPtrFactory<AttestationPolicyObserver> weak_factory_; |
| 82 | 94 |
| 83 DISALLOW_COPY_AND_ASSIGN(AttestationPolicyObserver); | 95 DISALLOW_COPY_AND_ASSIGN(AttestationPolicyObserver); |
| 84 }; | 96 }; |
| 85 | 97 |
| 86 } // namespace attestation | 98 } // namespace attestation |
| 87 } // namespace chromeos | 99 } // namespace chromeos |
| 88 | 100 |
| 89 #endif // CHROME_BROWSER_CHROMEOS_ATTESTATION_ATTESTATION_POLICY_OBSERVER_H_ | 101 #endif // CHROME_BROWSER_CHROMEOS_ATTESTATION_ATTESTATION_POLICY_OBSERVER_H_ |
| OLD | NEW |