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

Unified Diff: ash/system/power/power_event_observer.cc

Issue 2916733002: cros: Suspend media sessions on SuspendImminent
Patch Set: PowerEventObserver 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 | « ash/system/power/power_event_observer.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/system/power/power_event_observer.cc
diff --git a/ash/system/power/power_event_observer.cc b/ash/system/power/power_event_observer.cc
index 9a773a66f1e3867c4a58762f214e88de05d753d9..f1e19043869bfe628dfe81c3f837f31a9a9de892 100644
--- a/ash/system/power/power_event_observer.cc
+++ b/ash/system/power/power_event_observer.cc
@@ -7,6 +7,7 @@
#include "ash/public/cpp/config.h"
#include "ash/session/session_controller.h"
#include "ash/shell.h"
+#include "ash/shell_delegate.h"
#include "ash/shell_port.h"
#include "ash/system/tray/system_tray_notifier.h"
#include "ash/wm/power_button_controller.h"
@@ -44,8 +45,7 @@ void OnSuspendDisplaysCompleted(const base::Closure& suspend_callback,
} // namespace
-PowerEventObserver::PowerEventObserver()
- : screen_locked_(false), waiting_for_lock_screen_animations_(false) {
+PowerEventObserver::PowerEventObserver() {
chromeos::DBusThreadManager::Get()->GetPowerManagerClient()->AddObserver(
this);
chromeos::DBusThreadManager::Get()->GetSessionManagerClient()->AddObserver(
@@ -102,8 +102,8 @@ void PowerEventObserver::SuspendImminent() {
->GetSessionManagerClient()
->RequestLockScreen();
} else if (waiting_for_lock_screen_animations_) {
- // The lock-before-suspending pref has been set and the lock screen is ready
- // but the animations have not completed yet. This can happen if a suspend
+ // The auto-screen-lock pref has been set and the lock screen is ready but
+ // the animations have not completed yet. This can happen if a suspend
// request is canceled after the lock screen is ready but before the
// animations have completed and then another suspend request is immediately
// started. In practice, it is highly unlikely that this will ever happen
@@ -113,7 +113,7 @@ void PowerEventObserver::SuspendImminent() {
->GetPowerManagerClient()
->GetSuspendReadinessCallback();
} else {
- // The lock-before-suspending pref is not set or the screen has already been
+ // The auto-screen-lock pref is not set or the screen has already been
// locked and the animations have completed. Rendering can be stopped now.
StopRenderingRequests();
}
@@ -153,6 +153,7 @@ void PowerEventObserver::ScreenIsLocked() {
// The screen is now locked but the pending suspend, if any, will be blocked
// until all the animations have completed.
if (!screen_lock_callback_.is_null()) {
+ Shell::Get()->shell_delegate()->SuspendMediaSessions();
VLOG(1) << "Screen locked due to suspend";
} else {
VLOG(1) << "Screen locked without suspend";
« no previous file with comments | « ash/system/power/power_event_observer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698