<!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>[166384] trunk/Source</title>
</head>
<body>

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

<h3>Log Message</h3>
<pre>Add support for AirPlay picker in WK2 for iOS.
https://bugs.webkit.org/show_bug.cgi?id=130855
&lt;rdar://problem/15349859&gt;

Source/WebCore: 

Reviewed by Eric Carlson, Joseph Pecoraro and Benjamin Poulain.

Adds support in HTMLMediaSession to display the airplay picker
and to monitor presence of available wireless targets.

* html/HTMLMediaSession.cpp:
(WebCore::HTMLMediaSession::showPlaybackTargetPicker):
(WebCore::HTMLMediaSession::hasWirelessPlaybackTargets):
(WebCore::HTMLMediaSession::setHasPlaybackTargetAvailabilityListeners):
* loader/EmptyClients.h:
* page/ChromeClient.h:
* platform/audio/MediaSessionManager.cpp:
(WebCore::MediaSessionManager::wirelessRoutesAvailableChanged):
* platform/audio/MediaSessionManager.h:
(WebCore::MediaSessionManager::hasWirelessTargetsAvailable):
(WebCore::MediaSessionManager::startMonitoringAirPlayRoutes):
(WebCore::MediaSessionManager::stopMonitoringAirPlayRoutes):
* platform/audio/ios/MediaSessionManagerIOS.h:
* platform/audio/ios/MediaSessionManagerIOS.mm:
(WebCore::MediaSessionManageriOS::hasWirelessTargetsAvailable):
(WebCore::MediaSessionManageriOS::startMonitoringAirPlayRoutes):
(WebCore::MediaSessionManageriOS::stopMonitoringAirPlayRoutes):
(-[WebMediaSessionHelper initWithCallback:]):
(-[WebMediaSessionHelper hasWirelessTargetsAvailable]):
(-[WebMediaSessionHelper startMonitoringAirPlayRoutes]):
(-[WebMediaSessionHelper stopMonitoringAirPlayRoutes]):
(-[WebMediaSessionHelper wirelessRoutesAvailableDidChange:]):
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
(WebCore::MediaPlayerPrivateAVFoundationObjC::wirelessVideoPlaybackDisabled):
(WebCore::MediaPlayerPrivateAVFoundationObjC::setWirelessVideoPlaybackDisabled):

Source/WebKit/ios: 

Reviewed by Eric Carlson, Joseph Pecoraro and Benjamin Poulain.

Adds stub for new WebKit chrome client method.

* WebCoreSupport/WebChromeClientIOS.h:
* WebCoreSupport/WebChromeClientIOS.mm:
(WebChromeClientIOS::showAirPlayRoutePicker):

Source/WebKit2: 

Reviewed by Joseph Pecoraro and Benjamin Poulain.

Adds support to display the airplay picker for iPhone and iPad
in WK2.
The picker on iPad is displayed next to the airplay button.

* UIProcess/PageClient.h:
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* UIProcess/ios/PageClientImplIOS.h:
* UIProcess/ios/PageClientImplIOS.mm:
(WebKit::PageClientImpl::showAirPlayRoutePicker):
* UIProcess/ios/WKContentViewInteraction.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView _showAirPlayRoutePicker:fromRect:]):
* UIProcess/ios/WebPageProxyIOS.mm:
(WebKit::WebPageProxy::showAirPlayRoutePicker):
* UIProcess/ios/forms/WKAirPlayRoutePicker.h: Added.
* UIProcess/ios/forms/WKAirPlayRoutePicker.mm: Added.
(-[WKAirPlayRoutePicker initWithView:]):
(-[WKAirPlayRoutePicker dealloc]):
(-[WKAirPlayRoutePicker popoverControllerDidDismissPopover:]):
(-[WKAirPlayRoutePicker _presentAirPlayPopoverAnimated:fromRect:]):
(-[WKAirPlayRoutePicker _windowWillRotate:]):
(-[WKAirPlayRoutePicker _windowDidRotate:]):
(-[WKAirPlayRoutePicker _dismissAirPlayRoutePickerIPad]):
(-[WKAirPlayRoutePicker showAirPlayPickerIPad:fromRect:]):
(-[WKAirPlayRoutePicker showAirPlayPickerIPhone:]):
(-[WKAirPlayRoutePicker show:fromRect:]):
* WebKit2.xcodeproj/project.pbxproj:
* WebProcess/WebCoreSupport/WebChromeClient.h:
* WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm:
(WebKit::WebChromeClient::showAirPlayRoutePicker):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::touchEvent):
(WebKit::WebPage::touchEventSyncForTesting):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::rectForElementAtInteractionLocation):
(WebKit::WebPage::handleTap):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLMediaSessioncpp">trunk/Source/WebCore/html/HTMLMediaSession.cpp</a></li>
<li><a href="#trunkSourceWebCoreloaderEmptyClientsh">trunk/Source/WebCore/loader/EmptyClients.h</a></li>
<li><a href="#trunkSourceWebCorepageChromeClienth">trunk/Source/WebCore/page/ChromeClient.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="#trunkSourceWebCoreplatformaudioiosMediaSessionManagerIOSh">trunk/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.h</a></li>
<li><a href="#trunkSourceWebCoreplatformaudioiosMediaSessionManagerIOSmm">trunk/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.mm</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsavfoundationobjcMediaPlayerPrivateAVFoundationObjCmm">trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm</a></li>
<li><a href="#trunkSourceWebKitiosChangeLog">trunk/Source/WebKit/ios/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitiosWebCoreSupportWebChromeClientIOSh">trunk/Source/WebKit/ios/WebCoreSupport/WebChromeClientIOS.h</a></li>
<li><a href="#trunkSourceWebKitiosWebCoreSupportWebChromeClientIOSmm">trunk/Source/WebKit/ios/WebCoreSupport/WebChromeClientIOS.mm</a></li>
<li><a href="#trunkSourceWebKitiosWebCoreSupportWebFrameIOSmm">trunk/Source/WebKit/ios/WebCoreSupport/WebFrameIOS.mm</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2UIProcessPageClienth">trunk/Source/WebKit2/UIProcess/PageClient.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebPageProxyh">trunk/Source/WebKit2/UIProcess/WebPageProxy.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebPageProxymessagesin">trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in</a></li>
<li><a href="#trunkSourceWebKit2UIProcessiosPageClientImplIOSh">trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessiosPageClientImplIOSmm">trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessiosWKContentViewInteractionh">trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessiosWKContentViewInteractionmm">trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessiosWebPageProxyIOSmm">trunk/Source/WebKit2/UIProcess/ios/WebPageProxyIOS.mm</a></li>
<li><a href="#trunkSourceWebKit2WebKit2xcodeprojprojectpbxproj">trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebCoreSupportWebChromeClienth">trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebCoreSupportiosWebChromeClientIOSmm">trunk/Source/WebKit2/WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageWebPagecpp">trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageWebPageh">trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageiosWebPageIOSmm">trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2UIProcessiosformsWKAirPlayRoutePickerh">trunk/Source/WebKit2/UIProcess/ios/forms/WKAirPlayRoutePicker.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessiosformsWKAirPlayRoutePickermm">trunk/Source/WebKit2/UIProcess/ios/forms/WKAirPlayRoutePicker.mm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (166383 => 166384)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-03-27 23:40:04 UTC (rev 166383)
+++ trunk/Source/WebCore/ChangeLog        2014-03-27 23:41:46 UTC (rev 166384)
</span><span class="lines">@@ -1,3 +1,40 @@
</span><ins>+2014-03-27  Enrica Casucci  &lt;enrica@apple.com&gt;
+
+        Add support for AirPlay picker in WK2 for iOS.
+        https://bugs.webkit.org/show_bug.cgi?id=130855
+        &lt;rdar://problem/15349859&gt;
+
+        Reviewed by Eric Carlson, Joseph Pecoraro and Benjamin Poulain.
+
+        Adds support in HTMLMediaSession to display the airplay picker
+        and to monitor presence of available wireless targets.
+
+        * html/HTMLMediaSession.cpp:
+        (WebCore::HTMLMediaSession::showPlaybackTargetPicker):
+        (WebCore::HTMLMediaSession::hasWirelessPlaybackTargets):
+        (WebCore::HTMLMediaSession::setHasPlaybackTargetAvailabilityListeners):
+        * loader/EmptyClients.h:
+        * page/ChromeClient.h:
+        * platform/audio/MediaSessionManager.cpp:
+        (WebCore::MediaSessionManager::wirelessRoutesAvailableChanged):
+        * platform/audio/MediaSessionManager.h:
+        (WebCore::MediaSessionManager::hasWirelessTargetsAvailable):
+        (WebCore::MediaSessionManager::startMonitoringAirPlayRoutes):
+        (WebCore::MediaSessionManager::stopMonitoringAirPlayRoutes):
+        * platform/audio/ios/MediaSessionManagerIOS.h:
+        * platform/audio/ios/MediaSessionManagerIOS.mm:
+        (WebCore::MediaSessionManageriOS::hasWirelessTargetsAvailable):
+        (WebCore::MediaSessionManageriOS::startMonitoringAirPlayRoutes):
+        (WebCore::MediaSessionManageriOS::stopMonitoringAirPlayRoutes):
+        (-[WebMediaSessionHelper initWithCallback:]):
+        (-[WebMediaSessionHelper hasWirelessTargetsAvailable]):
+        (-[WebMediaSessionHelper startMonitoringAirPlayRoutes]):
+        (-[WebMediaSessionHelper stopMonitoringAirPlayRoutes]):
+        (-[WebMediaSessionHelper wirelessRoutesAvailableDidChange:]):
+        * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
+        (WebCore::MediaPlayerPrivateAVFoundationObjC::wirelessVideoPlaybackDisabled):
+        (WebCore::MediaPlayerPrivateAVFoundationObjC::setWirelessVideoPlaybackDisabled):
+
</ins><span class="cx"> 2014-03-27  Bem Jones-Bey  &lt;bjonesbe@adobe.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [CSS Shapes][css clip-path] rounded corner calculation for box shapes is wrong
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLMediaSessioncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLMediaSession.cpp (166383 => 166384)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLMediaSession.cpp        2014-03-27 23:40:04 UTC (rev 166383)
+++ trunk/Source/WebCore/html/HTMLMediaSession.cpp        2014-03-27 23:41:46 UTC (rev 166384)
</span><span class="lines">@@ -29,6 +29,9 @@
</span><span class="cx"> 
</span><span class="cx"> #include &quot;HTMLMediaSession.h&quot;
</span><span class="cx"> 
</span><ins>+#include &quot;Chrome.h&quot;
+#include &quot;ChromeClient.h&quot;
+#include &quot;Frame.h&quot;
</ins><span class="cx"> #include &quot;HTMLMediaElement.h&quot;
</span><span class="cx"> #include &quot;HTMLNames.h&quot;
</span><span class="cx"> #include &quot;Logging.h&quot;
</span><span class="lines">@@ -205,7 +208,9 @@
</span><span class="cx">     }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-    MediaSessionManager::sharedManager().showPlaybackTargetPicker();
</del><ins>+#if PLATFORM(IOS)
+    element.document().frame()-&gt;page()-&gt;chrome().client().showPlaybackTargetPicker(element.hasVideo());
+#endif
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool HTMLMediaSession::hasWirelessPlaybackTargets(const HTMLMediaElement&amp; element) const
</span><span class="lines">@@ -222,9 +227,7 @@
</span><span class="cx">     UNUSED_PARAM(element);
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-    // FIXME: this only lets us know if the current element is playing to an external target, we want to
-    // know if there are *any* external targets.
-    bool hasTargets = currentPlaybackTargetIsWireless(element);
</del><ins>+    bool hasTargets = MediaSessionManager::sharedManager().hasWirelessTargetsAvailable();
</ins><span class="cx">     LOG(Media, &quot;HTMLMediaSession::hasWirelessPlaybackTargets - returning %s&quot;, hasTargets ? &quot;TRUE&quot; : &quot;FALSE&quot;);
</span><span class="cx"> 
</span><span class="cx">     return hasTargets;
</span><span class="lines">@@ -290,11 +293,13 @@
</span><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> #else
</span><del>-    UNUSED_PARAM(hasListeners);
</del><span class="cx">     UNUSED_PARAM(element);
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-    notImplemented();
</del><ins>+    if (hasListeners)
+        MediaSessionManager::sharedManager().startMonitoringAirPlayRoutes();
+    else
+        MediaSessionManager::sharedManager().stopMonitoringAirPlayRoutes();
</ins><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderEmptyClientsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/EmptyClients.h (166383 => 166384)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/EmptyClients.h        2014-03-27 23:40:04 UTC (rev 166383)
+++ trunk/Source/WebCore/loader/EmptyClients.h        2014-03-27 23:41:46 UTC (rev 166384)
</span><span class="lines">@@ -207,6 +207,7 @@
</span><span class="cx">     virtual void removeScrollingLayer(Node*, PlatformLayer*, PlatformLayer*) override { }
</span><span class="cx"> 
</span><span class="cx">     virtual void webAppOrientationsUpdated() override { };
</span><ins>+    virtual void showPlaybackTargetPicker(bool) override { };
</ins><span class="cx"> #endif // PLATFORM(IOS)
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(IOS)
</span></span></pre></div>
<a id="trunkSourceWebCorepageChromeClienth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/ChromeClient.h (166383 => 166384)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/ChromeClient.h        2014-03-27 23:40:04 UTC (rev 166383)
+++ trunk/Source/WebCore/page/ChromeClient.h        2014-03-27 23:41:46 UTC (rev 166384)
</span><span class="lines">@@ -257,6 +257,7 @@
</span><span class="cx">     virtual void removeScrollingLayer(Node*, PlatformLayer* scrollingLayer, PlatformLayer* contentsLayer) = 0;
</span><span class="cx"> 
</span><span class="cx">     virtual void webAppOrientationsUpdated() = 0;
</span><ins>+    virtual void showPlaybackTargetPicker(bool hasVideo) = 0;
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(INPUT_TYPE_COLOR)
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformaudioMediaSessionManagercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/audio/MediaSessionManager.cpp (166383 => 166384)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/audio/MediaSessionManager.cpp        2014-03-27 23:40:04 UTC (rev 166383)
+++ trunk/Source/WebCore/platform/audio/MediaSessionManager.cpp        2014-03-27 23:41:46 UTC (rev 166384)
</span><span class="lines">@@ -29,6 +29,7 @@
</span><span class="cx"> #if ENABLE(VIDEO)
</span><span class="cx"> 
</span><span class="cx"> #include &quot;Logging.h&quot;
</span><ins>+#include &quot;NotImplemented.h&quot;
</ins><span class="cx"> #include &quot;MediaSession.h&quot;
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="lines">@@ -276,6 +277,11 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void MediaSessionManager::wirelessRoutesAvailableChanged()
+{
+    notImplemented();
+}
+
</ins><span class="cx"> #if !PLATFORM(COCOA)
</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 (166383 => 166384)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/audio/MediaSessionManager.h        2014-03-27 23:40:04 UTC (rev 166383)
+++ trunk/Source/WebCore/platform/audio/MediaSessionManager.h        2014-03-27 23:41:46 UTC (rev 166384)
</span><span class="lines">@@ -65,6 +65,7 @@
</span><span class="cx"> 
</span><span class="cx">     void applicationWillEnterForeground() const;
</span><span class="cx">     void applicationWillEnterBackground() const;
</span><ins>+    void wirelessRoutesAvailableChanged();
</ins><span class="cx"> 
</span><span class="cx">     enum SessionRestrictionFlags {
</span><span class="cx">         NoRestrictions = 0,
</span><span class="lines">@@ -87,7 +88,9 @@
</span><span class="cx">     bool sessionRestrictsInlineVideoPlayback(const MediaSession&amp;) const;
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(IOS_AIRPLAY)
</span><del>-    virtual void showPlaybackTargetPicker() { }
</del><ins>+    virtual bool hasWirelessTargetsAvailable() { return false; }
+    virtual void startMonitoringAirPlayRoutes() { }
+    virtual void stopMonitoringAirPlayRoutes() { }
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">     virtual void didReceiveRemoteControlCommand(MediaSession::RemoteControlCommandType) override;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformaudioiosMediaSessionManagerIOSh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.h (166383 => 166384)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.h        2014-03-27 23:40:04 UTC (rev 166383)
+++ trunk/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.h        2014-03-27 23:41:46 UTC (rev 166384)
</span><span class="lines">@@ -56,7 +56,9 @@
</span><span class="cx">     virtual void resetRestrictions() override;
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(IOS_AIRPLAY)
</span><del>-    virtual void showPlaybackTargetPicker() override;
</del><ins>+    virtual bool hasWirelessTargetsAvailable() override;
+    virtual void startMonitoringAirPlayRoutes() override;
+    virtual void stopMonitoringAirPlayRoutes() override;
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">     MediaSessionManageriOS();
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformaudioiosMediaSessionManagerIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.mm (166383 => 166384)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.mm        2014-03-27 23:40:04 UTC (rev 166383)
+++ trunk/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.mm        2014-03-27 23:41:46 UTC (rev 166384)
</span><span class="lines">@@ -36,8 +36,10 @@
</span><span class="cx"> #import &quot;WebCoreSystemInterface.h&quot;
</span><span class="cx"> #import &quot;WebCoreThreadRun.h&quot;
</span><span class="cx"> #import &lt;AVFoundation/AVAudioSession.h&gt;
</span><ins>+#import &lt;MediaPlayer/MPAVRoutingController.h&gt;
</ins><span class="cx"> #import &lt;MediaPlayer/MPMediaItem.h&gt;
</span><span class="cx"> #import &lt;MediaPlayer/MPNowPlayingInfoCenter.h&gt;
</span><ins>+#import &lt;MediaPlayer/MPVolumeView.h&gt;
</ins><span class="cx"> #import &lt;UIKit/UIApplication.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">@@ -65,16 +67,21 @@
</span><span class="cx"> #define UIApplicationDidBecomeActiveNotification getUIApplicationDidBecomeActiveNotification()
</span><span class="cx"> 
</span><span class="cx"> SOFT_LINK_FRAMEWORK(MediaPlayer)
</span><ins>+SOFT_LINK_CLASS(MediaPlayer, MPAVRoutingController)
</ins><span class="cx"> SOFT_LINK_CLASS(MediaPlayer, MPNowPlayingInfoCenter)
</span><ins>+SOFT_LINK_CLASS(MediaPlayer, MPVolumeView)
</ins><span class="cx"> SOFT_LINK_POINTER(MediaPlayer, MPMediaItemPropertyTitle, NSString *)
</span><span class="cx"> SOFT_LINK_POINTER(MediaPlayer, MPMediaItemPropertyPlaybackDuration, NSString *)
</span><span class="cx"> SOFT_LINK_POINTER(MediaPlayer, MPNowPlayingInfoPropertyElapsedPlaybackTime, NSString *)
</span><span class="cx"> SOFT_LINK_POINTER(MediaPlayer, MPNowPlayingInfoPropertyPlaybackRate, NSString *)
</span><ins>+SOFT_LINK_POINTER(MediaPlayer, MPVolumeViewWirelessRoutesAvailableDidChangeNotification, NSString *)
</ins><span class="cx"> 
</span><ins>+
</ins><span class="cx"> #define MPMediaItemPropertyTitle getMPMediaItemPropertyTitle()
</span><span class="cx"> #define MPMediaItemPropertyPlaybackDuration getMPMediaItemPropertyPlaybackDuration()
</span><span class="cx"> #define MPNowPlayingInfoPropertyElapsedPlaybackTime getMPNowPlayingInfoPropertyElapsedPlaybackTime()
</span><span class="cx"> #define MPNowPlayingInfoPropertyPlaybackRate getMPNowPlayingInfoPropertyPlaybackRate()
</span><ins>+#define MPVolumeViewWirelessRoutesAvailableDidChangeNotification getMPVolumeViewWirelessRoutesAvailableDidChangeNotification()
</ins><span class="cx"> 
</span><span class="cx"> NSString* WebUIApplicationWillResignActiveNotification = @&quot;WebUIApplicationWillResignActiveNotification&quot;;
</span><span class="cx"> NSString* WebUIApplicationWillEnterForegroundNotification = @&quot;WebUIApplicationWillEnterForegroundNotification&quot;;
</span><span class="lines">@@ -84,6 +91,8 @@
</span><span class="cx"> 
</span><span class="cx"> @interface WebMediaSessionHelper : NSObject {
</span><span class="cx">     MediaSessionManageriOS* _callback;
</span><ins>+    RetainPtr&lt;MPVolumeView&gt; _volumeView;
+    RetainPtr&lt;MPAVRoutingController&gt; _airPlayPresenceRoutingController;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (id)initWithCallback:(MediaSessionManageriOS*)callback;
</span><span class="lines">@@ -91,6 +100,9 @@
</span><span class="cx"> - (void)interruption:(NSNotification *)notification;
</span><span class="cx"> - (void)applicationWillEnterForeground:(NSNotification *)notification;
</span><span class="cx"> - (void)applicationWillResignActive:(NSNotification *)notification;
</span><ins>+- (BOOL)hasWirelessTargetsAvailable;
+- (void)startMonitoringAirPlayRoutes;
+- (void)stopMonitoringAirPlayRoutes;
</ins><span class="cx"> @end
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="lines">@@ -131,10 +143,21 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(IOS_AIRPLAY)
</span><del>-void MediaSessionManageriOS::showPlaybackTargetPicker()
</del><ins>+
+bool MediaSessionManageriOS::hasWirelessTargetsAvailable()
</ins><span class="cx"> {
</span><del>-    notImplemented();
</del><ins>+    return [m_objcObserver hasWirelessTargetsAvailable];
</ins><span class="cx"> }
</span><ins>+
+void MediaSessionManageriOS::startMonitoringAirPlayRoutes()
+{
+    [m_objcObserver startMonitoringAirPlayRoutes];
+}
+
+void MediaSessionManageriOS::stopMonitoringAirPlayRoutes()
+{
+    [m_objcObserver stopMonitoringAirPlayRoutes];
+}
</ins><span class="cx"> #endif
</span><span class="cx">     
</span><span class="cx"> void MediaSessionManageriOS::sessionWillBeginPlayback(MediaSession&amp; session)
</span><span class="lines">@@ -187,6 +210,7 @@
</span><span class="cx">         return nil;
</span><span class="cx">     
</span><span class="cx">     _callback = callback;
</span><ins>+    _volumeView = adoptNS([[getMPVolumeViewClass() alloc] init]);
</ins><span class="cx"> 
</span><span class="cx">     NSNotificationCenter *center = [NSNotificationCenter defaultCenter];
</span><span class="cx">     [center addObserver:self selector:@selector(interruption:) name:AVAudioSessionInterruptionNotification object:[AVAudioSession sharedInstance]];
</span><span class="lines">@@ -197,7 +221,8 @@
</span><span class="cx">     [center addObserver:self selector:@selector(applicationDidBecomeActive:) name:WebUIApplicationDidBecomeActiveNotification object:nil];
</span><span class="cx">     [center addObserver:self selector:@selector(applicationWillResignActive:) name:UIApplicationWillResignActiveNotification object:nil];
</span><span class="cx">     [center addObserver:self selector:@selector(applicationWillResignActive:) name:WebUIApplicationWillResignActiveNotification object:nil];
</span><del>-    
</del><ins>+    [center addObserver:self selector:@selector(wirelessRoutesAvailableDidChange:) name:MPVolumeViewWirelessRoutesAvailableDidChangeNotification object:_volumeView.get()];
+
</ins><span class="cx">     // Now playing won't work unless we turn on the delivery of remote control events.
</span><span class="cx">     [[UIApplication sharedApplication] beginReceivingRemoteControlEvents];
</span><span class="cx">     
</span><span class="lines">@@ -215,6 +240,25 @@
</span><span class="cx">     _callback = nil;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+- (BOOL)hasWirelessTargetsAvailable
+{
+    return [_volumeView areWirelessRoutesAvailable];
+}
+
+- (void)startMonitoringAirPlayRoutes
+{
+    if (_airPlayPresenceRoutingController)
+        return;
+
+    _airPlayPresenceRoutingController = adoptNS([[getMPAVRoutingControllerClass() alloc] initWithName:@&quot;WebCore - HTML media element checking for AirPlay route presence&quot;]);
+    [_airPlayPresenceRoutingController setDiscoveryMode:MPRouteDiscoveryModePresence];
+}
+
+- (void)stopMonitoringAirPlayRoutes
+{
+    _airPlayPresenceRoutingController = nil;
+}
+
</ins><span class="cx"> - (void)interruption:(NSNotification *)notification
</span><span class="cx"> {
</span><span class="cx">     if (!_callback)
</span><span class="lines">@@ -283,6 +327,20 @@
</span><span class="cx">     });
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+- (void)wirelessRoutesAvailableDidChange:(NSNotification *)notification
+{
+    UNUSED_PARAM(notification);
+
+    if (!_callback)
+        return;
+
+    WebThreadRun(^{
+        if (!_callback)
+            return;
+
+        _callback-&gt;wirelessRoutesAvailableChanged();
+    });
+}
</ins><span class="cx"> @end
</span><span class="cx"> 
</span><span class="cx"> #endif // PLATFORM(IOS)
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsavfoundationobjcMediaPlayerPrivateAVFoundationObjCmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm (166383 => 166384)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm        2014-03-27 23:40:04 UTC (rev 166383)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm        2014-03-27 23:41:46 UTC (rev 166384)
</span><span class="lines">@@ -2134,7 +2134,7 @@
</span><span class="cx">     if (!m_avPlayer)
</span><span class="cx">         return !m_allowsWirelessVideoPlayback;
</span><span class="cx">     
</span><del>-    m_allowsWirelessVideoPlayback = ![m_avPlayer.get() allowsExternalPlayback];
</del><ins>+    m_allowsWirelessVideoPlayback = [m_avPlayer.get() allowsExternalPlayback];
</ins><span class="cx">     LOG(Media, &quot;MediaPlayerPrivateAVFoundationObjC::wirelessVideoPlaybackDisabled(%p) - returning %s&quot;, this, boolString(!m_allowsWirelessVideoPlayback));
</span><span class="cx"> 
</span><span class="cx">     return !m_allowsWirelessVideoPlayback;
</span><span class="lines">@@ -2147,7 +2147,7 @@
</span><span class="cx">     if (!m_avPlayer)
</span><span class="cx">         return;
</span><span class="cx">     
</span><del>-    [m_avPlayer.get() setAllowsExternalPlayback:disabled];
</del><ins>+    [m_avPlayer.get() setAllowsExternalPlayback:!disabled];
</ins><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKitiosChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/ios/ChangeLog (166383 => 166384)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/ios/ChangeLog        2014-03-27 23:40:04 UTC (rev 166383)
+++ trunk/Source/WebKit/ios/ChangeLog        2014-03-27 23:41:46 UTC (rev 166384)
</span><span class="lines">@@ -1,3 +1,17 @@
</span><ins>+2014-03-27  Enrica Casucci  &lt;enrica@apple.com&gt;
+
+        Add support for AirPlay picker in WK2 for iOS.
+        https://bugs.webkit.org/show_bug.cgi?id=130855
+        &lt;rdar://problem/15349859&gt;
+
+        Reviewed by Eric Carlson, Joseph Pecoraro and Benjamin Poulain.
+
+        Adds stub for new WebKit chrome client method.
+
+        * WebCoreSupport/WebChromeClientIOS.h:
+        * WebCoreSupport/WebChromeClientIOS.mm:
+        (WebChromeClientIOS::showAirPlayRoutePicker):
+
</ins><span class="cx"> 2014-03-25  Joseph Pecoraro  &lt;pecoraro@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [iOS] Inspector View Indication Support
</span></span></pre></div>
<a id="trunkSourceWebKitiosWebCoreSupportWebChromeClientIOSh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/ios/WebCoreSupport/WebChromeClientIOS.h (166383 => 166384)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/ios/WebCoreSupport/WebChromeClientIOS.h        2014-03-27 23:40:04 UTC (rev 166383)
+++ trunk/Source/WebKit/ios/WebCoreSupport/WebChromeClientIOS.h        2014-03-27 23:41:46 UTC (rev 166384)
</span><span class="lines">@@ -83,6 +83,7 @@
</span><span class="cx"> 
</span><span class="cx">     virtual void webAppOrientationsUpdated() override;
</span><span class="cx">     virtual void focusedElementChanged(WebCore::Element*) override;
</span><ins>+    virtual void showPlaybackTargetPicker(bool hasVideo) override;
</ins><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     int m_formNotificationSuppressions;
</span></span></pre></div>
<a id="trunkSourceWebKitiosWebCoreSupportWebChromeClientIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/ios/WebCoreSupport/WebChromeClientIOS.mm (166383 => 166384)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/ios/WebCoreSupport/WebChromeClientIOS.mm        2014-03-27 23:40:04 UTC (rev 166383)
+++ trunk/Source/WebKit/ios/WebCoreSupport/WebChromeClientIOS.mm        2014-03-27 23:41:46 UTC (rev 166384)
</span><span class="lines">@@ -33,6 +33,7 @@
</span><span class="cx"> #import &quot;WebFixedPositionContent.h&quot;
</span><span class="cx"> #import &quot;WebFixedPositionContentInternal.h&quot;
</span><span class="cx"> #import &quot;WebFormDelegate.h&quot;
</span><ins>+#import &quot;WebFrameIOS.h&quot;
</ins><span class="cx"> #import &quot;WebFrameInternal.h&quot;
</span><span class="cx"> #import &quot;WebKitSystemInterface.h&quot;
</span><span class="cx"> #import &quot;WebOpenPanelResultListener.h&quot;
</span><span class="lines">@@ -313,4 +314,8 @@
</span><span class="cx">     CallFormDelegate(webView(), @selector(didFocusTextField:inFrame:), kit(inputElement), kit(inputElement-&gt;document().frame()));
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void WebChromeClientIOS::showPlaybackTargetPicker(bool hasVideo)
+{
+}
+
</ins><span class="cx"> #endif // PLATFORM(IOS)
</span></span></pre></div>
<a id="trunkSourceWebKitiosWebCoreSupportWebFrameIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/ios/WebCoreSupport/WebFrameIOS.mm (166383 => 166384)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/ios/WebCoreSupport/WebFrameIOS.mm        2014-03-27 23:40:04 UTC (rev 166383)
+++ trunk/Source/WebKit/ios/WebCoreSupport/WebFrameIOS.mm        2014-03-27 23:41:46 UTC (rev 166384)
</span><span class="lines">@@ -30,6 +30,7 @@
</span><span class="cx"> #import &lt;WebCore/Editor.h&gt;
</span><span class="cx"> #import &lt;WebCore/Element.h&gt;
</span><span class="cx"> #import &lt;WebCore/DocumentMarkerController.h&gt;
</span><ins>+#import &lt;WebCore/EventHandler.h&gt;
</ins><span class="cx"> #import &lt;WebCore/FloatRect.h&gt;
</span><span class="cx"> #import &lt;WebCore/Frame.h&gt;
</span><span class="cx"> #import &lt;WebCore/FrameSelection.h&gt;
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (166383 => 166384)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-03-27 23:40:04 UTC (rev 166383)
+++ trunk/Source/WebKit2/ChangeLog        2014-03-27 23:41:46 UTC (rev 166384)
</span><span class="lines">@@ -1,3 +1,50 @@
</span><ins>+2014-03-27  Enrica Casucci  &lt;enrica@apple.com&gt;
+
+        Add support for AirPlay picker in WK2 for iOS.
+        https://bugs.webkit.org/show_bug.cgi?id=130855
+        &lt;rdar://problem/15349859&gt;
+
+        Reviewed by Joseph Pecoraro and Benjamin Poulain.
+
+        Adds support to display the airplay picker for iPhone and iPad
+        in WK2.
+        The picker on iPad is displayed next to the airplay button.
+
+        * UIProcess/PageClient.h:
+        * UIProcess/WebPageProxy.h:
+        * UIProcess/WebPageProxy.messages.in:
+        * UIProcess/ios/PageClientImplIOS.h:
+        * UIProcess/ios/PageClientImplIOS.mm:
+        (WebKit::PageClientImpl::showAirPlayRoutePicker):
+        * UIProcess/ios/WKContentViewInteraction.h:
+        * UIProcess/ios/WKContentViewInteraction.mm:
+        (-[WKContentView _showAirPlayRoutePicker:fromRect:]):
+        * UIProcess/ios/WebPageProxyIOS.mm:
+        (WebKit::WebPageProxy::showAirPlayRoutePicker):
+        * UIProcess/ios/forms/WKAirPlayRoutePicker.h: Added.
+        * UIProcess/ios/forms/WKAirPlayRoutePicker.mm: Added.
+        (-[WKAirPlayRoutePicker initWithView:]):
+        (-[WKAirPlayRoutePicker dealloc]):
+        (-[WKAirPlayRoutePicker popoverControllerDidDismissPopover:]):
+        (-[WKAirPlayRoutePicker _presentAirPlayPopoverAnimated:fromRect:]):
+        (-[WKAirPlayRoutePicker _windowWillRotate:]):
+        (-[WKAirPlayRoutePicker _windowDidRotate:]):
+        (-[WKAirPlayRoutePicker _dismissAirPlayRoutePickerIPad]):
+        (-[WKAirPlayRoutePicker showAirPlayPickerIPad:fromRect:]):
+        (-[WKAirPlayRoutePicker showAirPlayPickerIPhone:]):
+        (-[WKAirPlayRoutePicker show:fromRect:]):
+        * WebKit2.xcodeproj/project.pbxproj:
+        * WebProcess/WebCoreSupport/WebChromeClient.h:
+        * WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm:
+        (WebKit::WebChromeClient::showAirPlayRoutePicker):
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::touchEvent):
+        (WebKit::WebPage::touchEventSyncForTesting):
+        * WebProcess/WebPage/WebPage.h:
+        * WebProcess/WebPage/ios/WebPageIOS.mm:
+        (WebKit::WebPage::rectForElementAtInteractionLocation):
+        (WebKit::WebPage::handleTap):
+
</ins><span class="cx"> 2014-03-27  Benjamin Poulain  &lt;bpoulain@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [WK2][iOS] &lt;rdar://problem/16414684&gt; WKWebView should draw a white background before the page loads
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessPageClienth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/PageClient.h (166383 => 166384)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/PageClient.h        2014-03-27 23:40:04 UTC (rev 166383)
+++ trunk/Source/WebKit2/UIProcess/PageClient.h        2014-03-27 23:41:46 UTC (rev 166384)
</span><span class="lines">@@ -249,6 +249,7 @@
</span><span class="cx">     virtual void positionInformationDidChange(const InteractionInformationAtPosition&amp;) = 0;
</span><span class="cx">     virtual void saveImageToLibrary(PassRefPtr&lt;WebCore::SharedBuffer&gt;) = 0;
</span><span class="cx">     virtual void didUpdateBlockSelectionWithTouch(uint32_t touch, uint32_t flags, float growThreshold, float shrinkThreshold) = 0;
</span><ins>+    virtual void showPlaybackTargetPicker(bool hasVideo, const WebCore::IntRect&amp; elementRect) = 0;
</ins><span class="cx"> 
</span><span class="cx"> #if ENABLE(INSPECTOR)
</span><span class="cx">     virtual void showInspectorIndication() = 0;
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebPageProxyh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (166383 => 166384)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h        2014-03-27 23:40:04 UTC (rev 166383)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h        2014-03-27 23:41:46 UTC (rev 166384)
</span><span class="lines">@@ -1286,6 +1286,7 @@
</span><span class="cx">     void autocorrectionContextCallback(const String&amp;, const String&amp;, const String&amp;, const String&amp;, uint64_t, uint64_t, uint64_t);
</span><span class="cx">     void dictationContextCallback(const String&amp;, const String&amp;, const String&amp;, uint64_t);
</span><span class="cx">     void interpretKeyEvent(const EditorState&amp;, bool isCharEvent, bool&amp; handled);
</span><ins>+    void showPlaybackTargetPicker(bool hasVideo, const WebCore::IntRect&amp; elementRect);
</ins><span class="cx"> #endif
</span><span class="cx"> #if PLATFORM(GTK)
</span><span class="cx">     void printFinishedCallback(const WebCore::ResourceError&amp;, uint64_t);
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebPageProxymessagesin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in (166383 => 166384)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in        2014-03-27 23:40:04 UTC (rev 166383)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in        2014-03-27 23:41:46 UTC (rev 166384)
</span><span class="lines">@@ -167,6 +167,7 @@
</span><span class="cx">     DidReceivePositionInformation(WebKit::InteractionInformationAtPosition information)
</span><span class="cx">     SaveImageToLibrary(WebKit::SharedMemory::Handle handle, uint64_t size)
</span><span class="cx">     DidUpdateBlockSelectionWithTouch(uint32_t touch, uint32_t flags, float growThreshold, float shrinkThreshold)
</span><ins>+    ShowPlaybackTargetPicker(bool hasVideo, WebCore::IntRect elementRect)
</ins><span class="cx"> #endif
</span><span class="cx"> #if PLATFORM(GTK)
</span><span class="cx">     PrintFinishedCallback(WebCore::ResourceError error, uint64_t callbackID)
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessiosPageClientImplIOSh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.h (166383 => 166384)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.h        2014-03-27 23:40:04 UTC (rev 166383)
+++ trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.h        2014-03-27 23:41:46 UTC (rev 166384)
</span><span class="lines">@@ -113,6 +113,7 @@
</span><span class="cx">     virtual void positionInformationDidChange(const InteractionInformationAtPosition&amp;);
</span><span class="cx">     virtual void saveImageToLibrary(PassRefPtr&lt;WebCore::SharedBuffer&gt;);
</span><span class="cx">     virtual void didUpdateBlockSelectionWithTouch(uint32_t touch, uint32_t flags, float growThreshold, float shrinkThreshold);
</span><ins>+    virtual void showPlaybackTargetPicker(bool hasVideo, const WebCore::IntRect&amp; elementRect) override;
</ins><span class="cx"> 
</span><span class="cx"> #if ENABLE(INSPECTOR)
</span><span class="cx">     virtual void showInspectorIndication() override;
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessiosPageClientImplIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.mm (166383 => 166384)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.mm        2014-03-27 23:40:04 UTC (rev 166383)
+++ trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.mm        2014-03-27 23:41:46 UTC (rev 166384)
</span><span class="lines">@@ -363,6 +363,11 @@
</span><span class="cx">     [m_contentView _didUpdateBlockSelectionWithTouch:(WKSelectionTouch)touch withFlags:(WKSelectionFlags)flags growThreshold:growThreshold shrinkThreshold:shrinkThreshold];
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void PageClientImpl::showPlaybackTargetPicker(bool hasVideo, const IntRect&amp; elementRect)
+{
+    [m_contentView _showPlaybackTargetPicker:hasVideo fromRect:elementRect];
+}
+
</ins><span class="cx"> #if ENABLE(INSPECTOR)
</span><span class="cx"> void PageClientImpl::showInspectorIndication()
</span><span class="cx"> {
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessiosWKContentViewInteractionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.h (166383 => 166384)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.h        2014-03-27 23:40:04 UTC (rev 166383)
+++ trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.h        2014-03-27 23:41:46 UTC (rev 166384)
</span><span class="lines">@@ -29,6 +29,7 @@
</span><span class="cx"> 
</span><span class="cx"> #import &quot;AssistedNodeInformation.h&quot;
</span><span class="cx"> #import &quot;InteractionInformationAtPosition.h&quot;
</span><ins>+#import &quot;WKAirPlayRoutePicker.h&quot;
</ins><span class="cx"> #import &quot;WKFormPeripheral.h&quot;
</span><span class="cx"> #import &quot;WKGestureTypes.h&quot;
</span><span class="cx"> #import &lt;UIKit/UITextInput_Private.h&gt;
</span><span class="lines">@@ -95,6 +96,7 @@
</span><span class="cx">     RetainPtr&lt;_UIHighlightView&gt; _highlightView;
</span><span class="cx">     RetainPtr&lt;NSString&gt; _markedText;
</span><span class="cx">     RetainPtr&lt;WKActionSheetAssistant&gt; _actionSheetAssistant;
</span><ins>+    RetainPtr&lt;WKAirPlayRoutePicker&gt; _airPlayRoutePicker;
</ins><span class="cx"> 
</span><span class="cx">     std::unique_ptr&lt;WebKit::SmartMagnificationController&gt; _smartMagnificationController;
</span><span class="cx"> 
</span><span class="lines">@@ -141,6 +143,7 @@
</span><span class="cx"> - (void)_willStartUserTriggeredScrollingOrZooming;
</span><span class="cx"> - (void)_didEndScrollingOrZooming;
</span><span class="cx"> - (void)_didUpdateBlockSelectionWithTouch:(WebKit::WKSelectionTouch)touch withFlags:(WebKit::WKSelectionFlags)flags growThreshold:(CGFloat)growThreshold shrinkThreshold:(CGFloat)shrinkThreshold;
</span><ins>+- (void)_showPlaybackTargetPicker:(BOOL)hasVideo fromRect:(const WebCore::IntRect&amp;)elementRect;
</ins><span class="cx"> - (void)accessoryDone;
</span><span class="cx"> - (Vector&lt;WebKit::WKOptionItem&gt;&amp;) assistedNodeSelectOptions;
</span><span class="cx"> @end
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessiosWKContentViewInteractionmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm (166383 => 166384)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm        2014-03-27 23:40:04 UTC (rev 166383)
+++ trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm        2014-03-27 23:41:46 UTC (rev 166384)
</span><span class="lines">@@ -1951,6 +1951,13 @@
</span><span class="cx">     _selectionNeedsUpdate = NO;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+- (void)_showPlaybackTargetPicker:(BOOL)hasVideo fromRect:(const IntRect&amp;)elementRect
+{
+    if (!_airPlayRoutePicker)
+        _airPlayRoutePicker = adoptNS([[WKAirPlayRoutePicker alloc] initWithView:self]);
+    [_airPlayRoutePicker show:hasVideo fromRect:elementRect];
+}
+
</ins><span class="cx"> #pragma mark - Implementation of UIWebTouchEventsGestureRecognizerDelegate.
</span><span class="cx"> 
</span><span class="cx"> - (BOOL)shouldIgnoreWebTouch
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessiosWebPageProxyIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/ios/WebPageProxyIOS.mm (166383 => 166384)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/ios/WebPageProxyIOS.mm        2014-03-27 23:40:04 UTC (rev 166383)
+++ trunk/Source/WebKit2/UIProcess/ios/WebPageProxyIOS.mm        2014-03-27 23:41:46 UTC (rev 166384)
</span><span class="lines">@@ -534,6 +534,11 @@
</span><span class="cx">     m_pageClient.setAcceleratedCompositingRootLayer(rootLayer);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void WebPageProxy::showPlaybackTargetPicker(bool hasVideo, const IntRect&amp; elementRect)
+{
+    m_pageClient.showPlaybackTargetPicker(hasVideo, elementRect);
+}
+
</ins><span class="cx"> } // namespace WebKit
</span><span class="cx"> 
</span><span class="cx"> #endif // PLATFORM(IOS)
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessiosformsWKAirPlayRoutePickerh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit2/UIProcess/ios/forms/WKAirPlayRoutePicker.h (0 => 166384)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/ios/forms/WKAirPlayRoutePicker.h                                (rev 0)
+++ trunk/Source/WebKit2/UIProcess/ios/forms/WKAirPlayRoutePicker.h        2014-03-27 23:41:46 UTC (rev 166384)
</span><span class="lines">@@ -0,0 +1,38 @@
</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.
+ */
+
+#if PLATFORM(IOS)
+
+#import &lt;UIKit/UIPopoverController.h&gt;
+
+@class WKContentView;
+
+@interface WKAirPlayRoutePicker : UIView &lt;UIPopoverControllerDelegate&gt;
+- (instancetype)initWithView:(WKContentView *)view;
+- (void)show:(BOOL)hasVideo fromRect:(CGRect)elementRect;
+@end
+
+#endif // PLATFORM(IOS)
+
</ins></span></pre></div>
<a id="trunkSourceWebKit2UIProcessiosformsWKAirPlayRoutePickermm"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit2/UIProcess/ios/forms/WKAirPlayRoutePicker.mm (0 => 166384)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/ios/forms/WKAirPlayRoutePicker.mm                                (rev 0)
+++ trunk/Source/WebKit2/UIProcess/ios/forms/WKAirPlayRoutePicker.mm        2014-03-27 23:41:46 UTC (rev 166384)
</span><span class="lines">@@ -0,0 +1,161 @@
</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.
+ */
+
+#import &quot;config.h&quot;
+#import &quot;WKAirPlayRoutePicker.h&quot;
+
+#if PLATFORM(IOS)
+
+#import &quot;WKContentView.h&quot;
+#import &quot;WKContentViewInteraction.h&quot;
+#import &quot;WebPageProxy.h&quot;
+#import &lt;MediaPlayer/MPAVItem.h&gt;
+#import &lt;MediaPlayer/MPAVRoutingController.h&gt;
+#import &lt;MediaPlayer/MPAudioVideoRoutingPopoverController.h&gt;
+#import &lt;MediaPlayer/MPAudioVideoRoutingActionSheet.h&gt;
+#import &lt;WebCore/SoftLinking.h&gt;
+#import &lt;UIKit/UIApplication_Private.h&gt;
+#import &lt;UIKit/UIWindow_Private.h&gt;
+#import &lt;wtf/RetainPtr.h&gt;
+
+SOFT_LINK_FRAMEWORK(MediaPlayer)
+SOFT_LINK_CLASS(MediaPlayer, MPAVRoutingController)
+SOFT_LINK_CLASS(MediaPlayer, MPAudioVideoRoutingPopoverController)
+SOFT_LINK_CLASS(MediaPlayer, MPAudioVideoRoutingActionSheet)
+
+using namespace WebKit;
+
+@implementation WKAirPlayRoutePicker {
+    RetainPtr&lt;MPAVRoutingController&gt; _routingController;
+    RetainPtr&lt;MPAudioVideoRoutingPopoverController&gt; _popoverController;  // iPad
+    RetainPtr&lt;MPAudioVideoRoutingActionSheet&gt; _actionSheet;              // iPhone
+    __weak WKContentView* _view;   // Weak reference.
+}
+
+- (instancetype)initWithView:(WKContentView *)view
+{
+    if (!(self = [super init]))
+        return nil;
+
+    _view = view;
+    return self;
+}
+
+- (void)dealloc
+{
+    // The ActionSheet's completion handler will release and clear the ActionSheet.
+    [_actionSheet dismissWithClickedButtonIndex:[_actionSheet cancelButtonIndex] animated:YES];
+    [self _dismissAirPlayRoutePickerIPad];
+
+    [super dealloc];
+}
+
+- (void)popoverControllerDidDismissPopover:(UIPopoverController *)popoverController
+{
+    if (popoverController != _popoverController)
+        return;
+
+    [self _dismissAirPlayRoutePickerIPad];
+}
+
+- (void)_presentAirPlayPopoverAnimated:(BOOL)animated fromRect:(CGRect)elementRect
+{
+    [_popoverController presentPopoverFromRect:elementRect inView:_view permittedArrowDirections:UIPopoverArrowDirectionAny animated:animated];
+}
+
+- (void)_windowWillRotate:(NSNotification *)notification
+{
+    [_popoverController dismissPopoverAnimated:NO];
+}
+
+- (void)_windowDidRotate:(NSNotification *)notification
+{
+    [self _dismissAirPlayRoutePickerIPad];
+}
+
+- (void)_dismissAirPlayRoutePickerIPad
+{
+    _routingController = nil;
+
+    if (!_popoverController)
+        return;
+
+    NSNotificationCenter *center = [NSNotificationCenter defaultCenter];
+    [center removeObserver:self name:UIWindowWillRotateNotification object:nil];
+    [center removeObserver:self name:UIWindowDidRotateNotification object:nil];
+
+    [_popoverController dismissPopoverAnimated:NO];
+    [_popoverController setDelegate:nil];
+    _popoverController = nil;
+}
+
+- (void)showAirPlayPickerIPad:(MPAVItemType)itemType fromRect:(CGRect)elementRect
+{
+    if (_popoverController)
+        return;
+
+    _popoverController = adoptNS([[getMPAudioVideoRoutingPopoverControllerClass() alloc] initWithType:itemType]);
+    [_popoverController setDelegate:self];
+
+    NSNotificationCenter *center = [NSNotificationCenter defaultCenter];
+    [center addObserver:self selector:@selector(_windowWillRotate:) name:UIWindowWillRotateNotification object:nil];
+    [center addObserver:self selector:@selector(_windowDidRotate:) name:UIWindowDidRotateNotification object:nil];
+
+    [self _presentAirPlayPopoverAnimated:YES fromRect:elementRect];
+}
+
+- (void)showAirPlayPickerIPhone:(MPAVItemType)itemType
+{
+    if (_actionSheet)
+        return;
+
+    _actionSheet = adoptNS([[getMPAudioVideoRoutingActionSheetClass() alloc] initWithType:itemType]);
+
+    [_actionSheet
+        showWithValidInterfaceOrientationMaskBlock:^UIInterfaceOrientationMask {
+            return UIInterfaceOrientationMaskPortrait;
+        }
+        completionHandler:^{
+            _routingController = nil;
+            _actionSheet = nil;
+        }
+     ];
+}
+
+- (void)show:(BOOL)hasVideo fromRect:(CGRect)elementRect
+{
+    _routingController = adoptNS([[getMPAVRoutingControllerClass() alloc] initWithName:@&quot;WebKit2 - HTML media element showing AirPlay route picker&quot;]);
+    [_routingController setDiscoveryMode:MPRouteDiscoveryModeDetailed];
+
+    MPAVItemType itemType = hasVideo ? MPAVItemTypeVideo : MPAVItemTypeAudio;
+    if (UICurrentUserInterfaceIdiomIsPad())
+        [self showAirPlayPickerIPad:itemType fromRect:elementRect];
+    else
+        [self showAirPlayPickerIPhone:itemType];
+}
+
+@end
+
+#endif // PLATFORM(IOS)
</ins></span></pre></div>
<a id="trunkSourceWebKit2WebKit2xcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj (166383 => 166384)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj        2014-03-27 23:40:04 UTC (rev 166383)
+++ trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj        2014-03-27 23:41:46 UTC (rev 166384)
</span><span class="lines">@@ -1454,6 +1454,8 @@
</span><span class="cx">                 C5E1AFED16B21017006CC1F2 /* WebArchive.h in Headers */ = {isa = PBXBuildFile; fileRef = BC329D9A16ACCE9900316DE2 /* WebArchive.h */; };
</span><span class="cx">                 C5E1AFEE16B21025006CC1F2 /* WebArchiveResource.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC329D9E16ACD47800316DE2 /* WebArchiveResource.cpp */; };
</span><span class="cx">                 C5E1AFEF16B21029006CC1F2 /* WebArchiveResource.h in Headers */ = {isa = PBXBuildFile; fileRef = BC329D9F16ACD47800316DE2 /* WebArchiveResource.h */; };
</span><ins>+                C5FA1ED318E1062200B3F402 /* WKAirPlayRoutePicker.h in Headers */ = {isa = PBXBuildFile; fileRef = C5FA1ED118E1062200B3F402 /* WKAirPlayRoutePicker.h */; };
+                C5FA1ED418E1062200B3F402 /* WKAirPlayRoutePicker.mm in Sources */ = {isa = PBXBuildFile; fileRef = C5FA1ED218E1062200B3F402 /* WKAirPlayRoutePicker.mm */; };
</ins><span class="cx">                 CD5C66A0134B9D38004FE2A8 /* InjectedBundlePageFullScreenClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CD5C669E134B9D36004FE2A8 /* InjectedBundlePageFullScreenClient.cpp */; };
</span><span class="cx">                 CD5C66A1134B9D38004FE2A8 /* InjectedBundlePageFullScreenClient.h in Headers */ = {isa = PBXBuildFile; fileRef = CD5C669F134B9D37004FE2A8 /* InjectedBundlePageFullScreenClient.h */; };
</span><span class="cx">                 CD67D30E15C08F9A00843ADF /* InjectedBundlePageDiagnosticLoggingClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CD67D30815C07BE000843ADF /* InjectedBundlePageDiagnosticLoggingClient.cpp */; };
</span><span class="lines">@@ -3324,6 +3326,8 @@
</span><span class="cx">                 C58CDF2C1887609F00871536 /* InteractionInformationAtPosition.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InteractionInformationAtPosition.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 C59C4A5618B81174007BDCB6 /* AssistedNodeInformation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AssistedNodeInformation.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 C59C4A5718B81174007BDCB6 /* AssistedNodeInformation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AssistedNodeInformation.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                C5FA1ED118E1062200B3F402 /* WKAirPlayRoutePicker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WKAirPlayRoutePicker.h; path = ios/forms/WKAirPlayRoutePicker.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                C5FA1ED218E1062200B3F402 /* WKAirPlayRoutePicker.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WKAirPlayRoutePicker.mm; path = ios/forms/WKAirPlayRoutePicker.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 CD5C669E134B9D36004FE2A8 /* InjectedBundlePageFullScreenClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InjectedBundlePageFullScreenClient.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 CD5C669F134B9D37004FE2A8 /* InjectedBundlePageFullScreenClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InjectedBundlePageFullScreenClient.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 CD67D30815C07BE000843ADF /* InjectedBundlePageDiagnosticLoggingClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InjectedBundlePageDiagnosticLoggingClient.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -6427,6 +6431,8 @@
</span><span class="cx">                 C54256AE18BEC16100DE4179 /* forms */ = {
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><ins>+                                C5FA1ED118E1062200B3F402 /* WKAirPlayRoutePicker.h */,
+                                C5FA1ED218E1062200B3F402 /* WKAirPlayRoutePicker.mm */,
</ins><span class="cx">                                 C54256AF18BEC18B00DE4179 /* WKFormInputControl.h */,
</span><span class="cx">                                 C54256B018BEC18B00DE4179 /* WKFormInputControl.mm */,
</span><span class="cx">                                 C54256B118BEC18B00DE4179 /* WKFormPeripheral.h */,
</span><span class="lines">@@ -6616,6 +6622,7 @@
</span><span class="cx">                                 2989A414167D184B004F96D2 /* CustomProtocolManager.h in Headers */,
</span><span class="cx">                                 371B32DE184D67490013E2B2 /* WKNSURLProtectionSpace.h in Headers */,
</span><span class="cx">                                 2984F589164BA095004BC0C6 /* CustomProtocolManagerMessages.h in Headers */,
</span><ins>+                                C5FA1ED318E1062200B3F402 /* WKAirPlayRoutePicker.h in Headers */,
</ins><span class="cx">                                 1A7E376E18E3CA57003D0FFF /* _WKScriptWorld.h in Headers */,
</span><span class="cx">                                 29AD3093164B4C5D0072DEA9 /* CustomProtocolManagerProxy.h in Headers */,
</span><span class="cx">                                 2984F57D164B915F004BC0C6 /* CustomProtocolManagerProxyMessages.h in Headers */,
</span><span class="lines">@@ -8470,6 +8477,7 @@
</span><span class="cx">                                 C58CDF2D1887609F00871536 /* InteractionInformationAtPosition.cpp in Sources */,
</span><span class="cx">                                 51B3005112529D0E000B5CA0 /* WebPageProxyCF.cpp in Sources */,
</span><span class="cx">                                 1F7506AD1859161C00EC0FF7 /* WKWebProcessPlugInFrame.mm in Sources */,
</span><ins>+                                C5FA1ED418E1062200B3F402 /* WKAirPlayRoutePicker.mm in Sources */,
</ins><span class="cx">                                 BC857E8712B71EBB00EDEB2E /* WebPageProxyMac.mm in Sources */,
</span><span class="cx">                                 2DA944A11884E4F000ED86DB /* WebIOSEventFactory.mm in Sources */,
</span><span class="cx">                                 BCBD3914125BB1A800D2C29F /* WebPageProxyMessageReceiver.cpp in Sources */,
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebCoreSupportWebChromeClienth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h (166383 => 166384)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h        2014-03-27 23:40:04 UTC (rev 166383)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h        2014-03-27 23:41:46 UTC (rev 166384)
</span><span class="lines">@@ -175,6 +175,7 @@
</span><span class="cx">     virtual void removeScrollingLayer(WebCore::Node*, PlatformLayer* scrollingLayer, PlatformLayer* contentsLayer) override;
</span><span class="cx"> 
</span><span class="cx">     virtual void webAppOrientationsUpdated() override;
</span><ins>+    virtual void showPlaybackTargetPicker(bool hasVideo) override;
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">     virtual void runOpenPanel(WebCore::Frame*, PassRefPtr&lt;WebCore::FileChooser&gt;) override;
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebCoreSupportiosWebChromeClientIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm (166383 => 166384)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm        2014-03-27 23:40:04 UTC (rev 166383)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm        2014-03-27 23:41:46 UTC (rev 166384)
</span><span class="lines">@@ -124,6 +124,11 @@
</span><span class="cx">     notImplemented();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void WebChromeClient::showPlaybackTargetPicker(bool hasVideo)
+{
+    m_page-&gt;send(Messages::WebPageProxy::ShowPlaybackTargetPicker(hasVideo, m_page-&gt;rectForElementAtInteractionLocation()));
+}
+
</ins><span class="cx"> } // namespace WebKit
</span><span class="cx"> 
</span><span class="cx"> #endif // PLATFORM(IOS)
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageWebPagecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (166383 => 166384)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp        2014-03-27 23:40:04 UTC (rev 166383)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp        2014-03-27 23:41:46 UTC (rev 166384)
</span><span class="lines">@@ -1963,8 +1963,10 @@
</span><span class="cx"> 
</span><span class="cx"> void WebPage::touchEvent(const WebTouchEvent&amp; touchEvent)
</span><span class="cx"> {
</span><ins>+#if PLATFORM(IOS)
+    m_lastInteractionLocation = touchEvent.position();
+#endif
</ins><span class="cx">     bool handled = false;
</span><del>-
</del><span class="cx">     if (canHandleUserEvents()) {
</span><span class="cx">         CurrentEvent currentEvent(touchEvent);
</span><span class="cx"> 
</span><span class="lines">@@ -1975,6 +1977,9 @@
</span><span class="cx"> 
</span><span class="cx"> void WebPage::touchEventSyncForTesting(const WebTouchEvent&amp; touchEvent, bool&amp; handled)
</span><span class="cx"> {
</span><ins>+#if PLATFORM(IOS)
+    m_lastInteractionLocation = touchEvent.position();
+#endif
</ins><span class="cx">     CurrentEvent currentEvent(touchEvent);
</span><span class="cx">     handled = handleTouchEvent(touchEvent, m_page.get());
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageWebPageh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h (166383 => 166384)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h        2014-03-27 23:40:04 UTC (rev 166383)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h        2014-03-27 23:41:46 UTC (rev 166384)
</span><span class="lines">@@ -468,6 +468,7 @@
</span><span class="cx">     void setAssistedNodeValue(const String&amp;);
</span><span class="cx">     void setAssistedNodeValueAsNumber(double);
</span><span class="cx">     void setAssistedNodeSelectedIndex(uint32_t index, bool allowMultipleSelection);
</span><ins>+    WebCore::IntRect rectForElementAtInteractionLocation();
</ins><span class="cx"> 
</span><span class="cx"> #if ENABLE(INSPECTOR)
</span><span class="cx">     void showInspectorIndication();
</span><span class="lines">@@ -1130,6 +1131,7 @@
</span><span class="cx">     RefPtr&lt;WebCore::Range&gt; m_currentWordRange;
</span><span class="cx">     RefPtr&lt;WebCore::Node&gt; m_interactionNode;
</span><span class="cx">     bool m_shouldReturnWordAtSelection;
</span><ins>+    WebCore::IntPoint m_lastInteractionLocation;
</ins><span class="cx"> 
</span><span class="cx">     WebCore::ViewportConfiguration m_viewportConfiguration;
</span><span class="cx">     uint64_t m_lastVisibleContentRectUpdateID;
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageiosWebPageIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm (166383 => 166384)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm        2014-03-27 23:40:04 UTC (rev 166383)
+++ trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm        2014-03-27 23:41:46 UTC (rev 166384)
</span><span class="lines">@@ -281,6 +281,15 @@
</span><span class="cx">     notImplemented();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+IntRect WebPage::rectForElementAtInteractionLocation()
+{
+    HitTestResult result = m_page-&gt;mainFrame().eventHandler().hitTestResultAtPoint(m_lastInteractionLocation, HitTestRequest::ReadOnly | HitTestRequest::Active | HitTestRequest::AllowChildFrameContent);
+    Node* hitNode = result.innerNode();
+    if (!hitNode || !hitNode-&gt;renderer())
+        return IntRect();
+    return result.innerNodeFrame()-&gt;view()-&gt;contentsToRootView(hitNode-&gt;renderer()-&gt;absoluteBoundingBoxRect(true));
+}
+
</ins><span class="cx"> void WebPage::handleTap(const IntPoint&amp; point)
</span><span class="cx"> {
</span><span class="cx">     Frame&amp; mainframe = m_page-&gt;mainFrame();
</span><span class="lines">@@ -295,6 +304,7 @@
</span><span class="cx">     if (WKObservedContentChange() != WKContentNoChange)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    m_lastInteractionLocation = roundedAdjustedPoint;
</ins><span class="cx">     mainframe.eventHandler().handleMousePressEvent(PlatformMouseEvent(roundedAdjustedPoint, roundedAdjustedPoint, LeftButton, PlatformEvent::MousePressed, 1, false, false, false, false, 0));
</span><span class="cx">     mainframe.eventHandler().handleMouseReleaseEvent(PlatformMouseEvent(roundedAdjustedPoint, roundedAdjustedPoint, LeftButton, PlatformEvent::MouseReleased, 1, false, false, false, false, 0));
</span><span class="cx"> }
</span></span></pre>
</div>
</div>

</body>
</html>