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

Unified Diff: chromeos/dbus/power_policy_controller.cc

Issue 2912763003: cros: Prevent shut down on lid-close during migration. (Closed)
Patch Set: Created 3 years, 7 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: chromeos/dbus/power_policy_controller.cc
diff --git a/chromeos/dbus/power_policy_controller.cc b/chromeos/dbus/power_policy_controller.cc
index 783d17fb3e636d76b77b95fa5a243f6160514e1a..52c8d9bb78a021901240ac80ffe12fb173ea2d98 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();
+}
+
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);
}
@@ -382,6 +388,15 @@ void PowerPolicyController::SendCurrentPolicy() {
power_manager::PowerManagementPolicy_Action_DO_NOTHING);
}
+ if (encryption_migration_active_ &&
Daniel Erat 2017/05/30 13:39:42 thinking about this a bit more, i think i misspoke
dspaid 2017/05/30 23:37:22 Went ahead and moved it up, though in this case I
+ 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";
+ }
+
if (!causes.empty())
policy.set_reason(causes);
client_->SetPolicy(policy);

Powered by Google App Engine
This is Rietveld 408576698