Chromium Code Reviews| 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( |