| 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/media_session_controllers_manager.h" | 5 #include "content/browser/media/session/media_session_controllers_manager.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "content/browser/media/session/media_session_controller.h" | 8 #include "content/browser/media/session/media_session_controller.h" |
| 9 #include "media/base/media_switches.h" | 9 #include "media/base/media_switches.h" |
| 10 | 10 |
| 11 namespace content { | 11 namespace content { |
| 12 | 12 |
| 13 namespace { | 13 namespace { |
| 14 | 14 |
| 15 bool IsDefaultMediaSessionEnabled() { | 15 bool IsDefaultMediaSessionEnabled() { |
| 16 #if defined(OS_ANDROID) | 16 #if defined(OS_ANDROID) |
| 17 return true; | 17 return true; |
| 18 #else | 18 #else |
| 19 return base::CommandLine::ForCurrentProcess()->HasSwitch( | 19 return base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 20 switches::kEnableDefaultMediaSession); | 20 switches::kEnableAudioFocus); |
| 21 #endif | 21 #endif |
| 22 } | 22 } |
| 23 | 23 |
| 24 } // anonymous namespace | 24 } // anonymous namespace |
| 25 | 25 |
| 26 MediaSessionControllersManager::MediaSessionControllersManager( | 26 MediaSessionControllersManager::MediaSessionControllersManager( |
| 27 MediaWebContentsObserver* media_web_contents_observer) | 27 MediaWebContentsObserver* media_web_contents_observer) |
| 28 : media_web_contents_observer_(media_web_contents_observer) { | 28 : media_web_contents_observer_(media_web_contents_observer) { |
| 29 } | 29 } |
| 30 | 30 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 it->second->OnPlaybackPaused(); | 86 it->second->OnPlaybackPaused(); |
| 87 } | 87 } |
| 88 | 88 |
| 89 void MediaSessionControllersManager::OnEnd(const MediaPlayerId& id) { | 89 void MediaSessionControllersManager::OnEnd(const MediaPlayerId& id) { |
| 90 if (!IsDefaultMediaSessionEnabled()) | 90 if (!IsDefaultMediaSessionEnabled()) |
| 91 return; | 91 return; |
| 92 controllers_map_.erase(id); | 92 controllers_map_.erase(id); |
| 93 } | 93 } |
| 94 | 94 |
| 95 } // namespace content | 95 } // namespace content |
| OLD | NEW |