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

Unified Diff: chrome/browser/media/audio_stream_monitor.cc

Issue 478543003: Use AudioStreamMonitor to control power save blocking. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Compile. Created 6 years, 4 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: chrome/browser/media/audio_stream_monitor.cc
diff --git a/chrome/browser/media/audio_stream_monitor.cc b/chrome/browser/media/audio_stream_monitor.cc
index 8633053d510684d1a69143590ec9d3047eb44194..4e531f3afc4c61ca46a664a7a42ac97171e5f455 100644
--- a/chrome/browser/media/audio_stream_monitor.cc
+++ b/chrome/browser/media/audio_stream_monitor.cc
@@ -7,6 +7,7 @@
#include "base/bind.h"
#include "base/bind_helpers.h"
#include "content/public/browser/invalidate_type.h"
+#include "content/public/browser/power_save_blocker.h"
#include "content/public/browser/web_contents.h"
DEFINE_WEB_CONTENTS_USER_DATA_KEY(AudioStreamMonitor);
@@ -77,7 +78,15 @@ void AudioStreamMonitor::MaybeToggle() {
if (!should_indicator_be_on) {
off_timer_.Stop();
+ blocker_.reset();
} else if (!off_timer_.IsRunning()) {
+#if !defined(OS_CHROMEOS) && !defined(OS_ANDROID)
miu 2014/08/25 19:34:52 Hmm...I'm wondering whether this is the right plac
DaleCurtis 2014/08/28 00:55:19 I also wonder about this, as now the code lives ac
miu 2014/08/28 04:11:58 My opinion: Either ASM needs to move into content,
DaleCurtis 2014/08/28 18:51:43 I think we should, the ASM stuff is pretty awesome
+ if (!blocker_) {
+ blocker_ = content::PowerSaveBlocker::Create(
+ content::PowerSaveBlocker::kPowerSaveBlockPreventDisplaySleep,
miu 2014/08/25 19:34:52 You meant "AppSuspension" and not "DisplaySleep" r
DaleCurtis 2014/08/28 00:55:19 Acknowledged.
+ "Playing Audio");
+ }
+#endif
off_timer_.Start(
FROM_HERE,
off_time - now,

Powered by Google App Engine
This is Rietveld 408576698