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

Side by Side 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: rebase 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/browser/ui/ash/chrome_shell_delegate.h" 5 #include "chrome/browser/ui/ash/chrome_shell_delegate.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <limits> 9 #include <limits>
10 10
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 #include "chrome/browser/ui/ash/system_tray_delegate_chromeos.h" 53 #include "chrome/browser/ui/ash/system_tray_delegate_chromeos.h"
54 #include "chrome/browser/ui/aura/accessibility/automation_manager_aura.h" 54 #include "chrome/browser/ui/aura/accessibility/automation_manager_aura.h"
55 #include "chrome/browser/ui/browser.h" 55 #include "chrome/browser/ui/browser.h"
56 #include "chrome/browser/ui/browser_commands.h" 56 #include "chrome/browser/ui/browser_commands.h"
57 #include "chrome/browser/ui/browser_finder.h" 57 #include "chrome/browser/ui/browser_finder.h"
58 #include "chrome/browser/ui/browser_navigator.h" 58 #include "chrome/browser/ui/browser_navigator.h"
59 #include "chrome/browser/ui/browser_navigator_params.h" 59 #include "chrome/browser/ui/browser_navigator_params.h"
60 #include "chrome/browser/ui/browser_tabstrip.h" 60 #include "chrome/browser/ui/browser_tabstrip.h"
61 #include "chrome/browser/ui/browser_window.h" 61 #include "chrome/browser/ui/browser_window.h"
62 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" 62 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h"
63 #include "chrome/browser/ui/tab_contents/tab_contents_iterator.h"
63 #include "chrome/common/pref_names.h" 64 #include "chrome/common/pref_names.h"
64 #include "chrome/grit/chromium_strings.h" 65 #include "chrome/grit/chromium_strings.h"
65 #include "chrome/grit/generated_resources.h" 66 #include "chrome/grit/generated_resources.h"
66 #include "chrome/grit/theme_resources.h" 67 #include "chrome/grit/theme_resources.h"
67 #include "chromeos/chromeos_switches.h" 68 #include "chromeos/chromeos_switches.h"
68 #include "components/prefs/pref_service.h" 69 #include "components/prefs/pref_service.h"
69 #include "components/user_manager/user.h" 70 #include "components/user_manager/user.h"
70 #include "components/user_manager/user_manager.h" 71 #include "components/user_manager/user_manager.h"
72 #include "content/public/browser/media_session.h"
71 #include "content/public/browser/notification_service.h" 73 #include "content/public/browser/notification_service.h"
72 #include "content/public/common/service_manager_connection.h" 74 #include "content/public/common/service_manager_connection.h"
73 #include "ui/aura/window.h" 75 #include "ui/aura/window.h"
74 #include "ui/base/ime/chromeos/input_method_manager.h" 76 #include "ui/base/ime/chromeos/input_method_manager.h"
75 #include "ui/base/l10n/l10n_util.h" 77 #include "ui/base/l10n/l10n_util.h"
76 #include "ui/base/resource/resource_bundle.h" 78 #include "ui/base/resource/resource_bundle.h"
77 79
78 using chromeos::AccessibilityManager; 80 using chromeos::AccessibilityManager;
79 81
80 namespace { 82 namespace {
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after
583 585
584 void ChromeShellDelegate::UpdateTouchscreenStatusFromPrefs() { 586 void ChromeShellDelegate::UpdateTouchscreenStatusFromPrefs() {
585 chromeos::system::InputDeviceSettings::Get() 587 chromeos::system::InputDeviceSettings::Get()
586 ->UpdateTouchscreenStatusFromPrefs(); 588 ->UpdateTouchscreenStatusFromPrefs();
587 } 589 }
588 590
589 void ChromeShellDelegate::ToggleTouchpad() { 591 void ChromeShellDelegate::ToggleTouchpad() {
590 chromeos::system::InputDeviceSettings::Get()->ToggleTouchpad(); 592 chromeos::system::InputDeviceSettings::Get()->ToggleTouchpad();
591 } 593 }
592 594
595 void ChromeShellDelegate::ResumeMediaSessions() {
596 for (TabContentsIterator it; !it.done(); it.Next()) {
597 content::MediaSession::Get(*it)->Resume(
598 content::MediaSession::SuspendType::SYSTEM);
Daniel Erat 2017/05/17 01:22:25 is SYSTEM actually an appropriate type to use here
mlamouri (slow - plz ping) 2017/05/17 12:52:26 System sounds like the right thing to do here. The
Qiang(Joe) Xu 2017/05/22 22:58:47 mlamouri@, since we are not actually entering susp
599 }
600 }
601
602 void ChromeShellDelegate::SuspendMediaSessions() {
603 for (TabContentsIterator it; !it.done(); it.Next()) {
604 content::MediaSession::Get(*it)->Suspend(
605 content::MediaSession::SuspendType::SYSTEM);
606 }
607 }
608
593 keyboard::KeyboardUI* ChromeShellDelegate::CreateKeyboardUI() { 609 keyboard::KeyboardUI* ChromeShellDelegate::CreateKeyboardUI() {
594 return new ChromeKeyboardUI(ProfileManager::GetActiveUserProfile()); 610 return new ChromeKeyboardUI(ProfileManager::GetActiveUserProfile());
595 } 611 }
596 612
597 ash::SessionStateDelegate* ChromeShellDelegate::CreateSessionStateDelegate() { 613 ash::SessionStateDelegate* ChromeShellDelegate::CreateSessionStateDelegate() {
598 return new SessionStateDelegateChromeos; 614 return new SessionStateDelegateChromeos;
599 } 615 }
600 616
601 ash::AccessibilityDelegate* ChromeShellDelegate::CreateAccessibilityDelegate() { 617 ash::AccessibilityDelegate* ChromeShellDelegate::CreateAccessibilityDelegate() {
602 return new AccessibilityDelegateImpl; 618 return new AccessibilityDelegateImpl;
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
645 NOTREACHED() << "Unexpected notification " << type; 661 NOTREACHED() << "Unexpected notification " << type;
646 } 662 }
647 } 663 }
648 664
649 void ChromeShellDelegate::PlatformInit() { 665 void ChromeShellDelegate::PlatformInit() {
650 registrar_.Add(this, chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED, 666 registrar_.Add(this, chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED,
651 content::NotificationService::AllSources()); 667 content::NotificationService::AllSources());
652 registrar_.Add(this, chrome::NOTIFICATION_SESSION_STARTED, 668 registrar_.Add(this, chrome::NOTIFICATION_SESSION_STARTED,
653 content::NotificationService::AllSources()); 669 content::NotificationService::AllSources());
654 } 670 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698