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

Unified Diff: chrome/browser/ui/ash/chrome_shell_delegate.cc

Issue 2821303004: cros: Suspend media sessions with display off trigger by tablet power button (Closed)
Patch Set: feedback & remove resuming Created 3 years, 7 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
Index: chrome/browser/ui/ash/chrome_shell_delegate.cc
diff --git a/chrome/browser/ui/ash/chrome_shell_delegate.cc b/chrome/browser/ui/ash/chrome_shell_delegate.cc
index b550ad2e967d17fd79e488c9f81b614caf89f402..defacbb8a2a4cd87c299ad68d7d3897c44633b4b 100644
--- a/chrome/browser/ui/ash/chrome_shell_delegate.cc
+++ b/chrome/browser/ui/ash/chrome_shell_delegate.cc
@@ -60,6 +60,7 @@
#include "chrome/browser/ui/browser_tabstrip.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/scoped_tabbed_browser_displayer.h"
+#include "chrome/browser/ui/tab_contents/tab_contents_iterator.h"
#include "chrome/common/pref_names.h"
#include "chrome/grit/chromium_strings.h"
#include "chrome/grit/generated_resources.h"
@@ -68,8 +69,10 @@
#include "components/prefs/pref_service.h"
#include "components/user_manager/user.h"
#include "components/user_manager/user_manager.h"
+#include "content/public/browser/media_session.h"
#include "content/public/browser/notification_service.h"
#include "content/public/common/service_manager_connection.h"
+#include "media/base/media_switches.h"
#include "ui/aura/window.h"
#include "ui/base/ime/chromeos/input_method_manager.h"
#include "ui/base/l10n/l10n_util.h"
@@ -463,6 +466,11 @@ void ChromeShellDelegate::PreInit() {
// in Shell::Init.
display_configuration_observer_.reset(
new chromeos::DisplayConfigurationObserver());
+
+ // Append switch for SuspendMediaSessions() that will suspend media players
+ // without turning on audio focus.
+ base::CommandLine::ForCurrentProcess()->AppendSwitch(
+ ::switches::kEnableInternalMediaSession);
Daniel Erat 2017/05/22 23:38:34 src/content/browser/media/session/media_session_co
Qiang(Joe) Xu 2017/05/23 17:54:46 Done. mlamouri@, do you agree on this?
}
void ChromeShellDelegate::PreShutdown() {
@@ -590,6 +598,13 @@ void ChromeShellDelegate::ToggleTouchpad() {
chromeos::system::InputDeviceSettings::Get()->ToggleTouchpad();
}
+void ChromeShellDelegate::SuspendMediaSessions() {
+ for (TabContentsIterator it; !it.done(); it.Next()) {
+ content::MediaSession::Get(*it)->Suspend(
+ content::MediaSession::SuspendType::SYSTEM);
+ }
+}
+
keyboard::KeyboardUI* ChromeShellDelegate::CreateKeyboardUI() {
return new ChromeKeyboardUI(ProfileManager::GetActiveUserProfile());
}

Powered by Google App Engine
This is Rietveld 408576698