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

Unified Diff: chrome/browser/chromeos/policy/enrollment_handler_chromeos.cc

Issue 2727713003: Update FWMP in TPM (Closed)
Patch Set: Test fixed Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/policy/enrollment_handler_chromeos.cc
diff --git a/chrome/browser/chromeos/policy/enrollment_handler_chromeos.cc b/chrome/browser/chromeos/policy/enrollment_handler_chromeos.cc
index c4bcf11f3d016e291ce611035e442083827f8090..ae9da61a051e81ce1d663726c10a27ce0ed91ef5 100644
--- a/chrome/browser/chromeos/policy/enrollment_handler_chromeos.cc
+++ b/chrome/browser/chromeos/policy/enrollment_handler_chromeos.cc
@@ -393,10 +393,50 @@ void EnrollmentHandlerChromeOS::OnGetTokensResponse(
robot_refresh_token_ = refresh_token;
+ SetStep(STEP_SET_FWMP_DATA);
+ SetFwmpData();
+}
+
+void EnrollmentHandlerChromeOS::SetFwmpData() {
+ DCHECK_EQ(STEP_SET_FWMP_DATA, enrollment_step_);
Daniel Erat 2017/03/06 21:18:25 nit: i think the order used for DCHECK_EQ is typic
igorcov 2017/03/09 12:22:57 This would make my code inconsistent with the rest
Daniel Erat 2017/03/09 14:52:37 because they come from completely different places
+
+ install_attributes_->SetBlockDevmodeInTpm(
+ GetBlockDevmode(), base::Bind(&EnrollmentHandlerChromeOS::OnFwmpDataSet,
+ weak_ptr_factory_.GetWeakPtr()));
+}
+
+void EnrollmentHandlerChromeOS::OnFwmpDataSet(
+ chromeos::DBusMethodCallStatus call_status,
+ bool result,
+ const cryptohome::BaseReply& reply) {
+ DCHECK_EQ(STEP_SET_FWMP_DATA, enrollment_step_);
Daniel Erat 2017/03/06 21:18:26 nit: same here
+ if (!result) {
+ LOG(ERROR) << "Failed to update firmware management parameters in TPM";
+ }
+
+ // get devmode and set the data.
Daniel Erat 2017/03/06 21:18:25 nit: s/get/Get/
igorcov 2017/03/09 12:22:57 Done.
SetStep(STEP_AD_DOMAIN_JOIN);
StartJoinAdDomain();
}
+bool EnrollmentHandlerChromeOS::GetBlockDevmode() {
+ bool block_devmode = false;
+ std::unique_ptr<em::PolicyData> policy_data(new em::PolicyData());
Daniel Erat 2017/03/06 21:18:25 nit: use auto and MakeUnique
igorcov 2017/03/09 12:22:57 Done.
+ policy_data->ParseFromString(policy_->policy_data());
Daniel Erat 2017/03/06 21:18:26 shouldn't you be checking the return value here to
igorcov 2017/03/09 12:22:57 Done.
+
+ std::unique_ptr<em::ChromeDeviceSettingsProto> payload(
+ new em::ChromeDeviceSettingsProto());
+ payload->ParseFromString(policy_data->policy_value());
+ if (payload->has_system_settings()) {
+ const em::SystemSettingsProto& container(payload->system_settings());
+ if (container.has_block_devmode()) {
+ block_devmode = container.block_devmode();
+ }
+ }
+
+ return block_devmode;
+}
+
// GaiaOAuthClient::Delegate
void EnrollmentHandlerChromeOS::OnRefreshTokenResponse(
const std::string& access_token,

Powered by Google App Engine
This is Rietveld 408576698