Chromium Code Reviews| Index: chrome/browser/chromeos/login/enrollment/auto_enrollment_controller.cc |
| diff --git a/chrome/browser/chromeos/login/enrollment/auto_enrollment_controller.cc b/chrome/browser/chromeos/login/enrollment/auto_enrollment_controller.cc |
| index 1a6f976f51e85e99b5fd1a6aa46e96c542faad80..1a7873b92a7a8b601808561118b749a1a1c7d35d 100644 |
| --- a/chrome/browser/chromeos/login/enrollment/auto_enrollment_controller.cc |
| +++ b/chrome/browser/chromeos/login/enrollment/auto_enrollment_controller.cc |
| @@ -12,7 +12,9 @@ |
| #include "chrome/browser/browser_process.h" |
| #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" |
| #include "chrome/browser/chromeos/policy/server_backed_state_keys_broker.h" |
| +#include "chrome/browser/chromeos/settings/install_attributes.h" |
| #include "chromeos/chromeos_switches.h" |
| +#include "chromeos/dbus/dbus_thread_manager.h" |
| #include "chromeos/system/statistics_provider.h" |
| #include "components/policy/core/common/cloud/device_management_service.h" |
| #include "net/url_request/url_request_context_getter.h" |
| @@ -291,14 +293,37 @@ void AutoEnrollmentController::UpdateState( |
| case policy::AUTO_ENROLLMENT_STATE_CONNECTION_ERROR: |
| case policy::AUTO_ENROLLMENT_STATE_SERVER_ERROR: |
| case policy::AUTO_ENROLLMENT_STATE_TRIGGER_ENROLLMENT: |
| - case policy::AUTO_ENROLLMENT_STATE_NO_ENROLLMENT: |
| safeguard_timer_.Stop(); |
| break; |
| + case policy::AUTO_ENROLLMENT_STATE_NO_ENROLLMENT: |
| + RemoveFwmp(); |
|
Andrew T Wilson (Slow)
2017/03/07 11:16:30
Document that RemoveFwmp() will handle calling the
igorcov
2017/03/09 12:22:56
It would possibly request to remove FWMP twice, wh
|
| + return; |
| } |
| progress_callbacks_.Notify(state_); |
| } |
| +void AutoEnrollmentController::RemoveFwmp() { |
| + DCHECK(state_ == policy::AUTO_ENROLLMENT_STATE_NO_ENROLLMENT); |
|
Daniel Erat
2017/03/06 21:18:25
use DCHECK_EQ so the actual value is logged on fai
Andrew T Wilson (Slow)
2017/03/07 11:16:30
DCHECK_EQ
igorcov
2017/03/09 12:22:56
Done.
|
| + |
| + std::unique_ptr<chromeos::InstallAttributes> install_attributes = |
|
Daniel Erat
2017/03/06 21:18:25
nit: auto (since the type is obvious from the Make
|
| + base::MakeUnique<chromeos::InstallAttributes>( |
|
Andrew T Wilson (Slow)
2017/03/07 11:16:30
This is something Thiemo should look at - I don't
igorcov
2017/03/09 12:22:56
I've changed this to use directly the CryptohomeCl
|
| + chromeos::DBusThreadManager::Get()->GetCryptohomeClient()); |
| + install_attributes->RemoveFwmpInTpm( |
| + base::Bind(&AutoEnrollmentController::OnFwmpRemoved, |
| + client_start_weak_factory_.GetWeakPtr())); |
|
Andrew T Wilson (Slow)
2017/03/07 11:16:30
Why do we only call progress callbacks and stop th
igorcov
2017/03/09 12:22:56
Included in the comments of RemoveFirmwareManageme
|
| +} |
| + |
| +void AutoEnrollmentController::OnFwmpRemoved( |
| + chromeos::DBusMethodCallStatus call_status, |
| + bool result, |
| + const cryptohome::BaseReply& reply) { |
| + if (!result) |
| + LOG(ERROR) << "Failed to remove firmware management parameters"; |
|
Andrew T Wilson (Slow)
2017/03/07 11:16:30
Any other info we can log here (does it return a m
igorcov
2017/03/09 12:22:56
Added the reply error. We can't use much from call
|
| + safeguard_timer_.Stop(); |
| + progress_callbacks_.Notify(state_); |
| +} |
| + |
| void AutoEnrollmentController::Timeout() { |
| // TODO(mnissler): Add UMA to track results of auto-enrollment checks. |
| if (client_start_weak_factory_.HasWeakPtrs() && |