Diff
Modified: trunk/Source/WebCore/CMakeLists.txt (165792 => 165793)
--- trunk/Source/WebCore/CMakeLists.txt 2014-03-18 03:00:06 UTC (rev 165792)
+++ trunk/Source/WebCore/CMakeLists.txt 2014-03-18 03:16:43 UTC (rev 165793)
@@ -1805,6 +1805,7 @@
platform/NotImplemented.cpp
platform/PlatformEvent.cpp
platform/PlatformStrategies.cpp
+ platform/RemoteCommandListener.cpp
platform/RuntimeApplicationChecks.cpp
platform/SchemeRegistry.cpp
platform/ScrollAnimator.cpp
Modified: trunk/Source/WebCore/ChangeLog (165792 => 165793)
--- trunk/Source/WebCore/ChangeLog 2014-03-18 03:00:06 UTC (rev 165792)
+++ trunk/Source/WebCore/ChangeLog 2014-03-18 03:16:43 UTC (rev 165793)
@@ -1,3 +1,23 @@
+2014-03-17 Jer Noble <[email protected]>
+
+ Add RemoteCommandListener support to MediaSessionManager.
+ https://bugs.webkit.org/show_bug.cgi?id=130354
+
+ Reviewed by Eric Carlson.
+
+ Listen for remote commands in MediaSessionManager.
+
+ * platform/audio/MediaSessionManager.cpp:
+ (WebCore::MediaSessionManager::addSession):
+ (WebCore::MediaSessionManager::removeSession):
+ * platform/audio/MediaSessionManager.h:
+
+ Add RemoteCommandListener to the project files:
+ * CMakeLists.txt:
+ * GNUmakefile.list.am:
+ * WebCore.vcxproj/WebCore.vcxproj:
+ * WebCore.vcxproj/WebCore.vcxproj.filters:
+
2014-03-17 Ryosuke Niwa <[email protected]>
Rewrite WebHTMLConverter::_elementHasOwnBackgroundColor in C++
Modified: trunk/Source/WebCore/GNUmakefile.list.am (165792 => 165793)
--- trunk/Source/WebCore/GNUmakefile.list.am 2014-03-18 03:00:06 UTC (rev 165792)
+++ trunk/Source/WebCore/GNUmakefile.list.am 2014-03-18 03:16:43 UTC (rev 165793)
@@ -5475,6 +5475,8 @@
Source/WebCore/platform/network/soup/SoupNetworkSession.h \
Source/WebCore/platform/network/soup/SoupNetworkSession.cpp \
Source/WebCore/platform/network/soup/SynchronousLoaderClientSoup.cpp \
+ Source/WebCore/platform/RemoteCommandListener.cpp \
+ Source/WebCore/platform/RemoteCommandListener.h \
Source/WebCore/platform/ScrollableArea.cpp \
Source/WebCore/platform/ScrollableArea.h \
Source/WebCore/platform/ScrollbarThemeClient.h \
Modified: trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj (165792 => 165793)
--- trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj 2014-03-18 03:00:06 UTC (rev 165792)
+++ trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj 2014-03-18 03:16:43 UTC (rev 165793)
@@ -7446,6 +7446,7 @@
<ClCompile Include="..\platform\NotImplemented.cpp" />
<ClCompile Include="..\platform\PlatformEvent.cpp" />
<ClCompile Include="..\platform\PlatformStrategies.cpp" />
+ <ClCompile Include="..\platform\RemoteCommandListener.cpp" />
<ClCompile Include="..\platform\RuntimeApplicationChecks.cpp" />
<ClCompile Include="..\platform\SchemeRegistry.cpp" />
<ClCompile Include="..\platform\ScrollableArea.cpp" />
@@ -18992,6 +18993,7 @@
<ClInclude Include="..\platform\PopupMenuStyle.h" />
<ClInclude Include="..\platform\PurgeableBuffer.h" />
<ClInclude Include="..\platform\ReferrerPolicy.h" />
+ <ClInclude Include="..\platform\RemoteCommandListener.h" />
<ClInclude Include="..\platform\RuntimeApplicationChecks.h" />
<ClInclude Include="..\platform\SchemeRegistry.h" />
<ClInclude Include="..\platform\ScrollableArea.h" />
Modified: trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters (165792 => 165793)
--- trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters 2014-03-18 03:00:06 UTC (rev 165792)
+++ trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters 2014-03-18 03:16:43 UTC (rev 165793)
@@ -7004,6 +7004,7 @@
<ClCompile Include="..\inspector\InspectorNodeFinder.cpp" />
<ClCompile Include="..\Modules\indexeddb\IDBKeyData.cpp" />
<ClCompile Include="..\page\ContextMenuContext.cpp" />
+ <ClCompile Include="..\platform\RemoteCommandListener.cpp" />
<ClCompile Include="..\platform\audio\AudioSession.cpp" />
<ClCompile Include="..\platform\audio\MediaSession.cpp" />
<ClCompile Include="..\platform\audio\MediaSessionManager.cpp" />
@@ -14799,6 +14800,7 @@
<ClInclude Include="..\page\ContextMenuContext.h" />
<ClInclude Include="..\page\DefaultVisitedLinkStore.h" />
<ClInclude Include="..\page\VisitedLinkStore.h" />
+ <ClInclude Include="..\platform\RemoteCommandListener.h" />
<ClInclude Include="..\platform\audio\AudioSession.h" />
<ClInclude Include="..\platform\audio\AudioSessionListener.h" />
<ClInclude Include="..\platform\audio\MediaSession.h" />
Modified: trunk/Source/WebCore/platform/audio/MediaSessionManager.cpp (165792 => 165793)
--- trunk/Source/WebCore/platform/audio/MediaSessionManager.cpp 2014-03-18 03:00:06 UTC (rev 165792)
+++ trunk/Source/WebCore/platform/audio/MediaSessionManager.cpp 2014-03-18 03:16:43 UTC (rev 165793)
@@ -103,6 +103,9 @@
session.setState(MediaSession::Interrupted);
updateSessionState();
+ if (!m_remoteCommandListener)
+ m_remoteCommandListener = RemoteCommandListener::create(*this);
+
if (m_clients.isEmpty() || !(session.mediaType() == MediaSession::Video || session.mediaType() == MediaSession::Audio))
return;
@@ -123,6 +126,9 @@
m_sessions.remove(index);
updateSessionState();
+ if (m_sessions.isEmpty())
+ m_remoteCommandListener = nullptr;
+
if (m_clients.isEmpty() || !(session.mediaType() == MediaSession::Video || session.mediaType() == MediaSession::Audio))
return;
Modified: trunk/Source/WebCore/platform/audio/MediaSessionManager.h (165792 => 165793)
--- trunk/Source/WebCore/platform/audio/MediaSessionManager.h 2014-03-18 03:00:06 UTC (rev 165792)
+++ trunk/Source/WebCore/platform/audio/MediaSessionManager.h 2014-03-18 03:16:43 UTC (rev 165793)
@@ -27,6 +27,7 @@
#define MediaSessionManager_h
#include "MediaSession.h"
+#include "RemoteCommandListener.h"
#include "Settings.h"
#include <map>
#include <wtf/Vector.h>
@@ -35,6 +36,7 @@
class HTMLMediaElement;
class MediaSession;
+class RemoteCommandListener;
class MediaSessionManagerClient {
public:
@@ -49,7 +51,7 @@
MediaSessionManagerClient() { }
};
-class MediaSessionManager {
+class MediaSessionManager : RemoteCommandListenerClient {
public:
static MediaSessionManager& sharedManager();
virtual ~MediaSessionManager() { }
@@ -87,7 +89,7 @@
virtual void showPlaybackTargetPicker() { }
#endif
- void didReceiveRemoteControlCommand(MediaSession::RemoteControlCommandType);
+ virtual void didReceiveRemoteControlCommand(MediaSession::RemoteControlCommandType) override;
void addClient(MediaSessionManagerClient*);
void removeClient(MediaSessionManagerClient*);
@@ -109,6 +111,7 @@
Vector<MediaSession*> m_sessions;
Vector<MediaSessionManagerClient*> m_clients;
+ std::unique_ptr<RemoteCommandListener> m_remoteCommandListener;
MediaSession* m_activeSession;
bool m_interrupted;
};