Reviewed by Dan Bernstein.
* Shared/WebPageCreationParameters.cpp:
(WebKit::WebPageCreationParameters::encode): Encode the mediaVolume parameter.
(WebKit::WebPageCreationParameters::decode): Decode the mediaVolume parameter.
* Shared/WebPageCreationParameters.h:
* UIProcess/API/C/WKPage.cpp:
(WKPageSetMediaVolume): Call WebPageProxy::setMediaVolume().
* UIProcess/API/C/WKPagePrivate.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::WebPageProxy): Initialize new data member m_mediaVolume.
(WebKit::WebPageProxy::setMediaVolume): Bail if the volume hasn't changed. Update m_mediaVolume
and bail if the page is no longer valid. Otherwise, send a WebPage::SetMediaVolume message to
the web process.
(WebKit::WebPageProxy::creationParameters): Add media volume to the creation parameters.
* UIProcess/WebPageProxy.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::WebPage): Initialize media volume from the WebPageCreationParameters.
(WebKit::WebPage::setMediaVolume): Call Page::setMediaVolume().
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in: Add the SetMediaVolume message.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@105439
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2012-01-18 Ada Chan <adachan@apple.com>
+
+ Need a WebKit2 API for setting media volume
+ https://bugs.webkit.org/show_bug.cgi?id=76560
+
+ Reviewed by Dan Bernstein.
+
+ * Shared/WebPageCreationParameters.cpp:
+ (WebKit::WebPageCreationParameters::encode): Encode the mediaVolume parameter.
+ (WebKit::WebPageCreationParameters::decode): Decode the mediaVolume parameter.
+ * Shared/WebPageCreationParameters.h:
+ * UIProcess/API/C/WKPage.cpp:
+ (WKPageSetMediaVolume): Call WebPageProxy::setMediaVolume().
+ * UIProcess/API/C/WKPagePrivate.h:
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::WebPageProxy): Initialize new data member m_mediaVolume.
+ (WebKit::WebPageProxy::setMediaVolume): Bail if the volume hasn't changed. Update m_mediaVolume
+ and bail if the page is no longer valid. Otherwise, send a WebPage::SetMediaVolume message to
+ the web process.
+ (WebKit::WebPageProxy::creationParameters): Add media volume to the creation parameters.
+ * UIProcess/WebPageProxy.h:
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::WebPage::WebPage): Initialize media volume from the WebPageCreationParameters.
+ (WebKit::WebPage::setMediaVolume): Call Page::setMediaVolume().
+ * WebProcess/WebPage/WebPage.h:
+ * WebProcess/WebPage/WebPage.messages.in: Add the SetMediaVolume message.
+
2012-01-19 Carlos Garcia Campos <cgarcia@igalia.com>
[GTK] WebKit2 GTK+ API public headers are not installed
encoder->encode(canRunBeforeUnloadConfirmPanel);
encoder->encode(canRunModal);
encoder->encode(deviceScaleFactor);
+ encoder->encode(mediaVolume);
#if PLATFORM(MAC)
encoder->encode(isSmartInsertDeleteEnabled);
return false;
if (!decoder->decode(parameters.deviceScaleFactor))
return false;
+ if (!decoder->decode(parameters.mediaVolume))
+ return false;
#if PLATFORM(MAC)
if (!decoder->decode(parameters.isSmartInsertDeleteEnabled))
bool canRunModal;
float deviceScaleFactor;
+
+ float mediaVolume;
#if PLATFORM(MAC)
bool isSmartInsertDeleteEnabled;
{
toImpl(page)->setShouldSendEventsSynchronously(sync);
}
+
+void WKPageSetMediaVolume(WKPageRef page, float volume)
+{
+ toImpl(page)->setMediaVolume(volume);
+}
WK_EXPORT void WKPageSetShouldSendEventsSynchronously(WKPageRef page, bool sync);
+WK_EXPORT void WKPageSetMediaVolume(WKPageRef page, float volume);
+
#ifdef __cplusplus
}
#endif
, m_pageCount(0)
, m_renderTreeSize(0)
, m_shouldSendEventsSynchronously(false)
+ , m_mediaVolume(1)
{
#ifndef NDEBUG
webPageProxyCounter.increment();
printFrame(m_mainFrame->frameID());
}
+void WebPageProxy::setMediaVolume(float volume)
+{
+ if (volume == m_mediaVolume)
+ return;
+
+ m_mediaVolume = volume;
+
+ if (!isValid())
+ return;
+
+ process()->send(Messages::WebPage::SetMediaVolume(volume), m_pageID);
+}
+
#if PLATFORM(QT)
void WebPageProxy::didChangeContentsSize(const IntSize& size)
{
parameters.canRunBeforeUnloadConfirmPanel = m_uiClient.canRunBeforeUnloadConfirmPanel();
parameters.canRunModal = m_uiClient.canRunModal();
parameters.deviceScaleFactor = m_intrinsicDeviceScaleFactor;
+ parameters.mediaVolume = m_mediaVolume;
#if PLATFORM(MAC)
parameters.isSmartInsertDeleteEnabled = m_isSmartInsertDeleteEnabled;
void setShouldSendEventsSynchronously(bool sync) { m_shouldSendEventsSynchronously = sync; };
void printMainFrame();
+
+ void setMediaVolume(float);
// WebPopupMenuProxy::Client
virtual NativeWebMouseEvent* currentlyProcessedMouseDownEvent();
static WKPageDebugPaintFlags s_debugPaintFlags;
bool m_shouldSendEventsSynchronously;
+
+ float m_mediaVolume;
#if PLATFORM(QT)
WTF::HashSet<RefPtr<QtNetworkRequestData> > m_applicationSchemeRequests;
restoreSession(parameters.sessionState);
m_drawingArea->setPaintingEnabled(true);
+
+ setMediaVolume(parameters.mediaVolume);
#ifndef NDEBUG
webPageCounter.increment();
}
#endif
+void WebPage::setMediaVolume(float volume)
+{
+ m_page->setMediaVolume(volume);
+}
+
void WebPage::runModal()
{
if (m_isClosed)
void drawPagesToPDF(uint64_t frameID, const PrintInfo&, uint32_t first, uint32_t count, uint64_t callbackID);
#endif
+ void setMediaVolume(float);
+
bool mainFrameHasCustomRepresentation() const;
void didChangeScrollOffsetForMainFrame();
DrawPagesToPDF(uint64_t frameID, WebKit::PrintInfo printInfo, uint32_t first, uint32_t count, uint64_t callbackID)
#endif
+ # Media
+ SetMediaVolume(float volume)
+
SetMemoryCacheMessagesEnabled(bool memoryCacheMessagesEnabled)
// FIXME: This a dummy message, to avoid breaking the build for platforms that don't require