<!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>[197461] 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/197461">197461</a></dd>
<dt>Author</dt> <dd>bdakin@apple.com</dd>
<dt>Date</dt> <dd>2016-03-02 12:59:28 -0800 (Wed, 02 Mar 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Add support for playbackControlsManager
https://bugs.webkit.org/show_bug.cgi?id=154742
-and corresponding-
rdar://problem/23833753

Reviewed by Jer Noble.

Source/WebCore:

Make AVKitSPI.h private so that it can be used from other projects.
* WebCore.xcodeproj/project.pbxproj:

Right now, set up a controls manager for a video when it starts playing. In 
the future, this is something that should be handled by the 
PlatformMediaSessionManager since we only want a controls for the 
currentSession.
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::playInternal):

New function setUpVideoControlsManager.
* page/ChromeClient.h:

Make these CoreMedia functions available on Mac and iOS instead of just iOS.
* platform/cf/CoreMediaSoftLink.cpp:
* platform/cf/CoreMediaSoftLink.h:

This patch fleshes out an implementation for a bunch of these interface 
functions since they need to communicate to the playbackControlsManager. This 
is also where the playbackControlsManager lives.
* platform/mac/WebVideoFullscreenInterfaceMac.h:

Define an interface and implementation for WebPlaybackControlsManager.
* platform/mac/WebVideoFullscreenInterfaceMac.mm:
(-[WebPlaybackControlsManager initWithWebVideoFullscreenInterfaceMac:]):
(-[WebPlaybackControlsManager isSeeking]):
(-[WebPlaybackControlsManager seekToTime:toleranceBefore:toleranceAfter:]):
(-[WebPlaybackControlsManager audioMediaSelectionOptions]):
(-[WebPlaybackControlsManager currentAudioMediaSelectionOption]):
(-[WebPlaybackControlsManager setCurrentAudioMediaSelectionOption:]):
(-[WebPlaybackControlsManager legibleMediaSelectionOptions]):
(-[WebPlaybackControlsManager currentLegibleMediaSelectionOption]):
(-[WebPlaybackControlsManager setCurrentLegibleMediaSelectionOption:]):
(-[WebPlaybackControlsManager cancelThumbnailAndAudioAmplitudeSampleGeneration]):

Relay this information to the playbackControlsManager.
(WebCore::WebVideoFullscreenInterfaceMac::setDuration):
(WebCore::WebVideoFullscreenInterfaceMac::setCurrentTime):
(WebCore::WebVideoFullscreenInterfaceMac::setRate):
(WebCore::WebVideoFullscreenInterfaceMac::setSeekableRanges):
(WebCore::WebVideoFullscreenInterfaceMac::ensureControlsManager):
(WebCore::WebVideoFullscreenInterfaceMac::playBackControlsManager):
(WebCore::WebVideoFullscreenInterfaceMac::setupFullscreen):

New SPI needed.
* platform/spi/cocoa/AVKitSPI.h:
* platform/spi/mac/AVFoundationSPI.h:

Source/WebKit2:

WebVideoFullscreenManagerProxy ensures the model and interface for the 
UIProcess side of the playbackControlsManager. It also caches the 
m_controlsManagerContextId so that it can return the 
controlsManagerInterface.
* UIProcess/Cocoa/WebVideoFullscreenManagerProxy.h:
* UIProcess/Cocoa/WebVideoFullscreenManagerProxy.messages.in:
* UIProcess/Cocoa/WebVideoFullscreenManagerProxy.mm:
(WebKit::WebVideoFullscreenManagerProxy::setUpVideoControlsManagerWithID):
(WebKit::WebVideoFullscreenManagerProxy::controlsManagerInterface):

Pipe isPlayingMediaDidChange() to WebViewImpl, and use that information to 
update WebViewImplAdditions.
* UIProcess/Cocoa/WebViewImpl.h:
* UIProcess/Cocoa/WebViewImpl.mm:
(WebKit::WebViewImpl::isPlayingMediaDidChange):
* UIProcess/PageClient.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::isPlayingMediaDidChange):
(WebKit::WebPageProxy::isPlayingVideoWithAudio):
* UIProcess/WebPageProxy.h:
(WebKit::WebPageProxy::isPlayingAudio):
* UIProcess/mac/PageClientImpl.h:
* UIProcess/mac/PageClientImpl.mm:
(WebKit::PageClientImpl::isPlayingMediaDidChange):

Pipe setUpVideoControlsManager to the WebVideoFullscreenManager.
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::setUpVideoControlsManager):
* WebProcess/WebCoreSupport/WebChromeClient.h:

Ensure the model an interface for the playbackControlsManager on the 
WebProcess side and pass the message to the UIProcess to do the same.
* WebProcess/cocoa/WebVideoFullscreenManager.h:
* WebProcess/cocoa/WebVideoFullscreenManager.mm:
(WebKit::WebVideoFullscreenManager::setUpVideoControlsManager):</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="#trunkSourceWebCorehtmlHTMLMediaElementcpp">trunk/Source/WebCore/html/HTMLMediaElement.cpp</a></li>
<li><a href="#trunkSourceWebCorepageChromeClienth">trunk/Source/WebCore/page/ChromeClient.h</a></li>
<li><a href="#trunkSourceWebCoreplatformcfCoreMediaSoftLinkcpp">trunk/Source/WebCore/platform/cf/CoreMediaSoftLink.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformcfCoreMediaSoftLinkh">trunk/Source/WebCore/platform/cf/CoreMediaSoftLink.h</a></li>
<li><a href="#trunkSourceWebCoreplatformmacWebVideoFullscreenInterfaceMach">trunk/Source/WebCore/platform/mac/WebVideoFullscreenInterfaceMac.h</a></li>
<li><a href="#trunkSourceWebCoreplatformmacWebVideoFullscreenInterfaceMacmm">trunk/Source/WebCore/platform/mac/WebVideoFullscreenInterfaceMac.mm</a></li>
<li><a href="#trunkSourceWebCoreplatformspicocoaAVKitSPIh">trunk/Source/WebCore/platform/spi/cocoa/AVKitSPI.h</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2UIProcessCocoaWebVideoFullscreenManagerProxyh">trunk/Source/WebKit2/UIProcess/Cocoa/WebVideoFullscreenManagerProxy.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessCocoaWebVideoFullscreenManagerProxymessagesin">trunk/Source/WebKit2/UIProcess/Cocoa/WebVideoFullscreenManagerProxy.messages.in</a></li>
<li><a href="#trunkSourceWebKit2UIProcessCocoaWebVideoFullscreenManagerProxymm">trunk/Source/WebKit2/UIProcess/Cocoa/WebVideoFullscreenManagerProxy.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessCocoaWebViewImplh">trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessCocoaWebViewImplmm">trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessPageClienth">trunk/Source/WebKit2/UIProcess/PageClient.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="#trunkSourceWebKit2UIProcessmacPageClientImplh">trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessmacPageClientImplmm">trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.mm</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebCoreSupportWebChromeClientcpp">trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebCoreSupportWebChromeClienth">trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcesscocoaWebVideoFullscreenManagerh">trunk/Source/WebKit2/WebProcess/cocoa/WebVideoFullscreenManager.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcesscocoaWebVideoFullscreenManagermm">trunk/Source/WebKit2/WebProcess/cocoa/WebVideoFullscreenManager.mm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (197460 => 197461)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-03-02 20:49:57 UTC (rev 197460)
+++ trunk/Source/WebCore/ChangeLog        2016-03-02 20:59:28 UTC (rev 197461)
</span><span class="lines">@@ -1,3 +1,60 @@
</span><ins>+2016-03-02  Beth Dakin  &lt;bdakin@apple.com&gt;
+
+        Add support for playbackControlsManager
+        https://bugs.webkit.org/show_bug.cgi?id=154742
+        -and corresponding-
+        rdar://problem/23833753
+
+        Reviewed by Jer Noble.
+
+        Make AVKitSPI.h private so that it can be used from other projects.
+        * WebCore.xcodeproj/project.pbxproj:
+
+        Right now, set up a controls manager for a video when it starts playing. In 
+        the future, this is something that should be handled by the 
+        PlatformMediaSessionManager since we only want a controls for the 
+        currentSession.
+        * html/HTMLMediaElement.cpp:
+        (WebCore::HTMLMediaElement::playInternal):
+
+        New function setUpVideoControlsManager.
+        * page/ChromeClient.h:
+
+        Make these CoreMedia functions available on Mac and iOS instead of just iOS.
+        * platform/cf/CoreMediaSoftLink.cpp:
+        * platform/cf/CoreMediaSoftLink.h:
+
+        This patch fleshes out an implementation for a bunch of these interface 
+        functions since they need to communicate to the playbackControlsManager. This 
+        is also where the playbackControlsManager lives.
+        * platform/mac/WebVideoFullscreenInterfaceMac.h:
+
+        Define an interface and implementation for WebPlaybackControlsManager.
+        * platform/mac/WebVideoFullscreenInterfaceMac.mm:
+        (-[WebPlaybackControlsManager initWithWebVideoFullscreenInterfaceMac:]):
+        (-[WebPlaybackControlsManager isSeeking]):
+        (-[WebPlaybackControlsManager seekToTime:toleranceBefore:toleranceAfter:]):
+        (-[WebPlaybackControlsManager audioMediaSelectionOptions]):
+        (-[WebPlaybackControlsManager currentAudioMediaSelectionOption]):
+        (-[WebPlaybackControlsManager setCurrentAudioMediaSelectionOption:]):
+        (-[WebPlaybackControlsManager legibleMediaSelectionOptions]):
+        (-[WebPlaybackControlsManager currentLegibleMediaSelectionOption]):
+        (-[WebPlaybackControlsManager setCurrentLegibleMediaSelectionOption:]):
+        (-[WebPlaybackControlsManager cancelThumbnailAndAudioAmplitudeSampleGeneration]):
+
+        Relay this information to the playbackControlsManager.
+        (WebCore::WebVideoFullscreenInterfaceMac::setDuration):
+        (WebCore::WebVideoFullscreenInterfaceMac::setCurrentTime):
+        (WebCore::WebVideoFullscreenInterfaceMac::setRate):
+        (WebCore::WebVideoFullscreenInterfaceMac::setSeekableRanges):
+        (WebCore::WebVideoFullscreenInterfaceMac::ensureControlsManager):
+        (WebCore::WebVideoFullscreenInterfaceMac::playBackControlsManager):
+        (WebCore::WebVideoFullscreenInterfaceMac::setupFullscreen):
+
+        New SPI needed.
+        * platform/spi/cocoa/AVKitSPI.h:
+        * platform/spi/mac/AVFoundationSPI.h:
+
</ins><span class="cx"> 2016-03-02  Gavin Barraclough  &lt;barraclough@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Add Page::TimerThrottlingState
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (197460 => 197461)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2016-03-02 20:49:57 UTC (rev 197460)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2016-03-02 20:59:28 UTC (rev 197461)
</span><span class="lines">@@ -329,7 +329,7 @@
</span><span class="cx">                 07EE76EC1BE96DB000F89133 /* MockRealtimeVideoSource.h in Headers */ = {isa = PBXBuildFile; fileRef = 07EE76EA1BE96DB000F89133 /* MockRealtimeVideoSource.h */; };
</span><span class="cx">                 07EE76EF1BEA619800F89133 /* MockRealtimeVideoSourceMac.h in Headers */ = {isa = PBXBuildFile; fileRef = 07EE76ED1BEA619800F89133 /* MockRealtimeVideoSourceMac.h */; };
</span><span class="cx">                 07EE76F01BEA619800F89133 /* MockRealtimeVideoSourceMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 07EE76EE1BEA619800F89133 /* MockRealtimeVideoSourceMac.mm */; };
</span><del>-                07F0B97A1AC5DB3300E535D9 /* AVKitSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 07F0B9791AC5DB3300E535D9 /* AVKitSPI.h */; };
</del><ins>+                07F0B97A1AC5DB3300E535D9 /* AVKitSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 07F0B9791AC5DB3300E535D9 /* AVKitSPI.h */; settings = {ATTRIBUTES = (Private, ); }; };
</ins><span class="cx">                 07F0B97C1AC5DB4600E535D9 /* AVFoundationSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 07F0B97B1AC5DB4600E535D9 /* AVFoundationSPI.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 07F876841AD580F900905849 /* MediaPlaybackTargetContext.h in Headers */ = {isa = PBXBuildFile; fileRef = 07F876831AD4A94500905849 /* MediaPlaybackTargetContext.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 07F944161864D046005D31CB /* PlatformMediaSessionManager.h in Headers */ = {isa = PBXBuildFile; fileRef = CDAE8C081746B95700532D78 /* PlatformMediaSessionManager.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLMediaElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (197460 => 197461)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLMediaElement.cpp        2016-03-02 20:49:57 UTC (rev 197460)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp        2016-03-02 20:59:28 UTC (rev 197461)
</span><span class="lines">@@ -2959,6 +2959,14 @@
</span><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    // FIXME: rdar://problem/23833752 We need to be more strategic about when we set up the video controls manager.
+    // It's really something that should be handled by the PlatformMediaSessionManager since we only want a controls
+    // manager for the currentSession.
+    if (document().page() &amp;&amp; is&lt;HTMLVideoElement&gt;(*this)) {
+        HTMLVideoElement&amp; asVideo = downcast&lt;HTMLVideoElement&gt;(*this);
+        document().page()-&gt;chrome().client().setUpVideoControlsManager(asVideo);
+    }
+
</ins><span class="cx">     // 4.8.10.9. Playing the media resource
</span><span class="cx">     if (!m_player || m_networkState == NETWORK_EMPTY)
</span><span class="cx">         scheduleDelayedAction(LoadMediaResource);
</span></span></pre></div>
<a id="trunkSourceWebCorepageChromeClienth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/ChromeClient.h (197460 => 197461)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/ChromeClient.h        2016-03-02 20:49:57 UTC (rev 197460)
+++ trunk/Source/WebCore/page/ChromeClient.h        2016-03-02 20:59:28 UTC (rev 197461)
</span><span class="lines">@@ -341,6 +341,7 @@
</span><span class="cx">     virtual bool supportsVideoFullscreen(HTMLMediaElementEnums::VideoFullscreenMode) { return false; }
</span><span class="cx"> #if ENABLE(VIDEO)
</span><span class="cx">     virtual void enterVideoFullscreenForVideoElement(HTMLVideoElement&amp;, HTMLMediaElementEnums::VideoFullscreenMode) { }
</span><ins>+    virtual void setUpVideoControlsManager(HTMLVideoElement&amp;) { }
</ins><span class="cx"> #endif
</span><span class="cx">     virtual void exitVideoFullscreenForVideoElement(WebCore::HTMLVideoElement&amp;) { }
</span><span class="cx">     virtual bool requiresFullscreenForVideoPlayback() { return false; } 
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformcfCoreMediaSoftLinkcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/cf/CoreMediaSoftLink.cpp (197460 => 197461)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/cf/CoreMediaSoftLink.cpp        2016-03-02 20:49:57 UTC (rev 197460)
+++ trunk/Source/WebCore/platform/cf/CoreMediaSoftLink.cpp        2016-03-02 20:59:28 UTC (rev 197461)
</span><span class="lines">@@ -45,6 +45,7 @@
</span><span class="cx"> SOFT_LINK_FUNCTION_FOR_SOURCE(WebCore, CoreMedia, CMTimeMake, CMTime, (int64_t value, int32_t timescale), (value, timescale))
</span><span class="cx"> SOFT_LINK_FUNCTION_FOR_SOURCE(WebCore, CoreMedia, CMTimeMakeWithSeconds, CMTime, (Float64 seconds, int32_t preferredTimeScale), (seconds, preferredTimeScale))
</span><span class="cx"> SOFT_LINK_FUNCTION_FOR_SOURCE(WebCore, CoreMedia, CMTimeRangeGetEnd, CMTime, (CMTimeRange range), (range))
</span><ins>+SOFT_LINK_FUNCTION_FOR_SOURCE(WebCore, CoreMedia, CMTimeRangeMake, CMTimeRange, (CMTime start, CMTime duration), (start, duration))
</ins><span class="cx"> 
</span><span class="cx"> SOFT_LINK_CONSTANT_FOR_SOURCE(WebCore, CoreMedia, kCMFormatDescriptionExtension_SampleDescriptionExtensionAtoms, CFStringRef)
</span><span class="cx"> SOFT_LINK_CONSTANT_FOR_SOURCE(WebCore, CoreMedia, kCMTextMarkupAlignmentType_End, CFStringRef)
</span><span class="lines">@@ -113,7 +114,6 @@
</span><span class="cx"> SOFT_LINK_FUNCTION_FOR_SOURCE(WebCore, CoreMedia, CMTimeMaximum, CMTime, (CMTime time1, CMTime time2), (time1, time2))
</span><span class="cx"> SOFT_LINK_FUNCTION_FOR_SOURCE(WebCore, CoreMedia, CMTimeMinimum, CMTime, (CMTime time1, CMTime time2), (time1, time2))
</span><span class="cx"> SOFT_LINK_FUNCTION_FOR_SOURCE(WebCore, CoreMedia, CMTimeRangeContainsTime, Boolean, (CMTimeRange range, CMTime time), (range, time))
</span><del>-SOFT_LINK_FUNCTION_FOR_SOURCE(WebCore, CoreMedia, CMTimeRangeMake, CMTimeRange, (CMTime start, CMTime duration), (start, duration))
</del><span class="cx"> SOFT_LINK_FUNCTION_FOR_SOURCE(WebCore, CoreMedia, CMTimeSubtract, CMTime, (CMTime minuend, CMTime subtrahend), (minuend, subtrahend))
</span><span class="cx"> 
</span><span class="cx"> SOFT_LINK_CONSTANT_FOR_SOURCE(WebCore, CoreMedia, kCMTimeIndefinite, CMTime)
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformcfCoreMediaSoftLinkh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/cf/CoreMediaSoftLink.h (197460 => 197461)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/cf/CoreMediaSoftLink.h        2016-03-02 20:49:57 UTC (rev 197460)
+++ trunk/Source/WebCore/platform/cf/CoreMediaSoftLink.h        2016-03-02 20:59:28 UTC (rev 197461)
</span><span class="lines">@@ -59,6 +59,8 @@
</span><span class="cx"> #define CMTimeMakeWithSeconds softLink_CoreMedia_CMTimeMakeWithSeconds
</span><span class="cx"> SOFT_LINK_FUNCTION_FOR_HEADER(WebCore, CoreMedia, CMTimeRangeGetEnd, CMTime, (CMTimeRange range), (range))
</span><span class="cx"> #define CMTimeRangeGetEnd softLink_CoreMedia_CMTimeRangeGetEnd
</span><ins>+SOFT_LINK_FUNCTION_FOR_HEADER(WebCore, CoreMedia, CMTimeRangeMake, CMTimeRange, (CMTime start, CMTime duration), (start, duration))
+#define CMTimeRangeMake softLink_CoreMedia_CMTimeRangeMake
</ins><span class="cx"> 
</span><span class="cx"> SOFT_LINK_CONSTANT_FOR_HEADER(WebCore, CoreMedia, kCMFormatDescriptionExtension_SampleDescriptionExtensionAtoms, CFStringRef)
</span><span class="cx"> #define kCMFormatDescriptionExtension_SampleDescriptionExtensionAtoms get_CoreMedia_kCMFormatDescriptionExtension_SampleDescriptionExtensionAtoms()
</span><span class="lines">@@ -191,8 +193,6 @@
</span><span class="cx"> #define CMTimeMinimum softLink_CoreMedia_CMTimeMinimum
</span><span class="cx"> SOFT_LINK_FUNCTION_FOR_HEADER(WebCore, CoreMedia, CMTimeRangeContainsTime, Boolean, (CMTimeRange range, CMTime time), (range, time))
</span><span class="cx"> #define CMTimeRangeContainsTime softLink_CoreMedia_CMTimeRangeContainsTime
</span><del>-SOFT_LINK_FUNCTION_FOR_HEADER(WebCore, CoreMedia, CMTimeRangeMake, CMTimeRange, (CMTime start, CMTime duration), (start, duration))
-#define CMTimeRangeMake softLink_CoreMedia_CMTimeRangeMake
</del><span class="cx"> SOFT_LINK_FUNCTION_FOR_HEADER(WebCore, CoreMedia, CMTimeSubtract, CMTime, (CMTime minuend, CMTime subtrahend), (minuend, subtrahend))
</span><span class="cx"> #define CMTimeSubtract softLink_CoreMedia_CMTimeSubtract
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformmacWebVideoFullscreenInterfaceMach"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/mac/WebVideoFullscreenInterfaceMac.h (197460 => 197461)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/mac/WebVideoFullscreenInterfaceMac.h        2016-03-02 20:49:57 UTC (rev 197460)
+++ trunk/Source/WebCore/platform/mac/WebVideoFullscreenInterfaceMac.h        2016-03-02 20:59:28 UTC (rev 197461)
</span><span class="lines">@@ -35,6 +35,7 @@
</span><span class="cx"> #include &lt;wtf/text/WTFString.h&gt;
</span><span class="cx"> 
</span><span class="cx"> OBJC_CLASS NSWindow;
</span><ins>+OBJC_CLASS WebPlaybackControlsManager;
</ins><span class="cx"> 
</span><span class="cx"> #if USE(APPLE_INTERNAL_SDK)
</span><span class="cx"> OBJC_CLASS WebVideoFullscreenInterfaceMacObjC;
</span><span class="lines">@@ -61,12 +62,12 @@
</span><span class="cx">     WEBCORE_EXPORT void setWebVideoFullscreenChangeObserver(WebVideoFullscreenChangeObserver*);
</span><span class="cx"> 
</span><span class="cx">     WEBCORE_EXPORT void resetMediaState() override { }
</span><del>-    WEBCORE_EXPORT void setDuration(double) override { }
-    WEBCORE_EXPORT void setCurrentTime(double /*currentTime*/, double /*anchorTime*/) override { }
</del><ins>+    WEBCORE_EXPORT void setDuration(double) override;
+    WEBCORE_EXPORT void setCurrentTime(double /*currentTime*/, double /*anchorTime*/) override;
</ins><span class="cx">     WEBCORE_EXPORT void setBufferedTime(double) override { }
</span><del>-    WEBCORE_EXPORT void setRate(bool /*isPlaying*/, float /*playbackRate*/) override { }
</del><ins>+    WEBCORE_EXPORT void setRate(bool /*isPlaying*/, float /*playbackRate*/) override;
</ins><span class="cx">     WEBCORE_EXPORT void setVideoDimensions(bool /*hasVideo*/, float /*width*/, float /*height*/) override { }
</span><del>-    WEBCORE_EXPORT void setSeekableRanges(const TimeRanges&amp;) override { }
</del><ins>+    WEBCORE_EXPORT void setSeekableRanges(const TimeRanges&amp;) override;
</ins><span class="cx">     WEBCORE_EXPORT void setCanPlayFastReverse(bool) override { }
</span><span class="cx">     WEBCORE_EXPORT void setAudioMediaSelectionOptions(const Vector&lt;WTF::String&gt;&amp; /*options*/, uint64_t /*selectedIndex*/) override { }
</span><span class="cx">     WEBCORE_EXPORT void setLegibleMediaSelectionOptions(const Vector&lt;WTF::String&gt;&amp; /*options*/, uint64_t /*selectedIndex*/) override { }
</span><span class="lines">@@ -80,6 +81,7 @@
</span><span class="cx">     WEBCORE_EXPORT void invalidate();
</span><span class="cx">     WEBCORE_EXPORT void requestHideAndExitFullscreen() { }
</span><span class="cx">     WEBCORE_EXPORT void preparedToReturnToInline(bool visible, const IntRect&amp; inlineRect, NSWindow *parentWindow);
</span><ins>+    WEBCORE_EXPORT void ensureControlsManager();
</ins><span class="cx"> 
</span><span class="cx">     HTMLMediaElementEnums::VideoFullscreenMode mode() const { return m_mode; }
</span><span class="cx">     bool hasMode(HTMLMediaElementEnums::VideoFullscreenMode mode) const { return m_mode &amp; mode; }
</span><span class="lines">@@ -90,6 +92,8 @@
</span><span class="cx">     WEBCORE_EXPORT bool mayAutomaticallyShowVideoPictureInPicture() const { return false; }
</span><span class="cx">     void applicationDidBecomeActive() { }
</span><span class="cx"> 
</span><ins>+    WEBCORE_EXPORT WebPlaybackControlsManager *playBackControlsManager();
+
</ins><span class="cx"> private:
</span><span class="cx">     WebVideoFullscreenModel* m_videoFullscreenModel { nullptr };
</span><span class="cx">     WebVideoFullscreenChangeObserver* m_fullscreenChangeObserver { nullptr };
</span><span class="lines">@@ -98,6 +102,7 @@
</span><span class="cx"> #if USE(APPLE_INTERNAL_SDK)
</span><span class="cx">     RetainPtr&lt;WebVideoFullscreenInterfaceMacObjC&gt; m_webVideoFullscreenInterfaceObjC;
</span><span class="cx"> #endif
</span><ins>+    RetainPtr&lt;WebPlaybackControlsManager&gt; m_playbackControlsManager;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformmacWebVideoFullscreenInterfaceMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/mac/WebVideoFullscreenInterfaceMac.mm (197460 => 197461)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/mac/WebVideoFullscreenInterfaceMac.mm        2016-03-02 20:49:57 UTC (rev 197460)
+++ trunk/Source/WebCore/platform/mac/WebVideoFullscreenInterfaceMac.mm        2016-03-02 20:59:28 UTC (rev 197461)
</span><span class="lines">@@ -28,14 +28,128 @@
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(MAC) &amp;&amp; ENABLE(VIDEO_PRESENTATION_MODE)
</span><span class="cx"> 
</span><ins>+#import &quot;AVKitSPI.h&quot;
+#import &quot;CoreMediaSoftLink.h&quot;
</ins><span class="cx"> #import &quot;IntRect.h&quot;
</span><ins>+#import &quot;MediaTimeAVFoundation.h&quot;
+#import &quot;TimeRanges.h&quot;
</ins><span class="cx"> #import &quot;WebVideoFullscreenChangeObserver.h&quot;
</span><span class="cx"> #import &quot;WebVideoFullscreenModel.h&quot;
</span><ins>+#import &lt;AVFoundation/AVTime.h&gt;
</ins><span class="cx"> 
</span><ins>+#import &quot;SoftLinking.h&quot;
+
+SOFT_LINK_FRAMEWORK(AVKit)
+SOFT_LINK_CLASS(AVKit, AVValueTiming)
+
</ins><span class="cx"> #if USE(APPLE_INTERNAL_SDK)
</span><span class="cx"> #include &lt;WebKitAdditions/WebVideoFullscreenInterfaceMacAdditions.mm&gt;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+using namespace WebCore;
+
+@interface WebPlaybackControlsManager : NSObject {
+    NSTimeInterval _contentDuration;
+    AVValueTiming *_timing;
+    NSTimeInterval _seekToTime;
+    NSArray *_seekableTimeRanges;
+    BOOL _hasEnabledAudio;
+    BOOL _hasEnabledVideo;
+    float _rate;
+
+@private
+    WebCore::WebVideoFullscreenInterfaceMac* _webVideoFullscreenInterfaceMac;
+}
+
+@property (readwrite) NSTimeInterval contentDuration;
+@property (nonatomic, retain, readwrite) AVValueTiming *timing;
+@property NSTimeInterval seekToTime;
+@property (nonatomic, retain, readwrite) NSArray *seekableTimeRanges;
+@property (readwrite) BOOL hasEnabledAudio;
+@property (readwrite) BOOL hasEnabledVideo;
+
+@property (nonatomic) float rate;
+
+- (instancetype)initWithWebVideoFullscreenInterfaceMac:(WebCore::WebVideoFullscreenInterfaceMac*)webVideoFullscreenInterfaceMac;
+
+@end
+
+#if USE(APPLE_INTERNAL_SDK)
+#import &lt;WebKitAdditions/WebPlaybackControlsControllerAdditions.mm&gt;
+#endif
+
+@implementation WebPlaybackControlsManager
+
+@synthesize contentDuration=_contentDuration;
+@synthesize timing=_timing;
+@synthesize seekToTime=_seekToTime;
+@synthesize seekableTimeRanges=_seekableTimeRanges;
+@synthesize hasEnabledAudio=_hasEnabledAudio;
+@synthesize hasEnabledVideo=_hasEnabledVideo;
+@synthesize rate=_rate;
+
+- (instancetype)initWithWebVideoFullscreenInterfaceMac:(WebCore::WebVideoFullscreenInterfaceMac*)webVideoFullscreenInterfaceMac
+{
+    if (!(self = [super init]))
+        return nil;
+
+    _webVideoFullscreenInterfaceMac = webVideoFullscreenInterfaceMac;
+
+    return self;
+}
+
+- (BOOL)isSeeking
+{
+    return NO;
+}
+
+- (void)seekToTime:(NSTimeInterval)time toleranceBefore:(NSTimeInterval)toleranceBefore toleranceAfter:(NSTimeInterval)toleranceAfter
+{
+    UNUSED_PARAM(toleranceBefore);
+    UNUSED_PARAM(toleranceAfter);
+    _webVideoFullscreenInterfaceMac-&gt;webVideoFullscreenModel()-&gt;seekToTime(time);
+}
+
+- (NSArray *)audioMediaSelectionOptions
+{
+    return @[];
+}
+
+- (AVMediaSelectionOption *)currentAudioMediaSelectionOption
+{
+    return nil;
+}
+
+- (void)setCurrentAudioMediaSelectionOption:(AVMediaSelectionOption *)audioMediaSelectionOption
+{
+    UNUSED_PARAM(audioMediaSelectionOption);
+}
+
+- (NSArray *)legibleMediaSelectionOptions
+{
+    return @[];
+}
+
+- (AVMediaSelectionOption *)currentLegibleMediaSelectionOption
+{
+    return nil;
+}
+
+- (void)setCurrentLegibleMediaSelectionOption:(AVMediaSelectionOption *)legibleMediaSelectionOption
+{
+    UNUSED_PARAM(legibleMediaSelectionOption);
+}
+
+- (void)cancelThumbnailAndAudioAmplitudeSampleGeneration
+{
+}
+
+#if USE(APPLE_INTERNAL_SDK)
+#import &lt;WebKitAdditions/WebPlaybackControlsControllerThumbnailAdditions.mm&gt;
+#endif
+
+@end
+
</ins><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="cx"> WebVideoFullscreenInterfaceMac::~WebVideoFullscreenInterfaceMac()
</span><span class="lines">@@ -74,6 +188,66 @@
</span><span class="cx">         m_videoFullscreenModel-&gt;fullscreenModeChanged(m_mode);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void WebVideoFullscreenInterfaceMac::setDuration(double duration)
+{
+    WebPlaybackControlsManager* controlsManager = playBackControlsManager();
+
+    controlsManager.contentDuration = duration;
+
+    // FIXME: We take this as an indication that playback is ready, but that is not necessarily true.
+    controlsManager.hasEnabledAudio = YES;
+    controlsManager.hasEnabledVideo = YES;
+}
+
+void WebVideoFullscreenInterfaceMac::setCurrentTime(double currentTime, double anchorTime)
+{
+    WebPlaybackControlsManager* controlsManager = playBackControlsManager();
+
+    NSTimeInterval anchorTimeStamp = ![controlsManager rate] ? NAN : anchorTime;
+    AVValueTiming *timing = [getAVValueTimingClass() valueTimingWithAnchorValue:currentTime
+        anchorTimeStamp:anchorTimeStamp rate:0];
+    
+    [controlsManager setTiming:timing];
+}
+
+void WebVideoFullscreenInterfaceMac::setRate(bool isPlaying, float playbackRate)
+{
+    WebPlaybackControlsManager* controlsManager = playBackControlsManager();
+
+    [controlsManager setRate:isPlaying ? playbackRate : 0.];
+}
+
+void WebVideoFullscreenInterfaceMac::setSeekableRanges(const TimeRanges&amp; timeRanges)
+{
+    WebPlaybackControlsManager* controlsManager = playBackControlsManager();
+
+    RetainPtr&lt;NSMutableArray&gt; seekableRanges = adoptNS([[NSMutableArray alloc] init]);
+
+    for (unsigned i = 0; i &lt; timeRanges.length(); i++) {
+        const PlatformTimeRanges&amp; ranges = timeRanges.ranges();
+        CMTimeRange range = CMTimeRangeMake(toCMTime(ranges.start(i)), toCMTime(ranges.end(i)));
+        [seekableRanges addObject:[NSValue valueWithCMTimeRange:range]];
+    }
+    
+    [controlsManager setSeekableTimeRanges:seekableRanges.get()];
+}
+
+void WebVideoFullscreenInterfaceMac::ensureControlsManager()
+{
+    playBackControlsManager();
+}
+
+WebPlaybackControlsManager *WebVideoFullscreenInterfaceMac::playBackControlsManager()
+{
+#if __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 101200
+    if (!m_playbackControlsManager)
+        m_playbackControlsManager = adoptNS([[WebPlaybackControlsManager alloc] initWithWebVideoFullscreenInterfaceMac:this]);
+    return m_playbackControlsManager.get();
+#else
+    return nil;
+#endif
+}
+
</ins><span class="cx"> #if !USE(APPLE_INTERNAL_SDK)
</span><span class="cx"> void WebVideoFullscreenInterfaceMac::setupFullscreen(NSView&amp;, const IntRect&amp;, NSWindow *, HTMLMediaElementEnums::VideoFullscreenMode, bool)
</span><span class="cx"> {
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformspicocoaAVKitSPIh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/spi/cocoa/AVKitSPI.h (197460 => 197461)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/spi/cocoa/AVKitSPI.h        2016-03-02 20:49:57 UTC (rev 197460)
+++ trunk/Source/WebCore/platform/spi/cocoa/AVKitSPI.h        2016-03-02 20:59:28 UTC (rev 197461)
</span><span class="lines">@@ -101,15 +101,6 @@
</span><span class="cx"> @end
</span><span class="cx"> 
</span><span class="cx"> #endif // USE(APPLE_INTERNAL_SDK)
</span><del>-
-@interface AVValueTiming : NSObject &lt;NSCoding, NSCopying, NSMutableCopying&gt;
-@end
-
-@interface AVValueTiming ()
-+ (AVValueTiming *)valueTimingWithAnchorValue:(double)anchorValue anchorTimeStamp:(NSTimeInterval)timeStamp rate:(double)rate;
-@property (NS_NONATOMIC_IOSONLY, readonly) double currentValue;
-@end
-
</del><span class="cx"> #endif // PLATFORM(IOS)
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(WIRELESS_PLAYBACK_TARGET) &amp;&amp; !PLATFORM(IOS)
</span><span class="lines">@@ -144,6 +135,14 @@
</span><span class="cx"> @end
</span><span class="cx"> 
</span><span class="cx"> 
</span><del>-#endif
</del><ins>+#endif // USE(APPLE_INTERNAL_SDK)
</ins><span class="cx"> 
</span><del>-#endif
</del><ins>+#endif // ENABLE(WIRELESS_PLAYBACK_TARGET) &amp;&amp; !PLATFORM(IOS)
+
+@interface AVValueTiming : NSObject &lt;NSCoding, NSCopying, NSMutableCopying&gt; 
+@end
+
+@interface AVValueTiming ()
++ (AVValueTiming *)valueTimingWithAnchorValue:(double)anchorValue anchorTimeStamp:(NSTimeInterval)timeStamp rate:(double)rate;
+@property (NS_NONATOMIC_IOSONLY, readonly) double currentValue;
+@end
</ins></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (197460 => 197461)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2016-03-02 20:49:57 UTC (rev 197460)
+++ trunk/Source/WebKit2/ChangeLog        2016-03-02 20:59:28 UTC (rev 197461)
</span><span class="lines">@@ -1,3 +1,48 @@
</span><ins>+2016-03-02  Beth Dakin  &lt;bdakin@apple.com&gt;
+
+        Add support for playbackControlsManager
+        https://bugs.webkit.org/show_bug.cgi?id=154742
+        -and corresponding-
+        rdar://problem/23833753
+
+        Reviewed by Jer Noble.
+
+        WebVideoFullscreenManagerProxy ensures the model and interface for the 
+        UIProcess side of the playbackControlsManager. It also caches the 
+        m_controlsManagerContextId so that it can return the 
+        controlsManagerInterface.
+        * UIProcess/Cocoa/WebVideoFullscreenManagerProxy.h:
+        * UIProcess/Cocoa/WebVideoFullscreenManagerProxy.messages.in:
+        * UIProcess/Cocoa/WebVideoFullscreenManagerProxy.mm:
+        (WebKit::WebVideoFullscreenManagerProxy::setUpVideoControlsManagerWithID):
+        (WebKit::WebVideoFullscreenManagerProxy::controlsManagerInterface):
+
+        Pipe isPlayingMediaDidChange() to WebViewImpl, and use that information to 
+        update WebViewImplAdditions.
+        * UIProcess/Cocoa/WebViewImpl.h:
+        * UIProcess/Cocoa/WebViewImpl.mm:
+        (WebKit::WebViewImpl::isPlayingMediaDidChange):
+        * UIProcess/PageClient.h:
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::isPlayingMediaDidChange):
+        (WebKit::WebPageProxy::isPlayingVideoWithAudio):
+        * UIProcess/WebPageProxy.h:
+        (WebKit::WebPageProxy::isPlayingAudio):
+        * UIProcess/mac/PageClientImpl.h:
+        * UIProcess/mac/PageClientImpl.mm:
+        (WebKit::PageClientImpl::isPlayingMediaDidChange):
+
+        Pipe setUpVideoControlsManager to the WebVideoFullscreenManager.
+        * WebProcess/WebCoreSupport/WebChromeClient.cpp:
+        (WebKit::WebChromeClient::setUpVideoControlsManager):
+        * WebProcess/WebCoreSupport/WebChromeClient.h:
+
+        Ensure the model an interface for the playbackControlsManager on the 
+        WebProcess side and pass the message to the UIProcess to do the same.
+        * WebProcess/cocoa/WebVideoFullscreenManager.h:
+        * WebProcess/cocoa/WebVideoFullscreenManager.mm:
+        (WebKit::WebVideoFullscreenManager::setUpVideoControlsManager):
+
</ins><span class="cx"> 2016-03-02  Carlos Garcia Campos  &lt;cgarcia@igalia.com&gt;
</span><span class="cx"> 
</span><span class="cx">         REGRESSION(r197409): [GTK] Web process always crashes on WebPage construction after r197409
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessCocoaWebVideoFullscreenManagerProxyh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/Cocoa/WebVideoFullscreenManagerProxy.h (197460 => 197461)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/Cocoa/WebVideoFullscreenManagerProxy.h        2016-03-02 20:49:57 UTC (rev 197460)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/WebVideoFullscreenManagerProxy.h        2016-03-02 20:59:28 UTC (rev 197461)
</span><span class="lines">@@ -119,6 +119,8 @@
</span><span class="cx">     void applicationDidBecomeActive();
</span><span class="cx">     bool isVisible() const;
</span><span class="cx"> 
</span><ins>+    PlatformWebVideoFullscreenInterface&amp; controlsManagerInterface();
+
</ins><span class="cx"> private:
</span><span class="cx">     friend class WebVideoFullscreenModelContext;
</span><span class="cx"> 
</span><span class="lines">@@ -133,6 +135,7 @@
</span><span class="cx"> 
</span><span class="cx">     // Messages from WebVideoFullscreenManager
</span><span class="cx">     void setupFullscreenWithID(uint64_t contextId, uint32_t videoLayerID, const WebCore::IntRect&amp; initialRect, float hostingScaleFactor, WebCore::HTMLMediaElementEnums::VideoFullscreenMode, bool allowsPictureInPicture);
</span><ins>+    void setUpVideoControlsManagerWithID(uint64_t contextId);
</ins><span class="cx">     void resetMediaState(uint64_t contextId);
</span><span class="cx">     void setCurrentTime(uint64_t contextId, double currentTime, double hostTime);
</span><span class="cx">     void setBufferedTime(uint64_t contextId, double bufferedTime);
</span><span class="lines">@@ -175,6 +178,7 @@
</span><span class="cx"> 
</span><span class="cx">     WebPageProxy* m_page;
</span><span class="cx">     HashMap&lt;uint64_t, ModelInterfaceTuple&gt; m_contextMap;
</span><ins>+    uint64_t m_controlsManagerContextId { 0 };
</ins><span class="cx"> 
</span><span class="cx"> };
</span><span class="cx">     
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessCocoaWebVideoFullscreenManagerProxymessagesin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/Cocoa/WebVideoFullscreenManagerProxy.messages.in (197460 => 197461)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/Cocoa/WebVideoFullscreenManagerProxy.messages.in        2016-03-02 20:49:57 UTC (rev 197460)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/WebVideoFullscreenManagerProxy.messages.in        2016-03-02 20:59:28 UTC (rev 197461)
</span><span class="lines">@@ -39,5 +39,6 @@
</span><span class="cx">     ExitFullscreen(uint64_t contextId, WebCore::IntRect finalRect)
</span><span class="cx">     CleanupFullscreen(uint64_t contextId)
</span><span class="cx">     PreparedToReturnToInline(uint64_t contextId, bool visible, WebCore::IntRect inlineRect)
</span><ins>+    SetUpVideoControlsManagerWithID(uint64_t contextId)
</ins><span class="cx"> }
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessCocoaWebVideoFullscreenManagerProxymm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/Cocoa/WebVideoFullscreenManagerProxy.mm (197460 => 197461)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/Cocoa/WebVideoFullscreenManagerProxy.mm        2016-03-02 20:49:57 UTC (rev 197460)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/WebVideoFullscreenManagerProxy.mm        2016-03-02 20:59:28 UTC (rev 197461)
</span><span class="lines">@@ -374,6 +374,24 @@
</span><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void WebVideoFullscreenManagerProxy::setUpVideoControlsManagerWithID(uint64_t contextId)
+{
+#if PLATFORM(MAC)
+    // If there is an existing controls manager, clean it up.
+    if (m_controlsManagerContextId)
+        m_contextMap.remove(m_controlsManagerContextId);
+
+    RefPtr&lt;WebVideoFullscreenModelContext&gt; model;
+    RefPtr&lt;PlatformWebVideoFullscreenInterface&gt; interface;
+
+    std::tie(model, interface) = ensureModelAndInterface(contextId);
+    m_controlsManagerContextId = contextId;
+    interface-&gt;ensureControlsManager();
+#else
+    UNUSED_PARAM(contextId);
+#endif
+}
+
</ins><span class="cx"> void WebVideoFullscreenManagerProxy::resetMediaState(uint64_t contextId)
</span><span class="cx"> {
</span><span class="cx">     ensureInterface(contextId).resetMediaState();
</span><span class="lines">@@ -615,6 +633,11 @@
</span><span class="cx">     return m_page-&gt;isViewVisible() &amp;&amp; m_page-&gt;isInWindow();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+PlatformWebVideoFullscreenInterface&amp; WebVideoFullscreenManagerProxy::controlsManagerInterface()
+{
+    return ensureInterface(m_controlsManagerContextId);
+}
+
</ins><span class="cx"> void WebVideoFullscreenManagerProxy::fullscreenMayReturnToInline(uint64_t contextId)
</span><span class="cx"> {
</span><span class="cx">     bool isViewVisible = m_page-&gt;isViewVisible();
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessCocoaWebViewImplh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.h (197460 => 197461)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.h        2016-03-02 20:49:57 UTC (rev 197460)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.h        2016-03-02 20:59:28 UTC (rev 197461)
</span><span class="lines">@@ -324,6 +324,7 @@
</span><span class="cx">     void completeImmediateActionAnimation();
</span><span class="cx">     void didChangeContentSize(CGSize);
</span><span class="cx">     void didHandleAcceptedCandidate();
</span><ins>+    void isPlayingMediaDidChange();
</ins><span class="cx"> 
</span><span class="cx">     void setIgnoresNonWheelEvents(bool);
</span><span class="cx">     bool ignoresNonWheelEvents() const { return m_ignoresNonWheelEvents; }
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessCocoaWebViewImplmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.mm (197460 => 197461)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.mm        2016-03-02 20:49:57 UTC (rev 197460)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.mm        2016-03-02 20:59:28 UTC (rev 197461)
</span><span class="lines">@@ -2371,6 +2371,13 @@
</span><span class="cx">     m_isHandlingAcceptedCandidate = false;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void WebViewImpl::isPlayingMediaDidChange()
+{
+#if __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 101200
+    updateWebViewImplAdditions();
+#endif
+}
+
</ins><span class="cx"> void WebViewImpl::setIgnoresNonWheelEvents(bool ignoresNonWheelEvents)
</span><span class="cx"> {
</span><span class="cx">     if (m_ignoresNonWheelEvents == ignoresNonWheelEvents)
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessPageClienth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/PageClient.h (197460 => 197461)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/PageClient.h        2016-03-02 20:49:57 UTC (rev 197460)
+++ trunk/Source/WebKit2/UIProcess/PageClient.h        2016-03-02 20:59:28 UTC (rev 197461)
</span><span class="lines">@@ -350,6 +350,8 @@
</span><span class="cx">     virtual void* immediateActionAnimationControllerForHitTestResult(RefPtr&lt;API::HitTestResult&gt;, uint64_t, RefPtr&lt;API::Object&gt;) = 0;
</span><span class="cx"> 
</span><span class="cx">     virtual void didHandleAcceptedCandidate() = 0;
</span><ins>+
+    virtual void isPlayingMediaDidChange() = 0;
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(WIRELESS_PLAYBACK_TARGET) &amp;&amp; !PLATFORM(IOS)
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebPageProxycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (197460 => 197461)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp        2016-03-02 20:49:57 UTC (rev 197460)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp        2016-03-02 20:59:28 UTC (rev 197461)
</span><span class="lines">@@ -5994,9 +5994,17 @@
</span><span class="cx">     if ((oldState &amp; MediaProducer::IsPlayingAudio) == (m_mediaState &amp; MediaProducer::IsPlayingAudio))
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+#if PLATFORM(MAC)
+    m_pageClient.isPlayingMediaDidChange();
+#endif
</ins><span class="cx">     m_uiClient-&gt;isPlayingAudioDidChange(*this);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+bool WebPageProxy::isPlayingVideoWithAudio() const
+{
+    return m_mediaState &amp; MediaProducer::IsPlayingAudio &amp;&amp; m_mediaState &amp; MediaProducer::IsPlayingVideo;
+}
+
</ins><span class="cx"> #if ENABLE(MEDIA_SESSION)
</span><span class="cx"> void WebPageProxy::hasMediaSessionWithActiveMediaElementsDidChange(bool state)
</span><span class="cx"> {
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebPageProxyh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (197460 => 197461)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h        2016-03-02 20:49:57 UTC (rev 197460)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h        2016-03-02 20:59:28 UTC (rev 197461)
</span><span class="lines">@@ -1014,6 +1014,8 @@
</span><span class="cx">     bool isPlayingAudio() const { return !!(m_mediaState &amp; WebCore::MediaProducer::IsPlayingAudio); }
</span><span class="cx">     void isPlayingMediaDidChange(WebCore::MediaProducer::MediaStateFlags, uint64_t);
</span><span class="cx"> 
</span><ins>+    bool isPlayingVideoWithAudio() const;
+
</ins><span class="cx"> #if ENABLE(MEDIA_SESSION)
</span><span class="cx">     void hasMediaSessionWithActiveMediaElementsDidChange(bool);
</span><span class="cx">     void mediaSessionMetadataDidChange(const WebCore::MediaSessionMetadata&amp;);
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessmacPageClientImplh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.h (197460 => 197461)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.h        2016-03-02 20:49:57 UTC (rev 197460)
+++ trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.h        2016-03-02 20:59:28 UTC (rev 197461)
</span><span class="lines">@@ -214,6 +214,8 @@
</span><span class="cx"> 
</span><span class="cx">     virtual void didHandleAcceptedCandidate() override;
</span><span class="cx"> 
</span><ins>+    void isPlayingMediaDidChange() override;
+
</ins><span class="cx">     virtual void showPlatformContextMenu(NSMenu *, WebCore::IntPoint) override;
</span><span class="cx"> 
</span><span class="cx">     virtual void didChangeBackgroundColor() override;
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessmacPageClientImplmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.mm (197460 => 197461)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.mm        2016-03-02 20:49:57 UTC (rev 197460)
+++ trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.mm        2016-03-02 20:59:28 UTC (rev 197461)
</span><span class="lines">@@ -794,6 +794,11 @@
</span><span class="cx">     m_impl-&gt;didHandleAcceptedCandidate();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void PageClientImpl::isPlayingMediaDidChange()
+{
+    m_impl-&gt;isPlayingMediaDidChange();
+}
+
</ins><span class="cx"> void PageClientImpl::showPlatformContextMenu(NSMenu *menu, IntPoint location)
</span><span class="cx"> {
</span><span class="cx">     [menu popUpMenuPositioningItem:nil atLocation:location inView:m_view];
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebCoreSupportWebChromeClientcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp (197460 => 197461)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp        2016-03-02 20:49:57 UTC (rev 197460)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp        2016-03-02 20:59:28 UTC (rev 197461)
</span><span class="lines">@@ -855,6 +855,11 @@
</span><span class="cx">     return m_page-&gt;videoFullscreenManager()-&gt;supportsVideoFullscreen(mode);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void WebChromeClient::setUpVideoControlsManager(WebCore::HTMLVideoElement&amp; videoElement)
+{
+    m_page-&gt;videoFullscreenManager()-&gt;setUpVideoControlsManager(videoElement);
+}
+
</ins><span class="cx"> void WebChromeClient::enterVideoFullscreenForVideoElement(WebCore::HTMLVideoElement&amp; videoElement, WebCore::HTMLMediaElementEnums::VideoFullscreenMode mode)
</span><span class="cx"> {
</span><span class="cx">     ASSERT(mode != HTMLMediaElementEnums::VideoFullscreenModeNone);
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebCoreSupportWebChromeClienth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h (197460 => 197461)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h        2016-03-02 20:49:57 UTC (rev 197460)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h        2016-03-02 20:59:28 UTC (rev 197461)
</span><span class="lines">@@ -244,6 +244,7 @@
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(IOS) || (PLATFORM(MAC) &amp;&amp; ENABLE(VIDEO_PRESENTATION_MODE))
</span><span class="cx">     virtual bool supportsVideoFullscreen(WebCore::HTMLMediaElementEnums::VideoFullscreenMode) override;
</span><ins>+    virtual void setUpVideoControlsManager(WebCore::HTMLVideoElement&amp;) override;
</ins><span class="cx">     virtual void enterVideoFullscreenForVideoElement(WebCore::HTMLVideoElement&amp;, WebCore::HTMLMediaElementEnums::VideoFullscreenMode) override;
</span><span class="cx">     virtual void exitVideoFullscreenForVideoElement(WebCore::HTMLVideoElement&amp;) override;
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcesscocoaWebVideoFullscreenManagerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/cocoa/WebVideoFullscreenManager.h (197460 => 197461)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/cocoa/WebVideoFullscreenManager.h        2016-03-02 20:49:57 UTC (rev 197460)
+++ trunk/Source/WebKit2/WebProcess/cocoa/WebVideoFullscreenManager.h        2016-03-02 20:59:28 UTC (rev 197461)
</span><span class="lines">@@ -116,6 +116,7 @@
</span><span class="cx">     bool supportsVideoFullscreen(WebCore::HTMLMediaElementEnums::VideoFullscreenMode) const;
</span><span class="cx">     void enterVideoFullscreenForVideoElement(WebCore::HTMLVideoElement&amp;, WebCore::HTMLMediaElementEnums::VideoFullscreenMode);
</span><span class="cx">     void exitVideoFullscreenForVideoElement(WebCore::HTMLVideoElement&amp;);
</span><ins>+    void setUpVideoControlsManager(WebCore::HTMLVideoElement&amp;);
</ins><span class="cx">     
</span><span class="cx"> protected:
</span><span class="cx">     friend class WebVideoFullscreenInterfaceContext;
</span><span class="lines">@@ -168,6 +169,7 @@
</span><span class="cx">     WebPage* m_page;
</span><span class="cx">     HashMap&lt;WebCore::HTMLVideoElement*, uint64_t&gt; m_videoElements;
</span><span class="cx">     HashMap&lt;uint64_t, ModelInterfaceTuple&gt; m_contextMap;
</span><ins>+    uint64_t m_controlsManagerContextId { 0 };
</ins><span class="cx"> };
</span><span class="cx">     
</span><span class="cx"> } // namespace WebKit
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcesscocoaWebVideoFullscreenManagermm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/cocoa/WebVideoFullscreenManager.mm (197460 => 197461)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/cocoa/WebVideoFullscreenManager.mm        2016-03-02 20:49:57 UTC (rev 197460)
+++ trunk/Source/WebKit2/WebProcess/cocoa/WebVideoFullscreenManager.mm        2016-03-02 20:59:28 UTC (rev 197461)
</span><span class="lines">@@ -279,6 +279,34 @@
</span><span class="cx">     m_page-&gt;send(Messages::WebVideoFullscreenManagerProxy::ExitFullscreen(contextId, clientRectForElement(&amp;videoElement)), m_page-&gt;pageID());
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void WebVideoFullscreenManager::setUpVideoControlsManager(WebCore::HTMLVideoElement&amp; videoElement)
+{
+    // If there is an existing controls manager, clean it up.
+    if (m_controlsManagerContextId) {
+        RefPtr&lt;WebVideoFullscreenModelVideoElement&gt; model;
+        RefPtr&lt;WebVideoFullscreenInterfaceContext&gt; interface;
+        std::tie(model, interface) = ensureModelAndInterface(m_controlsManagerContextId);
+
+        RefPtr&lt;HTMLVideoElement&gt; videoElement = model-&gt;videoElement();
+        model-&gt;setVideoElement(nullptr);
+        model-&gt;setWebVideoFullscreenInterface(nullptr);
+        interface-&gt;invalidate();
+        m_videoElements.remove(videoElement.get());
+        m_contextMap.remove(m_controlsManagerContextId);
+    }
+
+    auto addResult = m_videoElements.ensure(&amp;videoElement, [&amp;] { return nextContextId(); });
+    auto contextId = addResult.iterator-&gt;value;
+    m_controlsManagerContextId = contextId;
+
+    RefPtr&lt;WebVideoFullscreenModelVideoElement&gt; model;
+    RefPtr&lt;WebVideoFullscreenInterfaceContext&gt; interface;
+    std::tie(model, interface) = ensureModelAndInterface(contextId);
+    model-&gt;setVideoElement(&amp;videoElement);
+    
+    m_page-&gt;send(Messages::WebVideoFullscreenManagerProxy::SetUpVideoControlsManagerWithID(contextId), m_page-&gt;pageID());
+}
+
</ins><span class="cx"> #pragma mark Interface to WebVideoFullscreenInterfaceContext:
</span><span class="cx"> 
</span><span class="cx"> void WebVideoFullscreenManager::resetMediaState(uint64_t contextId)
</span></span></pre>
</div>
</div>

</body>
</html>