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

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: 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 static const char kEnterpriseMachineKey[];
Mattias Nissler (ping if slow) 2013/04/23 10:53:01 nit: newline before coment
dkrahn 2013/04/23 21:17:09 Done.
55 // The number of days before a certificate expires during which it is
56 // considered 'expiring soon' and replacement is initiated.
57 static const int kExpiryThresholdInDays;
Mattias Nissler (ping if slow) 2013/04/23 10:53:01 If you're not using these elsewhere, you can just
dkrahn 2013/04/23 21:17:09 Done.
54 58
55 // Checks attestation policy and starts any necessary work. 59 // Checks attestation policy and starts any necessary work.
56 void Start(); 60 void Start();
57 61
58 // Gets a new certificate for the Enterprise Machine Key (EMK). 62 // Gets a new certificate for the Enterprise Machine Key (EMK).
59 void GetNewCertificate(); 63 void GetNewCertificate();
60 64
61 // Gets the existing EMK certificate and sends it to CheckCertificateExpiry. 65 // Gets the existing EMK certificate and sends it to CheckCertificateExpiry.
62 void GetExistingCertificate(); 66 void GetExistingCertificate();
63 67
64 // Checks if the given certificate is expired and, if so, get a new one. 68 // Checks if the given certificate is expired and, if so, get a new one.
65 void CheckCertificateExpiry(const std::string& certificate); 69 void CheckCertificateExpiry(const std::string& certificate);
66 70
67 // Uploads a certificate to the policy server. 71 // Uploads a certificate to the policy server.
68 void UploadCertificate(const std::string& certificate); 72 void UploadCertificate(const std::string& certificate);
69 73
70 // Checks if a certificate has already been uploaded and, if not, upload. 74 // Checks if a certificate has already been uploaded and, if not, upload.
71 void CheckIfUploaded(const std::string& certificate); 75 void CheckIfUploaded(const std::string& certificate,
76 const std::string& key_payload);
77
78 // Gets the payload associated with the EMK and sends it to |callback|.
79 void GetKeyPayload(base::Callback<void(const std::string&)> callback);
80
81 // Called when a certificate upload operation completes. On success, |status|
82 // will be true.
83 void OnUploadComplete(bool status);
84
85 // Marks a key as uploaded in the payload proto.
86 void MarkAsUploaded(const std::string& key_payload);
72 87
73 CrosSettings* cros_settings_; 88 CrosSettings* cros_settings_;
74 policy::CloudPolicyClient* policy_client_; 89 policy::CloudPolicyClient* policy_client_;
75 CryptohomeClient* cryptohome_client_; 90 CryptohomeClient* cryptohome_client_;
76 AttestationFlow* attestation_flow_; 91 AttestationFlow* attestation_flow_;
77 scoped_ptr<AttestationFlow> default_attestation_flow_; 92 scoped_ptr<AttestationFlow> default_attestation_flow_;
78 93
79 // Note: This should remain the last member so it'll be destroyed and 94 // Note: This should remain the last member so it'll be destroyed and
80 // invalidate the weak pointers before any other members are destroyed. 95 // invalidate the weak pointers before any other members are destroyed.
81 base::WeakPtrFactory<AttestationPolicyObserver> weak_factory_; 96 base::WeakPtrFactory<AttestationPolicyObserver> weak_factory_;
82 97
83 DISALLOW_COPY_AND_ASSIGN(AttestationPolicyObserver); 98 DISALLOW_COPY_AND_ASSIGN(AttestationPolicyObserver);
84 }; 99 };
85 100
86 } // namespace attestation 101 } // namespace attestation
87 } // namespace chromeos 102 } // namespace chromeos
88 103
89 #endif // CHROME_BROWSER_CHROMEOS_ATTESTATION_ATTESTATION_POLICY_OBSERVER_H_ 104 #endif // CHROME_BROWSER_CHROMEOS_ATTESTATION_ATTESTATION_POLICY_OBSERVER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698