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

Unified Diff: content/browser/media/session/pepper_player_delegate.cc

Issue 2437623005: Let Flash take one-shot focus in default MediaSession (Closed)
Patch Set: IsDuckFlash -> ShouldDuckFlash Created 4 years, 2 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 | « content/browser/media/session/pepper_playback_observer.cc ('k') | media/base/media_switches.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/media/session/pepper_player_delegate.cc
diff --git a/content/browser/media/session/pepper_player_delegate.cc b/content/browser/media/session/pepper_player_delegate.cc
index 8c38b2a57e54a32fc307284344ae7e1a93661a6b..7b95734faa6b4ac566c07915eb635076c4e5f221 100644
--- a/content/browser/media/session/pepper_player_delegate.cc
+++ b/content/browser/media/session/pepper_player_delegate.cc
@@ -8,6 +8,7 @@
#include "content/browser/media/session/pepper_playback_observer.h"
#include "content/browser/web_contents/web_contents_impl.h"
#include "content/common/frame_messages.h"
+#include "media/base/media_switches.h"
namespace content {
@@ -15,6 +16,12 @@ namespace {
const double kDuckVolume = 0.2f;
+bool ShouldDuckFlash() {
+ return base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
+ switches::kEnableDefaultMediaSession) ==
+ switches::kEnableDefaultMediaSessionDuckFlash;
+}
+
} // anonymous namespace
const int PepperPlayerDelegate::kPlayerId = 0;
@@ -27,18 +34,27 @@ PepperPlayerDelegate::PepperPlayerDelegate(
PepperPlayerDelegate::~PepperPlayerDelegate() = default;
void PepperPlayerDelegate::OnSuspend(int player_id) {
+ if (!ShouldDuckFlash())
+ return;
+
// Pepper player cannot be really suspended. Duck the volume instead.
DCHECK_EQ(player_id, kPlayerId);
SetVolume(player_id, kDuckVolume);
}
void PepperPlayerDelegate::OnResume(int player_id) {
+ if (!ShouldDuckFlash())
+ return;
+
DCHECK_EQ(player_id, kPlayerId);
SetVolume(player_id, 1.0f);
}
void PepperPlayerDelegate::OnSetVolumeMultiplier(int player_id,
double volume_multiplier) {
+ if (!ShouldDuckFlash())
+ return;
+
DCHECK_EQ(player_id, kPlayerId);
SetVolume(player_id, volume_multiplier);
}
« no previous file with comments | « content/browser/media/session/pepper_playback_observer.cc ('k') | media/base/media_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698