Title: [188218] trunk/Source/WebKit2
- Revision
- 188218
- Author
- mra...@apple.com
- Date
- 2015-08-10 12:18:50 -0700 (Mon, 10 Aug 2015)
Log Message
Media Session: generalize isFocusedContentMediaElementPlaying so it works with other playback attributes
https://bugs.webkit.org/show_bug.cgi?id=147797
Reviewed by Simon Fraser.
* UIProcess/API/C/WKMediaSessionFocusManager.cpp:
(WKMediaSessionFocusManagerValueForPlaybackAttribute):
(WKMediaSessionFocusManagerIsFocusedContentMediaElementPlaying): Deleted.
* UIProcess/API/C/WKMediaSessionFocusManager.h:
* UIProcess/WebMediaSessionFocusManager.cpp:
(WebKit::WebMediaSessionFocusManager::valueForPlaybackAttribute):
(WebKit::WebMediaSessionFocusManager::mediaControlIsEnabledDidChange):
(WebKit::WebMediaSessionFocusManager::isFocusedContentMediaElementPlaying): Deleted.
(WebKit::WebMediaSessionFocusManager::mediaElementIsPlayingDidChange): Deleted.
* UIProcess/WebMediaSessionFocusManager.h:
Modified Paths
Diff
Modified: trunk/Source/WebKit2/ChangeLog (188217 => 188218)
--- trunk/Source/WebKit2/ChangeLog 2015-08-10 18:57:47 UTC (rev 188217)
+++ trunk/Source/WebKit2/ChangeLog 2015-08-10 19:18:50 UTC (rev 188218)
@@ -1,3 +1,21 @@
+2015-08-07 Matt Rajca <mra...@apple.com>
+
+ Media Session: generalize isFocusedContentMediaElementPlaying so it works with other playback attributes
+ https://bugs.webkit.org/show_bug.cgi?id=147797
+
+ Reviewed by Simon Fraser.
+
+ * UIProcess/API/C/WKMediaSessionFocusManager.cpp:
+ (WKMediaSessionFocusManagerValueForPlaybackAttribute):
+ (WKMediaSessionFocusManagerIsFocusedContentMediaElementPlaying): Deleted.
+ * UIProcess/API/C/WKMediaSessionFocusManager.h:
+ * UIProcess/WebMediaSessionFocusManager.cpp:
+ (WebKit::WebMediaSessionFocusManager::valueForPlaybackAttribute):
+ (WebKit::WebMediaSessionFocusManager::mediaControlIsEnabledDidChange):
+ (WebKit::WebMediaSessionFocusManager::isFocusedContentMediaElementPlaying): Deleted.
+ (WebKit::WebMediaSessionFocusManager::mediaElementIsPlayingDidChange): Deleted.
+ * UIProcess/WebMediaSessionFocusManager.h:
+
2015-08-10 Zan Dobersek <zdober...@igalia.com>
[CoordinatedGraphics] Fix forward declarations of CoordinatedGraphicsLayerState, ViewportAttributes
Modified: trunk/Source/WebKit2/UIProcess/API/C/WKMediaSessionFocusManager.cpp (188217 => 188218)
--- trunk/Source/WebKit2/UIProcess/API/C/WKMediaSessionFocusManager.cpp 2015-08-10 18:57:47 UTC (rev 188217)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKMediaSessionFocusManager.cpp 2015-08-10 19:18:50 UTC (rev 188218)
@@ -50,12 +50,13 @@
#endif
}
-bool WKMediaSessionFocusManagerIsFocusedContentMediaElementPlaying(WKMediaSessionFocusManagerRef manager)
+bool WKMediaSessionFocusManagerValueForPlaybackAttribute(WKMediaSessionFocusManagerRef manager, WKMediaSessionFocusManagerPlaybackAttribute attribute)
{
#if ENABLE(MEDIA_SESSION)
- return toImpl(manager)->isFocusedContentMediaElementPlaying();
+ return toImpl(manager)->valueForPlaybackAttribute(attribute);
#else
UNUSED_PARAM(manager);
+ UNUSED_PARAM(attribute);
return false;
#endif
}
Modified: trunk/Source/WebKit2/UIProcess/API/C/WKMediaSessionFocusManager.h (188217 => 188218)
--- trunk/Source/WebKit2/UIProcess/API/C/WKMediaSessionFocusManager.h 2015-08-10 18:57:47 UTC (rev 188217)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKMediaSessionFocusManager.h 2015-08-10 19:18:50 UTC (rev 188218)
@@ -36,10 +36,12 @@
extern "C" {
#endif
-enum {
- IsPlaying = 1 << 0
+enum WKMediaSessionFocusManagerPlaybackAttribute {
+ IsPlaying = 1 << 0,
+ IsPreviousTrackControlEnabled = 1 << 1,
+ IsNextTrackControlEnabled = 1 << 2,
};
-typedef uint32_t WKMediaSessionFocusManagerPlaybackAttribute;
+typedef uint32_t WKMediaSessionFocusManagerPlaybackAttributes;
// Media Session Focus Manager Client
typedef void (*WKMediaSessionFocusManagerDidChangePlaybackAttribute)(WKMediaSessionFocusManagerRef manager, WKMediaSessionFocusManagerPlaybackAttribute playbackAttribute, bool value, const void *clientInfo);
@@ -60,7 +62,7 @@
WK_EXPORT void WKMediaSessionFocusManagerSetClient(WKMediaSessionFocusManagerRef manager, const WKMediaSessionFocusManagerClientBase* client);
-WK_EXPORT bool WKMediaSessionFocusManagerIsFocusedContentMediaElementPlaying(WKMediaSessionFocusManagerRef manager);
+WK_EXPORT bool WKMediaSessionFocusManagerValueForPlaybackAttribute(WKMediaSessionFocusManagerRef, WKMediaSessionFocusManagerPlaybackAttribute);
#ifdef __cplusplus
}
Modified: trunk/Source/WebKit2/UIProcess/WebMediaSessionFocusManager.cpp (188217 => 188218)
--- trunk/Source/WebKit2/UIProcess/WebMediaSessionFocusManager.cpp 2015-08-10 18:57:47 UTC (rev 188217)
+++ trunk/Source/WebKit2/UIProcess/WebMediaSessionFocusManager.cpp 2015-08-10 19:18:50 UTC (rev 188218)
@@ -62,19 +62,23 @@
m_client.initialize(client);
}
-bool WebMediaSessionFocusManager::isFocusedContentMediaElementPlaying() const
+bool WebMediaSessionFocusManager::valueForPlaybackAttribute(WKMediaSessionFocusManagerPlaybackAttribute attribute) const
{
if (!m_focusedMediaElement)
return false;
- return m_focusedMediaElementIsPlaying;
+ return m_playbackAttributes & attribute;
}
void WebMediaSessionFocusManager::mediaElementIsPlayingDidChange(WebPageProxy* proxy, uint64_t elementID, bool isPlaying)
{
if (m_focusedMediaElement) {
if (proxy == m_focusedMediaElement->first && elementID == m_focusedMediaElement->second) {
- m_focusedMediaElementIsPlaying = isPlaying;
+ if (isPlaying)
+ m_playbackAttributes |= IsPlaying;
+ else
+ m_playbackAttributes &= ~IsPlaying;
+
m_client.didChangePlaybackAttribute(this, IsPlaying, isPlaying);
}
}
Modified: trunk/Source/WebKit2/UIProcess/WebMediaSessionFocusManager.h (188217 => 188218)
--- trunk/Source/WebKit2/UIProcess/WebMediaSessionFocusManager.h 2015-08-10 18:57:47 UTC (rev 188217)
+++ trunk/Source/WebKit2/UIProcess/WebMediaSessionFocusManager.h 2015-08-10 19:18:50 UTC (rev 188218)
@@ -45,7 +45,7 @@
void initializeClient(const WKMediaSessionFocusManagerClientBase*);
- bool isFocusedContentMediaElementPlaying() const;
+ bool valueForPlaybackAttribute(WKMediaSessionFocusManagerPlaybackAttribute) const;
void mediaElementIsPlayingDidChange(WebPageProxy*, uint64_t, bool);
void setFocusedMediaElement(WebPageProxy&, uint64_t);
@@ -62,7 +62,7 @@
virtual void derefWebContextSupplement() override;
std::unique_ptr<FocusedMediaElement> m_focusedMediaElement;
- bool m_focusedMediaElementIsPlaying { false };
+ WKMediaSessionFocusManagerPlaybackAttributes m_playbackAttributes { 0 };
WebMediaSessionFocusManagerClient m_client;
};
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes