| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "content/browser/media/session/pepper_playback_observer.h" | 5 #include "content/browser/media/session/pepper_playback_observer.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/metrics/histogram_macros.h" | 8 #include "base/metrics/histogram_macros.h" |
| 9 #include "content/browser/media/session/media_session_impl.h" | 9 #include "content/browser/media/session/media_session_impl.h" |
| 10 #include "content/browser/media/session/pepper_player_delegate.h" | 10 #include "content/browser/media/session/pepper_player_delegate.h" |
| 11 #include "content/common/frame_messages.h" | 11 #include "content/common/frame_messages.h" |
| 12 #include "ipc/ipc_message_macros.h" | 12 #include "ipc/ipc_message_macros.h" |
| 13 #include "media/base/media_content_type.h" | 13 #include "media/base/media_content_type.h" |
| 14 #include "media/base/media_switches.h" | 14 #include "media/base/media_switches.h" |
| 15 | 15 |
| 16 namespace content { | 16 namespace content { |
| 17 | 17 |
| 18 namespace { | 18 namespace { |
| 19 | 19 |
| 20 bool ShouldDuckFlash() { | 20 bool ShouldDuckFlash() { |
| 21 return base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | 21 return base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
| 22 switches::kEnableDefaultMediaSession) == | 22 switches::kEnableAudioFocus) == |
| 23 switches::kEnableDefaultMediaSessionDuckFlash; | 23 switches::kEnableAudioFocusDuckFlash; |
| 24 } | 24 } |
| 25 | 25 |
| 26 } // anonymous namespace | 26 } // anonymous namespace |
| 27 | 27 |
| 28 PepperPlaybackObserver::PepperPlaybackObserver(WebContents* contents) | 28 PepperPlaybackObserver::PepperPlaybackObserver(WebContents* contents) |
| 29 : contents_(contents) {} | 29 : contents_(contents) {} |
| 30 | 30 |
| 31 PepperPlaybackObserver::~PepperPlaybackObserver() { | 31 PepperPlaybackObserver::~PepperPlaybackObserver() { |
| 32 // At this point WebContents is being destructed, so it's safe to | 32 // At this point WebContents is being destructed, so it's safe to |
| 33 // call this. MediaSession may decide to send further IPC messages | 33 // call this. MediaSession may decide to send further IPC messages |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 if (!players_map_.count(id)) | 96 if (!players_map_.count(id)) |
| 97 return; | 97 return; |
| 98 | 98 |
| 99 MediaSessionImpl::Get(contents_)->RemovePlayer( | 99 MediaSessionImpl::Get(contents_)->RemovePlayer( |
| 100 players_map_[id].get(), PepperPlayerDelegate::kPlayerId); | 100 players_map_[id].get(), PepperPlayerDelegate::kPlayerId); |
| 101 | 101 |
| 102 players_map_.erase(id); | 102 players_map_.erase(id); |
| 103 } | 103 } |
| 104 | 104 |
| 105 } // namespace content | 105 } // namespace content |
| OLD | NEW |