OLD | NEW |
---|---|
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chromeos/dbus/power_policy_controller.h" | 5 #include "chromeos/dbus/power_policy_controller.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
269 SendCurrentPolicy(); | 269 SendCurrentPolicy(); |
270 } | 270 } |
271 | 271 |
272 void PowerPolicyController::NotifyChromeIsExiting() { | 272 void PowerPolicyController::NotifyChromeIsExiting() { |
273 if (chrome_is_exiting_) | 273 if (chrome_is_exiting_) |
274 return; | 274 return; |
275 chrome_is_exiting_ = true; | 275 chrome_is_exiting_ = true; |
276 SendCurrentPolicy(); | 276 SendCurrentPolicy(); |
277 } | 277 } |
278 | 278 |
279 void PowerPolicyController::SetEncryptionMigrationActive(bool active) { | |
280 encryption_migration_active_ = active; | |
281 SendCurrentPolicy(); | |
282 } | |
283 | |
279 PowerPolicyController::PowerPolicyController(PowerManagerClient* client) | 284 PowerPolicyController::PowerPolicyController(PowerManagerClient* client) |
280 : client_(client), | 285 : client_(client), |
281 prefs_were_set_(false), | 286 prefs_were_set_(false), |
282 honor_screen_wake_locks_(true), | 287 honor_screen_wake_locks_(true), |
283 next_wake_lock_id_(1), | 288 next_wake_lock_id_(1), |
284 chrome_is_exiting_(false) { | 289 chrome_is_exiting_(false), |
290 encryption_migration_active_(false) { | |
285 DCHECK(client_); | 291 DCHECK(client_); |
286 client_->AddObserver(this); | 292 client_->AddObserver(this); |
287 } | 293 } |
288 | 294 |
289 PowerPolicyController::~PowerPolicyController() { | 295 PowerPolicyController::~PowerPolicyController() { |
290 client_->RemoveObserver(this); | 296 client_->RemoveObserver(this); |
291 } | 297 } |
292 | 298 |
293 PowerPolicyController::WakeLock::WakeLock(Type type, | 299 PowerPolicyController::WakeLock::WakeLock(Type type, |
294 WakeLockReason reason, | 300 WakeLockReason reason, |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
375 if (chrome_is_exiting_ && | 381 if (chrome_is_exiting_ && |
376 (!policy.has_lid_closed_action() || | 382 (!policy.has_lid_closed_action() || |
377 policy.lid_closed_action() == | 383 policy.lid_closed_action() == |
378 power_manager::PowerManagementPolicy_Action_SUSPEND || | 384 power_manager::PowerManagementPolicy_Action_SUSPEND || |
379 policy.lid_closed_action() == | 385 policy.lid_closed_action() == |
380 power_manager::PowerManagementPolicy_Action_SHUT_DOWN)) { | 386 power_manager::PowerManagementPolicy_Action_SHUT_DOWN)) { |
381 policy.set_lid_closed_action( | 387 policy.set_lid_closed_action( |
382 power_manager::PowerManagementPolicy_Action_DO_NOTHING); | 388 power_manager::PowerManagementPolicy_Action_DO_NOTHING); |
383 } | 389 } |
384 | 390 |
391 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
| |
392 policy.lid_closed_action() != | |
393 power_manager::PowerManagementPolicy_Action_DO_NOTHING) { | |
394 policy.set_lid_closed_action( | |
395 power_manager::PowerManagementPolicy_Action_SUSPEND); | |
396 causes += | |
397 std::string((causes.empty() ? "" : ", ")) + "encryption migration"; | |
398 } | |
399 | |
385 if (!causes.empty()) | 400 if (!causes.empty()) |
386 policy.set_reason(causes); | 401 policy.set_reason(causes); |
387 client_->SetPolicy(policy); | 402 client_->SetPolicy(policy); |
388 } | 403 } |
389 | 404 |
390 } // namespace chromeos | 405 } // namespace chromeos |
OLD | NEW |