<!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>[162145] trunk</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/162145">162145</a></dd>
<dt>Author</dt> <dd>eric.carlson@apple.com</dd>
<dt>Date</dt> <dd>2014-01-16 13:26:53 -0800 (Thu, 16 Jan 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Allow MediaSessionManager to restrict inline &lt;video&gt; playback
https://bugs.webkit.org/show_bug.cgi?id=127113

Reviewed by Jer Noble.

Source/WebCore: 

Test: media/video-fullscreeen-only-playback.html

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::updatePlayState): Drive-by change to not tell the media session that
    playback is starting if the media player is already playing. Enter fullscreen if the media
    session says it is required.

* html/HTMLMediaSession.cpp:
(WebCore::HTMLMediaSession::clientWillBeginPlayback): Make it const.
(WebCore::HTMLMediaSession::requiresFullscreenForVideoPlayback): New, see if the specified
    media element must be played in fullscreen based on the media session settings, document
    settings, and attributes.
* html/HTMLMediaSession.h:

* platform/audio/MediaSession.h: pauseSession shouldn't be virtual.

* platform/audio/MediaSessionManager.cpp:
(WebCore::MediaSessionManager::sessionWillBeginPlayback): Return immediately if ConcurrentPlaybackNotPermitted
    is not set.
(WebCore::MediaSessionManager::sessionRestrictsInlineVideoPlayback): New.
* platform/audio/MediaSessionManager.h:

* platform/audio/ios/MediaSessionManagerIOS.mm:
(WebCore::MediaSessionManageriOS::MediaSessionManageriOS): Set InlineVideoPlaybackRestricted if
    running on an iPhone or iPod class device.

* testing/Internals.cpp:
(WebCore::Internals::setMediaSessionRestrictions): Support InlineVideoPlaybackRestricted.

LayoutTests: 

* media/video-fullscreeen-only-playback-expected.txt: Added.
* media/video-fullscreeen-only-playback.html: Added.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLMediaElementcpp">trunk/Source/WebCore/html/HTMLMediaElement.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLMediaSessioncpp">trunk/Source/WebCore/html/HTMLMediaSession.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLMediaSessionh">trunk/Source/WebCore/html/HTMLMediaSession.h</a></li>
<li><a href="#trunkSourceWebCoreplatformaudioMediaSessionh">trunk/Source/WebCore/platform/audio/MediaSession.h</a></li>
<li><a href="#trunkSourceWebCoreplatformaudioMediaSessionManagercpp">trunk/Source/WebCore/platform/audio/MediaSessionManager.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformaudioMediaSessionManagerh">trunk/Source/WebCore/platform/audio/MediaSessionManager.h</a></li>
<li><a href="#trunkSourceWebCoreplatformaudioiosMediaSessionManagerIOSmm">trunk/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.mm</a></li>
<li><a href="#trunkSourceWebCoretestingInternalscpp">trunk/Source/WebCore/testing/Internals.cpp</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsmediavideofullscreeenonlyplaybackexpectedtxt">trunk/LayoutTests/media/video-fullscreeen-only-playback-expected.txt</a></li>
<li><a href="#trunkLayoutTestsmediavideofullscreeenonlyplaybackhtml">trunk/LayoutTests/media/video-fullscreeen-only-playback.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (162144 => 162145)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2014-01-16 21:23:23 UTC (rev 162144)
+++ trunk/LayoutTests/ChangeLog        2014-01-16 21:26:53 UTC (rev 162145)
</span><span class="lines">@@ -1,3 +1,13 @@
</span><ins>+2014-01-16  Eric Carlson  &lt;eric.carlson@apple.com&gt;
+
+        Allow MediaSessionManager to restrict inline &lt;video&gt; playback
+        https://bugs.webkit.org/show_bug.cgi?id=127113
+
+        Reviewed by Jer Noble.
+
+        * media/video-fullscreeen-only-playback-expected.txt: Added.
+        * media/video-fullscreeen-only-playback.html: Added.
+
</ins><span class="cx"> 2014-01-07  Myles C. Maxfield  &lt;mmaxfield@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         text-emphasis-position CSS property doesn't recognize 'left' and 'right'
</span></span></pre></div>
<a id="trunkLayoutTestsmediavideofullscreeenonlyplaybackexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/media/video-fullscreeen-only-playback-expected.txt (0 => 162145)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/media/video-fullscreeen-only-playback-expected.txt                                (rev 0)
+++ trunk/LayoutTests/media/video-fullscreeen-only-playback-expected.txt        2014-01-16 21:26:53 UTC (rev 162145)
</span><span class="lines">@@ -0,0 +1,19 @@
</span><ins>+
+Test play() when &lt;video&gt; playback requires fullscreen.
+
+RUN(internals.setMediaSessionRestrictions('video', 'InlineVideoPlaybackRestricted'))
+
+EVENT(canplaythrough)
+EXPECTED (video.webkitSupportsFullscreen == 'true') OK
+EXPECTED (video.webkitDisplayingFullscreen == 'false') OK
+
+** Clicking 'play' button...
+EVENT(playing)
+
+** Entered fullscreen
+EXPECTED (video.webkitDisplayingFullscreen == 'true') OK
+RUN(video.webkitExitFullScreen())
+
+** Exited fullscreen
+END OF TEST
+
</ins></span></pre></div>
<a id="trunkLayoutTestsmediavideofullscreeenonlyplaybackhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/media/video-fullscreeen-only-playback.html (0 => 162145)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/media/video-fullscreeen-only-playback.html                                (rev 0)
+++ trunk/LayoutTests/media/video-fullscreeen-only-playback.html        2014-01-16 21:26:53 UTC (rev 162145)
</span><span class="lines">@@ -0,0 +1,77 @@
</span><ins>+&lt;html&gt;
+    &lt;head&gt;
+        &lt;script src=media-file.js&gt;&lt;/script&gt;
+        &lt;script src=video-test.js&gt;&lt;/script&gt;
+        &lt;script src=media-controls.js&gt;&lt;/script&gt;
+        &lt;script&gt;
+
+            function fullscreenchange()
+            {
+                if (document.webkitIsFullScreen)
+                    beginfullscreen();
+                else
+                    endfullscreen();
+            }
+
+            function beginfullscreen()
+            {
+                consoleWrite(&quot;&lt;br&gt;** Entered fullscreen&quot;);
+                testExpected(&quot;video.webkitDisplayingFullscreen&quot;, true);
+                run(&quot;video.webkitExitFullScreen()&quot;);
+            }
+
+            function endfullscreen()
+            {
+                consoleWrite(&quot;&lt;br&gt;** Exited fullscreen&quot;);
+                endTest();
+            }
+
+            function canplaythrough()
+            {
+                testExpected(&quot;video.webkitSupportsFullscreen&quot;, true);
+                testExpected(&quot;video.webkitDisplayingFullscreen&quot;, false);
+
+                consoleWrite(&quot;&lt;br&gt;** Clicking \'play\' button...&quot;);
+
+                var playCoords;
+                try {
+                    playCoords = mediaControlsButtonCoordinates(video, &quot;play-button&quot;);
+                } catch (exception) {
+                    failTest(exception.description);
+                    return;
+                }
+
+                eventSender.mouseMoveTo(playCoords[0], playCoords[1]);
+                eventSender.mouseDown();
+                eventSender.mouseUp();
+            }
+
+
+            function start()
+            {
+                if (!window.internals) {
+                    failTest('This test requires window.internals.');
+                    return;
+                }
+
+                video = document.getElementsByTagName('video')[0];
+                waitForEvent(&quot;canplaythrough&quot;, canplaythrough);
+                waitForEvent('playing');
+
+                video.addEventListener('webkitbeginfullscreen', beginfullscreen, true);
+                video.addEventListener('webkitendfullscreen', endfullscreen, true);
+                video.addEventListener('webkitfullscreenchange', fullscreenchange, true);
+
+                video.src = findMediaFile(&quot;video&quot;, &quot;content/test&quot;);
+
+                run(&quot;internals.setMediaSessionRestrictions('video', 'InlineVideoPlaybackRestricted')&quot;);
+                consoleWrite(&quot;&quot;);
+            }
+        &lt;/script&gt;
+    &lt;/head&gt;
+
+    &lt;body onload=&quot;start()&quot;&gt;
+        &lt;video controls&gt;&lt;/video&gt;
+        &lt;p&gt;Test play() when &amp;lt;video&amp;gt; playback requires fullscreen.&lt;/p&gt;
+    &lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (162144 => 162145)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-01-16 21:23:23 UTC (rev 162144)
+++ trunk/Source/WebCore/ChangeLog        2014-01-16 21:26:53 UTC (rev 162145)
</span><span class="lines">@@ -1,3 +1,39 @@
</span><ins>+2014-01-16  Eric Carlson  &lt;eric.carlson@apple.com&gt;
+
+        Allow MediaSessionManager to restrict inline &lt;video&gt; playback
+        https://bugs.webkit.org/show_bug.cgi?id=127113
+
+        Reviewed by Jer Noble.
+
+        Test: media/video-fullscreeen-only-playback.html
+
+        * html/HTMLMediaElement.cpp:
+        (WebCore::HTMLMediaElement::updatePlayState): Drive-by change to not tell the media session that
+            playback is starting if the media player is already playing. Enter fullscreen if the media
+            session says it is required.
+
+        * html/HTMLMediaSession.cpp:
+        (WebCore::HTMLMediaSession::clientWillBeginPlayback): Make it const.
+        (WebCore::HTMLMediaSession::requiresFullscreenForVideoPlayback): New, see if the specified
+            media element must be played in fullscreen based on the media session settings, document
+            settings, and attributes.
+        * html/HTMLMediaSession.h:
+
+        * platform/audio/MediaSession.h: pauseSession shouldn't be virtual.
+
+        * platform/audio/MediaSessionManager.cpp:
+        (WebCore::MediaSessionManager::sessionWillBeginPlayback): Return immediately if ConcurrentPlaybackNotPermitted
+            is not set.
+        (WebCore::MediaSessionManager::sessionRestrictsInlineVideoPlayback): New.
+        * platform/audio/MediaSessionManager.h:
+
+        * platform/audio/ios/MediaSessionManagerIOS.mm:
+        (WebCore::MediaSessionManageriOS::MediaSessionManageriOS): Set InlineVideoPlaybackRestricted if
+            running on an iPhone or iPod class device.
+
+        * testing/Internals.cpp:
+        (WebCore::Internals::setMediaSessionRestrictions): Support InlineVideoPlaybackRestricted.
+
</ins><span class="cx"> 2014-01-16  Roger Fong  &lt;roger_fong@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Add support for handling WebGL load policies.
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLMediaElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (162144 => 162145)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLMediaElement.cpp        2014-01-16 21:23:23 UTC (rev 162144)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp        2014-01-16 21:26:53 UTC (rev 162145)
</span><span class="lines">@@ -4255,10 +4255,10 @@
</span><span class="cx">         setDisplayMode(Video);
</span><span class="cx">         invalidateCachedTime();
</span><span class="cx"> 
</span><del>-        m_mediaSession-&gt;clientWillBeginPlayback();
</del><ins>+        if (playerPaused) {
+            m_mediaSession-&gt;clientWillBeginPlayback();
</ins><span class="cx"> 
</span><del>-        if (playerPaused) {
-            if (!m_isFullscreen &amp;&amp; isVideo() &amp;&amp; document().page() &amp;&amp; document().page()-&gt;chrome().requiresFullscreenForVideoPlayback())
</del><ins>+            if (m_mediaSession-&gt;requiresFullscreenForVideoPlayback(*this))
</ins><span class="cx">                 enterFullscreen();
</span><span class="cx"> 
</span><span class="cx">             // Set rate, muted before calling play in case they were set before the media engine was setup.
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLMediaSessioncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLMediaSession.cpp (162144 => 162145)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLMediaSession.cpp        2014-01-16 21:23:23 UTC (rev 162144)
+++ trunk/Source/WebCore/html/HTMLMediaSession.cpp        2014-01-16 21:26:53 UTC (rev 162145)
</span><span class="lines">@@ -35,6 +35,10 @@
</span><span class="cx"> #include &quot;Page.h&quot;
</span><span class="cx"> #include &quot;ScriptController.h&quot;
</span><span class="cx"> 
</span><ins>+#if PLATFORM(IOS)
+#include &quot;RuntimeApplicationChecksIOS.h&quot;
+#endif
+
</ins><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="cx"> std::unique_ptr&lt;HTMLMediaSession&gt; HTMLMediaSession::create(MediaSessionClient&amp; client)
</span><span class="lines">@@ -122,16 +126,31 @@
</span><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-void HTMLMediaSession::clientWillBeginPlayback()
</del><ins>+void HTMLMediaSession::clientWillBeginPlayback() const
</ins><span class="cx"> {
</span><span class="cx">     MediaSessionManager::sharedManager().sessionWillBeginPlayback(*this);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void HTMLMediaSession::pauseSession()
</del><ins>+bool HTMLMediaSession::requiresFullscreenForVideoPlayback(const HTMLMediaElement&amp; element) const
</ins><span class="cx"> {
</span><del>-    client().pausePlayback();
</del><ins>+    if (!MediaSessionManager::sharedManager().sessionRestrictsInlineVideoPlayback(*this))
+        return false;
+
+    Settings* settings = element.document().settings();
+    if (!settings || !settings-&gt;mediaPlaybackAllowsInline())
+        return true;
+
+    if (element.fastHasAttribute(HTMLNames::webkit_playsinlineAttr))
+        return false;
+
+#if PLATFORM(IOS)
+    if (applicationIsDumpRenderTree())
+        return false;
+#endif
+
+    return true;
</ins><span class="cx"> }
</span><del>- 
</del><ins>+
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #endif // ENABLE(VIDEO)
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLMediaSessionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLMediaSession.h (162144 => 162145)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLMediaSession.h        2014-01-16 21:23:23 UTC (rev 162144)
+++ trunk/Source/WebCore/html/HTMLMediaSession.h        2014-01-16 21:26:53 UTC (rev 162145)
</span><span class="lines">@@ -41,10 +41,8 @@
</span><span class="cx">     HTMLMediaSession(MediaSessionClient&amp;);
</span><span class="cx">     virtual ~HTMLMediaSession() { }
</span><span class="cx"> 
</span><del>-    void clientWillBeginPlayback();
</del><ins>+    void clientWillBeginPlayback() const;
</ins><span class="cx"> 
</span><del>-    virtual void pauseSession() override;
-
</del><span class="cx">     bool playbackPermitted(const HTMLMediaElement&amp;) const;
</span><span class="cx">     bool dataLoadingPermitted(const HTMLMediaElement&amp;) const;
</span><span class="cx">     bool fullscreenPermitted(const HTMLMediaElement&amp;) const;
</span><span class="lines">@@ -53,6 +51,7 @@
</span><span class="cx"> #if ENABLE(IOS_AIRPLAY)
</span><span class="cx">     bool showingPlaybackTargetPickerPermitted(const HTMLMediaElement&amp;) const;
</span><span class="cx"> #endif
</span><ins>+    bool requiresFullscreenForVideoPlayback(const HTMLMediaElement&amp;) const;
</ins><span class="cx"> 
</span><span class="cx">     // Restrictions to modify default behaviors.
</span><span class="cx">     enum BehaviorRestrictionFlags {
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformaudioMediaSessionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/audio/MediaSession.h (162144 => 162145)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/audio/MediaSession.h        2014-01-16 21:23:23 UTC (rev 162144)
+++ trunk/Source/WebCore/platform/audio/MediaSession.h        2014-01-16 21:26:53 UTC (rev 162145)
</span><span class="lines">@@ -62,7 +62,7 @@
</span><span class="cx">     void beginInterruption();
</span><span class="cx">     void endInterruption(EndInterruptionFlags);
</span><span class="cx"> 
</span><del>-    virtual void pauseSession();
</del><ins>+    void pauseSession();
</ins><span class="cx"> 
</span><span class="cx"> protected:
</span><span class="cx">     MediaSessionClient&amp; client() const { return m_client; }
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformaudioMediaSessionManagercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/audio/MediaSessionManager.cpp (162144 => 162145)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/audio/MediaSessionManager.cpp        2014-01-16 21:23:23 UTC (rev 162144)
+++ trunk/Source/WebCore/platform/audio/MediaSessionManager.cpp        2014-01-16 21:26:53 UTC (rev 162145)
</span><span class="lines">@@ -126,11 +126,11 @@
</span><span class="cx">     return m_restrictions[type];
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void MediaSessionManager::sessionWillBeginPlayback(MediaSession&amp; session)
</del><ins>+void MediaSessionManager::sessionWillBeginPlayback(const MediaSession&amp; session) const
</ins><span class="cx"> {
</span><span class="cx">     MediaSession::MediaType sessionType = session.mediaType();
</span><span class="cx">     SessionRestrictions restrictions = m_restrictions[sessionType];
</span><del>-    if (restrictions == NoRestrictions)
</del><ins>+    if (!restrictions &amp; ConcurrentPlaybackNotPermitted)
</ins><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     for (auto* oneSession : m_sessions) {
</span><span class="lines">@@ -143,6 +143,15 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+bool MediaSessionManager::sessionRestrictsInlineVideoPlayback(const MediaSession&amp; session) const
+{
+    MediaSession::MediaType sessionType = session.mediaType();
+    if (sessionType != MediaSession::Video)
+        return false;
+
+    return m_restrictions[sessionType] &amp; InlineVideoPlaybackRestricted;
+}
+
</ins><span class="cx"> #if !PLATFORM(MAC)
</span><span class="cx"> void MediaSessionManager::updateSessionState()
</span><span class="cx"> {
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformaudioMediaSessionManagerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/audio/MediaSessionManager.h (162144 => 162145)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/audio/MediaSessionManager.h        2014-01-16 21:23:23 UTC (rev 162144)
+++ trunk/Source/WebCore/platform/audio/MediaSessionManager.h        2014-01-16 21:26:53 UTC (rev 162145)
</span><span class="lines">@@ -49,6 +49,7 @@
</span><span class="cx">     enum SessionRestrictionFlags {
</span><span class="cx">         NoRestrictions = 0,
</span><span class="cx">         ConcurrentPlaybackNotPermitted = 1 &lt;&lt; 0,
</span><ins>+        InlineVideoPlaybackRestricted = 1 &lt;&lt; 0,
</ins><span class="cx">     };
</span><span class="cx">     typedef unsigned SessionRestrictions;
</span><span class="cx">     
</span><span class="lines">@@ -56,7 +57,8 @@
</span><span class="cx">     void removeRestriction(MediaSession::MediaType, SessionRestrictions);
</span><span class="cx">     SessionRestrictions restrictions(MediaSession::MediaType);
</span><span class="cx"> 
</span><del>-    void sessionWillBeginPlayback(MediaSession&amp;);
</del><ins>+    void sessionWillBeginPlayback(const MediaSession&amp;) const;
+    bool sessionRestrictsInlineVideoPlayback(const MediaSession&amp;) const;
</ins><span class="cx"> 
</span><span class="cx"> protected:
</span><span class="cx">     friend class MediaSession;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformaudioiosMediaSessionManagerIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.mm (162144 => 162145)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.mm        2014-01-16 21:23:23 UTC (rev 162144)
+++ trunk/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.mm        2014-01-16 21:26:53 UTC (rev 162145)
</span><span class="lines">@@ -32,6 +32,7 @@
</span><span class="cx"> #import &quot;MediaSession.h&quot;
</span><span class="cx"> #import &quot;SoftLinking.h&quot;
</span><span class="cx"> #import &quot;WebCoreThreadRun.h&quot;
</span><ins>+#import &quot;WebCoreSystemInterface.h&quot;
</ins><span class="cx"> #import &lt;AVFoundation/AVAudioSession.h&gt;
</span><span class="cx"> #import &lt;objc/runtime.h&gt;
</span><span class="cx"> #import &lt;wtf/RetainPtr.h&gt;
</span><span class="lines">@@ -72,6 +73,11 @@
</span><span class="cx">     :MediaSessionManager()
</span><span class="cx">     , m_objcObserver(adoptNS([[WebMediaSessionHelper alloc] initWithCallback:this]))
</span><span class="cx"> {
</span><ins>+    DEFINE_STATIC_LOCAL(wkDeviceClass, deviceClass, iosDeviceClass());
+
+    if (deviceClass == wkDeviceClassiPhone || deviceClass == wkDeviceClassiPod)
+        addRestriction(MediaSession::Video, InlineVideoPlaybackRestricted);
+
</ins><span class="cx">     addRestriction(MediaSession::Video, ConcurrentPlaybackNotPermitted);
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoretestingInternalscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/testing/Internals.cpp (162144 => 162145)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/testing/Internals.cpp        2014-01-16 21:23:23 UTC (rev 162144)
+++ trunk/Source/WebCore/testing/Internals.cpp        2014-01-16 21:26:53 UTC (rev 162145)
</span><span class="lines">@@ -2312,6 +2312,8 @@
</span><span class="cx">     
</span><span class="cx">     if (equalIgnoringCase(restrictionsString, &quot;ConcurrentPlaybackNotPermitted&quot;))
</span><span class="cx">         restrictions = MediaSessionManager::ConcurrentPlaybackNotPermitted;
</span><ins>+    if (equalIgnoringCase(restrictionsString, &quot;InlineVideoPlaybackRestricted&quot;))
+        restrictions += MediaSessionManager::InlineVideoPlaybackRestricted;
</ins><span class="cx">     
</span><span class="cx">     MediaSessionManager::sharedManager().addRestriction(mediaType, restrictions);
</span><span class="cx"> }
</span></span></pre>
</div>
</div>

</body>
</html>