summaryrefslogtreecommitdiffstats
path: root/ash
diff options
context:
space:
mode:
authoroshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-11-01 11:43:07 +0000
committeroshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-11-01 11:43:07 +0000
commitefc897f7d4133bc9e119d29a2878375abc07e4fd (patch)
treef4a4490a6b65a1de02eec6697bca1e6d6ceefd97 /ash
parentb6bd5916a34b1694acd55e53be84601747b9731e (diff)
downloadchromium_src-efc897f7d4133bc9e119d29a2878375abc07e4fd.zip
chromium_src-efc897f7d4133bc9e119d29a2878375abc07e4fd.tar.gz
chromium_src-efc897f7d4133bc9e119d29a2878375abc07e4fd.tar.bz2
Introduce MediaDelegate
BUG=none Review URL: https://codereview.chromium.org/48523010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@232330 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash')
-rw-r--r--ash/accelerators/accelerator_controller.cc7
-rw-r--r--ash/accessibility_delegate.h1
-rw-r--r--ash/media_delegate.h27
-rw-r--r--ash/new_window_delegate.h1
-rw-r--r--ash/shell.cc4
-rw-r--r--ash/shell.h6
-rw-r--r--ash/shell/shell_delegate_impl.cc27
-rw-r--r--ash/shell/shell_delegate_impl.h4
-rw-r--r--ash/shell_delegate.h13
-rw-r--r--ash/test/test_shell_delegate.cc21
-rw-r--r--ash/test/test_shell_delegate.h4
11 files changed, 77 insertions, 38 deletions
diff --git a/ash/accelerators/accelerator_controller.cc b/ash/accelerators/accelerator_controller.cc
index 5941081..efb9098 100644
--- a/ash/accelerators/accelerator_controller.cc
+++ b/ash/accelerators/accelerator_controller.cc
@@ -24,6 +24,7 @@
#include "ash/launcher/launcher_model.h"
#include "ash/magnifier/magnification_controller.h"
#include "ash/magnifier/partial_magnification_controller.h"
+#include "ash/media_delegate.h"
#include "ash/multi_profile_uma.h"
#include "ash/new_window_delegate.h"
#include "ash/root_window_controller.h"
@@ -313,17 +314,17 @@ bool HandleMagnifyScreen(int delta_index) {
}
bool HandleMediaNextTrack() {
- Shell::GetInstance()->delegate()->HandleMediaNextTrack();
+ Shell::GetInstance()->media_delegate()->HandleMediaNextTrack();
return true;
}
bool HandleMediaPlayPause() {
- Shell::GetInstance()->delegate()->HandleMediaPlayPause();
+ Shell::GetInstance()->media_delegate()->HandleMediaPlayPause();
return true;
}
bool HandleMediaPrevTrack() {
- Shell::GetInstance()->delegate()->HandleMediaPrevTrack();
+ Shell::GetInstance()->media_delegate()->HandleMediaPrevTrack();
return true;
}
diff --git a/ash/accessibility_delegate.h b/ash/accessibility_delegate.h
index a77e840..1f0f349 100644
--- a/ash/accessibility_delegate.h
+++ b/ash/accessibility_delegate.h
@@ -18,7 +18,6 @@ enum AccessibilityNotificationVisibility {
// A deletate class to control accessibility features.
class ASH_EXPORT AccessibilityDelegate {
public:
- AccessibilityDelegate() {}
virtual ~AccessibilityDelegate() {}
// Invoked to toggle spoken feedback for accessibility
diff --git a/ash/media_delegate.h b/ash/media_delegate.h
new file mode 100644
index 0000000..1dac059
--- /dev/null
+++ b/ash/media_delegate.h
@@ -0,0 +1,27 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef ASH_MEDIA_DELEGATE_H_
+#define ASH_MEDIA_DELEGATE_H_
+
+namespace ash {
+
+// A delegate class to control media playback.
+class MediaDelegate {
+ public:
+ virtual ~MediaDelegate() {}
+
+ // Handles the Next Track Media shortcut key.
+ virtual void HandleMediaNextTrack() = 0;
+
+ // Handles the Play/Pause Toggle Media shortcut key.
+ virtual void HandleMediaPlayPause() = 0;
+
+ // Handles the Previous Track Media shortcut key.
+ virtual void HandleMediaPrevTrack() = 0;
+};
+
+} // namespace ash
+
+#endif // ASH_MEDIA_DELEGATE_H_
diff --git a/ash/new_window_delegate.h b/ash/new_window_delegate.h
index b4a592b..57319af 100644
--- a/ash/new_window_delegate.h
+++ b/ash/new_window_delegate.h
@@ -11,7 +11,6 @@ namespace ash {
// ash.
class NewWindowDelegate {
public:
- NewWindowDelegate() {}
virtual ~NewWindowDelegate() {}
// Invoked when the user uses Ctrl+T to open a new tab.
diff --git a/ash/shell.cc b/ash/shell.cc
index 02a84db..0410c40 100644
--- a/ash/shell.cc
+++ b/ash/shell.cc
@@ -36,6 +36,7 @@
#include "ash/launcher/launcher_model_util.h"
#include "ash/magnifier/magnification_controller.h"
#include "ash/magnifier/partial_magnification_controller.h"
+#include "ash/media_delegate.h"
#include "ash/new_window_delegate.h"
#include "ash/root_window_controller.h"
#include "ash/screen_ash.h"
@@ -665,6 +666,8 @@ Shell::~Shell() {
keyboard_controller_.reset();
accessibility_delegate_.reset();
+ new_window_delegate_.reset();
+ media_delegate_.reset();
#if defined(OS_CHROMEOS) && defined(USE_X11)
if (display_change_observer_)
@@ -842,6 +845,7 @@ void Shell::Init() {
session_state_delegate_.reset(delegate_->CreateSessionStateDelegate());
accessibility_delegate_.reset(delegate_->CreateAccessibilityDelegate());
new_window_delegate_.reset(delegate_->CreateNewWindowDelegate());
+ media_delegate_.reset(delegate_->CreateMediaDelegate());
if (!command_line->HasSwitch(views::corewm::switches::kNoDropShadows)) {
resize_shadow_controller_.reset(new internal::ResizeShadowController());
diff --git a/ash/shell.h b/ash/shell.h
index 62379ac..fa54faa 100644
--- a/ash/shell.h
+++ b/ash/shell.h
@@ -92,6 +92,7 @@ class LauncherItemDelegateManager;
class LauncherModel;
class LockStateController;
class MagnificationController;
+class MediaDelegate;
class MruWindowTracker;
class NestedDispatcherController;
class NewWindowDelegate;
@@ -377,6 +378,10 @@ class ASH_EXPORT Shell
return new_window_delegate_.get();
}
+ MediaDelegate* media_delegate() {
+ return media_delegate_.get();
+ }
+
HighContrastController* high_contrast_controller() {
return high_contrast_controller_.get();
}
@@ -586,6 +591,7 @@ class ASH_EXPORT Shell
scoped_ptr<SessionStateDelegate> session_state_delegate_;
scoped_ptr<AccessibilityDelegate> accessibility_delegate_;
scoped_ptr<NewWindowDelegate> new_window_delegate_;
+ scoped_ptr<MediaDelegate> media_delegate_;
scoped_ptr<LauncherDelegate> launcher_delegate_;
scoped_ptr<LauncherItemDelegateManager> launcher_item_delegate_manager_;
diff --git a/ash/shell/shell_delegate_impl.cc b/ash/shell/shell_delegate_impl.cc
index e414419..d890625 100644
--- a/ash/shell/shell_delegate_impl.cc
+++ b/ash/shell/shell_delegate_impl.cc
@@ -10,6 +10,7 @@
#include "ash/default_user_wallpaper_delegate.h"
#include "ash/host/root_window_host_factory.h"
#include "ash/keyboard_controller_proxy_stub.h"
+#include "ash/media_delegate.h"
#include "ash/new_window_delegate.h"
#include "ash/session_state_delegate.h"
#include "ash/session_state_delegate_stub.h"
@@ -51,6 +52,19 @@ class NewWindowDelegateImpl : public NewWindowDelegate {
DISALLOW_COPY_AND_ASSIGN(NewWindowDelegateImpl);
};
+class MediaDelegateImpl : public MediaDelegate {
+ public:
+ MediaDelegateImpl() {}
+ virtual ~MediaDelegateImpl() {}
+
+ virtual void HandleMediaNextTrack() OVERRIDE {}
+ virtual void HandleMediaPlayPause() OVERRIDE {}
+ virtual void HandleMediaPrevTrack() OVERRIDE {}
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(MediaDelegateImpl);
+};
+
} // namespace
ShellDelegateImpl::ShellDelegateImpl()
@@ -136,6 +150,10 @@ ash::NewWindowDelegate* ShellDelegateImpl::CreateNewWindowDelegate() {
return new NewWindowDelegateImpl;
}
+ash::MediaDelegate* ShellDelegateImpl::CreateMediaDelegate() {
+ return new MediaDelegateImpl;
+}
+
aura::client::UserActionClient* ShellDelegateImpl::CreateUserActionClient() {
return NULL;
}
@@ -143,15 +161,6 @@ aura::client::UserActionClient* ShellDelegateImpl::CreateUserActionClient() {
void ShellDelegateImpl::RecordUserMetricsAction(UserMetricsAction action) {
}
-void ShellDelegateImpl::HandleMediaNextTrack() {
-}
-
-void ShellDelegateImpl::HandleMediaPlayPause() {
-}
-
-void ShellDelegateImpl::HandleMediaPrevTrack() {
-}
-
ui::MenuModel* ShellDelegateImpl::CreateContextMenu(aura::Window* root) {
return new ContextMenu(root);
}
diff --git a/ash/shell/shell_delegate_impl.h b/ash/shell/shell_delegate_impl.h
index 544eef9..db31609 100644
--- a/ash/shell/shell_delegate_impl.h
+++ b/ash/shell/shell_delegate_impl.h
@@ -46,11 +46,9 @@ class ShellDelegateImpl : public ash::ShellDelegate {
virtual ash::SessionStateDelegate* CreateSessionStateDelegate() OVERRIDE;
virtual ash::AccessibilityDelegate* CreateAccessibilityDelegate() OVERRIDE;
virtual ash::NewWindowDelegate* CreateNewWindowDelegate() OVERRIDE;
+ virtual ash::MediaDelegate* CreateMediaDelegate() OVERRIDE;
virtual aura::client::UserActionClient* CreateUserActionClient() OVERRIDE;
virtual void RecordUserMetricsAction(UserMetricsAction action) OVERRIDE;
- virtual void HandleMediaNextTrack() OVERRIDE;
- virtual void HandleMediaPlayPause() OVERRIDE;
- virtual void HandleMediaPrevTrack() OVERRIDE;
virtual ui::MenuModel* CreateContextMenu(
aura::Window* root_window) OVERRIDE;
virtual RootWindowHostFactory* CreateRootWindowHostFactory() OVERRIDE;
diff --git a/ash/shell_delegate.h b/ash/shell_delegate.h
index 3c8d344..76a129d 100644
--- a/ash/shell_delegate.h
+++ b/ash/shell_delegate.h
@@ -42,6 +42,7 @@ class CapsLockDelegate;
class LauncherDelegate;
class LauncherModel;
struct LauncherItem;
+class MediaDelegate;
class NewWindowDelegate;
class RootWindowHostFactory;
class AccessibilityDelegate;
@@ -168,21 +169,15 @@ class ASH_EXPORT ShellDelegate {
// Creates an application delegate. Shell takes ownership of the delegate.
virtual NewWindowDelegate* CreateNewWindowDelegate() = 0;
+ // Creates a media delegate. Shell takes ownership of the delegate.
+ virtual MediaDelegate* CreateMediaDelegate() = 0;
+
// Creates a user action client. Shell takes ownership of the object.
virtual aura::client::UserActionClient* CreateUserActionClient() = 0;
// Records that the user performed an action.
virtual void RecordUserMetricsAction(UserMetricsAction action) = 0;
- // Handles the Next Track Media shortcut key.
- virtual void HandleMediaNextTrack() = 0;
-
- // Handles the Play/Pause Toggle Media shortcut key.
- virtual void HandleMediaPlayPause() = 0;
-
- // Handles the Previous Track Media shortcut key.
- virtual void HandleMediaPrevTrack() = 0;
-
// Creates a menu model of the context for the |root_window|.
virtual ui::MenuModel* CreateContextMenu(aura::Window* root_window) = 0;
diff --git a/ash/test/test_shell_delegate.cc b/ash/test/test_shell_delegate.cc
index 5fde812..735ad60 100644
--- a/ash/test/test_shell_delegate.cc
+++ b/ash/test/test_shell_delegate.cc
@@ -10,6 +10,7 @@
#include "ash/default_accessibility_delegate.h"
#include "ash/host/root_window_host_factory.h"
#include "ash/keyboard_controller_proxy_stub.h"
+#include "ash/media_delegate.h"
#include "ash/new_window_delegate.h"
#include "ash/session_state_delegate.h"
#include "ash/shell.h"
@@ -39,6 +40,13 @@ class NewWindowDelegateImpl : public NewWindowDelegate {
virtual void OpenFeedbackPage() OVERRIDE {}
};
+class MediaDelegateImpl : public MediaDelegate {
+ public:
+ virtual void HandleMediaNextTrack() OVERRIDE {}
+ virtual void HandleMediaPlayPause() OVERRIDE {}
+ virtual void HandleMediaPrevTrack() OVERRIDE {}
+};
+
} // namespace
TestShellDelegate::TestShellDelegate()
@@ -121,6 +129,10 @@ NewWindowDelegate* TestShellDelegate::CreateNewWindowDelegate() {
return new NewWindowDelegateImpl;
}
+MediaDelegate* TestShellDelegate::CreateMediaDelegate() {
+ return new MediaDelegateImpl;
+}
+
aura::client::UserActionClient* TestShellDelegate::CreateUserActionClient() {
return NULL;
}
@@ -128,15 +140,6 @@ aura::client::UserActionClient* TestShellDelegate::CreateUserActionClient() {
void TestShellDelegate::RecordUserMetricsAction(UserMetricsAction action) {
}
-void TestShellDelegate::HandleMediaNextTrack() {
-}
-
-void TestShellDelegate::HandleMediaPlayPause() {
-}
-
-void TestShellDelegate::HandleMediaPrevTrack() {
-}
-
ui::MenuModel* TestShellDelegate::CreateContextMenu(aura::Window* root) {
return NULL;
}
diff --git a/ash/test/test_shell_delegate.h b/ash/test/test_shell_delegate.h
index b241eb7..790163c 100644
--- a/ash/test/test_shell_delegate.h
+++ b/ash/test/test_shell_delegate.h
@@ -49,11 +49,9 @@ class TestShellDelegate : public ShellDelegate {
virtual SessionStateDelegate* CreateSessionStateDelegate() OVERRIDE;
virtual AccessibilityDelegate* CreateAccessibilityDelegate() OVERRIDE;
virtual NewWindowDelegate* CreateNewWindowDelegate() OVERRIDE;
+ virtual MediaDelegate* CreateMediaDelegate() OVERRIDE;
virtual aura::client::UserActionClient* CreateUserActionClient() OVERRIDE;
virtual void RecordUserMetricsAction(UserMetricsAction action) OVERRIDE;
- virtual void HandleMediaNextTrack() OVERRIDE;
- virtual void HandleMediaPlayPause() OVERRIDE;
- virtual void HandleMediaPrevTrack() OVERRIDE;
virtual ui::MenuModel* CreateContextMenu(aura::Window* root) OVERRIDE;
virtual RootWindowHostFactory* CreateRootWindowHostFactory() OVERRIDE;
virtual base::string16 GetProductName() const OVERRIDE;