Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "chrome/browser/chromeos/attestation/attestation_policy_observer.h" | |
| 6 | |
| 7 #include <string> | |
| 8 | |
| 9 #include "chrome/browser/policy/cloud/cloud_policy_client.h" | |
| 10 #include "chrome/browser/policy/cloud/cloud_policy_manager.h" | |
| 11 #include "chrome/common/chrome_notification_types.h" | |
| 12 #include "content/public/browser/notification_details.h" | |
| 13 | |
| 14 using std::string; | |
| 15 | |
| 16 namespace chromeos { | |
| 17 namespace attestation { | |
| 18 | |
| 19 AttestationPolicyObserver::AttestationPolicyObserver( | |
| 20 CrosSettings* settings, | |
| 21 policy::CloudPolicyManager* policy_manager, | |
|
Mattias Nissler (ping if slow)
2013/03/27 14:16:34
Just pass a CloudPolicyClient pointer if that's al
dkrahn
2013/03/27 21:20:44
From my reading of the code (correct me if I'm wro
Mattias Nissler (ping if slow)
2013/04/02 12:49:39
You're right about the CloudPolicyClient not neces
dkrahn
2013/04/04 21:27:26
Moved to DeviceCloudPolicyManagerChromeOS and adde
| |
| 22 scoped_ptr<AttestationFlow> attestation_flow) | |
| 23 : settings_(settings), | |
| 24 policy_manager_(policy_manager), | |
| 25 attestation_flow_(attestation_flow.Pass()) { | |
| 26 settings_->AddSettingsObserver(kDeviceAttestationEnabled, this); | |
| 27 } | |
| 28 | |
| 29 AttestationPolicyObserver::~AttestationPolicyObserver() { | |
| 30 settings_->RemoveSettingsObserver(kDeviceAttestationEnabled, this); | |
| 31 } | |
| 32 | |
| 33 void AttestationPolicyObserver::Observe( | |
| 34 int type, | |
| 35 const content::NotificationSource& source, | |
| 36 const content::NotificationDetails& details) { | |
| 37 string* path = content::Details<string>(details).ptr(); | |
| 38 if (type != chrome::NOTIFICATION_SYSTEM_SETTING_CHANGED || | |
| 39 *path != kDeviceAttestationEnabled) { | |
| 40 LOG(WARNING) << "AttestationPolicyObserver: Unexpected event received."; | |
| 41 return; | |
| 42 } | |
| 43 | |
| 44 // If attestation is not enabled, there is nothing to do. | |
| 45 bool enabled = false; | |
| 46 if (!settings_->GetBoolean(kDeviceAttestationEnabled, &enabled) || !enabled) | |
| 47 return; | |
| 48 | |
| 49 // We need a valid CloudPolicyClient to proceed. | |
| 50 policy::CloudPolicyClient* client = policy_manager_->core()->client(); | |
| 51 if (!client) { | |
| 52 LOG(ERROR) << "AttestationPolicyObserver: Invalid CloudPolicyClient."; | |
| 53 return; | |
| 54 } | |
| 55 | |
| 56 // TODO(dkrahn): Generate EMK and upload EMCert if necessary. | |
|
Mattias Nissler (ping if slow)
2013/03/27 14:16:34
Are you meaning to commit this in the half-baked s
dkrahn
2013/03/27 21:20:44
Yes. Before I do a lot of work I want your +1 tha
Mattias Nissler (ping if slow)
2013/04/02 12:49:39
Hard for me to figure out with significant pieces
dkrahn
2013/04/04 21:27:26
I've added more meat here, although there are stil
| |
| 57 } | |
| 58 | |
| 59 } // namespace attestation | |
| 60 } // namespace chromeos | |
| OLD | NEW |