Index: chromeos/dbus/power_policy_controller.cc |
diff --git a/chromeos/dbus/power_policy_controller.cc b/chromeos/dbus/power_policy_controller.cc |
index 783d17fb3e636d76b77b95fa5a243f6160514e1a..0592a18fd35f9475375aacd3fe764576ca915f3f 100644 |
--- a/chromeos/dbus/power_policy_controller.cc |
+++ b/chromeos/dbus/power_policy_controller.cc |
@@ -276,12 +276,18 @@ void PowerPolicyController::NotifyChromeIsExiting() { |
SendCurrentPolicy(); |
} |
+void PowerPolicyController::SetEncryptionMigrationActive(bool active) { |
+ encryption_migration_active_ = active; |
+ SendCurrentPolicy(); |
fukino
2017/05/31 05:57:22
Maybe we should call SendCurrentPolicy() only when
dspaid
2017/05/31 07:04:26
Done.
|
+} |
+ |
PowerPolicyController::PowerPolicyController(PowerManagerClient* client) |
: client_(client), |
prefs_were_set_(false), |
honor_screen_wake_locks_(true), |
next_wake_lock_id_(1), |
- chrome_is_exiting_(false) { |
+ chrome_is_exiting_(false), |
+ encryption_migration_active_(false) { |
DCHECK(client_); |
client_->AddObserver(this); |
} |
@@ -367,6 +373,15 @@ void PowerPolicyController::SendCurrentPolicy() { |
} |
} |
+ if (encryption_migration_active_ && |
+ policy.lid_closed_action() != |
+ power_manager::PowerManagementPolicy_Action_DO_NOTHING) { |
+ policy.set_lid_closed_action( |
+ power_manager::PowerManagementPolicy_Action_SUSPEND); |
+ causes += |
+ std::string((causes.empty() ? "" : ", ")) + "encryption migration"; |
+ } |
+ |
// To avoid a race in the case where the user asks Chrome to sign out |
// and then immediately closes the lid, override the lid-closed action |
// so the system will stay awake while Chrome is exiting. When Chrome |