| 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 IsMediaSessionEnabled() { | 15 bool IsMediaSessionEnabled() { |
| 16 #if defined(OS_ANDROID) | 16 // Media session is enabled on Android and Chrome OS to allow control of media |
| 17 // players as needed. |
| 18 #if defined(OS_ANDROID) || defined(OS_CHROMEOS) |
| 17 return true; | 19 return true; |
| 18 #else | 20 #else |
| 19 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 21 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
| 20 return command_line->HasSwitch(switches::kEnableInternalMediaSession) || | 22 return command_line->HasSwitch(switches::kEnableInternalMediaSession) || |
| 21 command_line->HasSwitch(switches::kEnableAudioFocus); | 23 command_line->HasSwitch(switches::kEnableAudioFocus); |
| 22 #endif | 24 #endif |
| 23 } | 25 } |
| 24 | 26 |
| 25 } // anonymous namespace | 27 } // anonymous namespace |
| 26 | 28 |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 it->second->OnPlaybackPaused(); | 89 it->second->OnPlaybackPaused(); |
| 88 } | 90 } |
| 89 | 91 |
| 90 void MediaSessionControllersManager::OnEnd(const MediaPlayerId& id) { | 92 void MediaSessionControllersManager::OnEnd(const MediaPlayerId& id) { |
| 91 if (!IsMediaSessionEnabled()) | 93 if (!IsMediaSessionEnabled()) |
| 92 return; | 94 return; |
| 93 controllers_map_.erase(id); | 95 controllers_map_.erase(id); |
| 94 } | 96 } |
| 95 | 97 |
| 96 } // namespace content | 98 } // namespace content |
| OLD | NEW |