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

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

Issue 48523010: [Refactor] Introduce MediaDelegate (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 2 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_chromeos.cc
diff --git a/chrome/browser/ui/ash/chrome_shell_delegate_chromeos.cc b/chrome/browser/ui/ash/chrome_shell_delegate_chromeos.cc
index e6d31a5ae2f984b02b87eab9fa245024e26b8803..d3703832128889bd74ce891ab92532f334d7c919 100644
--- a/chrome/browser/ui/ash/chrome_shell_delegate_chromeos.cc
+++ b/chrome/browser/ui/ash/chrome_shell_delegate_chromeos.cc
@@ -5,6 +5,7 @@
#include "chrome/browser/ui/ash/chrome_shell_delegate.h"
#include "ash/accessibility_delegate.h"
+#include "ash/media_delegate.h"
#include "ash/wm/mru_window_tracker.h"
#include "ash/wm/window_util.h"
#include "base/command_line.h"
@@ -145,6 +146,33 @@ class AccessibilityDelegateImpl : public ash::AccessibilityDelegate {
DISALLOW_COPY_AND_ASSIGN(AccessibilityDelegateImpl);
};
+class MediaDelegateImpl : public ash::MediaDelegate {
+ public:
+ MediaDelegateImpl() {}
+ virtual ~MediaDelegateImpl() {}
+
+ virtual void HandleMediaNextTrack() OVERRIDE {
+ extensions::MediaPlayerAPI::Get(
+ ProfileManager::GetDefaultProfileOrOffTheRecord())->
+ media_player_event_router()->NotifyNextTrack();
+ }
+
+ virtual void HandleMediaPlayPause() OVERRIDE {
+ extensions::MediaPlayerAPI::Get(
+ ProfileManager::GetDefaultProfileOrOffTheRecord())->
+ media_player_event_router()->NotifyTogglePlayState();
+ }
+
+ virtual void HandleMediaPrevTrack() OVERRIDE {
+ extensions::MediaPlayerAPI::Get(
+ ProfileManager::GetDefaultProfileOrOffTheRecord())->
+ media_player_event_router()->NotifyPrevTrack();
+ }
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(MediaDelegateImpl);
+};
+
} // anonymous namespace
bool ChromeShellDelegate::IsFirstRunAfterBoot() const {
@@ -180,6 +208,10 @@ ash::NewWindowDelegate* ChromeShellDelegate::CreateNewWindowDelegate() {
return new ChromeNewWindowDelegateChromeos;
}
+ash::MediaDelegate* ChromeShellDelegate::CreateMediaDelegate() {
+ return new MediaDelegateImpl;
+}
+
ash::SystemTrayDelegate* ChromeShellDelegate::CreateSystemTrayDelegate() {
return chromeos::CreateSystemTrayDelegate();
}
@@ -188,24 +220,6 @@ ash::UserWallpaperDelegate* ChromeShellDelegate::CreateUserWallpaperDelegate() {
return chromeos::CreateUserWallpaperDelegate();
}
-void ChromeShellDelegate::HandleMediaNextTrack() {
- extensions::MediaPlayerAPI::Get(
- ProfileManager::GetDefaultProfileOrOffTheRecord())->
- media_player_event_router()->NotifyNextTrack();
-}
-
-void ChromeShellDelegate::HandleMediaPlayPause() {
- extensions::MediaPlayerAPI::Get(
- ProfileManager::GetDefaultProfileOrOffTheRecord())->
- media_player_event_router()->NotifyTogglePlayState();
-}
-
-void ChromeShellDelegate::HandleMediaPrevTrack() {
- extensions::MediaPlayerAPI::Get(
- ProfileManager::GetDefaultProfileOrOffTheRecord())->
- media_player_event_router()->NotifyPrevTrack();
-}
-
void ChromeShellDelegate::Observe(int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) {

Powered by Google App Engine
This is Rietveld 408576698