Title: [174384] trunk/Source/WebKit2
Revision
174384
Author
adac...@apple.com
Date
2014-10-06 21:42:01 -0700 (Mon, 06 Oct 2014)

Log Message

Call WKPageUIClient::isPlayingAudioDidChange() whenever audio starts/stops playing on a page.
https://bugs.webkit.org/show_bug.cgi?id=137050

Reviewed by Anders Carlsson.

Implement WebChromeClient::isPlayingAudioDidChange() which sends the new isPlayingAudio state
over to the UI process. WebPageProxy caches the isPlayingAudio state, and when that changes,
it calls WKPageUIClient::isPlayingAudioDidChange().

* UIProcess/API/APIUIClient.h:
(API::UIClient::isPlayingAudioDidChange):
* UIProcess/API/C/WKPage.cpp:
(WKPageSetPageUIClient):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::WebPageProxy):
(WebKit::WebPageProxy::isPlayingAudioDidChange):
* UIProcess/WebPageProxy.h:
(WebKit::WebPageProxy::isPlayingAudio):
* UIProcess/WebPageProxy.messages.in:
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::isPlayingAudioDidChange):
* WebProcess/WebCoreSupport/WebChromeClient.h:

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (174383 => 174384)


--- trunk/Source/WebKit2/ChangeLog	2014-10-07 03:32:55 UTC (rev 174383)
+++ trunk/Source/WebKit2/ChangeLog	2014-10-07 04:42:01 UTC (rev 174384)
@@ -1,3 +1,28 @@
+2014-10-06  Ada Chan  <adac...@apple.com>
+
+        Call WKPageUIClient::isPlayingAudioDidChange() whenever audio starts/stops playing on a page.
+        https://bugs.webkit.org/show_bug.cgi?id=137050
+
+        Reviewed by Anders Carlsson.
+
+        Implement WebChromeClient::isPlayingAudioDidChange() which sends the new isPlayingAudio state
+        over to the UI process. WebPageProxy caches the isPlayingAudio state, and when that changes,
+        it calls WKPageUIClient::isPlayingAudioDidChange().
+
+        * UIProcess/API/APIUIClient.h:
+        (API::UIClient::isPlayingAudioDidChange):
+        * UIProcess/API/C/WKPage.cpp:
+        (WKPageSetPageUIClient):
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::WebPageProxy):
+        (WebKit::WebPageProxy::isPlayingAudioDidChange):
+        * UIProcess/WebPageProxy.h:
+        (WebKit::WebPageProxy::isPlayingAudio):
+        * UIProcess/WebPageProxy.messages.in:
+        * WebProcess/WebCoreSupport/WebChromeClient.cpp:
+        (WebKit::WebChromeClient::isPlayingAudioDidChange):
+        * WebProcess/WebCoreSupport/WebChromeClient.h:
+
 2014-10-06  Gyuyoung Kim  <gyuyoung....@samsung.com>
 
         [EFL] Restore previous scroll position using restoreViewState()

Modified: trunk/Source/WebKit2/UIProcess/API/APIUIClient.h (174383 => 174384)


--- trunk/Source/WebKit2/UIProcess/API/APIUIClient.h	2014-10-07 03:32:55 UTC (rev 174383)
+++ trunk/Source/WebKit2/UIProcess/API/APIUIClient.h	2014-10-07 04:42:01 UTC (rev 174384)
@@ -144,6 +144,8 @@
     virtual void didRecognizeLongMousePress(WebKit::WebPageProxy*, API::Object*) { }
     virtual void didCancelTrackingPotentialLongMousePress(WebKit::WebPageProxy*, API::Object*) { }
 
+    virtual void isPlayingAudioDidChange(WebKit::WebPageProxy&) { }
+
 #if PLATFORM(IOS)
     virtual RetainPtr<NSArray> actionsForElement(_WKActivatedElementInfo *, RetainPtr<NSArray> defaultActions) { return WTF::move(defaultActions); }
     virtual void didNotHandleTapAsClick(const WebCore::IntPoint&) { }

Modified: trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp (174383 => 174384)


--- trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp	2014-10-07 03:32:55 UTC (rev 174383)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp	2014-10-07 04:42:01 UTC (rev 174384)
@@ -1610,6 +1610,14 @@
 
             m_client.didCancelTrackingPotentialLongMousePress(toAPI(page), toAPI(userInfo), m_client.base.clientInfo);
         }
+
+        virtual void isPlayingAudioDidChange(WebPageProxy& page)
+        {
+            if (!m_client.isPlayingAudioDidChange)
+                return;
+
+            m_client.isPlayingAudioDidChange(toAPI(&page), m_client.base.clientInfo);
+        }
     };
 
     toImpl(pageRef)->setUIClient(std::make_unique<UIClient>(wkClient));

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (174383 => 174384)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2014-10-07 03:32:55 UTC (rev 174383)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2014-10-07 04:42:01 UTC (rev 174384)
@@ -370,6 +370,7 @@
     , m_configurationPreferenceValues(configuration.preferenceValues)
     , m_potentiallyChangedViewStateFlags(ViewState::NoFlags)
     , m_viewStateChangeWantsReply(false)
+    , m_isPlayingAudio(false)
 {
     if (m_process->state() == WebProcessProxy::State::Running) {
         if (m_userContentController)
@@ -5244,6 +5245,15 @@
     recordNavigationSnapshot();
 }
 
+void WebPageProxy::isPlayingAudioDidChange(bool newIsPlayingAudio)
+{
+    if (m_isPlayingAudio == newIsPlayingAudio)
+        return;
+
+    m_isPlayingAudio = newIsPlayingAudio;
+    m_uiClient->isPlayingAudioDidChange(*this);
+}
+
 #if PLATFORM(MAC)
 void WebPageProxy::removeNavigationGestureSnapshot()
 {

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (174383 => 174384)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h	2014-10-07 03:32:55 UTC (rev 174383)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h	2014-10-07 04:42:01 UTC (rev 174384)
@@ -911,6 +911,9 @@
 
     bool isShowingNavigationGestureSnapshot() const { return m_isShowingNavigationGestureSnapshot; }
 
+    void isPlayingAudioDidChange(bool);
+    bool isPlayingAudio() const { return m_isPlayingAudio; }
+
 #if PLATFORM(MAC)
     void removeNavigationGestureSnapshot();
 #endif
@@ -1546,6 +1549,8 @@
     WebPreferencesStore::ValueMap m_configurationPreferenceValues;
     WebCore::ViewState::Flags m_potentiallyChangedViewStateFlags;
     bool m_viewStateChangeWantsReply;
+
+    bool m_isPlayingAudio;
 };
 
 } // namespace WebKit

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in (174383 => 174384)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in	2014-10-07 03:32:55 UTC (rev 174383)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in	2014-10-07 04:42:01 UTC (rev 174384)
@@ -414,4 +414,6 @@
 #if ENABLE(CONTENT_FILTERING)
     ContentFilterDidBlockLoadForFrame(WebCore::ContentFilter contentFilter, uint64_t frameID)
 #endif
+
+    IsPlayingAudioDidChange(bool newIsPlayingAudio);
 }

Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp (174383 => 174384)


--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp	2014-10-07 03:32:55 UTC (rev 174383)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp	2014-10-07 04:42:01 UTC (rev 174384)
@@ -1051,6 +1051,11 @@
     return m_page->drawingArea()->shouldUseTiledBackingForFrameView(frameView);
 }
 
+void WebChromeClient::isPlayingAudioDidChange(bool newIsPlayingAudio)
+{
+    m_page->send(Messages::WebPageProxy::IsPlayingAudioDidChange(newIsPlayingAudio));
+}
+
 #if ENABLE(SUBTLE_CRYPTO)
 bool WebChromeClient::wrapCryptoKey(const Vector<uint8_t>& key, Vector<uint8_t>& wrappedKey) const
 {

Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h (174383 => 174384)


--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h	2014-10-07 03:32:55 UTC (rev 174383)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h	2014-10-07 04:42:01 UTC (rev 174384)
@@ -298,6 +298,8 @@
 
     virtual bool shouldUseTiledBackingForFrameView(const WebCore::FrameView*) const override;
 
+    virtual void isPlayingAudioDidChange(bool) override;
+
 #if ENABLE(SUBTLE_CRYPTO)
     virtual bool wrapCryptoKey(const Vector<uint8_t>&, Vector<uint8_t>&) const override;
     virtual bool unwrapCryptoKey(const Vector<uint8_t>&, Vector<uint8_t>&) const override;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to