Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(381)

Side by Side Diff: chrome/browser/chromeos/attestation/attestation_policy_observer.h

Issue 14220003: Finished implementing AttestationPolicyObserver. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added NET_EXPORT_PRIVATE for unit tests Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 22 matching lines...) Expand all
43 AttestationFlow* attestation_flow); 44 AttestationFlow* attestation_flow);
44 45
45 virtual ~AttestationPolicyObserver(); 46 virtual ~AttestationPolicyObserver();
46 47
47 // content::NotificationObserver: 48 // content::NotificationObserver:
48 virtual void Observe(int type, 49 virtual void Observe(int type,
49 const content::NotificationSource& source, 50 const content::NotificationSource& source,
50 const content::NotificationDetails& details) OVERRIDE; 51 const content::NotificationDetails& details) OVERRIDE;
51 52
52 private: 53 private:
53 static const char kEnterpriseMachineKey[];
54
55 // Checks attestation policy and starts any necessary work. 54 // Checks attestation policy and starts any necessary work.
56 void Start(); 55 void Start();
57 56
58 // Gets a new certificate for the Enterprise Machine Key (EMK). 57 // Gets a new certificate for the Enterprise Machine Key (EMK).
59 void GetNewCertificate(); 58 void GetNewCertificate();
60 59
61 // Gets the existing EMK certificate and sends it to CheckCertificateExpiry. 60 // Gets the existing EMK certificate and sends it to CheckCertificateExpiry.
62 void GetExistingCertificate(); 61 void GetExistingCertificate();
63 62
64 // Checks if the given certificate is expired and, if so, get a new one. 63 // Checks if the given certificate is expired and, if so, get a new one.
65 void CheckCertificateExpiry(const std::string& certificate); 64 void CheckCertificateExpiry(const std::string& certificate);
66 65
67 // Uploads a certificate to the policy server. 66 // Uploads a certificate to the policy server.
68 void UploadCertificate(const std::string& certificate); 67 void UploadCertificate(const std::string& certificate);
69 68
70 // Checks if a certificate has already been uploaded and, if not, upload. 69 // Checks if a certificate has already been uploaded and, if not, upload.
71 void CheckIfUploaded(const std::string& certificate); 70 void CheckIfUploaded(const std::string& certificate,
71 const std::string& key_payload);
72
73 // Gets the payload associated with the EMK and sends it to |callback|.
74 void GetKeyPayload(base::Callback<void(const std::string&)> callback);
75
76 // Called when a certificate upload operation completes. On success, |status|
77 // will be true.
78 void OnUploadComplete(bool status);
79
80 // Marks a key as uploaded in the payload proto.
81 void MarkAsUploaded(const std::string& key_payload);
72 82
73 CrosSettings* cros_settings_; 83 CrosSettings* cros_settings_;
74 policy::CloudPolicyClient* policy_client_; 84 policy::CloudPolicyClient* policy_client_;
75 CryptohomeClient* cryptohome_client_; 85 CryptohomeClient* cryptohome_client_;
76 AttestationFlow* attestation_flow_; 86 AttestationFlow* attestation_flow_;
77 scoped_ptr<AttestationFlow> default_attestation_flow_; 87 scoped_ptr<AttestationFlow> default_attestation_flow_;
78 88
79 // Note: This should remain the last member so it'll be destroyed and 89 // Note: This should remain the last member so it'll be destroyed and
80 // invalidate the weak pointers before any other members are destroyed. 90 // invalidate the weak pointers before any other members are destroyed.
81 base::WeakPtrFactory<AttestationPolicyObserver> weak_factory_; 91 base::WeakPtrFactory<AttestationPolicyObserver> weak_factory_;
82 92
83 DISALLOW_COPY_AND_ASSIGN(AttestationPolicyObserver); 93 DISALLOW_COPY_AND_ASSIGN(AttestationPolicyObserver);
84 }; 94 };
85 95
86 } // namespace attestation 96 } // namespace attestation
87 } // namespace chromeos 97 } // namespace chromeos
88 98
89 #endif // CHROME_BROWSER_CHROMEOS_ATTESTATION_ATTESTATION_POLICY_OBSERVER_H_ 99 #endif // CHROME_BROWSER_CHROMEOS_ATTESTATION_ATTESTATION_POLICY_OBSERVER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698