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

Unified Diff: chrome/browser/ui/webui/chromeos/login/encryption_migration_screen_handler.cc

Issue 2907773002: 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/chromeos/login/encryption_migration_screen_handler.cc
diff --git a/chrome/browser/ui/webui/chromeos/login/encryption_migration_screen_handler.cc b/chrome/browser/ui/webui/chromeos/login/encryption_migration_screen_handler.cc
index e47c7ad10f96d3a801b44b0f14e9630dd8d51b20..5f97b4bb25a47248dba8d12df33665b986faa20f 100644
--- a/chrome/browser/ui/webui/chromeos/login/encryption_migration_screen_handler.cc
+++ b/chrome/browser/ui/webui/chromeos/login/encryption_migration_screen_handler.cc
@@ -27,6 +27,7 @@
#include "chromeos/cryptohome/homedir_methods.h"
#include "chromeos/dbus/cryptohome_client.h"
#include "chromeos/dbus/dbus_thread_manager.h"
+#include "chromeos/dbus/power_manager/policy.pb.h"
#include "chromeos/dbus/power_manager/power_supply_properties.pb.h"
#include "chromeos/dbus/power_manager_client.h"
#include "components/login/localized_values_builder.h"
@@ -351,6 +352,17 @@ void EncryptionMigrationScreenHandler::OnMountExistingVault(
return;
}
+ // Prevent shut down on lid close.
+ // We set SUSPEND instead of DO_NOTHING to avoid potential heat issue.
+ // Note that, once migration finishes, the system will shut down or restart
+ // regardless of the migration result (success or failures). Given this, we
+ // don't need to restore the power policy.
+ power_manager::PowerManagementPolicy policy;
+ policy.set_lid_closed_action(
+ power_manager::PowerManagementPolicy_Action_SUSPEND);
+ DBusThreadManager::Get()->GetPowerManagerClient()->SetPolicy(policy);
Daniel Erat 2017/05/26 13:45:34 you can't send a policy directly like this; it'll
+
+ // Start migration with a progress listener.
DBusThreadManager::Get()
->GetCryptohomeClient()
->SetDircryptoMigrationProgressHandler(
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698