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

Side by Side Diff: content/browser/media/session/media_session_controllers_manager.cc

Issue 2821303004: cros: Suspend media sessions with display off trigger by tablet power button (Closed)
Patch Set: rebase Created 3 years, 6 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 unified diff | Download patch
« no previous file with comments | « content/browser/media/session/media_session_browsertest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
OLDNEW
« no previous file with comments | « content/browser/media/session/media_session_browsertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698