Media Session: let UI clients query whether a media element is paused
authormrajca@apple.com <mrajca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 4 Aug 2015 00:30:45 +0000 (00:30 +0000)
committermrajca@apple.com <mrajca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 4 Aug 2015 00:30:45 +0000 (00:30 +0000)
https://bugs.webkit.org/show_bug.cgi?id=147588

Reviewed by Tim Horton.

WebCore:
* page/Page.cpp:
(WebCore::Page::isMediaElementPaused): Determine if the media element with the given ID is paused.
* page/Page.h:

WebKit2: Added plumbing to determine if a page's media element is paused.
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::isMediaElementPaused):
* UIProcess/WebPageProxy.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::isMediaElementPaused):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@187790 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/page/Page.cpp
Source/WebCore/page/Page.h
Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/WebPageProxy.cpp
Source/WebKit2/UIProcess/WebPageProxy.h
Source/WebKit2/WebProcess/WebPage/WebPage.cpp
Source/WebKit2/WebProcess/WebPage/WebPage.h
Source/WebKit2/WebProcess/WebPage/WebPage.messages.in

index 3946a0d..c301b17 100644 (file)
@@ -1,3 +1,14 @@
+2015-08-03  Matt Rajca  <mrajca@apple.com>
+
+        Media Session: let UI clients query whether a media element is paused
+        https://bugs.webkit.org/show_bug.cgi?id=147588
+
+        Reviewed by Tim Horton.
+
+        * page/Page.cpp:
+        (WebCore::Page::isMediaElementPaused): Determine if the media element with the given ID is paused.
+        * page/Page.h:
+
 2015-08-03  Eric Carlson  <eric.carlson@apple.com>
 
         [Mac] Always require user gesture to begin playing to AppleTV automatically
index 1606390..8ea969d 100644 (file)
@@ -1224,6 +1224,15 @@ void Page::handleMediaEvent(MediaEventType eventType)
         break;
     }
 }
+
+bool Page::isMediaElementPaused(uint64_t elementID)
+{
+    if (HTMLMediaElement* element = HTMLMediaElement::elementWithID(elementID))
+        return element->paused();
+
+    ASSERT_NOT_REACHED();
+    return true;
+}
 #endif
 
 #if !ASSERT_DISABLED
index 02b2010..188eb4d 100644 (file)
@@ -442,6 +442,7 @@ public:
 
 #if ENABLE(MEDIA_SESSION)
     WEBCORE_EXPORT void handleMediaEvent(MediaEventType);
+    WEBCORE_EXPORT bool isMediaElementPaused(uint64_t);
 #endif
 
 #if ENABLE(WIRELESS_PLAYBACK_TARGET)
index 8beb561..a2d354c 100644 (file)
@@ -1,3 +1,20 @@
+2015-08-03  Matt Rajca  <mrajca@apple.com>
+
+        Media Session: let UI clients query whether a media element is paused
+        https://bugs.webkit.org/show_bug.cgi?id=147588
+
+        Reviewed by Tim Horton.
+
+        Added plumbing to determine if a page's media element is paused.
+
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::isMediaElementPaused):
+        * UIProcess/WebPageProxy.h:
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::isMediaElementPaused):
+        * WebProcess/WebPage/WebPage.h:
+        * WebProcess/WebPage/WebPage.messages.in:
+
 2015-08-03  Chris Dumez  <cdumez@apple.com>
 
         Make sure error handling code APIUserContentExtensionStore closes open file descriptors
index 599c9a7..028b540 100644 (file)
@@ -3885,6 +3885,14 @@ void WebPageProxy::handleMediaEvent(MediaEventType eventType)
     
     m_process->send(Messages::WebPage::HandleMediaEvent(eventType), m_pageID);
 }
+
+void WebPageProxy::isMediaElementPaused(uint64_t elementID, uint64_t callbackID)
+{
+    if (!isValid())
+        return;
+
+    m_process->send(Messages::WebPage::IsMediaElementPaused(elementID, callbackID), m_pageID);
+}
 #endif
 
 void WebPageProxy::setMayStartMediaWhenInWindow(bool mayStartMedia)
index e2ec023..1ebce1e 100644 (file)
@@ -946,6 +946,7 @@ public:
 #if ENABLE(MEDIA_SESSION)
     bool hasMediaSessionWithActiveMediaElements() const { return m_hasMediaSessionWithActiveMediaElements; }
     void handleMediaEvent(WebCore::MediaEventType);
+    void isMediaElementPaused(uint64_t, uint64_t);
 #endif
 
     // WebPopupMenuProxy::Client
index 9fca476..725f5c0 100644 (file)
@@ -4068,6 +4068,12 @@ void WebPage::handleMediaEvent(uint32_t eventType)
 {
     m_page->handleMediaEvent(static_cast<MediaEventType>(eventType));
 }
+
+void WebPage::isMediaElementPaused(uint64_t elementID, uint64_t callbackID)
+{
+    bool paused = m_page->isMediaElementPaused(elementID);
+    send(Messages::WebPageProxy::UnsignedCallback(paused, callbackID));
+}
 #endif
 
 void WebPage::setMayStartMediaWhenInWindow(bool mayStartMedia)
index 3cb6266..159a80c 100644 (file)
@@ -750,6 +750,7 @@ public:
 
 #if ENABLE(MEDIA_SESSION)
     void handleMediaEvent(uint32_t /* WebCore::MediaEventType */);
+    void isMediaElementPaused(uint64_t, uint64_t);
 #endif
 
     void updateMainFrameScrollOffsetPinning();
index 00ab4fd..7cb701d 100644 (file)
@@ -316,6 +316,7 @@ messages -> WebPage LegacyReceiver {
 
 #if ENABLE(MEDIA_SESSION)
     HandleMediaEvent(uint32_t eventType)
+    IsMediaElementPaused(uint64_t elementID, uint64_t callbackID)
 #endif
 
     // FIXME: This a dummy message, to avoid breaking the build for platforms that don't require