<!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>[184966] trunk/Source/WebCore</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/184966">184966</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2015-05-28 16:03:34 -0700 (Thu, 28 May 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>Rename HTMLMediaSession to MediaElementSession to reserve "media session" for the Media Session API.
https://bugs.webkit.org/show_bug.cgi?id=145440
Patch by Matt Rajca <mrajca@apple.com> on 2015-05-28
Reviewed by Eric Carlson.
* CMakeLists.txt:
* WebCore.vcxproj/WebCore.vcxproj:
* WebCore.vcxproj/WebCore.vcxproj.filters:
* WebCore.xcodeproj/project.pbxproj:
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::HTMLMediaElement):
(WebCore::HTMLMediaElement::loadInternal):
(WebCore::HTMLMediaElement::loadResource):
(WebCore::HTMLMediaElement::suspend):
(WebCore::HTMLMediaElement::resume):
(WebCore::HTMLMediaElement::removeBehaviorsRestrictionsAfterFirstUserGesture):
(WebCore::HTMLMediaElement::mediaState):
* html/HTMLMediaElement.h:
(WebCore::HTMLMediaElement::mediaSession):
* html/MediaElementSession.cpp: Renamed from Source/WebCore/html/HTMLMediaSession.cpp.
(WebCore::restrictionName):
(WebCore::MediaElementSession::MediaElementSession):
(WebCore::MediaElementSession::registerWithDocument):
(WebCore::MediaElementSession::unregisterWithDocument):
(WebCore::MediaElementSession::addBehaviorRestriction):
(WebCore::MediaElementSession::removeBehaviorRestriction):
(WebCore::MediaElementSession::playbackPermitted):
(WebCore::MediaElementSession::dataLoadingPermitted):
(WebCore::MediaElementSession::fullscreenPermitted):
(WebCore::MediaElementSession::pageAllowsDataLoading):
(WebCore::MediaElementSession::pageAllowsPlaybackAfterResuming):
(WebCore::MediaElementSession::showPlaybackTargetPicker):
(WebCore::MediaElementSession::hasWirelessPlaybackTargets):
(WebCore::MediaElementSession::wirelessVideoPlaybackDisabled):
(WebCore::MediaElementSession::setWirelessVideoPlaybackDisabled):
(WebCore::MediaElementSession::setHasPlaybackTargetAvailabilityListeners):
(WebCore::MediaElementSession::setPlaybackTarget):
(WebCore::MediaElementSession::targetAvailabilityChangedTimerFired):
(WebCore::MediaElementSession::externalOutputDeviceAvailableDidChange):
(WebCore::MediaElementSession::canPlayToWirelessPlaybackTarget):
(WebCore::MediaElementSession::isPlayingToWirelessPlaybackTarget):
(WebCore::MediaElementSession::setShouldPlayToPlaybackTarget):
(WebCore::MediaElementSession::mediaStateDidChange):
(WebCore::MediaElementSession::effectivePreloadForElement):
(WebCore::MediaElementSession::requiresFullscreenForVideoPlayback):
(WebCore::MediaElementSession::mediaEngineUpdated):
(WebCore::MediaElementSession::allowsAlternateFullscreen):
(WebCore::MediaElementSession::maximumMediaSourceBufferSize):
* html/MediaElementSession.h: Renamed from Source/WebCore/html/HTMLMediaSession.h.
* testing/Internals.cpp:
(WebCore::Internals::setMediaElementRestrictions):
(WebCore::Internals::setAudioContextRestrictions):</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreCMakeListstxt">trunk/Source/WebCore/CMakeLists.txt</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreWebCorevcxprojWebCorevcxproj">trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj</a></li>
<li><a href="#trunkSourceWebCoreWebCorevcxprojWebCorevcxprojfilters">trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters</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="#trunkSourceWebCorehtmlHTMLMediaElementh">trunk/Source/WebCore/html/HTMLMediaElement.h</a></li>
<li><a href="#trunkSourceWebCoretestingInternalscpp">trunk/Source/WebCore/testing/Internals.cpp</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebCorehtmlMediaElementSessioncpp">trunk/Source/WebCore/html/MediaElementSession.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlMediaElementSessionh">trunk/Source/WebCore/html/MediaElementSession.h</a></li>
</ul>
<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkSourceWebCorehtmlHTMLMediaSessioncpp">trunk/Source/WebCore/html/HTMLMediaSession.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLMediaSessionh">trunk/Source/WebCore/html/HTMLMediaSession.h</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreCMakeListstxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/CMakeLists.txt (184965 => 184966)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/CMakeLists.txt        2015-05-28 22:41:19 UTC (rev 184965)
+++ trunk/Source/WebCore/CMakeLists.txt        2015-05-28 23:03:34 UTC (rev 184966)
</span><span class="lines">@@ -1636,7 +1636,6 @@
</span><span class="cx"> html/HTMLMapElement.cpp
</span><span class="cx"> html/HTMLMarqueeElement.cpp
</span><span class="cx"> html/HTMLMediaElement.cpp
</span><del>- html/HTMLMediaSession.cpp
</del><span class="cx"> html/HTMLMenuElement.cpp
</span><span class="cx"> html/HTMLMetaElement.cpp
</span><span class="cx"> html/HTMLMeterElement.cpp
</span><span class="lines">@@ -1688,6 +1687,7 @@
</span><span class="cx"> html/LinkRelAttribute.cpp
</span><span class="cx"> html/MediaController.cpp
</span><span class="cx"> html/MediaDocument.cpp
</span><ins>+ html/MediaElementSession.cpp
</ins><span class="cx"> html/MediaFragmentURIParser.cpp
</span><span class="cx"> html/MonthInputType.cpp
</span><span class="cx"> html/NumberInputType.cpp
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (184965 => 184966)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-05-28 22:41:19 UTC (rev 184965)
+++ trunk/Source/WebCore/ChangeLog        2015-05-28 23:03:34 UTC (rev 184966)
</span><span class="lines">@@ -1,3 +1,58 @@
</span><ins>+2015-05-28 Matt Rajca <mrajca@apple.com>
+
+ Rename HTMLMediaSession to MediaElementSession to reserve "media session" for the Media Session API.
+ https://bugs.webkit.org/show_bug.cgi?id=145440
+
+ Reviewed by Eric Carlson.
+
+ * CMakeLists.txt:
+ * WebCore.vcxproj/WebCore.vcxproj:
+ * WebCore.vcxproj/WebCore.vcxproj.filters:
+ * WebCore.xcodeproj/project.pbxproj:
+ * html/HTMLMediaElement.cpp:
+ (WebCore::HTMLMediaElement::HTMLMediaElement):
+ (WebCore::HTMLMediaElement::loadInternal):
+ (WebCore::HTMLMediaElement::loadResource):
+ (WebCore::HTMLMediaElement::suspend):
+ (WebCore::HTMLMediaElement::resume):
+ (WebCore::HTMLMediaElement::removeBehaviorsRestrictionsAfterFirstUserGesture):
+ (WebCore::HTMLMediaElement::mediaState):
+ * html/HTMLMediaElement.h:
+ (WebCore::HTMLMediaElement::mediaSession):
+ * html/MediaElementSession.cpp: Renamed from Source/WebCore/html/HTMLMediaSession.cpp.
+ (WebCore::restrictionName):
+ (WebCore::MediaElementSession::MediaElementSession):
+ (WebCore::MediaElementSession::registerWithDocument):
+ (WebCore::MediaElementSession::unregisterWithDocument):
+ (WebCore::MediaElementSession::addBehaviorRestriction):
+ (WebCore::MediaElementSession::removeBehaviorRestriction):
+ (WebCore::MediaElementSession::playbackPermitted):
+ (WebCore::MediaElementSession::dataLoadingPermitted):
+ (WebCore::MediaElementSession::fullscreenPermitted):
+ (WebCore::MediaElementSession::pageAllowsDataLoading):
+ (WebCore::MediaElementSession::pageAllowsPlaybackAfterResuming):
+ (WebCore::MediaElementSession::showPlaybackTargetPicker):
+ (WebCore::MediaElementSession::hasWirelessPlaybackTargets):
+ (WebCore::MediaElementSession::wirelessVideoPlaybackDisabled):
+ (WebCore::MediaElementSession::setWirelessVideoPlaybackDisabled):
+ (WebCore::MediaElementSession::setHasPlaybackTargetAvailabilityListeners):
+ (WebCore::MediaElementSession::setPlaybackTarget):
+ (WebCore::MediaElementSession::targetAvailabilityChangedTimerFired):
+ (WebCore::MediaElementSession::externalOutputDeviceAvailableDidChange):
+ (WebCore::MediaElementSession::canPlayToWirelessPlaybackTarget):
+ (WebCore::MediaElementSession::isPlayingToWirelessPlaybackTarget):
+ (WebCore::MediaElementSession::setShouldPlayToPlaybackTarget):
+ (WebCore::MediaElementSession::mediaStateDidChange):
+ (WebCore::MediaElementSession::effectivePreloadForElement):
+ (WebCore::MediaElementSession::requiresFullscreenForVideoPlayback):
+ (WebCore::MediaElementSession::mediaEngineUpdated):
+ (WebCore::MediaElementSession::allowsAlternateFullscreen):
+ (WebCore::MediaElementSession::maximumMediaSourceBufferSize):
+ * html/MediaElementSession.h: Renamed from Source/WebCore/html/HTMLMediaSession.h.
+ * testing/Internals.cpp:
+ (WebCore::Internals::setMediaElementRestrictions):
+ (WebCore::Internals::setAudioContextRestrictions):
+
</ins><span class="cx"> 2015-05-28 Myles C. Maxfield <mmaxfield@apple.com>
</span><span class="cx">
</span><span class="cx"> Crash under ICU with ASAN during editing/selection/move-by-word-visually-crash-test-5.html
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorevcxprojWebCorevcxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj (184965 => 184966)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj        2015-05-28 22:41:19 UTC (rev 184965)
+++ trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj        2015-05-28 23:03:34 UTC (rev 184966)
</span><span class="lines">@@ -15098,7 +15098,7 @@
</span><span class="cx"> <ClCompile Include="..\html\DOMSettableTokenList.cpp" />
</span><span class="cx"> <ClCompile Include="..\html\DOMTokenList.cpp" />
</span><span class="cx"> <ClCompile Include="..\html\DOMURL.cpp" />
</span><del>- <ClCompile Include="..\html\HTMLMediaSession.cpp" />
</del><ins>+ <ClCompile Include="..\html\MediaElementSession.cpp" />
</ins><span class="cx"> <ClCompile Include="..\html\EmailInputType.cpp" />
</span><span class="cx"> <ClCompile Include="..\html\PublicURLManager.cpp" />
</span><span class="cx"> <ClCompile Include="..\fileapi\File.cpp" />
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorevcxprojWebCorevcxprojfilters"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters (184965 => 184966)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters        2015-05-28 22:41:19 UTC (rev 184965)
+++ trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters        2015-05-28 23:03:34 UTC (rev 184966)
</span><span class="lines">@@ -7030,7 +7030,7 @@
</span><span class="cx"> <ClCompile Include="..\Modules\gamepad\GamepadEvent.cpp">
</span><span class="cx"> <Filter>Modules\gamepad</Filter>
</span><span class="cx"> </ClCompile>
</span><del>- <ClCompile Include="..\html\HTMLMediaSession.cpp">
</del><ins>+ <ClCompile Include="..\html\MediaElementSession.cpp">
</ins><span class="cx"> <Filter>html</Filter>
</span><span class="cx"> </ClCompile>
</span><span class="cx"> <ClCompile Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\HTTPHeaderNames.cpp">
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (184965 => 184966)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2015-05-28 22:41:19 UTC (rev 184965)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2015-05-28 23:03:34 UTC (rev 184966)
</span><span class="lines">@@ -351,8 +351,8 @@
</span><span class="cx">                 07F876841AD580F900905849 /* MediaPlaybackTargetContext.h in Headers */ = {isa = PBXBuildFile; fileRef = 07F876831AD4A94500905849 /* MediaPlaybackTargetContext.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 07F944161864D046005D31CB /* MediaSessionManager.h in Headers */ = {isa = PBXBuildFile; fileRef = CDAE8C081746B95700532D78 /* MediaSessionManager.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 07FBDE2C18FED178001A7CFF /* JSDataCueCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 07FBDE2B18FED178001A7CFF /* JSDataCueCustom.cpp */; };
</span><del>-                07FE99DC18807A7D00256648 /* HTMLMediaSession.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 07FE99DA18807A7D00256648 /* HTMLMediaSession.cpp */; };
-                07FE99DD18807A7D00256648 /* HTMLMediaSession.h in Headers */ = {isa = PBXBuildFile; fileRef = 07FE99DB18807A7D00256648 /* HTMLMediaSession.h */; settings = {ATTRIBUTES = (Private, ); }; };
</del><ins>+                07FE99DC18807A7D00256648 /* MediaElementSession.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 07FE99DA18807A7D00256648 /* MediaElementSession.cpp */; };
+                07FE99DD18807A7D00256648 /* MediaElementSession.h in Headers */ = {isa = PBXBuildFile; fileRef = 07FE99DB18807A7D00256648 /* MediaElementSession.h */; settings = {ATTRIBUTES = (Private, ); }; };
</ins><span class="cx">                 07FFDE68181AED420072D409 /* MediaStreamTrackPrivate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 07FFDE66181AED420072D409 /* MediaStreamTrackPrivate.cpp */; };
</span><span class="cx">                 07FFDE69181AED420072D409 /* MediaStreamTrackPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 07FFDE67181AED420072D409 /* MediaStreamTrackPrivate.h */; };
</span><span class="cx">                 0806E57A12893045007CED32 /* SVGMatrix.h in Headers */ = {isa = PBXBuildFile; fileRef = 0806E57912893045007CED32 /* SVGMatrix.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="lines">@@ -7403,8 +7403,8 @@
</span><span class="cx">                 07F0B97B1AC5DB4600E535D9 /* AVFoundationSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AVFoundationSPI.h; sourceTree = "<group>"; };
</span><span class="cx">                 07F876831AD4A94500905849 /* MediaPlaybackTargetContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaPlaybackTargetContext.h; sourceTree = "<group>"; };
</span><span class="cx">                 07FBDE2B18FED178001A7CFF /* JSDataCueCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDataCueCustom.cpp; sourceTree = "<group>"; };
</span><del>-                07FE99DA18807A7D00256648 /* HTMLMediaSession.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLMediaSession.cpp; sourceTree = "<group>"; };
-                07FE99DB18807A7D00256648 /* HTMLMediaSession.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTMLMediaSession.h; sourceTree = "<group>"; };
</del><ins>+                07FE99DA18807A7D00256648 /* MediaElementSession.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MediaElementSession.cpp; sourceTree = "<group>"; };
+                07FE99DB18807A7D00256648 /* MediaElementSession.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaElementSession.h; sourceTree = "<group>"; };
</ins><span class="cx">                 07FFDE66181AED420072D409 /* MediaStreamTrackPrivate.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MediaStreamTrackPrivate.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 07FFDE67181AED420072D409 /* MediaStreamTrackPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaStreamTrackPrivate.h; sourceTree = "<group>"; };
</span><span class="cx">                 0806E57912893045007CED32 /* SVGMatrix.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGMatrix.h; sourceTree = "<group>"; };
</span><span class="lines">@@ -18156,8 +18156,6 @@
</span><span class="cx">                                 E44613930CD6331000FADA75 /* HTMLMediaElement.h */,
</span><span class="cx">                                 E44613940CD6331000FADA75 /* HTMLMediaElement.idl */,
</span><span class="cx">                                 CD5209E51B0BD9E10077184E /* HTMLMediaElementEnums.h */,
</span><del>-                                07FE99DA18807A7D00256648 /* HTMLMediaSession.cpp */,
-                                07FE99DB18807A7D00256648 /* HTMLMediaSession.h */,
</del><span class="cx">                                 A8EA79EC0A1916DF00A8EF5F /* HTMLMenuElement.cpp */,
</span><span class="cx">                                 A8EA79E80A1916DF00A8EF5F /* HTMLMenuElement.h */,
</span><span class="cx">                                 1AE2AE430A1D269E00B42B25 /* HTMLMenuElement.idl */,
</span><span class="lines">@@ -18296,6 +18294,8 @@
</span><span class="cx">                                 CDF65CC9145B43A700C4C7AA /* MediaControllerInterface.h */,
</span><span class="cx">                                 97205AB31239291000B17380 /* MediaDocument.cpp */,
</span><span class="cx">                                 97205AB41239291000B17380 /* MediaDocument.h */,
</span><ins>+                                07FE99DA18807A7D00256648 /* MediaElementSession.cpp */,
+                                07FE99DB18807A7D00256648 /* MediaElementSession.h */,
</ins><span class="cx">                                 E446139B0CD6331000FADA75 /* MediaError.h */,
</span><span class="cx">                                 E446139C0CD6331000FADA75 /* MediaError.idl */,
</span><span class="cx">                                 07A6D1E91491137700051D0C /* MediaFragmentURIParser.cpp */,
</span><span class="lines">@@ -24895,7 +24895,6 @@
</span><span class="cx">                                 A8EA7CAB0A192B9C00A8EF5F /* HTMLMarqueeElement.h in Headers */,
</span><span class="cx">                                 E44613A50CD6331000FADA75 /* HTMLMediaElement.h in Headers */,
</span><span class="cx">                                 0779BF0E18453168000B6AE7 /* HTMLMediaElementMediaStream.h in Headers */,
</span><del>-                                07FE99DD18807A7D00256648 /* HTMLMediaSession.h in Headers */,
</del><span class="cx">                                 A8EA79F40A1916DF00A8EF5F /* HTMLMenuElement.h in Headers */,
</span><span class="cx">                                 2BE8E2C712A589EC00FAD550 /* HTMLMetaCharsetParser.h in Headers */,
</span><span class="cx">                                 A871DC240A15205700B12A68 /* HTMLMetaElement.h in Headers */,
</span><span class="lines">@@ -25774,6 +25773,7 @@
</span><span class="cx">                                 5EA725D31ACABD4700EAD17B /* MediaDevices.h in Headers */,
</span><span class="cx">                                 97205AB81239291000B17380 /* MediaDocument.h in Headers */,
</span><span class="cx">                                 FD6F252D13F5EF0E0065165F /* MediaElementAudioSourceNode.h in Headers */,
</span><ins>+                                07FE99DD18807A7D00256648 /* MediaElementSession.h in Headers */,
</ins><span class="cx">                                 E44613AD0CD6331000FADA75 /* MediaError.h in Headers */,
</span><span class="cx">                                 4E1959220A39DABA00220FE5 /* MediaFeatureNames.h in Headers */,
</span><span class="cx">                                 07A6D1EC1491137700051D0C /* MediaFragmentURIParser.h in Headers */,
</span><span class="lines">@@ -28402,7 +28402,6 @@
</span><span class="cx">                                 A8EA7CAC0A192B9C00A8EF5F /* HTMLMarqueeElement.cpp in Sources */,
</span><span class="cx">                                 E44613A40CD6331000FADA75 /* HTMLMediaElement.cpp in Sources */,
</span><span class="cx">                                 0779BF0D18453168000B6AE7 /* HTMLMediaElementMediaStream.cpp in Sources */,
</span><del>-                                07FE99DC18807A7D00256648 /* HTMLMediaSession.cpp in Sources */,
</del><span class="cx">                                 A8EA79F80A1916DF00A8EF5F /* HTMLMenuElement.cpp in Sources */,
</span><span class="cx">                                 2BE8E2C912A58A0100FAD550 /* HTMLMetaCharsetParser.cpp in Sources */,
</span><span class="cx">                                 A871DC270A15205700B12A68 /* HTMLMetaElement.cpp in Sources */,
</span><span class="lines">@@ -29355,6 +29354,7 @@
</span><span class="cx">                                 5EA725D21ACABD4700EAD17B /* MediaDevices.cpp in Sources */,
</span><span class="cx">                                 97205AB71239291000B17380 /* MediaDocument.cpp in Sources */,
</span><span class="cx">                                 FD6F252C13F5EF0E0065165F /* MediaElementAudioSourceNode.cpp in Sources */,
</span><ins>+                                07FE99DC18807A7D00256648 /* MediaElementSession.cpp in Sources */,
</ins><span class="cx">                                 4E1959210A39DABA00220FE5 /* MediaFeatureNames.cpp in Sources */,
</span><span class="cx">                                 07A6D1EB1491137700051D0C /* MediaFragmentURIParser.cpp in Sources */,
</span><span class="cx">                                 CDB859F7160D48A400E5B07F /* MediaKeyEvent.cpp in Sources */,
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLMediaElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (184965 => 184966)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLMediaElement.cpp        2015-05-28 22:41:19 UTC (rev 184965)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp        2015-05-28 23:03:34 UTC (rev 184966)
</span><span class="lines">@@ -351,7 +351,7 @@
</span><span class="cx"> #if ENABLE(WEB_AUDIO)
</span><span class="cx"> , m_audioSourceNode(0)
</span><span class="cx"> #endif
</span><del>- , m_mediaSession(std::make_unique<HTMLMediaSession>(*this))
</del><ins>+ , m_mediaSession(std::make_unique<MediaElementSession>(*this))
</ins><span class="cx"> , m_reportedExtraMemoryCost(0)
</span><span class="cx"> #if ENABLE(MEDIA_STREAM)
</span><span class="cx"> , m_mediaStreamSrcObject(nullptr)
</span><span class="lines">@@ -360,36 +360,36 @@
</span><span class="cx"> LOG(Media, "HTMLMediaElement::HTMLMediaElement(%p)", this);
</span><span class="cx"> setHasCustomStyleResolveCallbacks();
</span><span class="cx">
</span><del>- m_mediaSession->addBehaviorRestriction(HTMLMediaSession::RequireUserGestureForFullscreen);
- m_mediaSession->addBehaviorRestriction(HTMLMediaSession::RequirePageConsentToLoadMedia);
</del><ins>+ m_mediaSession->addBehaviorRestriction(MediaElementSession::RequireUserGestureForFullscreen);
+ m_mediaSession->addBehaviorRestriction(MediaElementSession::RequirePageConsentToLoadMedia);
</ins><span class="cx"> #if ENABLE(WIRELESS_PLAYBACK_TARGET)
</span><del>- m_mediaSession->addBehaviorRestriction(HTMLMediaSession::RequireUserGestureToAutoplayToExternalDevice);
</del><ins>+ m_mediaSession->addBehaviorRestriction(MediaElementSession::RequireUserGestureToAutoplayToExternalDevice);
</ins><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> // FIXME: We should clean up and look to better merge the iOS and non-iOS code below.
</span><span class="cx"> Settings* settings = document.settings();
</span><span class="cx"> #if !PLATFORM(IOS)
</span><span class="cx"> if (settings && settings->requiresUserGestureForMediaPlayback()) {
</span><del>- m_mediaSession->addBehaviorRestriction(HTMLMediaSession::RequireUserGestureForRateChange);
- m_mediaSession->addBehaviorRestriction(HTMLMediaSession::RequireUserGestureForLoad);
</del><ins>+ m_mediaSession->addBehaviorRestriction(MediaElementSession::RequireUserGestureForRateChange);
+ m_mediaSession->addBehaviorRestriction(MediaElementSession::RequireUserGestureForLoad);
</ins><span class="cx"> }
</span><span class="cx"> #else
</span><span class="cx"> m_sendProgressEvents = false;
</span><span class="cx"> if (!settings || settings->requiresUserGestureForMediaPlayback()) {
</span><span class="cx"> // Allow autoplay in a MediaDocument that is not in an iframe.
</span><span class="cx"> if (document.ownerElement() || !document.isMediaDocument())
</span><del>- m_mediaSession->addBehaviorRestriction(HTMLMediaSession::RequireUserGestureForRateChange);
</del><ins>+ m_mediaSession->addBehaviorRestriction(MediaElementSession::RequireUserGestureForRateChange);
</ins><span class="cx"> #if ENABLE(WIRELESS_PLAYBACK_TARGET)
</span><del>- m_mediaSession->addBehaviorRestriction(HTMLMediaSession::RequireUserGestureToShowPlaybackTargetPicker);
</del><ins>+ m_mediaSession->addBehaviorRestriction(MediaElementSession::RequireUserGestureToShowPlaybackTargetPicker);
</ins><span class="cx"> #endif
</span><span class="cx"> } else {
</span><span class="cx"> // Relax RequireUserGestureForFullscreen when requiresUserGestureForMediaPlayback is not set:
</span><del>- m_mediaSession->removeBehaviorRestriction(HTMLMediaSession::RequireUserGestureForFullscreen);
</del><ins>+ m_mediaSession->removeBehaviorRestriction(MediaElementSession::RequireUserGestureForFullscreen);
</ins><span class="cx"> }
</span><span class="cx"> #endif // !PLATFORM(IOS)
</span><span class="cx">
</span><span class="cx"> if (settings && settings->audioPlaybackRequiresUserGesture())
</span><del>- m_mediaSession->addBehaviorRestriction(HTMLMediaSession::RequireUserGestureForAudioRateChange);
</del><ins>+ m_mediaSession->addBehaviorRestriction(MediaElementSession::RequireUserGestureForAudioRateChange);
</ins><span class="cx">
</span><span class="cx"> #if ENABLE(VIDEO_TRACK)
</span><span class="cx"> if (document.page())
</span><span class="lines">@@ -1021,7 +1021,7 @@
</span><span class="cx"> // Once the page has allowed an element to load media, it is free to load at will. This allows a
</span><span class="cx"> // playlist that starts in a foreground tab to continue automatically if the tab is subsequently
</span><span class="cx"> // put into the background.
</span><del>- m_mediaSession->removeBehaviorRestriction(HTMLMediaSession::RequirePageConsentToLoadMedia);
</del><ins>+ m_mediaSession->removeBehaviorRestriction(MediaElementSession::RequirePageConsentToLoadMedia);
</ins><span class="cx">
</span><span class="cx"> #if ENABLE(VIDEO_TRACK)
</span><span class="cx"> if (hasMediaControls())
</span><span class="lines">@@ -1200,7 +1200,7 @@
</span><span class="cx">
</span><span class="cx"> #if ENABLE(MEDIA_STREAM)
</span><span class="cx"> if (MediaStreamRegistry::registry().lookup(url.string()))
</span><del>- m_mediaSession->removeBehaviorRestriction(HTMLMediaSession::RequireUserGestureForRateChange);
</del><ins>+ m_mediaSession->removeBehaviorRestriction(MediaElementSession::RequireUserGestureForRateChange);
</ins><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> if (m_sendProgressEvents)
</span><span class="lines">@@ -4835,7 +4835,7 @@
</span><span class="cx"> {
</span><span class="cx"> case PageCache:
</span><span class="cx"> stop();
</span><del>- m_mediaSession->addBehaviorRestriction(HTMLMediaSession::RequirePageConsentToResumeMedia);
</del><ins>+ m_mediaSession->addBehaviorRestriction(MediaElementSession::RequirePageConsentToResumeMedia);
</ins><span class="cx"> break;
</span><span class="cx"> case DocumentWillBePaused:
</span><span class="cx"> case JavaScriptDebuggerPaused:
</span><span class="lines">@@ -4857,7 +4857,7 @@
</span><span class="cx"> else
</span><span class="cx"> setPausedInternal(false);
</span><span class="cx">
</span><del>- m_mediaSession->removeBehaviorRestriction(HTMLMediaSession::RequirePageConsentToResumeMedia);
</del><ins>+ m_mediaSession->removeBehaviorRestriction(MediaElementSession::RequirePageConsentToResumeMedia);
</ins><span class="cx">
</span><span class="cx"> if (m_error && m_error->code() == MediaError::MEDIA_ERR_ABORTED) {
</span><span class="cx"> // Restart the load if it was aborted in the middle by moving the document to the page cache.
</span><span class="lines">@@ -5962,15 +5962,15 @@
</span><span class="cx">
</span><span class="cx"> void HTMLMediaElement::removeBehaviorsRestrictionsAfterFirstUserGesture()
</span><span class="cx"> {
</span><del>- HTMLMediaSession::BehaviorRestrictions restrictionsToRemove = HTMLMediaSession::RequireUserGestureForLoad
</del><ins>+ MediaElementSession::BehaviorRestrictions restrictionsToRemove = MediaElementSession::RequireUserGestureForLoad
</ins><span class="cx"> #if ENABLE(WIRELESS_PLAYBACK_TARGET)
</span><del>- | HTMLMediaSession::RequireUserGestureToShowPlaybackTargetPicker
- | HTMLMediaSession::RequireUserGestureToAutoplayToExternalDevice
</del><ins>+ | MediaElementSession::RequireUserGestureToShowPlaybackTargetPicker
+ | MediaElementSession::RequireUserGestureToAutoplayToExternalDevice
</ins><span class="cx"> #endif
</span><del>- | HTMLMediaSession::RequireUserGestureForLoad
- | HTMLMediaSession::RequireUserGestureForRateChange
- | HTMLMediaSession::RequireUserGestureForAudioRateChange
- | HTMLMediaSession::RequireUserGestureForFullscreen;
</del><ins>+ | MediaElementSession::RequireUserGestureForLoad
+ | MediaElementSession::RequireUserGestureForRateChange
+ | MediaElementSession::RequireUserGestureForAudioRateChange
+ | MediaElementSession::RequireUserGestureForFullscreen;
</ins><span class="cx"> m_mediaSession->removeBehaviorRestriction(restrictionsToRemove);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -6295,7 +6295,7 @@
</span><span class="cx"> if (!m_mediaSession->wirelessVideoPlaybackDisabled(*this) && m_hasPlaybackTargetAvailabilityListeners && m_player->canPlayToWirelessPlaybackTarget())
</span><span class="cx"> state |= RequiresPlaybackTargetMonitoring;
</span><span class="cx">
</span><del>- bool requireUserGesture = m_mediaSession->hasBehaviorRestriction(HTMLMediaSession::RequireUserGestureToAutoplayToExternalDevice);
</del><ins>+ bool requireUserGesture = m_mediaSession->hasBehaviorRestriction(MediaElementSession::RequireUserGestureToAutoplayToExternalDevice);
</ins><span class="cx"> if (hasActiveVideo && (!requireUserGesture || (hasAudio && !loop())))
</span><span class="cx"> state |= ExternalDeviceAutoPlayCandidate;
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLMediaElementh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLMediaElement.h (184965 => 184966)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLMediaElement.h        2015-05-28 22:41:19 UTC (rev 184965)
+++ trunk/Source/WebCore/html/HTMLMediaElement.h        2015-05-28 23:03:34 UTC (rev 184966)
</span><span class="lines">@@ -32,9 +32,9 @@
</span><span class="cx"> #include "GenericEventQueue.h"
</span><span class="cx"> #include "GenericTaskQueue.h"
</span><span class="cx"> #include "HTMLMediaElementEnums.h"
</span><del>-#include "HTMLMediaSession.h"
</del><span class="cx"> #include "MediaCanStartListener.h"
</span><span class="cx"> #include "MediaControllerInterface.h"
</span><ins>+#include "MediaElementSession.h"
</ins><span class="cx"> #include "MediaProducer.h"
</span><span class="cx"> #include "PageThrottler.h"
</span><span class="cx">
</span><span class="lines">@@ -416,7 +416,7 @@
</span><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> MediaPlayerEnums::Preload preloadValue() const { return m_preload; }
</span><del>- HTMLMediaSession& mediaSession() const { return *m_mediaSession; }
</del><ins>+ MediaElementSession& mediaSession() const { return *m_mediaSession; }
</ins><span class="cx">
</span><span class="cx"> #if ENABLE(MEDIA_CONTROLS_SCRIPT)
</span><span class="cx"> void pageScaleFactorChanged();
</span><span class="lines">@@ -894,7 +894,7 @@
</span><span class="cx"> RefPtr<PlatformTextTrackMenuInterface> m_platformMenu;
</span><span class="cx"> #endif
</span><span class="cx">
</span><del>- std::unique_ptr<HTMLMediaSession> m_mediaSession;
</del><ins>+ std::unique_ptr<MediaElementSession> m_mediaSession;
</ins><span class="cx"> PageActivityAssertionToken m_activityToken;
</span><span class="cx"> size_t m_reportedExtraMemoryCost;
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLMediaSessioncpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/html/HTMLMediaSession.cpp (184965 => 184966)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLMediaSession.cpp        2015-05-28 22:41:19 UTC (rev 184965)
+++ trunk/Source/WebCore/html/HTMLMediaSession.cpp        2015-05-28 23:03:34 UTC (rev 184966)
</span><span class="lines">@@ -1,422 +0,0 @@
</span><del>-/*
- * Copyright (C) 2014 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. AND ITS CONTRIBUTORS ``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 ITS 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.
- */
-
-#include "config.h"
-
-#if ENABLE(VIDEO)
-
-#include "HTMLMediaSession.h"
-
-#include "Chrome.h"
-#include "ChromeClient.h"
-#include "Document.h"
-#include "Frame.h"
-#include "FrameView.h"
-#include "HTMLMediaElement.h"
-#include "HTMLNames.h"
-#include "HTMLVideoElement.h"
-#include "Logging.h"
-#include "MediaSessionManager.h"
-#include "Page.h"
-#include "ScriptController.h"
-#include "SourceBuffer.h"
-
-#if PLATFORM(IOS)
-#include "AudioSession.h"
-#include "RuntimeApplicationChecksIOS.h"
-#endif
-
-namespace WebCore {
-
-#if !LOG_DISABLED
-static String restrictionName(HTMLMediaSession::BehaviorRestrictions restriction)
-{
- StringBuilder restrictionBuilder;
-#define CASE(restrictionType) \
- if (restriction & HTMLMediaSession::restrictionType) { \
- if (!restrictionBuilder.isEmpty()) \
- restrictionBuilder.append(", "); \
- restrictionBuilder.append(#restrictionType); \
- } \
-
- CASE(NoRestrictions);
- CASE(RequireUserGestureForLoad);
- CASE(RequireUserGestureForRateChange);
- CASE(RequireUserGestureForAudioRateChange);
- CASE(RequireUserGestureForFullscreen);
- CASE(RequirePageConsentToLoadMedia);
- CASE(RequirePageConsentToResumeMedia);
-#if ENABLE(WIRELESS_PLAYBACK_TARGET)
- CASE(RequireUserGestureToShowPlaybackTargetPicker);
- CASE(WirelessVideoPlaybackDisabled);
-#endif
- CASE(RequireUserGestureForAudioRateChange);
-
- return restrictionBuilder.toString();
-}
-#endif
-
-HTMLMediaSession::HTMLMediaSession(MediaSessionClient& client)
- : MediaSession(client)
- , m_restrictions(NoRestrictions)
-#if ENABLE(WIRELESS_PLAYBACK_TARGET)
- , m_targetAvailabilityChangedTimer(*this, &HTMLMediaSession::targetAvailabilityChangedTimerFired)
-#endif
-{
-}
-
-void HTMLMediaSession::registerWithDocument(const HTMLMediaElement& element)
-{
-#if ENABLE(WIRELESS_PLAYBACK_TARGET)
- element.document().addPlaybackTargetPickerClient(*this);
-#else
- UNUSED_PARAM(element);
-#endif
-}
-
-void HTMLMediaSession::unregisterWithDocument(const HTMLMediaElement& element)
-{
-#if ENABLE(WIRELESS_PLAYBACK_TARGET)
- element.document().removePlaybackTargetPickerClient(*this);
-#else
- UNUSED_PARAM(element);
-#endif
-}
-
-void HTMLMediaSession::addBehaviorRestriction(BehaviorRestrictions restriction)
-{
- LOG(Media, "HTMLMediaSession::addBehaviorRestriction - adding %s", restrictionName(restriction).utf8().data());
- m_restrictions |= restriction;
-}
-
-void HTMLMediaSession::removeBehaviorRestriction(BehaviorRestrictions restriction)
-{
- LOG(Media, "HTMLMediaSession::removeBehaviorRestriction - removing %s", restrictionName(restriction).utf8().data());
- m_restrictions &= ~restriction;
-}
-
-bool HTMLMediaSession::playbackPermitted(const HTMLMediaElement& element) const
-{
- if (m_restrictions & RequireUserGestureForRateChange && !ScriptController::processingUserGesture()) {
- LOG(Media, "HTMLMediaSession::playbackPermitted - returning FALSE");
- return false;
- }
-
- if (m_restrictions & RequireUserGestureForAudioRateChange && element.hasAudio() && !ScriptController::processingUserGesture()) {
- LOG(Media, "HTMLMediaSession::playbackPermitted - returning FALSE");
- return false;
- }
-
- return true;
-}
-
-bool HTMLMediaSession::dataLoadingPermitted(const HTMLMediaElement&) const
-{
- if (m_restrictions & RequireUserGestureForLoad && !ScriptController::processingUserGesture()) {
- LOG(Media, "HTMLMediaSession::dataLoadingPermitted - returning FALSE");
- return false;
- }
-
- return true;
-}
-
-bool HTMLMediaSession::fullscreenPermitted(const HTMLMediaElement&) const
-{
- if (m_restrictions & RequireUserGestureForFullscreen && !ScriptController::processingUserGesture()) {
- LOG(Media, "HTMLMediaSession::fullscreenPermitted - returning FALSE");
- return false;
- }
-
- return true;
-}
-
-bool HTMLMediaSession::pageAllowsDataLoading(const HTMLMediaElement& element) const
-{
- Page* page = element.document().page();
- if (m_restrictions & RequirePageConsentToLoadMedia && page && !page->canStartMedia()) {
- LOG(Media, "HTMLMediaSession::pageAllowsDataLoading - returning FALSE");
- return false;
- }
-
- return true;
-}
-
-bool HTMLMediaSession::pageAllowsPlaybackAfterResuming(const HTMLMediaElement& element) const
-{
- Page* page = element.document().page();
- if (m_restrictions & RequirePageConsentToResumeMedia && page && !page->canStartMedia()) {
- LOG(Media, "HTMLMediaSession::pageAllowsPlaybackAfterResuming - returning FALSE");
- return false;
- }
-
- return true;
-}
-
-#if ENABLE(WIRELESS_PLAYBACK_TARGET)
-void HTMLMediaSession::showPlaybackTargetPicker(const HTMLMediaElement& element)
-{
- LOG(Media, "HTMLMediaSession::showPlaybackTargetPicker");
-
- if (m_restrictions & RequireUserGestureToShowPlaybackTargetPicker && !ScriptController::processingUserGesture()) {
- LOG(Media, "HTMLMediaSession::showPlaybackTargetPicker - returning early because of permissions");
- return;
- }
-
- if (!element.document().page()) {
- LOG(Media, "HTMLMediaSession::showingPlaybackTargetPickerPermitted - returning early because page is NULL");
- return;
- }
-
-#if !PLATFORM(IOS)
- if (!element.hasVideo()) {
- LOG(Media, "HTMLMediaSession::showPlaybackTargetPicker - returning early because element has no video");
- return;
- }
-#endif
-
- element.document().showPlaybackTargetPicker(*this, is<HTMLVideoElement>(element));
-}
-
-bool HTMLMediaSession::hasWirelessPlaybackTargets(const HTMLMediaElement&) const
-{
-#if PLATFORM(IOS)
- // FIXME: consolidate Mac and iOS implementations
- m_hasPlaybackTargets = MediaSessionManager::sharedManager().hasWirelessTargetsAvailable();
-#endif
-
- LOG(Media, "HTMLMediaSession::hasWirelessPlaybackTargets - returning %s", m_hasPlaybackTargets ? "TRUE" : "FALSE");
-
- return m_hasPlaybackTargets;
-}
-
-bool HTMLMediaSession::wirelessVideoPlaybackDisabled(const HTMLMediaElement& element) const
-{
- Settings* settings = element.document().settings();
- if (!settings || !settings->allowsAirPlayForMediaPlayback()) {
- LOG(Media, "HTMLMediaSession::wirelessVideoPlaybackDisabled - returning TRUE because of settings");
- return true;
- }
-
- if (element.fastHasAttribute(HTMLNames::webkitwirelessvideoplaybackdisabledAttr)) {
- LOG(Media, "HTMLMediaSession::wirelessVideoPlaybackDisabled - returning TRUE because of attribute");
- return true;
- }
-
-#if PLATFORM(IOS)
- String legacyAirplayAttributeValue = element.fastGetAttribute(HTMLNames::webkitairplayAttr);
- if (equalIgnoringCase(legacyAirplayAttributeValue, "deny")) {
- LOG(Media, "HTMLMediaSession::wirelessVideoPlaybackDisabled - returning TRUE because of legacy attribute");
- return true;
- }
- if (equalIgnoringCase(legacyAirplayAttributeValue, "allow")) {
- LOG(Media, "HTMLMediaSession::wirelessVideoPlaybackDisabled - returning FALSE because of legacy attribute");
- return false;
- }
-#endif
-
- MediaPlayer* player = element.player();
- if (!player)
- return true;
-
- bool disabled = player->wirelessVideoPlaybackDisabled();
- LOG(Media, "HTMLMediaSession::wirelessVideoPlaybackDisabled - returning %s because media engine says so", disabled ? "TRUE" : "FALSE");
-
- return disabled;
-}
-
-void HTMLMediaSession::setWirelessVideoPlaybackDisabled(const HTMLMediaElement& element, bool disabled)
-{
- if (disabled)
- addBehaviorRestriction(WirelessVideoPlaybackDisabled);
- else
- removeBehaviorRestriction(WirelessVideoPlaybackDisabled);
-
- MediaPlayer* player = element.player();
- if (!player)
- return;
-
- LOG(Media, "HTMLMediaSession::setWirelessVideoPlaybackDisabled - disabled %s", disabled ? "TRUE" : "FALSE");
- player->setWirelessVideoPlaybackDisabled(disabled);
-}
-
-void HTMLMediaSession::setHasPlaybackTargetAvailabilityListeners(const HTMLMediaElement& element, bool hasListeners)
-{
- LOG(Media, "HTMLMediaSession::setHasPlaybackTargetAvailabilityListeners - hasListeners %s", hasListeners ? "TRUE" : "FALSE");
-
-#if PLATFORM(IOS)
- UNUSED_PARAM(element);
- m_hasPlaybackTargetAvailabilityListeners = hasListeners;
- MediaSessionManager::sharedManager().configureWireLessTargetMonitoring();
-#else
- UNUSED_PARAM(hasListeners);
- element.document().playbackTargetPickerClientStateDidChange(*this, element.mediaState());
-#endif
-}
-
-void HTMLMediaSession::setPlaybackTarget(Ref<MediaPlaybackTarget>&& device)
-{
- m_playbackTarget = WTF::move(device);
- client().setWirelessPlaybackTarget(*m_playbackTarget.copyRef());
-}
-
-void HTMLMediaSession::targetAvailabilityChangedTimerFired()
-{
- client().wirelessRoutesAvailableDidChange();
-}
-
-void HTMLMediaSession::externalOutputDeviceAvailableDidChange(bool hasTargets)
-{
- if (m_hasPlaybackTargets == hasTargets)
- return;
-
- LOG(Media, "HTMLMediaSession::externalOutputDeviceAvailableDidChange(%p) - hasTargets %s", this, hasTargets ? "TRUE" : "FALSE");
-
- m_hasPlaybackTargets = hasTargets;
- m_targetAvailabilityChangedTimer.startOneShot(0);
-}
-
-bool HTMLMediaSession::canPlayToWirelessPlaybackTarget() const
-{
- if (!m_playbackTarget || !m_playbackTarget->hasActiveRoute())
- return false;
-
- return client().canPlayToWirelessPlaybackTarget();
-}
-
-bool HTMLMediaSession::isPlayingToWirelessPlaybackTarget() const
-{
- if (!m_playbackTarget || !m_playbackTarget->hasActiveRoute())
- return false;
-
- return client().isPlayingToWirelessPlaybackTarget();
-}
-
-void HTMLMediaSession::setShouldPlayToPlaybackTarget(bool shouldPlay)
-{
- LOG(Media, "HTMLMediaSession::setShouldPlayToPlaybackTarget - shouldPlay %s", shouldPlay ? "TRUE" : "FALSE");
- m_shouldPlayToPlaybackTarget = shouldPlay;
- client().setShouldPlayToPlaybackTarget(shouldPlay);
-}
-
-void HTMLMediaSession::mediaStateDidChange(const HTMLMediaElement& element, MediaProducer::MediaStateFlags state)
-{
- element.document().playbackTargetPickerClientStateDidChange(*this, state);
-}
-#endif
-
-MediaPlayer::Preload HTMLMediaSession::effectivePreloadForElement(const HTMLMediaElement& element) const
-{
- MediaSessionManager::SessionRestrictions restrictions = MediaSessionManager::sharedManager().restrictions(mediaType());
- MediaPlayer::Preload preload = element.preloadValue();
-
- if ((restrictions & MediaSessionManager::MetadataPreloadingNotPermitted) == MediaSessionManager::MetadataPreloadingNotPermitted)
- return MediaPlayer::None;
-
- if ((restrictions & MediaSessionManager::AutoPreloadingNotPermitted) == MediaSessionManager::AutoPreloadingNotPermitted) {
- if (preload > MediaPlayer::MetaData)
- return MediaPlayer::MetaData;
- }
-
- return preload;
-}
-
-bool HTMLMediaSession::requiresFullscreenForVideoPlayback(const HTMLMediaElement& element) const
-{
- if (!MediaSessionManager::sharedManager().sessionRestrictsInlineVideoPlayback(*this))
- return false;
-
- Settings* settings = element.document().settings();
- if (!settings || !settings->allowsInlineMediaPlayback())
- return true;
-
- if (element.fastHasAttribute(HTMLNames::webkit_playsinlineAttr))
- return false;
-
-#if PLATFORM(IOS)
- if (applicationIsDumpRenderTree())
- return false;
-#endif
-
- return true;
-}
-
-void HTMLMediaSession::mediaEngineUpdated(const HTMLMediaElement& element)
-{
- LOG(Media, "HTMLMediaSession::mediaEngineUpdated");
-
-#if ENABLE(WIRELESS_PLAYBACK_TARGET)
- if (m_restrictions & WirelessVideoPlaybackDisabled)
- setWirelessVideoPlaybackDisabled(element, true);
- if (m_playbackTarget)
- client().setWirelessPlaybackTarget(*m_playbackTarget.copyRef());
- if (m_shouldPlayToPlaybackTarget)
- client().setShouldPlayToPlaybackTarget(true);
-#else
- UNUSED_PARAM(element);
-#endif
-
-}
-
-bool HTMLMediaSession::allowsAlternateFullscreen(const HTMLMediaElement& element) const
-{
- Settings* settings = element.document().settings();
- return settings && settings->allowsAlternateFullscreen();
-}
-
-#if ENABLE(MEDIA_SOURCE)
-const unsigned fiveMinutesOf1080PVideo = 290 * 1024 * 1024; // 290 MB is approximately 5 minutes of 8Mbps (1080p) content.
-const unsigned fiveMinutesStereoAudio = 14 * 1024 * 1024; // 14 MB is approximately 5 minutes of 384kbps content.
-
-size_t HTMLMediaSession::maximumMediaSourceBufferSize(const SourceBuffer& buffer) const
-{
- // A good quality 1080p video uses 8,000 kbps and stereo audio uses 384 kbps, so assume 95% for video and 5% for audio.
- const float bufferBudgetPercentageForVideo = .95;
- const float bufferBudgetPercentageForAudio = .05;
-
- size_t maximum;
- Settings* settings = buffer.document().settings();
- if (settings)
- maximum = settings->maximumSourceBufferSize();
- else
- maximum = fiveMinutesOf1080PVideo + fiveMinutesStereoAudio;
-
- // Allow a SourceBuffer to buffer as though it is audio-only even if it doesn't have any active tracks (yet).
- size_t bufferSize = static_cast<size_t>(maximum * bufferBudgetPercentageForAudio);
- if (buffer.hasVideo())
- bufferSize += static_cast<size_t>(maximum * bufferBudgetPercentageForVideo);
-
- // FIXME: we might want to modify this algorithm to:
- // - decrease the maximum size for background tabs
- // - decrease the maximum size allowed for inactive elements when a process has more than one
- // element, eg. so a page with many elements which are played one at a time doesn't keep
- // everything buffered after an element has finished playing.
-
- return bufferSize;
-}
-#endif
-
-}
-
-#endif // ENABLE(VIDEO)
</del></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLMediaSessionh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/html/HTMLMediaSession.h (184965 => 184966)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLMediaSession.h        2015-05-28 22:41:19 UTC (rev 184965)
+++ trunk/Source/WebCore/html/HTMLMediaSession.h        2015-05-28 23:03:34 UTC (rev 184966)
</span><span class="lines">@@ -1,134 +0,0 @@
</span><del>-/*
- * Copyright (C) 2014-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. AND ITS CONTRIBUTORS ``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 ITS 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 HTMLMediaSession_h
-#define HTMLMediaSession_h
-
-#if ENABLE(VIDEO)
-
-#include "MediaPlayer.h"
-#include "MediaSession.h"
-#include "Timer.h"
-
-namespace WebCore {
-
-class Document;
-class HTMLMediaElement;
-class SourceBuffer;
-
-class HTMLMediaSession final : public MediaSession {
- WTF_MAKE_FAST_ALLOCATED;
-public:
- explicit HTMLMediaSession(MediaSessionClient&);
- virtual ~HTMLMediaSession() { }
-
- void registerWithDocument(const HTMLMediaElement&);
- void unregisterWithDocument(const HTMLMediaElement&);
-
- bool playbackPermitted(const HTMLMediaElement&) const;
- bool dataLoadingPermitted(const HTMLMediaElement&) const;
- bool fullscreenPermitted(const HTMLMediaElement&) const;
- bool pageAllowsDataLoading(const HTMLMediaElement&) const;
- bool pageAllowsPlaybackAfterResuming(const HTMLMediaElement&) const;
-
-#if ENABLE(WIRELESS_PLAYBACK_TARGET)
- void showPlaybackTargetPicker(const HTMLMediaElement&);
- bool hasWirelessPlaybackTargets(const HTMLMediaElement&) const;
-
- bool wirelessVideoPlaybackDisabled(const HTMLMediaElement&) const;
- void setWirelessVideoPlaybackDisabled(const HTMLMediaElement&, bool);
-
- void setHasPlaybackTargetAvailabilityListeners(const HTMLMediaElement&, bool);
-
- virtual bool canPlayToWirelessPlaybackTarget() const override;
- virtual bool isPlayingToWirelessPlaybackTarget() const override;
-
- void mediaStateDidChange(const HTMLMediaElement&, MediaProducer::MediaStateFlags);
-#endif
-
- bool requiresFullscreenForVideoPlayback(const HTMLMediaElement&) const;
- WEBCORE_EXPORT bool allowsAlternateFullscreen(const HTMLMediaElement&) const;
- MediaPlayer::Preload effectivePreloadForElement(const HTMLMediaElement&) const;
-
- void mediaEngineUpdated(const HTMLMediaElement&);
-
- // Restrictions to modify default behaviors.
- enum BehaviorRestrictionFlags {
- NoRestrictions = 0,
- RequireUserGestureForLoad = 1 << 0,
- RequireUserGestureForRateChange = 1 << 1,
- RequireUserGestureForFullscreen = 1 << 2,
- RequirePageConsentToLoadMedia = 1 << 3,
- RequirePageConsentToResumeMedia = 1 << 4,
- RequireUserGestureForAudioRateChange = 1 << 5,
-#if ENABLE(WIRELESS_PLAYBACK_TARGET)
- RequireUserGestureToShowPlaybackTargetPicker = 1 << 6,
- WirelessVideoPlaybackDisabled = 1 << 7,
- RequireUserGestureToAutoplayToExternalDevice = 1 << 8,
-#endif
- };
- typedef unsigned BehaviorRestrictions;
-
- WEBCORE_EXPORT BehaviorRestrictions behaviorRestrictions() const { return m_restrictions; }
- WEBCORE_EXPORT void addBehaviorRestriction(BehaviorRestrictions);
- WEBCORE_EXPORT void removeBehaviorRestriction(BehaviorRestrictions);
- bool hasBehaviorRestriction(BehaviorRestrictions restriction) const { return restriction & m_restrictions; }
-
-#if ENABLE(MEDIA_SOURCE)
- size_t maximumMediaSourceBufferSize(const SourceBuffer&) const;
-#endif
-
-private:
-
-#if ENABLE(WIRELESS_PLAYBACK_TARGET)
- void targetAvailabilityChangedTimerFired();
-
- // MediaPlaybackTargetClient
- virtual void setPlaybackTarget(Ref<MediaPlaybackTarget>&&) override;
- virtual void externalOutputDeviceAvailableDidChange(bool) override;
- virtual void setShouldPlayToPlaybackTarget(bool) override;
-#endif
-#if PLATFORM(IOS)
- bool requiresPlaybackTargetRouteMonitoring() const override { return m_hasPlaybackTargetAvailabilityListeners; }
-#endif
-
- BehaviorRestrictions m_restrictions;
-
-#if ENABLE(WIRELESS_PLAYBACK_TARGET)
- mutable Timer m_targetAvailabilityChangedTimer;
- RefPtr<MediaPlaybackTarget> m_playbackTarget;
- bool m_shouldPlayToPlaybackTarget { false };
- mutable bool m_hasPlaybackTargets { false };
-#endif
-#if PLATFORM(IOS)
- bool m_hasPlaybackTargetAvailabilityListeners { false };
-#endif
-};
-
-}
-
-#endif // MediaSession_h
-
-#endif // ENABLE(VIDEO)
</del></span></pre></div>
<a id="trunkSourceWebCorehtmlMediaElementSessioncppfromrev184965trunkSourceWebCorehtmlHTMLMediaSessioncpp"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/html/MediaElementSession.cpp (from rev 184965, trunk/Source/WebCore/html/HTMLMediaSession.cpp) (0 => 184966)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/MediaElementSession.cpp         (rev 0)
+++ trunk/Source/WebCore/html/MediaElementSession.cpp        2015-05-28 23:03:34 UTC (rev 184966)
</span><span class="lines">@@ -0,0 +1,422 @@
</span><ins>+/*
+ * Copyright (C) 2014 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. AND ITS CONTRIBUTORS ``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 ITS 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.
+ */
+
+#include "config.h"
+
+#if ENABLE(VIDEO)
+
+#include "MediaElementSession.h"
+
+#include "Chrome.h"
+#include "ChromeClient.h"
+#include "Document.h"
+#include "Frame.h"
+#include "FrameView.h"
+#include "HTMLMediaElement.h"
+#include "HTMLNames.h"
+#include "HTMLVideoElement.h"
+#include "Logging.h"
+#include "MediaSessionManager.h"
+#include "Page.h"
+#include "ScriptController.h"
+#include "SourceBuffer.h"
+
+#if PLATFORM(IOS)
+#include "AudioSession.h"
+#include "RuntimeApplicationChecksIOS.h"
+#endif
+
+namespace WebCore {
+
+#if !LOG_DISABLED
+static String restrictionName(MediaElementSession::BehaviorRestrictions restriction)
+{
+ StringBuilder restrictionBuilder;
+#define CASE(restrictionType) \
+ if (restriction & MediaElementSession::restrictionType) { \
+ if (!restrictionBuilder.isEmpty()) \
+ restrictionBuilder.append(", "); \
+ restrictionBuilder.append(#restrictionType); \
+ } \
+
+ CASE(NoRestrictions);
+ CASE(RequireUserGestureForLoad);
+ CASE(RequireUserGestureForRateChange);
+ CASE(RequireUserGestureForAudioRateChange);
+ CASE(RequireUserGestureForFullscreen);
+ CASE(RequirePageConsentToLoadMedia);
+ CASE(RequirePageConsentToResumeMedia);
+#if ENABLE(WIRELESS_PLAYBACK_TARGET)
+ CASE(RequireUserGestureToShowPlaybackTargetPicker);
+ CASE(WirelessVideoPlaybackDisabled);
+#endif
+ CASE(RequireUserGestureForAudioRateChange);
+
+ return restrictionBuilder.toString();
+}
+#endif
+
+MediaElementSession::MediaElementSession(MediaSessionClient& client)
+ : MediaSession(client)
+ , m_restrictions(NoRestrictions)
+#if ENABLE(WIRELESS_PLAYBACK_TARGET)
+ , m_targetAvailabilityChangedTimer(*this, &MediaElementSession::targetAvailabilityChangedTimerFired)
+#endif
+{
+}
+
+void MediaElementSession::registerWithDocument(const HTMLMediaElement& element)
+{
+#if ENABLE(WIRELESS_PLAYBACK_TARGET)
+ element.document().addPlaybackTargetPickerClient(*this);
+#else
+ UNUSED_PARAM(element);
+#endif
+}
+
+void MediaElementSession::unregisterWithDocument(const HTMLMediaElement& element)
+{
+#if ENABLE(WIRELESS_PLAYBACK_TARGET)
+ element.document().removePlaybackTargetPickerClient(*this);
+#else
+ UNUSED_PARAM(element);
+#endif
+}
+
+void MediaElementSession::addBehaviorRestriction(BehaviorRestrictions restriction)
+{
+ LOG(Media, "MediaElementSession::addBehaviorRestriction - adding %s", restrictionName(restriction).utf8().data());
+ m_restrictions |= restriction;
+}
+
+void MediaElementSession::removeBehaviorRestriction(BehaviorRestrictions restriction)
+{
+ LOG(Media, "MediaElementSession::removeBehaviorRestriction - removing %s", restrictionName(restriction).utf8().data());
+ m_restrictions &= ~restriction;
+}
+
+bool MediaElementSession::playbackPermitted(const HTMLMediaElement& element) const
+{
+ if (m_restrictions & RequireUserGestureForRateChange && !ScriptController::processingUserGesture()) {
+ LOG(Media, "MediaElementSession::playbackPermitted - returning FALSE");
+ return false;
+ }
+
+ if (m_restrictions & RequireUserGestureForAudioRateChange && element.hasAudio() && !ScriptController::processingUserGesture()) {
+ LOG(Media, "MediaElementSession::playbackPermitted - returning FALSE");
+ return false;
+ }
+
+ return true;
+}
+
+bool MediaElementSession::dataLoadingPermitted(const HTMLMediaElement&) const
+{
+ if (m_restrictions & RequireUserGestureForLoad && !ScriptController::processingUserGesture()) {
+ LOG(Media, "MediaElementSession::dataLoadingPermitted - returning FALSE");
+ return false;
+ }
+
+ return true;
+}
+
+bool MediaElementSession::fullscreenPermitted(const HTMLMediaElement&) const
+{
+ if (m_restrictions & RequireUserGestureForFullscreen && !ScriptController::processingUserGesture()) {
+ LOG(Media, "MediaElementSession::fullscreenPermitted - returning FALSE");
+ return false;
+ }
+
+ return true;
+}
+
+bool MediaElementSession::pageAllowsDataLoading(const HTMLMediaElement& element) const
+{
+ Page* page = element.document().page();
+ if (m_restrictions & RequirePageConsentToLoadMedia && page && !page->canStartMedia()) {
+ LOG(Media, "MediaElementSession::pageAllowsDataLoading - returning FALSE");
+ return false;
+ }
+
+ return true;
+}
+
+bool MediaElementSession::pageAllowsPlaybackAfterResuming(const HTMLMediaElement& element) const
+{
+ Page* page = element.document().page();
+ if (m_restrictions & RequirePageConsentToResumeMedia && page && !page->canStartMedia()) {
+ LOG(Media, "MediaElementSession::pageAllowsPlaybackAfterResuming - returning FALSE");
+ return false;
+ }
+
+ return true;
+}
+
+#if ENABLE(WIRELESS_PLAYBACK_TARGET)
+void MediaElementSession::showPlaybackTargetPicker(const HTMLMediaElement& element)
+{
+ LOG(Media, "MediaElementSession::showPlaybackTargetPicker");
+
+ if (m_restrictions & RequireUserGestureToShowPlaybackTargetPicker && !ScriptController::processingUserGesture()) {
+ LOG(Media, "MediaElementSession::showPlaybackTargetPicker - returning early because of permissions");
+ return;
+ }
+
+ if (!element.document().page()) {
+ LOG(Media, "MediaElementSession::showingPlaybackTargetPickerPermitted - returning early because page is NULL");
+ return;
+ }
+
+#if !PLATFORM(IOS)
+ if (!element.hasVideo()) {
+ LOG(Media, "MediaElementSession::showPlaybackTargetPicker - returning early because element has no video");
+ return;
+ }
+#endif
+
+ element.document().showPlaybackTargetPicker(*this, is<HTMLVideoElement>(element));
+}
+
+bool MediaElementSession::hasWirelessPlaybackTargets(const HTMLMediaElement&) const
+{
+#if PLATFORM(IOS)
+ // FIXME: consolidate Mac and iOS implementations
+ m_hasPlaybackTargets = MediaSessionManager::sharedManager().hasWirelessTargetsAvailable();
+#endif
+
+ LOG(Media, "MediaElementSession::hasWirelessPlaybackTargets - returning %s", m_hasPlaybackTargets ? "TRUE" : "FALSE");
+
+ return m_hasPlaybackTargets;
+}
+
+bool MediaElementSession::wirelessVideoPlaybackDisabled(const HTMLMediaElement& element) const
+{
+ Settings* settings = element.document().settings();
+ if (!settings || !settings->allowsAirPlayForMediaPlayback()) {
+ LOG(Media, "MediaElementSession::wirelessVideoPlaybackDisabled - returning TRUE because of settings");
+ return true;
+ }
+
+ if (element.fastHasAttribute(HTMLNames::webkitwirelessvideoplaybackdisabledAttr)) {
+ LOG(Media, "MediaElementSession::wirelessVideoPlaybackDisabled - returning TRUE because of attribute");
+ return true;
+ }
+
+#if PLATFORM(IOS)
+ String legacyAirplayAttributeValue = element.fastGetAttribute(HTMLNames::webkitairplayAttr);
+ if (equalIgnoringCase(legacyAirplayAttributeValue, "deny")) {
+ LOG(Media, "MediaElementSession::wirelessVideoPlaybackDisabled - returning TRUE because of legacy attribute");
+ return true;
+ }
+ if (equalIgnoringCase(legacyAirplayAttributeValue, "allow")) {
+ LOG(Media, "MediaElementSession::wirelessVideoPlaybackDisabled - returning FALSE because of legacy attribute");
+ return false;
+ }
+#endif
+
+ MediaPlayer* player = element.player();
+ if (!player)
+ return true;
+
+ bool disabled = player->wirelessVideoPlaybackDisabled();
+ LOG(Media, "MediaElementSession::wirelessVideoPlaybackDisabled - returning %s because media engine says so", disabled ? "TRUE" : "FALSE");
+
+ return disabled;
+}
+
+void MediaElementSession::setWirelessVideoPlaybackDisabled(const HTMLMediaElement& element, bool disabled)
+{
+ if (disabled)
+ addBehaviorRestriction(WirelessVideoPlaybackDisabled);
+ else
+ removeBehaviorRestriction(WirelessVideoPlaybackDisabled);
+
+ MediaPlayer* player = element.player();
+ if (!player)
+ return;
+
+ LOG(Media, "MediaElementSession::setWirelessVideoPlaybackDisabled - disabled %s", disabled ? "TRUE" : "FALSE");
+ player->setWirelessVideoPlaybackDisabled(disabled);
+}
+
+void MediaElementSession::setHasPlaybackTargetAvailabilityListeners(const HTMLMediaElement& element, bool hasListeners)
+{
+ LOG(Media, "MediaElementSession::setHasPlaybackTargetAvailabilityListeners - hasListeners %s", hasListeners ? "TRUE" : "FALSE");
+
+#if PLATFORM(IOS)
+ UNUSED_PARAM(element);
+ m_hasPlaybackTargetAvailabilityListeners = hasListeners;
+ MediaSessionManager::sharedManager().configureWireLessTargetMonitoring();
+#else
+ UNUSED_PARAM(hasListeners);
+ element.document().playbackTargetPickerClientStateDidChange(*this, element.mediaState());
+#endif
+}
+
+void MediaElementSession::setPlaybackTarget(Ref<MediaPlaybackTarget>&& device)
+{
+ m_playbackTarget = WTF::move(device);
+ client().setWirelessPlaybackTarget(*m_playbackTarget.copyRef());
+}
+
+void MediaElementSession::targetAvailabilityChangedTimerFired()
+{
+ client().wirelessRoutesAvailableDidChange();
+}
+
+void MediaElementSession::externalOutputDeviceAvailableDidChange(bool hasTargets)
+{
+ if (m_hasPlaybackTargets == hasTargets)
+ return;
+
+ LOG(Media, "MediaElementSession::externalOutputDeviceAvailableDidChange(%p) - hasTargets %s", this, hasTargets ? "TRUE" : "FALSE");
+
+ m_hasPlaybackTargets = hasTargets;
+ m_targetAvailabilityChangedTimer.startOneShot(0);
+}
+
+bool MediaElementSession::canPlayToWirelessPlaybackTarget() const
+{
+ if (!m_playbackTarget || !m_playbackTarget->hasActiveRoute())
+ return false;
+
+ return client().canPlayToWirelessPlaybackTarget();
+}
+
+bool MediaElementSession::isPlayingToWirelessPlaybackTarget() const
+{
+ if (!m_playbackTarget || !m_playbackTarget->hasActiveRoute())
+ return false;
+
+ return client().isPlayingToWirelessPlaybackTarget();
+}
+
+void MediaElementSession::setShouldPlayToPlaybackTarget(bool shouldPlay)
+{
+ LOG(Media, "MediaElementSession::setShouldPlayToPlaybackTarget - shouldPlay %s", shouldPlay ? "TRUE" : "FALSE");
+ m_shouldPlayToPlaybackTarget = shouldPlay;
+ client().setShouldPlayToPlaybackTarget(shouldPlay);
+}
+
+void MediaElementSession::mediaStateDidChange(const HTMLMediaElement& element, MediaProducer::MediaStateFlags state)
+{
+ element.document().playbackTargetPickerClientStateDidChange(*this, state);
+}
+#endif
+
+MediaPlayer::Preload MediaElementSession::effectivePreloadForElement(const HTMLMediaElement& element) const
+{
+ MediaSessionManager::SessionRestrictions restrictions = MediaSessionManager::sharedManager().restrictions(mediaType());
+ MediaPlayer::Preload preload = element.preloadValue();
+
+ if ((restrictions & MediaSessionManager::MetadataPreloadingNotPermitted) == MediaSessionManager::MetadataPreloadingNotPermitted)
+ return MediaPlayer::None;
+
+ if ((restrictions & MediaSessionManager::AutoPreloadingNotPermitted) == MediaSessionManager::AutoPreloadingNotPermitted) {
+ if (preload > MediaPlayer::MetaData)
+ return MediaPlayer::MetaData;
+ }
+
+ return preload;
+}
+
+bool MediaElementSession::requiresFullscreenForVideoPlayback(const HTMLMediaElement& element) const
+{
+ if (!MediaSessionManager::sharedManager().sessionRestrictsInlineVideoPlayback(*this))
+ return false;
+
+ Settings* settings = element.document().settings();
+ if (!settings || !settings->allowsInlineMediaPlayback())
+ return true;
+
+ if (element.fastHasAttribute(HTMLNames::webkit_playsinlineAttr))
+ return false;
+
+#if PLATFORM(IOS)
+ if (applicationIsDumpRenderTree())
+ return false;
+#endif
+
+ return true;
+}
+
+void MediaElementSession::mediaEngineUpdated(const HTMLMediaElement& element)
+{
+ LOG(Media, "MediaElementSession::mediaEngineUpdated");
+
+#if ENABLE(WIRELESS_PLAYBACK_TARGET)
+ if (m_restrictions & WirelessVideoPlaybackDisabled)
+ setWirelessVideoPlaybackDisabled(element, true);
+ if (m_playbackTarget)
+ client().setWirelessPlaybackTarget(*m_playbackTarget.copyRef());
+ if (m_shouldPlayToPlaybackTarget)
+ client().setShouldPlayToPlaybackTarget(true);
+#else
+ UNUSED_PARAM(element);
+#endif
+
+}
+
+bool MediaElementSession::allowsAlternateFullscreen(const HTMLMediaElement& element) const
+{
+ Settings* settings = element.document().settings();
+ return settings && settings->allowsAlternateFullscreen();
+}
+
+#if ENABLE(MEDIA_SOURCE)
+const unsigned fiveMinutesOf1080PVideo = 290 * 1024 * 1024; // 290 MB is approximately 5 minutes of 8Mbps (1080p) content.
+const unsigned fiveMinutesStereoAudio = 14 * 1024 * 1024; // 14 MB is approximately 5 minutes of 384kbps content.
+
+size_t MediaElementSession::maximumMediaSourceBufferSize(const SourceBuffer& buffer) const
+{
+ // A good quality 1080p video uses 8,000 kbps and stereo audio uses 384 kbps, so assume 95% for video and 5% for audio.
+ const float bufferBudgetPercentageForVideo = .95;
+ const float bufferBudgetPercentageForAudio = .05;
+
+ size_t maximum;
+ Settings* settings = buffer.document().settings();
+ if (settings)
+ maximum = settings->maximumSourceBufferSize();
+ else
+ maximum = fiveMinutesOf1080PVideo + fiveMinutesStereoAudio;
+
+ // Allow a SourceBuffer to buffer as though it is audio-only even if it doesn't have any active tracks (yet).
+ size_t bufferSize = static_cast<size_t>(maximum * bufferBudgetPercentageForAudio);
+ if (buffer.hasVideo())
+ bufferSize += static_cast<size_t>(maximum * bufferBudgetPercentageForVideo);
+
+ // FIXME: we might want to modify this algorithm to:
+ // - decrease the maximum size for background tabs
+ // - decrease the maximum size allowed for inactive elements when a process has more than one
+ // element, eg. so a page with many elements which are played one at a time doesn't keep
+ // everything buffered after an element has finished playing.
+
+ return bufferSize;
+}
+#endif
+
+}
+
+#endif // ENABLE(VIDEO)
</ins></span></pre></div>
<a id="trunkSourceWebCorehtmlMediaElementSessionhfromrev184965trunkSourceWebCorehtmlHTMLMediaSessionh"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/html/MediaElementSession.h (from rev 184965, trunk/Source/WebCore/html/HTMLMediaSession.h) (0 => 184966)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/MediaElementSession.h         (rev 0)
+++ trunk/Source/WebCore/html/MediaElementSession.h        2015-05-28 23:03:34 UTC (rev 184966)
</span><span class="lines">@@ -0,0 +1,134 @@
</span><ins>+/*
+ * Copyright (C) 2014-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. AND ITS CONTRIBUTORS ``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 ITS 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 MediaElementSession_h
+#define MediaElementSession_h
+
+#if ENABLE(VIDEO)
+
+#include "MediaPlayer.h"
+#include "MediaSession.h"
+#include "Timer.h"
+
+namespace WebCore {
+
+class Document;
+class HTMLMediaElement;
+class SourceBuffer;
+
+class MediaElementSession final : public MediaSession {
+ WTF_MAKE_FAST_ALLOCATED;
+public:
+ explicit MediaElementSession(MediaSessionClient&);
+ virtual ~MediaElementSession() { }
+
+ void registerWithDocument(const HTMLMediaElement&);
+ void unregisterWithDocument(const HTMLMediaElement&);
+
+ bool playbackPermitted(const HTMLMediaElement&) const;
+ bool dataLoadingPermitted(const HTMLMediaElement&) const;
+ bool fullscreenPermitted(const HTMLMediaElement&) const;
+ bool pageAllowsDataLoading(const HTMLMediaElement&) const;
+ bool pageAllowsPlaybackAfterResuming(const HTMLMediaElement&) const;
+
+#if ENABLE(WIRELESS_PLAYBACK_TARGET)
+ void showPlaybackTargetPicker(const HTMLMediaElement&);
+ bool hasWirelessPlaybackTargets(const HTMLMediaElement&) const;
+
+ bool wirelessVideoPlaybackDisabled(const HTMLMediaElement&) const;
+ void setWirelessVideoPlaybackDisabled(const HTMLMediaElement&, bool);
+
+ void setHasPlaybackTargetAvailabilityListeners(const HTMLMediaElement&, bool);
+
+ virtual bool canPlayToWirelessPlaybackTarget() const override;
+ virtual bool isPlayingToWirelessPlaybackTarget() const override;
+
+ void mediaStateDidChange(const HTMLMediaElement&, MediaProducer::MediaStateFlags);
+#endif
+
+ bool requiresFullscreenForVideoPlayback(const HTMLMediaElement&) const;
+ WEBCORE_EXPORT bool allowsAlternateFullscreen(const HTMLMediaElement&) const;
+ MediaPlayer::Preload effectivePreloadForElement(const HTMLMediaElement&) const;
+
+ void mediaEngineUpdated(const HTMLMediaElement&);
+
+ // Restrictions to modify default behaviors.
+ enum BehaviorRestrictionFlags {
+ NoRestrictions = 0,
+ RequireUserGestureForLoad = 1 << 0,
+ RequireUserGestureForRateChange = 1 << 1,
+ RequireUserGestureForFullscreen = 1 << 2,
+ RequirePageConsentToLoadMedia = 1 << 3,
+ RequirePageConsentToResumeMedia = 1 << 4,
+ RequireUserGestureForAudioRateChange = 1 << 5,
+#if ENABLE(WIRELESS_PLAYBACK_TARGET)
+ RequireUserGestureToShowPlaybackTargetPicker = 1 << 6,
+ WirelessVideoPlaybackDisabled = 1 << 7,
+ RequireUserGestureToAutoplayToExternalDevice = 1 << 8,
+#endif
+ };
+ typedef unsigned BehaviorRestrictions;
+
+ WEBCORE_EXPORT BehaviorRestrictions behaviorRestrictions() const { return m_restrictions; }
+ WEBCORE_EXPORT void addBehaviorRestriction(BehaviorRestrictions);
+ WEBCORE_EXPORT void removeBehaviorRestriction(BehaviorRestrictions);
+ bool hasBehaviorRestriction(BehaviorRestrictions restriction) const { return restriction & m_restrictions; }
+
+#if ENABLE(MEDIA_SOURCE)
+ size_t maximumMediaSourceBufferSize(const SourceBuffer&) const;
+#endif
+
+private:
+
+#if ENABLE(WIRELESS_PLAYBACK_TARGET)
+ void targetAvailabilityChangedTimerFired();
+
+ // MediaPlaybackTargetClient
+ virtual void setPlaybackTarget(Ref<MediaPlaybackTarget>&&) override;
+ virtual void externalOutputDeviceAvailableDidChange(bool) override;
+ virtual void setShouldPlayToPlaybackTarget(bool) override;
+#endif
+#if PLATFORM(IOS)
+ bool requiresPlaybackTargetRouteMonitoring() const override { return m_hasPlaybackTargetAvailabilityListeners; }
+#endif
+
+ BehaviorRestrictions m_restrictions;
+
+#if ENABLE(WIRELESS_PLAYBACK_TARGET)
+ mutable Timer m_targetAvailabilityChangedTimer;
+ RefPtr<MediaPlaybackTarget> m_playbackTarget;
+ bool m_shouldPlayToPlaybackTarget { false };
+ mutable bool m_hasPlaybackTargets { false };
+#endif
+#if PLATFORM(IOS)
+ bool m_hasPlaybackTargetAvailabilityListeners { false };
+#endif
+};
+
+}
+
+#endif // MediaElementSession_h
+
+#endif // ENABLE(VIDEO)
</ins></span></pre></div>
<a id="trunkSourceWebCoretestingInternalscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/testing/Internals.cpp (184965 => 184966)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/testing/Internals.cpp        2015-05-28 22:41:19 UTC (rev 184965)
+++ trunk/Source/WebCore/testing/Internals.cpp        2015-05-28 23:03:34 UTC (rev 184966)
</span><span class="lines">@@ -2648,34 +2648,34 @@
</span><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- HTMLMediaSession::BehaviorRestrictions restrictions = element->mediaSession().behaviorRestrictions();
</del><ins>+ MediaElementSession::BehaviorRestrictions restrictions = element->mediaSession().behaviorRestrictions();
</ins><span class="cx"> element->mediaSession().removeBehaviorRestriction(restrictions);
</span><span class="cx">
</span><del>- restrictions = HTMLMediaSession::NoRestrictions;
</del><ins>+ restrictions = MediaElementSession::NoRestrictions;
</ins><span class="cx">
</span><span class="cx"> Vector<String> restrictionsArray;
</span><span class="cx"> restrictionsString.split(',', false, restrictionsArray);
</span><span class="cx"> for (auto& restrictionString : restrictionsArray) {
</span><span class="cx"> if (equalIgnoringCase(restrictionString, "NoRestrictions"))
</span><del>- restrictions |= HTMLMediaSession::NoRestrictions;
</del><ins>+ restrictions |= MediaElementSession::NoRestrictions;
</ins><span class="cx"> if (equalIgnoringCase(restrictionString, "RequireUserGestureForLoad"))
</span><del>- restrictions |= HTMLMediaSession::RequireUserGestureForLoad;
</del><ins>+ restrictions |= MediaElementSession::RequireUserGestureForLoad;
</ins><span class="cx"> if (equalIgnoringCase(restrictionString, "RequireUserGestureForRateChange"))
</span><del>- restrictions |= HTMLMediaSession::RequireUserGestureForRateChange;
</del><ins>+ restrictions |= MediaElementSession::RequireUserGestureForRateChange;
</ins><span class="cx"> if (equalIgnoringCase(restrictionString, "RequireUserGestureForFullscreen"))
</span><del>- restrictions |= HTMLMediaSession::RequireUserGestureForFullscreen;
</del><ins>+ restrictions |= MediaElementSession::RequireUserGestureForFullscreen;
</ins><span class="cx"> if (equalIgnoringCase(restrictionString, "RequirePageConsentToLoadMedia"))
</span><del>- restrictions |= HTMLMediaSession::RequirePageConsentToLoadMedia;
</del><ins>+ restrictions |= MediaElementSession::RequirePageConsentToLoadMedia;
</ins><span class="cx"> if (equalIgnoringCase(restrictionString, "RequirePageConsentToResumeMedia"))
</span><del>- restrictions |= HTMLMediaSession::RequirePageConsentToResumeMedia;
</del><ins>+ restrictions |= MediaElementSession::RequirePageConsentToResumeMedia;
</ins><span class="cx"> #if ENABLE(WIRELESS_PLAYBACK_TARGET)
</span><span class="cx"> if (equalIgnoringCase(restrictionString, "RequireUserGestureToShowPlaybackTargetPicker"))
</span><del>- restrictions |= HTMLMediaSession::RequireUserGestureToShowPlaybackTargetPicker;
</del><ins>+ restrictions |= MediaElementSession::RequireUserGestureToShowPlaybackTargetPicker;
</ins><span class="cx"> if (equalIgnoringCase(restrictionString, "WirelessVideoPlaybackDisabled"))
</span><del>- restrictions |= HTMLMediaSession::WirelessVideoPlaybackDisabled;
</del><ins>+ restrictions |= MediaElementSession::WirelessVideoPlaybackDisabled;
</ins><span class="cx"> #endif
</span><span class="cx"> if (equalIgnoringCase(restrictionString, "RequireUserGestureForAudioRateChange"))
</span><del>- restrictions |= HTMLMediaSession::RequireUserGestureForAudioRateChange;
</del><ins>+ restrictions |= MediaElementSession::RequireUserGestureForAudioRateChange;
</ins><span class="cx"> }
</span><span class="cx"> element->mediaSession().addBehaviorRestriction(restrictions);
</span><span class="cx"> }
</span><span class="lines">@@ -2727,7 +2727,7 @@
</span><span class="cx"> AudioContext::BehaviorRestrictions restrictions = context->behaviorRestrictions();
</span><span class="cx"> context->removeBehaviorRestriction(restrictions);
</span><span class="cx">
</span><del>- restrictions = HTMLMediaSession::NoRestrictions;
</del><ins>+ restrictions = MediaElementSession::NoRestrictions;
</ins><span class="cx">
</span><span class="cx"> Vector<String> restrictionsArray;
</span><span class="cx"> restrictionsString.split(',', false, restrictionsArray);
</span></span></pre>
</div>
</div>
</body>
</html>