<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[185477] trunk/Source</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/185477">185477</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2015-06-11 14:49:49 -0700 (Thu, 11 Jun 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>Media Session: Add plumbing for media control event delivery.
https://bugs.webkit.org/show_bug.cgi?id=145859

Patch by Matt Rajca &lt;mrajca@apple.com&gt; on 2015-06-11
Reviewed by Anders Carlsson.

Source/WebCore:

* Modules/mediasession/MediaEventTypes.h: Added.
* WebCore.xcodeproj/project.pbxproj:
* page/Page.cpp:
(WebCore::Page::handleMediaEvent): Toggle media playback upon receiving the PlayPause event as described in the spec.
* page/Page.h:

Source/WebKit2:

* UIProcess/API/C/WKPage.cpp:
(WKPageHandleMediaEvent):
* UIProcess/API/C/WKPagePrivate.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::handleMediaEvent):
* UIProcess/WebPageProxy.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::handleMediaEvent):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreWebCorexcodeprojprojectpbxproj">trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebCorepagePagecpp">trunk/Source/WebCore/page/Page.cpp</a></li>
<li><a href="#trunkSourceWebCorepagePageh">trunk/Source/WebCore/page/Page.h</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICWKPagecpp">trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICWKPagePrivateh">trunk/Source/WebKit2/UIProcess/API/C/WKPagePrivate.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebPageProxycpp">trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebPageProxyh">trunk/Source/WebKit2/UIProcess/WebPageProxy.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageWebPagecpp">trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageWebPageh">trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageWebPagemessagesin">trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreModulesmediasessionMediaEventTypesh">trunk/Source/WebCore/Modules/mediasession/MediaEventTypes.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (185476 => 185477)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-06-11 21:40:22 UTC (rev 185476)
+++ trunk/Source/WebCore/ChangeLog        2015-06-11 21:49:49 UTC (rev 185477)
</span><span class="lines">@@ -1,3 +1,16 @@
</span><ins>+2015-06-11  Matt Rajca  &lt;mrajca@apple.com&gt;
+
+        Media Session: Add plumbing for media control event delivery.
+        https://bugs.webkit.org/show_bug.cgi?id=145859
+
+        Reviewed by Anders Carlsson.
+
+        * Modules/mediasession/MediaEventTypes.h: Added.
+        * WebCore.xcodeproj/project.pbxproj:
+        * page/Page.cpp:
+        (WebCore::Page::handleMediaEvent): Toggle media playback upon receiving the PlayPause event as described in the spec.
+        * page/Page.h:
+
</ins><span class="cx"> 2015-06-11  Jon Lee  &lt;jonlee@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Update media controls JS and CSS to use picture-in-picture
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesmediasessionMediaEventTypesh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/Modules/mediasession/MediaEventTypes.h (0 => 185477)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/mediasession/MediaEventTypes.h                                (rev 0)
+++ trunk/Source/WebCore/Modules/mediasession/MediaEventTypes.h        2015-06-11 21:49:49 UTC (rev 185477)
</span><span class="lines">@@ -0,0 +1,43 @@
</span><ins>+/*
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef MediaEventTypes_h
+#define MediaEventTypes_h
+
+#if ENABLE(MEDIA_SESSION)
+
+namespace WebCore {
+
+enum MediaEventType {
+    PlayPause,
+    TrackNext,
+    TrackPrevious
+};
+
+}
+
+#endif
+
+#endif /* MediaEventTypes_h */
</ins></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (185476 => 185477)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2015-06-11 21:40:22 UTC (rev 185476)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2015-06-11 21:49:49 UTC (rev 185477)
</span><span class="lines">@@ -5702,6 +5702,7 @@
</span><span class="cx">                 C937FE8D1B1F6821008ECC5D /* HTMLMediaElementMediaSession.h in Headers */ = {isa = PBXBuildFile; fileRef = C968B2E61B1E72F700EF1F81 /* HTMLMediaElementMediaSession.h */; };
</span><span class="cx">                 C968B2E81B1E778100EF1F81 /* HTMLMediaElementMediaSession.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C968B2E71B1E778100EF1F81 /* HTMLMediaElementMediaSession.cpp */; };
</span><span class="cx">                 C9DADBCB1B1D3B97001F17D8 /* JSMediaSession.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C9DADBC91B1D3B25001F17D8 /* JSMediaSession.cpp */; };
</span><ins>+                C9F87CFE1B28F40E00979B83 /* MediaEventTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = C9F87CFD1B28E5F600979B83 /* MediaEventTypes.h */; settings = {ATTRIBUTES = (Private, ); }; };
</ins><span class="cx">                 CA3BF67C10D99BAE00E6CE53 /* ScrollAnimator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CA3BF67B10D99BAE00E6CE53 /* ScrollAnimator.cpp */; };
</span><span class="cx">                 CA3BF67E10D99BAE00E6CE53 /* ScrollAnimator.h in Headers */ = {isa = PBXBuildFile; fileRef = CA3BF67D10D99BAE00E6CE53 /* ScrollAnimator.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 CAE9F90F146441F000C245B0 /* CSSAspectRatioValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CAE9F90D146441F000C245B0 /* CSSAspectRatioValue.cpp */; };
</span><span class="lines">@@ -13276,6 +13277,7 @@
</span><span class="cx">                 C968B2E71B1E778100EF1F81 /* HTMLMediaElementMediaSession.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLMediaElementMediaSession.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 C9DADBC91B1D3B25001F17D8 /* JSMediaSession.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSMediaSession.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 C9DADBCA1B1D3B25001F17D8 /* JSMediaSession.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSMediaSession.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                C9F87CFD1B28E5F600979B83 /* MediaEventTypes.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MediaEventTypes.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 CA3BF67B10D99BAE00E6CE53 /* ScrollAnimator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScrollAnimator.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 CA3BF67D10D99BAE00E6CE53 /* ScrollAnimator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScrollAnimator.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 CAE9F90D146441F000C245B0 /* CSSAspectRatioValue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CSSAspectRatioValue.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -14622,6 +14624,7 @@
</span><span class="cx">                                 C968B2E71B1E778100EF1F81 /* HTMLMediaElementMediaSession.cpp */,
</span><span class="cx">                                 C968B2E61B1E72F700EF1F81 /* HTMLMediaElementMediaSession.h */,
</span><span class="cx">                                 C968B2E51B1E704500EF1F81 /* HTMLMediaElementMediaSession.idl */,
</span><ins>+                                C9F87CFD1B28E5F600979B83 /* MediaEventTypes.h */,
</ins><span class="cx">                                 C90843CD1B18E47D00B68564 /* MediaRemoteControls.cpp */,
</span><span class="cx">                                 C90843CE1B18E47D00B68564 /* MediaRemoteControls.h */,
</span><span class="cx">                                 C93458BB1B18D77E0088EE12 /* MediaRemoteControls.idl */,
</span><span class="lines">@@ -25839,6 +25842,7 @@
</span><span class="cx">                                 FD6F252D13F5EF0E0065165F /* MediaElementAudioSourceNode.h in Headers */,
</span><span class="cx">                                 07FE99DD18807A7D00256648 /* MediaElementSession.h in Headers */,
</span><span class="cx">                                 E44613AD0CD6331000FADA75 /* MediaError.h in Headers */,
</span><ins>+                                C9F87CFE1B28F40E00979B83 /* MediaEventTypes.h in Headers */,
</ins><span class="cx">                                 4E1959220A39DABA00220FE5 /* MediaFeatureNames.h in Headers */,
</span><span class="cx">                                 07A6D1EC1491137700051D0C /* MediaFragmentURIParser.h in Headers */,
</span><span class="cx">                                 A8EA800E0A19516E00A8EF5F /* MediaList.h in Headers */,
</span></span></pre></div>
<a id="trunkSourceWebCorepagePagecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/Page.cpp (185476 => 185477)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/Page.cpp        2015-06-11 21:40:22 UTC (rev 185476)
+++ trunk/Source/WebCore/page/Page.cpp        2015-06-11 21:49:49 UTC (rev 185477)
</span><span class="lines">@@ -110,6 +110,10 @@
</span><span class="cx"> #include &quot;MediaPlaybackTarget.h&quot;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+#if ENABLE(MEDIA_SESSION)
+#include &quot;MediaSessionManager.h&quot;
+#endif
+
</ins><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="cx"> static HashSet&lt;Page*&gt;* allPages;
</span><span class="lines">@@ -1227,6 +1231,19 @@
</span><span class="cx">         frame-&gt;document()-&gt;pageMutedStateDidChange();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#if ENABLE(MEDIA_SESSION)
+void Page::handleMediaEvent(MediaEventType eventType)
+{
+    switch (eventType) {
+    case MediaEventType::PlayPause:
+        MediaSessionManager::singleton().togglePlayback();
+        break;
+    default:
+        break;
+    }
+}
+#endif
+
</ins><span class="cx"> #if !ASSERT_DISABLED
</span><span class="cx"> void Page::checkSubframeCountConsistency() const
</span><span class="cx"> {
</span></span></pre></div>
<a id="trunkSourceWebCorepagePageh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/Page.h (185476 => 185477)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/Page.h        2015-06-11 21:40:22 UTC (rev 185476)
+++ trunk/Source/WebCore/page/Page.h        2015-06-11 21:49:49 UTC (rev 185477)
</span><span class="lines">@@ -54,6 +54,10 @@
</span><span class="cx"> #include &lt;wtf/SchedulePair.h&gt;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+#if ENABLE(MEDIA_SESSION)
+#include &quot;MediaEventTypes.h&quot;
+#endif
+
</ins><span class="cx"> namespace JSC {
</span><span class="cx"> class Debugger;
</span><span class="cx"> }
</span><span class="lines">@@ -443,6 +447,10 @@
</span><span class="cx">     bool isMuted() const { return m_muted; }
</span><span class="cx">     WEBCORE_EXPORT void setMuted(bool);
</span><span class="cx"> 
</span><ins>+#if ENABLE(MEDIA_SESSION)
+    WEBCORE_EXPORT void handleMediaEvent(MediaEventType);
+#endif
+
</ins><span class="cx"> #if ENABLE(WIRELESS_PLAYBACK_TARGET)
</span><span class="cx">     void addPlaybackTargetPickerClient(uint64_t);
</span><span class="cx">     void removePlaybackTargetPickerClient(uint64_t);
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (185476 => 185477)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2015-06-11 21:40:22 UTC (rev 185476)
+++ trunk/Source/WebKit2/ChangeLog        2015-06-11 21:49:49 UTC (rev 185477)
</span><span class="lines">@@ -1,3 +1,21 @@
</span><ins>+2015-06-11  Matt Rajca  &lt;mrajca@apple.com&gt;
+
+        Media Session: Add plumbing for media control event delivery.
+        https://bugs.webkit.org/show_bug.cgi?id=145859
+
+        Reviewed by Anders Carlsson.
+
+        * UIProcess/API/C/WKPage.cpp:
+        (WKPageHandleMediaEvent):
+        * UIProcess/API/C/WKPagePrivate.h:
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::handleMediaEvent):
+        * UIProcess/WebPageProxy.h:
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::handleMediaEvent):
+        * WebProcess/WebPage/WebPage.h:
+        * WebProcess/WebPage/WebPage.messages.in:
+
</ins><span class="cx"> 2015-06-11  Myles C. Maxfield  &lt;mmaxfield@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [OS X] Decoding fonts may return nil when using force click
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICWKPagecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp (185476 => 185477)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp        2015-06-11 21:40:22 UTC (rev 185476)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp        2015-06-11 21:49:49 UTC (rev 185477)
</span><span class="lines">@@ -78,6 +78,10 @@
</span><span class="cx"> #include &quot;WebVibrationProxy.h&quot;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+#if ENABLE(MEDIA_SESSION)
+#include &lt;WebCore/MediaEventTypes.h&gt;
+#endif
+
</ins><span class="cx"> using namespace WebCore;
</span><span class="cx"> using namespace WebKit;
</span><span class="cx"> 
</span><span class="lines">@@ -2121,6 +2125,32 @@
</span><span class="cx">     toImpl(page)-&gt;setMuted(muted);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void WKPageHandleMediaEvent(WKPageRef page, WKMediaEventType wkEventType)
+{
+#if ENABLE(MEDIA_SESSION)
+    MediaEventType eventType;
+
+    switch (wkEventType) {
+    case kWKMediaEventTypePlayPause:
+        eventType = MediaEventType::PlayPause;
+        break;
+    case kWKMediaEventTypeTrackNext:
+        eventType = MediaEventType::TrackNext;
+        break;
+    case kWKMediaEventTypeTrackPrevious:
+        eventType = MediaEventType::TrackPrevious;
+        break;
+    default:
+        ASSERT_NOT_REACHED();
+    }
+
+    toImpl(page)-&gt;handleMediaEvent(eventType);
+#else
+    UNUSED_PARAM(page);
+    UNUSED_PARAM(wkEventType);
+#endif
+}
+
</ins><span class="cx"> void WKPagePostMessageToInjectedBundle(WKPageRef pageRef, WKStringRef messageNameRef, WKTypeRef messageBodyRef)
</span><span class="cx"> {
</span><span class="cx">     toImpl(pageRef)-&gt;postMessageToInjectedBundle(toImpl(messageNameRef)-&gt;string(), toImpl(messageBodyRef));
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICWKPagePrivateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/C/WKPagePrivate.h (185476 => 185477)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/C/WKPagePrivate.h        2015-06-11 21:40:22 UTC (rev 185476)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKPagePrivate.h        2015-06-11 21:49:49 UTC (rev 185477)
</span><span class="lines">@@ -111,6 +111,15 @@
</span><span class="cx"> WK_EXPORT bool WKPageIsPlayingAudio(WKPageRef page);
</span><span class="cx"> WK_EXPORT void WKPageSetMuted(WKPageRef page, bool muted);
</span><span class="cx"> 
</span><ins>+enum {
+    kWKMediaEventTypePlayPause,
+    kWKMediaEventTypeTrackNext,
+    kWKMediaEventTypeTrackPrevious
+};
+typedef uint32_t WKMediaEventType;
+
+WK_EXPORT void WKPageHandleMediaEvent(WKPageRef page, WKMediaEventType event);
+
</ins><span class="cx"> WK_EXPORT void WKPageLoadURLWithShouldOpenExternalURLsPolicy(WKPageRef page, WKURLRef url, bool shouldOpenExternalURLs);
</span><span class="cx"> 
</span><span class="cx"> #ifdef __cplusplus
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebPageProxycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (185476 => 185477)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp        2015-06-11 21:40:22 UTC (rev 185476)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp        2015-06-11 21:49:49 UTC (rev 185477)
</span><span class="lines">@@ -3774,6 +3774,16 @@
</span><span class="cx">     m_process-&gt;send(Messages::WebPage::SetMuted(muted), m_pageID);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#if ENABLE(MEDIA_SESSION)
+void WebPageProxy::handleMediaEvent(MediaEventType eventType)
+{
+    if (!isValid())
+        return;
+    
+    m_process-&gt;send(Messages::WebPage::HandleMediaEvent(eventType), m_pageID);
+}
+#endif
+
</ins><span class="cx"> void WebPageProxy::setMayStartMediaWhenInWindow(bool mayStartMedia)
</span><span class="cx"> {
</span><span class="cx">     if (mayStartMedia == m_mayStartMediaWhenInWindow)
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebPageProxyh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (185476 => 185477)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h        2015-06-11 21:40:22 UTC (rev 185476)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h        2015-06-11 21:49:49 UTC (rev 185477)
</span><span class="lines">@@ -922,6 +922,10 @@
</span><span class="cx">     void setMayStartMediaWhenInWindow(bool);
</span><span class="cx">     bool mayStartMediaWhenInWindow() const { return m_mayStartMediaWhenInWindow; }
</span><span class="cx">         
</span><ins>+#if ENABLE(MEDIA_SESSION)
+    void handleMediaEvent(WebCore::MediaEventType);
+#endif
+
</ins><span class="cx">     // WebPopupMenuProxy::Client
</span><span class="cx">     virtual NativeWebMouseEvent* currentlyProcessedMouseDownEvent() override;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageWebPagecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (185476 => 185477)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp        2015-06-11 21:40:22 UTC (rev 185476)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp        2015-06-11 21:49:49 UTC (rev 185477)
</span><span class="lines">@@ -4048,6 +4048,13 @@
</span><span class="cx">     m_page-&gt;setMuted(muted);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#if ENABLE(MEDIA_SESSION)
+void WebPage::handleMediaEvent(uint32_t eventType)
+{
+    m_page-&gt;handleMediaEvent(static_cast&lt;MediaEventType&gt;(eventType));
+}
+#endif
+
</ins><span class="cx"> void WebPage::setMayStartMediaWhenInWindow(bool mayStartMedia)
</span><span class="cx"> {
</span><span class="cx">     if (mayStartMedia == m_mayStartMediaWhenInWindow)
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageWebPageh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h (185476 => 185477)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h        2015-06-11 21:40:22 UTC (rev 185476)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h        2015-06-11 21:49:49 UTC (rev 185477)
</span><span class="lines">@@ -740,6 +740,10 @@
</span><span class="cx">     void setMuted(bool);
</span><span class="cx">     void setMayStartMediaWhenInWindow(bool);
</span><span class="cx"> 
</span><ins>+#if ENABLE(MEDIA_SESSION)
+    void handleMediaEvent(uint32_t /* WebCore::MediaEventType */);
+#endif
+
</ins><span class="cx">     void updateMainFrameScrollOffsetPinning();
</span><span class="cx"> 
</span><span class="cx">     bool mainFrameHasCustomContentProvider() const;
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageWebPagemessagesin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in (185476 => 185477)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in        2015-06-11 21:40:22 UTC (rev 185476)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in        2015-06-11 21:49:49 UTC (rev 185477)
</span><span class="lines">@@ -314,6 +314,10 @@
</span><span class="cx">     SetMuted(bool muted)
</span><span class="cx">     SetMayStartMediaWhenInWindow(bool mayStartMedia)
</span><span class="cx"> 
</span><ins>+#if ENABLE(MEDIA_SESSION)
+    HandleMediaEvent(uint32_t eventType)
+#endif
+
</ins><span class="cx">     // FIXME: This a dummy message, to avoid breaking the build for platforms that don't require
</span><span class="cx">     // any synchronous messages, and should be removed when &lt;rdar://problem/8775115&gt; is fixed.
</span><span class="cx">     Dummy() -&gt; (bool dummyReturn)
</span></span></pre>
</div>
</div>

</body>
</html>