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

Unified Diff: content/browser/media/session/pepper_playback_observer.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 | « chrome/browser/about_flags.cc ('k') | content/browser/media/session/pepper_player_delegate.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/media/session/pepper_playback_observer.cc
diff --git a/content/browser/media/session/pepper_playback_observer.cc b/content/browser/media/session/pepper_playback_observer.cc
index c0cc7e75a9be8548f67f9a080ed0098a97658494..53af5324468df7f565c20b719462bb23615d858d 100644
--- a/content/browser/media/session/pepper_playback_observer.cc
+++ b/content/browser/media/session/pepper_playback_observer.cc
@@ -15,6 +15,16 @@
namespace content {
+namespace {
+
+bool ShouldDuckFlash() {
+ return base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
+ switches::kEnableDefaultMediaSession) ==
+ switches::kEnableDefaultMediaSessionDuckFlash;
+}
+
+} // anonymous namespace
+
PepperPlaybackObserver::PepperPlaybackObserver(WebContentsImpl *contents)
: contents_(contents) {}
@@ -46,21 +56,16 @@ void PepperPlaybackObserver::PepperInstanceDeleted(int32_t pp_instance) {
void PepperPlaybackObserver::PepperStartsPlayback(int32_t pp_instance) {
players_played_sound_map_[pp_instance] = true;
- if (base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
- switches::kEnableDefaultMediaSession) !=
- switches::kEnableDefaultMediaSessionWithFlash) {
- return;
- }
-
if (players_map_.count(pp_instance))
return;
players_map_[pp_instance].reset(new PepperPlayerDelegate(
contents_, pp_instance));
+
MediaSession::Get(contents_)->AddPlayer(
- players_map_[pp_instance].get(),
- PepperPlayerDelegate::kPlayerId,
- media::MediaContentType::Pepper);
+ players_map_[pp_instance].get(), PepperPlayerDelegate::kPlayerId,
+ ShouldDuckFlash() ? media::MediaContentType::Pepper
+ : media::MediaContentType::Persistent);
}
void PepperPlaybackObserver::PepperStopsPlayback(int32_t pp_instance) {
« no previous file with comments | « chrome/browser/about_flags.cc ('k') | content/browser/media/session/pepper_player_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698