Title: [181444] tags/Safari-601.1.22/Source

Diff

Modified: tags/Safari-601.1.22/Source/WebCore/ChangeLog (181443 => 181444)


--- tags/Safari-601.1.22/Source/WebCore/ChangeLog	2015-03-12 17:27:26 UTC (rev 181443)
+++ tags/Safari-601.1.22/Source/WebCore/ChangeLog	2015-03-12 17:41:25 UTC (rev 181444)
@@ -1,3 +1,22 @@
+2015-03-12  Babak Shafiei  <[email protected]>
+
+        Merge r181442.
+
+    2015-03-12  Eric Carlson  <[email protected]>
+
+            [Mac] Update AirPlay handling
+            https://bugs.webkit.org/show_bug.cgi?id=142541
+
+            Unreviewed, respond to post-review comments.
+
+            * dom/Document.cpp:
+            (WebCore::Document::didChoosePlaybackTarget):
+            * page/ChromeClient.h:
+            * page/Page.cpp:
+            (WebCore::Page::showPlaybackTargetPicker):
+            (WebCore::Page::didChoosePlaybackTarget):
+            (WebCore::Page::configurePlaybackTargetMonitoring):
+
 2015-03-11  Babak Shafiei  <[email protected]>
 
         Merge r181423.

Modified: tags/Safari-601.1.22/Source/WebCore/dom/Document.cpp (181443 => 181444)


--- tags/Safari-601.1.22/Source/WebCore/dom/Document.cpp	2015-03-12 17:27:26 UTC (rev 181443)
+++ tags/Safari-601.1.22/Source/WebCore/dom/Document.cpp	2015-03-12 17:41:25 UTC (rev 181444)
@@ -6430,6 +6430,9 @@
         client->didChoosePlaybackTarget(device);
     }
 
+    // Notify the client that requested the chooser last because if more than one
+    // is playing, only the last one to set the context will actually get to play
+    //  to the external device.
     if (clientThatRequestedPicker)
         clientThatRequestedPicker->didChoosePlaybackTarget(device);
 }

Modified: tags/Safari-601.1.22/Source/WebCore/page/ChromeClient.h (181443 => 181444)


--- tags/Safari-601.1.22/Source/WebCore/page/ChromeClient.h	2015-03-12 17:27:26 UTC (rev 181443)
+++ tags/Safari-601.1.22/Source/WebCore/page/ChromeClient.h	2015-03-12 17:41:25 UTC (rev 181444)
@@ -446,7 +446,7 @@
     virtual bool shouldDispatchFakeMouseMoveEvents() const { return true; }
 
 #if ENABLE(WIRELESS_PLAYBACK_TARGET)
-    virtual void showPlaybackTargetPicker(const WebCore::IntPoint&, bool) { }
+    virtual void showPlaybackTargetPicker(const WebCore::IntPoint&, bool /* isVideo */) { }
     virtual void startingMonitoringPlaybackTargets() { }
     virtual void stopMonitoringPlaybackTargets() { }
 #endif

Modified: tags/Safari-601.1.22/Source/WebCore/page/Page.cpp (181443 => 181444)


--- tags/Safari-601.1.22/Source/WebCore/page/Page.cpp	2015-03-12 17:27:26 UTC (rev 181443)
+++ tags/Safari-601.1.22/Source/WebCore/page/Page.cpp	2015-03-12 17:41:25 UTC (rev 181444)
@@ -1700,8 +1700,8 @@
 #if ENABLE(WIRELESS_PLAYBACK_TARGET)
 void Page::showPlaybackTargetPicker(Document* document, const WebCore::IntPoint& location, bool isVideo)
 {
+    m_documentRequestingPlaybackTargetPicker = document;
 
-    m_documentRequestingPlaybackTargetPicker = document;
 #if PLATFORM(IOS)
     // FIXME: refactor iOS implementation.
     UNUSED_PARAM(location);
@@ -1725,6 +1725,9 @@
         frame->document()->didChoosePlaybackTarget(target);
     }
 
+    // Notify the document that requested the chooser last because if more than one element
+    // is playing the last one to set the context will be the one that actually gets to
+    //  play to the external device.
     if (documentThatRequestedPicker)
         documentThatRequestedPicker->didChoosePlaybackTarget(target);
 
@@ -1752,7 +1755,6 @@
         return;
     m_requiresPlaybackTargetMonitoring = monitoringRequired;
 
-
     if (monitoringRequired)
         chrome().client().startingMonitoringPlaybackTargets();
     else

Modified: tags/Safari-601.1.22/Source/WebKit2/ChangeLog (181443 => 181444)


--- tags/Safari-601.1.22/Source/WebKit2/ChangeLog	2015-03-12 17:27:26 UTC (rev 181443)
+++ tags/Safari-601.1.22/Source/WebKit2/ChangeLog	2015-03-12 17:41:25 UTC (rev 181444)
@@ -1,3 +1,31 @@
+2015-03-12  Babak Shafiei  <[email protected]>
+
+        Merge r181442.
+
+    2015-03-12  Eric Carlson  <[email protected]>
+
+            [Mac] Update AirPlay handling
+            https://bugs.webkit.org/show_bug.cgi?id=142541
+
+            Unreviewed, respond to post-review comments and add previously reviewed changes
+            missed by a bungled merge.
+
+            * Shared/mac/WebCoreArgumentCodersMac.mm:
+            * UIProcess/WebMediaPlaybackTargetPickerProxy.cpp:
+            (WebKit::WebMediaPlaybackTargetPickerProxy::~WebMediaPlaybackTargetPickerProxy):
+            * UIProcess/mac/PageClientImpl.h:
+            * UIProcess/mac/PageClientImpl.mm:
+            (WebKit::PageClientImpl::createPlaybackTargetPicker):
+            * UIProcess/mac/WebMediaPlaybackTargetPickerProxyMac.h: Added.
+            * UIProcess/mac/WebMediaPlaybackTargetPickerProxyMac.mm: Added.
+            * WebKit2.xcodeproj/project.pbxproj:
+            * WebProcess/WebCoreSupport/WebChromeClient.cpp:
+            * WebProcess/WebCoreSupport/WebChromeClient.h:
+            * WebProcess/WebPage/WebPage.h:
+            * WebProcess/WebPage/WebPage.messages.in:
+            * WebProcess/WebPage/mac/WebPageMac.mm:
+            * WebProcess/com.apple.WebProcess.sb.in:
+
 2015-03-11  Babak Shafiei  <[email protected]>
 
         Merge r181423.

Modified: tags/Safari-601.1.22/Source/WebKit2/Shared/mac/WebCoreArgumentCodersMac.mm (181443 => 181444)


--- tags/Safari-601.1.22/Source/WebKit2/Shared/mac/WebCoreArgumentCodersMac.mm	2015-03-12 17:27:26 UTC (rev 181443)
+++ tags/Safari-601.1.22/Source/WebKit2/Shared/mac/WebCoreArgumentCodersMac.mm	2015-03-12 17:41:25 UTC (rev 181444)
@@ -38,8 +38,6 @@
 #import <WebCore/ProtectionSpace.h>
 #import <WebCore/ResourceError.h>
 #import <WebCore/ResourceRequest.h>
-#import <WebCore/SoftLinking.h>
-#import <objc/runtime.h>
 
 #if USE(CFNETWORK)
 #import <CFNetwork/CFURLRequest.h>

Modified: tags/Safari-601.1.22/Source/WebKit2/UIProcess/WebMediaPlaybackTargetPickerProxy.cpp (181443 => 181444)


--- tags/Safari-601.1.22/Source/WebKit2/UIProcess/WebMediaPlaybackTargetPickerProxy.cpp	2015-03-12 17:27:26 UTC (rev 181443)
+++ tags/Safari-601.1.22/Source/WebKit2/UIProcess/WebMediaPlaybackTargetPickerProxy.cpp	2015-03-12 17:41:25 UTC (rev 181444)
@@ -37,7 +37,7 @@
 
 WebMediaPlaybackTargetPickerProxy::~WebMediaPlaybackTargetPickerProxy()
 {
-    m_client = 0;
+    m_client = nullptr;
 }
 
 void WebMediaPlaybackTargetPickerProxy::showPlaybackTargetPicker(const WebCore::FloatRect&, bool)

Modified: tags/Safari-601.1.22/Source/WebKit2/UIProcess/mac/PageClientImpl.h (181443 => 181444)


--- tags/Safari-601.1.22/Source/WebKit2/UIProcess/mac/PageClientImpl.h	2015-03-12 17:27:26 UTC (rev 181443)
+++ tags/Safari-601.1.22/Source/WebKit2/UIProcess/mac/PageClientImpl.h	2015-03-12 17:41:25 UTC (rev 181444)
@@ -204,6 +204,10 @@
 #if USE(DICTATION_ALTERNATIVES)
     std::unique_ptr<WebCore::AlternativeTextUIController> m_alternativeTextUIController;
 #endif
+
+#if ENABLE(WIRELESS_PLAYBACK_TARGET)
+    virtual std::unique_ptr<WebMediaPlaybackTargetPickerProxy> createPlaybackTargetPicker(WebPageProxy*) override;
+#endif
 };
 
 } // namespace WebKit

Modified: tags/Safari-601.1.22/Source/WebKit2/UIProcess/mac/PageClientImpl.mm (181443 => 181444)


--- tags/Safari-601.1.22/Source/WebKit2/UIProcess/mac/PageClientImpl.mm	2015-03-12 17:27:26 UTC (rev 181443)
+++ tags/Safari-601.1.22/Source/WebKit2/UIProcess/mac/PageClientImpl.mm	2015-03-12 17:41:25 UTC (rev 181444)
@@ -70,6 +70,10 @@
 #import <AppKit/NSTextAlternatives.h>
 #endif
 
+#if ENABLE(WIRELESS_PLAYBACK_TARGET)
+#include "WebMediaPlaybackTargetPickerProxyMac.h"
+#endif
+
 @interface NSApplication (WebNSApplicationDetails)
 - (NSCursor *)_cursorRectCursor;
 @end
@@ -788,6 +792,12 @@
     [menu popUpMenuPositioningItem:nil atLocation:location inView:m_wkView];
 }
 
+#if ENABLE(WIRELESS_PLAYBACK_TARGET)
+std::unique_ptr<WebMediaPlaybackTargetPickerProxy> PageClientImpl::createPlaybackTargetPicker(WebPageProxy* page)
+{
+    return WebMediaPlaybackTargetPickerProxyMac::create(*page);
+}
+#endif
 
 } // namespace WebKit
 

Copied: tags/Safari-601.1.22/Source/WebKit2/UIProcess/mac/WebMediaPlaybackTargetPickerProxyMac.h (from rev 181442, trunk/Source/WebKit2/UIProcess/mac/WebMediaPlaybackTargetPickerProxyMac.h) (0 => 181444)


--- tags/Safari-601.1.22/Source/WebKit2/UIProcess/mac/WebMediaPlaybackTargetPickerProxyMac.h	                        (rev 0)
+++ tags/Safari-601.1.22/Source/WebKit2/UIProcess/mac/WebMediaPlaybackTargetPickerProxyMac.h	2015-03-12 17:41:25 UTC (rev 181444)
@@ -0,0 +1,69 @@
+/*
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WebMediaPlaybackTargetPickerProxyMac_h
+#define WebMediaPlaybackTargetPickerProxyMac_h
+
+#if ENABLE(WIRELESS_PLAYBACK_TARGET) && !PLATFORM(IOS)
+
+#import "WebMediaPlaybackTargetPickerProxy.h"
+#include <wtf/RetainPtr.h>
+#include <wtf/RunLoop.h>
+
+OBJC_CLASS AVOutputDevicePickerMenuController;
+OBJC_CLASS WebAVOutputDevicePickerMenuControllerHelper;
+
+namespace WebKit {
+
+class WebMediaPlaybackTargetPickerProxyMac final : public WebMediaPlaybackTargetPickerProxy {
+    WTF_MAKE_NONCOPYABLE(WebMediaPlaybackTargetPickerProxyMac);
+public:
+    virtual ~WebMediaPlaybackTargetPickerProxyMac();
+
+    static std::unique_ptr<WebMediaPlaybackTargetPickerProxyMac> create(WebMediaPlaybackTargetPickerProxy::Client&);
+
+    virtual void showPlaybackTargetPicker(const WebCore::FloatRect&, bool) override;
+    virtual void startingMonitoringPlaybackTargets() override;
+    virtual void stopMonitoringPlaybackTargets() override;
+    
+    void availableDevicesDidChange();
+    void currentDeviceDidChange();
+
+private:
+    explicit WebMediaPlaybackTargetPickerProxyMac(WebMediaPlaybackTargetPickerProxy::Client&);
+
+    AVOutputDevicePickerMenuController *devicePicker();
+    void outputeDeviceAvailabilityChangedTimerFired();
+
+    RetainPtr<AVOutputDevicePickerMenuController> m_devicePickerMenuController;
+    RetainPtr<WebAVOutputDevicePickerMenuControllerHelper> m_devicePickerMenuControllerDelegate;
+    RunLoop::Timer<WebMediaPlaybackTargetPickerProxyMac> m_deviceChangeTimer;
+};
+
+} // namespace WebKit
+
+#endif // ENABLE(WIRELESS_PLAYBACK_TARGET)
+
+#endif // WebContextMenuProxyMac_h

Copied: tags/Safari-601.1.22/Source/WebKit2/UIProcess/mac/WebMediaPlaybackTargetPickerProxyMac.mm (from rev 181442, trunk/Source/WebKit2/UIProcess/mac/WebMediaPlaybackTargetPickerProxyMac.mm) (0 => 181444)


--- tags/Safari-601.1.22/Source/WebKit2/UIProcess/mac/WebMediaPlaybackTargetPickerProxyMac.mm	                        (rev 0)
+++ tags/Safari-601.1.22/Source/WebKit2/UIProcess/mac/WebMediaPlaybackTargetPickerProxyMac.mm	2015-03-12 17:41:25 UTC (rev 181444)
@@ -0,0 +1,188 @@
+/*
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. 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 "config.h"
+#import "WebMediaPlaybackTargetPickerProxyMac.h"
+
+#if ENABLE(WIRELESS_PLAYBACK_TARGET) && !PLATFORM(IOS)
+
+#import <AVFoundation/AVOutputDevicePickerContext.h>
+#import <AVKit/AVOutputDevicePickerMenuController.h>
+#import <WebCore/FloatRect.h>
+#import <WebCore/MediaPlaybackTarget.h>
+#import <WebCore/SoftLinking.h>
+#import <objc/runtime.h>
+#import <wtf/MainThread.h>
+
+typedef AVOutputDevicePickerContext AVOutputDevicePickerContextType;
+typedef AVOutputDevicePickerMenuController AVOutputDevicePickerMenuControllerType;
+
+SOFT_LINK_FRAMEWORK_OPTIONAL(AVFoundation)
+SOFT_LINK_FRAMEWORK_OPTIONAL(AVKit)
+
+SOFT_LINK_CLASS(AVFoundation, AVOutputDevicePickerContext)
+SOFT_LINK_CLASS(AVKit, AVOutputDevicePickerMenuController)
+SOFT_LINK_CLASS(AVKit, AVOutputDevicePickerDelegate)
+
+using namespace WebKit;
+
+static NSString *externalOutputDeviceAvailableKeyName = @"externalOutputDeviceAvailable";
+static NSString *externalOutputDevicePickedKeyName = @"externalOutputDevicePicked";
+
+@interface WebAVOutputDevicePickerMenuControllerHelper : NSObject {
+    WebMediaPlaybackTargetPickerProxyMac* m_callback;
+}
+
+- (instancetype)initWithCallback:(WebMediaPlaybackTargetPickerProxyMac*)callback;
+- (void)clearCallback;
+- (void)observeValueForKeyPath:(id)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context;
+@end
+
+namespace WebKit {
+
+std::unique_ptr<WebMediaPlaybackTargetPickerProxyMac> WebMediaPlaybackTargetPickerProxyMac::create(WebMediaPlaybackTargetPickerProxy::Client& client)
+{
+    return std::unique_ptr<WebMediaPlaybackTargetPickerProxyMac>(new WebMediaPlaybackTargetPickerProxyMac(client));
+}
+
+WebMediaPlaybackTargetPickerProxyMac::WebMediaPlaybackTargetPickerProxyMac(WebMediaPlaybackTargetPickerProxy::Client& client)
+    : WebMediaPlaybackTargetPickerProxy(client)
+    , m_devicePickerMenuControllerDelegate(adoptNS([[WebAVOutputDevicePickerMenuControllerHelper alloc] initWithCallback:this]))
+    , m_deviceChangeTimer(RunLoop::main(), this, &WebMediaPlaybackTargetPickerProxyMac::outputeDeviceAvailabilityChangedTimerFired)
+{
+}
+
+WebMediaPlaybackTargetPickerProxyMac::~WebMediaPlaybackTargetPickerProxyMac()
+{
+    m_deviceChangeTimer.stop();
+    [m_devicePickerMenuControllerDelegate clearCallback];
+
+    if (m_devicePickerMenuController) {
+        [m_devicePickerMenuController.get() removeObserver:m_devicePickerMenuControllerDelegate.get() forKeyPath:externalOutputDeviceAvailableKeyName];
+        [m_devicePickerMenuController.get() removeObserver:m_devicePickerMenuControllerDelegate.get() forKeyPath:externalOutputDevicePickedKeyName];
+        m_devicePickerMenuController = nil;
+    }
+}
+
+void WebMediaPlaybackTargetPickerProxyMac::outputeDeviceAvailabilityChangedTimerFired()
+{
+    if (!m_devicePickerMenuController || !m_client)
+        return;
+
+    m_client->externalOutputDeviceAvailableDidChange(devicePicker().externalOutputDeviceAvailable);
+}
+
+void WebMediaPlaybackTargetPickerProxyMac::availableDevicesDidChange()
+{
+    if (!m_client)
+        return;
+
+    m_deviceChangeTimer.stop();
+    m_deviceChangeTimer.startOneShot(0);
+}
+
+AVOutputDevicePickerMenuControllerType *WebMediaPlaybackTargetPickerProxyMac::devicePicker()
+{
+    if (!m_devicePickerMenuController) {
+        RetainPtr<AVOutputDevicePickerContextType> context = adoptNS([[getAVOutputDevicePickerContextClass() alloc] init]);
+        m_devicePickerMenuController = adoptNS([[getAVOutputDevicePickerMenuControllerClass() alloc] initWithOutputDevicePickerContext:context.get()]);
+
+        [m_devicePickerMenuController.get() addObserver:m_devicePickerMenuControllerDelegate.get() forKeyPath:externalOutputDeviceAvailableKeyName options:NSKeyValueObservingOptionNew context:nullptr];
+        [m_devicePickerMenuController.get() addObserver:m_devicePickerMenuControllerDelegate.get() forKeyPath:externalOutputDevicePickedKeyName options:NSKeyValueObservingOptionNew context:nullptr];
+
+        if (devicePicker().externalOutputDeviceAvailable)
+            availableDevicesDidChange();
+    }
+
+    return m_devicePickerMenuController.get();
+}
+
+void WebMediaPlaybackTargetPickerProxyMac::showPlaybackTargetPicker(const WebCore::FloatRect& location, bool)
+{
+    if (!m_client)
+        return;
+
+    [devicePicker() showMenuForRect:location appearanceName:NSAppearanceNameVibrantLight];
+}
+
+void WebMediaPlaybackTargetPickerProxyMac::currentDeviceDidChange()
+{
+    if (!m_client)
+        return;
+
+    m_client->didChoosePlaybackTarget(WebCore::MediaPlaybackTarget([devicePicker() outputDevicePickerContext]));
+}
+
+void WebMediaPlaybackTargetPickerProxyMac::startingMonitoringPlaybackTargets()
+{
+    devicePicker();
+}
+
+void WebMediaPlaybackTargetPickerProxyMac::stopMonitoringPlaybackTargets()
+{
+}
+
+} // namespace WebKit
+
+@implementation WebAVOutputDevicePickerMenuControllerHelper
+- (instancetype)initWithCallback:(WebMediaPlaybackTargetPickerProxyMac*)callback
+{
+    if (!(self = [super init]))
+        return nil;
+
+    m_callback = callback;
+
+    return self;
+}
+
+- (void)clearCallback
+{
+    m_callback = nil;
+}
+
+- (void)observeValueForKeyPath:(id)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
+{
+    if (!m_callback)
+        return;
+
+    if (![keyPath isEqualToString:externalOutputDeviceAvailableKeyName] && ![keyPath isEqualToString:externalOutputDevicePickedKeyName])
+        return;
+
+    RetainPtr<WebAVOutputDevicePickerMenuControllerHelper> strongSelf = self;
+    RetainPtr<NSString> strongKeyPath = keyPath;
+    callOnMainThread([strongSelf, strongKeyPath] {
+        WebMediaPlaybackTargetPickerProxyMac* callback = strongSelf->m_callback;
+        if (!callback)
+            return;
+
+        if ([strongKeyPath isEqualToString:externalOutputDeviceAvailableKeyName])
+            callback->availableDevicesDidChange();
+        else if ([strongKeyPath isEqualToString:externalOutputDevicePickedKeyName])
+            callback->currentDeviceDidChange();
+    });
+}
+@end
+
+#endif // ENABLE(WIRELESS_PLAYBACK_TARGET)

Modified: tags/Safari-601.1.22/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj (181443 => 181444)


--- tags/Safari-601.1.22/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj	2015-03-12 17:27:26 UTC (rev 181443)
+++ tags/Safari-601.1.22/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj	2015-03-12 17:41:25 UTC (rev 181444)
@@ -76,6 +76,10 @@
 		00B9661918E25AE100CE1F88 /* FindClient.mm in Sources */ = {isa = PBXBuildFile; fileRef = 00B9661718E25AE100CE1F88 /* FindClient.mm */; };
 		00B9661A18E25AE100CE1F88 /* FindClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 00B9661818E25AE100CE1F88 /* FindClient.h */; };
 		076E884E1A13CADF005E90FC /* APIContextMenuClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 076E884D1A13CADF005E90FC /* APIContextMenuClient.h */; };
+		0792164C1AA5501900A3C049 /* WebMediaPlaybackTargetPickerProxy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 079216481AA54E9D00A3C049 /* WebMediaPlaybackTargetPickerProxy.cpp */; };
+		0792164D1AA5501F00A3C049 /* WebMediaPlaybackTargetPickerProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 079216491AA54E9D00A3C049 /* WebMediaPlaybackTargetPickerProxy.h */; };
+		079216501AA5528A00A3C049 /* WebMediaPlaybackTargetPickerProxyMac.h in Headers */ = {isa = PBXBuildFile; fileRef = 0792164E1AA5528A00A3C049 /* WebMediaPlaybackTargetPickerProxyMac.h */; };
+		079216511AA5528A00A3C049 /* WebMediaPlaybackTargetPickerProxyMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0792164F1AA5528A00A3C049 /* WebMediaPlaybackTargetPickerProxyMac.mm */; };
 		0F0C365818C051BA00F607D7 /* RemoteLayerTreeHostIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0F0C365718C051BA00F607D7 /* RemoteLayerTreeHostIOS.mm */; };
 		0F0C365A18C0555800F607D7 /* LayerRepresentation.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F0C365918C0555800F607D7 /* LayerRepresentation.h */; };
 		0F0C365C18C05CA100F607D7 /* RemoteScrollingCoordinatorProxyIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0F0C365B18C05CA100F607D7 /* RemoteScrollingCoordinatorProxyIOS.mm */; };
@@ -2158,6 +2162,10 @@
 		00B9661818E25AE100CE1F88 /* FindClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FindClient.h; sourceTree = "<group>"; };
 		076E884D1A13CADF005E90FC /* APIContextMenuClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = APIContextMenuClient.h; sourceTree = "<group>"; };
 		076E884F1A13CBC6005E90FC /* APIInjectedBundlePageContextMenuClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = APIInjectedBundlePageContextMenuClient.h; sourceTree = "<group>"; };
+		079216481AA54E9D00A3C049 /* WebMediaPlaybackTargetPickerProxy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebMediaPlaybackTargetPickerProxy.cpp; sourceTree = "<group>"; };
+		079216491AA54E9D00A3C049 /* WebMediaPlaybackTargetPickerProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebMediaPlaybackTargetPickerProxy.h; sourceTree = "<group>"; };
+		0792164E1AA5528A00A3C049 /* WebMediaPlaybackTargetPickerProxyMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebMediaPlaybackTargetPickerProxyMac.h; sourceTree = "<group>"; };
+		0792164F1AA5528A00A3C049 /* WebMediaPlaybackTargetPickerProxyMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebMediaPlaybackTargetPickerProxyMac.mm; sourceTree = "<group>"; };
 		0867D6A5FE840307C02AAC07 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = "<absolute>"; };
 		089C1667FE841158C02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = "<group>"; };
 		0F0C365718C051BA00F607D7 /* RemoteLayerTreeHostIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = RemoteLayerTreeHostIOS.mm; path = ios/RemoteLayerTreeHostIOS.mm; sourceTree = "<group>"; };
@@ -6145,6 +6153,8 @@
 				512E3520130B550100ABD19A /* WebApplicationCacheManagerProxy.cpp */,
 				512E3521130B550100ABD19A /* WebApplicationCacheManagerProxy.h */,
 				512E35F0130B638C00ABD19A /* WebApplicationCacheManagerProxy.messages.in */,
+				079216481AA54E9D00A3C049 /* WebMediaPlaybackTargetPickerProxy.cpp */,
+				079216491AA54E9D00A3C049 /* WebMediaPlaybackTargetPickerProxy.h */,
 				BC72BA1B11E64907001EB4EA /* WebBackForwardList.cpp */,
 				BC72BA1C11E64907001EB4EA /* WebBackForwardList.h */,
 				F036978715F4BF0500C3A80E /* WebColorPicker.cpp */,
@@ -7003,6 +7013,8 @@
 				2D125C5D1857EA05003BA3CB /* ViewGestureControllerMac.mm */,
 				2D6CD117189058A500E5A4A0 /* ViewSnapshotStore.h */,
 				2D6CD118189058A500E5A4A0 /* ViewSnapshotStore.mm */,
+				0792164E1AA5528A00A3C049 /* WebMediaPlaybackTargetPickerProxyMac.h */,
+				0792164F1AA5528A00A3C049 /* WebMediaPlaybackTargetPickerProxyMac.mm */,
 				728E86EF1795188C0087879E /* WebColorPickerMac.h */,
 				728E86F01795188C0087879E /* WebColorPickerMac.mm */,
 				51ACBB9E127A8F2C00D203B9 /* WebContextMenuProxyMac.h */,
@@ -8095,6 +8107,7 @@
 				7C361D79192803BD0036A59D /* WebUserContentControllerProxyMessages.h in Headers */,
 				3F889D15188778C900FEADAF /* WebVideoFullscreenManagerProxy.h in Headers */,
 				29CD55AA128E294F00133C85 /* WKAccessibilityWebPageObjectBase.h in Headers */,
+				0792164D1AA5501F00A3C049 /* WebMediaPlaybackTargetPickerProxy.h in Headers */,
 				29232DF418B29D6800D0596F /* WKAccessibilityWebPageObjectMac.h in Headers */,
 				2D0730A319F9C7DA00E9D9C4 /* WKActionMenuController.h in Headers */,
 				934B724419F5B9BE00AE96D6 /* WKActionMenuItemTypes.h in Headers */,
@@ -8284,6 +8297,7 @@
 				1AB8A1F418400B8F00E9AE69 /* WKPageFindClient.h in Headers */,
 				1AB8A1F618400B9D00E9AE69 /* WKPageFindMatchesClient.h in Headers */,
 				1AB8A1F018400B0000E9AE69 /* WKPageFormClient.h in Headers */,
+				079216501AA5528A00A3C049 /* WebMediaPlaybackTargetPickerProxyMac.h in Headers */,
 				BC7B633712A45ABA00D174A4 /* WKPageGroup.h in Headers */,
 				1AB8A1EC1840080900E9AE69 /* WKPageLoaderClient.h in Headers */,
 				BC2D021912AC426C00E732A3 /* WKPageLoadTypes.h in Headers */,
@@ -9549,6 +9563,7 @@
 				0FCB4E6318BBE3D9000FCFC9 /* PageClientImpl.mm in Sources */,
 				0FCB4E4718BBE044000FCFC9 /* PageClientImplIOS.mm in Sources */,
 				1AC7537B183A9FDB0072CB15 /* PageLoadState.cpp in Sources */,
+				079216511AA5528A00A3C049 /* WebMediaPlaybackTargetPickerProxyMac.mm in Sources */,
 				C574A58212E66681002DFE98 /* PasteboardTypes.mm in Sources */,
 				E19582D6153CC05400B60875 /* PDFKitImports.mm in Sources */,
 				2D870D1016234FFE000A3F20 /* PDFPlugin.mm in Sources */,
@@ -9746,6 +9761,7 @@
 				BC111A5E112F4FBB00337BAB /* WebEditorClient.cpp in Sources */,
 				2D28F3E61885CCC1004B9EAE /* WebEditorClientIOS.mm in Sources */,
 				C5237F6012441CA300780472 /* WebEditorClientMac.mm in Sources */,
+				0792164C1AA5501900A3C049 /* WebMediaPlaybackTargetPickerProxy.cpp in Sources */,
 				BC111AE0112F5BC200337BAB /* WebErrorsMac.mm in Sources */,
 				C0337DAE127A24FE008FF4F4 /* WebEvent.cpp in Sources */,
 				BC032DBA10F4380F0058C15A /* WebEventConversion.cpp in Sources */,

Modified: tags/Safari-601.1.22/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp (181443 => 181444)


--- tags/Safari-601.1.22/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp	2015-03-12 17:27:26 UTC (rev 181443)
+++ tags/Safari-601.1.22/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp	2015-03-12 17:41:25 UTC (rev 181444)
@@ -1101,4 +1101,24 @@
     return m_page->shouldDispatchFakeMouseMoveEvents();
 }
 
+#if ENABLE(WIRELESS_PLAYBACK_TARGET) && !PLATFORM(IOS)
+void WebChromeClient::showPlaybackTargetPicker(const WebCore::IntPoint& position, bool isVideo)
+{
+    FrameView* frameView = m_page->mainFrame()->view();
+    FloatRect rect(frameView->contentsToRootView(frameView->windowToContents(position)), FloatSize());
+    m_page->send(Messages::WebPageProxy::ShowPlaybackTargetPicker(rect, isVideo));
+}
+
+void WebChromeClient::startingMonitoringPlaybackTargets()
+{
+    m_page->send(Messages::WebPageProxy::StartingMonitoringPlaybackTargets());
+}
+
+void WebChromeClient::stopMonitoringPlaybackTargets()
+{
+    m_page->send(Messages::WebPageProxy::StopMonitoringPlaybackTargets());
+}
+#endif
+
+
 } // namespace WebKit

Modified: tags/Safari-601.1.22/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h (181443 => 181444)


--- tags/Safari-601.1.22/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h	2015-03-12 17:27:26 UTC (rev 181443)
+++ tags/Safari-601.1.22/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h	2015-03-12 17:41:25 UTC (rev 181444)
@@ -310,6 +310,12 @@
 
     virtual bool shouldDispatchFakeMouseMoveEvents() const override;
 
+#if ENABLE(WIRELESS_PLAYBACK_TARGET) && !PLATFORM(IOS)
+    virtual void showPlaybackTargetPicker(const WebCore::IntPoint&, bool) override;
+    virtual void startingMonitoringPlaybackTargets() override;
+    virtual void stopMonitoringPlaybackTargets() override;
+#endif
+
     String m_cachedToolTip;
     mutable RefPtr<WebFrame> m_cachedFrameSetLargestFrame;
     mutable bool m_cachedMainFrameHasHorizontalScrollbar;

Modified: tags/Safari-601.1.22/Source/WebKit2/WebProcess/WebPage/WebPage.h (181443 => 181444)


--- tags/Safari-601.1.22/Source/WebKit2/WebProcess/WebPage/WebPage.h	2015-03-12 17:27:26 UTC (rev 181443)
+++ tags/Safari-601.1.22/Source/WebKit2/WebProcess/WebPage/WebPage.h	2015-03-12 17:41:25 UTC (rev 181444)
@@ -126,6 +126,7 @@
 class HTMLPlugInImageElement;
 class IntPoint;
 class KeyboardEvent;
+class MediaPlaybackTarget;
 class Page;
 class PrintContext;
 class Range;
@@ -142,7 +143,6 @@
 }
 
 namespace WebKit {
-
 class DrawingArea;
 class InjectedBundleBackForwardList;
 class NotificationPermissionRequestManager;
@@ -1093,6 +1093,11 @@
 
     void setShouldDispatchFakeMouseMoveEvents(bool dispatch) { m_shouldDispatchFakeMouseMoveEvents = dispatch; }
 
+#if ENABLE(WIRELESS_PLAYBACK_TARGET) && !PLATFORM(IOS)
+    void playbackTargetSelected(const WebCore::MediaPlaybackTarget& outputDevice) const;
+    void playbackTargetAvailabilityDidChange(bool);
+#endif
+
     uint64_t m_pageID;
 
     std::unique_ptr<WebCore::Page> m_page;

Modified: tags/Safari-601.1.22/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in (181443 => 181444)


--- tags/Safari-601.1.22/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in	2015-03-12 17:27:26 UTC (rev 181443)
+++ tags/Safari-601.1.22/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in	2015-03-12 17:41:25 UTC (rev 181444)
@@ -411,4 +411,10 @@
 #endif
 
     SetShouldDispatchFakeMouseMoveEvents(bool shouldDispatchFakeMouseMoveEvents)
+
+#if ENABLE(WIRELESS_PLAYBACK_TARGET) && !PLATFORM(IOS)
+    PlaybackTargetSelected(WebCore::MediaPlaybackTarget target)
+    PlaybackTargetAvailabilityDidChange(bool available)
+#endif
+
 }

Modified: tags/Safari-601.1.22/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm (181443 => 181444)


--- tags/Safari-601.1.22/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm	2015-03-12 17:27:26 UTC (rev 181443)
+++ tags/Safari-601.1.22/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm	2015-03-12 17:41:25 UTC (rev 181444)
@@ -87,6 +87,10 @@
 #import <WebCore/htmlediting.h>
 #import <WebKitSystemInterface.h>
 
+#if ENABLE(WIRELESS_PLAYBACK_TARGET)
+#include <WebCore/MediaPlaybackTarget.h>
+#endif
+
 using namespace WebCore;
 
 namespace WebKit {
@@ -1187,6 +1191,20 @@
     frame.editor().applyFontStyles(fontFamily, fontSize, fontTraits);
 }
 
+#if ENABLE(WIRELESS_PLAYBACK_TARGET) && !PLATFORM(IOS)
+void WebPage::playbackTargetSelected(const WebCore::MediaPlaybackTarget& playbackTarget) const
+{
+    MediaPlaybackTarget nonConstTarget(playbackTarget.devicePickerContext());
+    m_page->didChoosePlaybackTarget(nonConstTarget);
+}
+
+void WebPage::playbackTargetAvailabilityDidChange(bool changed)
+{
+    m_page->playbackTargetAvailabilityDidChange(changed);
+}
+#endif
+
+
 } // namespace WebKit
 
 #endif // PLATFORM(MAC)

Modified: tags/Safari-601.1.22/Source/WebKit2/WebProcess/com.apple.WebProcess.sb.in (181443 => 181444)


--- tags/Safari-601.1.22/Source/WebKit2/WebProcess/com.apple.WebProcess.sb.in	2015-03-12 17:27:26 UTC (rev 181443)
+++ tags/Safari-601.1.22/Source/WebKit2/WebProcess/com.apple.WebProcess.sb.in	2015-03-12 17:41:25 UTC (rev 181444)
@@ -297,3 +297,18 @@
        (home-subpath "/Library/Components")
        (home-subpath "/Library/Keyboard Layouts")
        (home-subpath "/Library/Input Methods"))
+
+;; AirPlay
+;; FIXME: remove this as described in rdar://19869448
+(allow mach-lookup
+    (global-name "com.apple.coremedia.endpoint.airplayuiagent")
+    (global-name "com.apple.coremedia.endpointstream.airplayuiagent")
+    (global-name "com.apple.coremedia.endpointplaybacksession.airplayuiagent")
+    (global-name "com.apple.coremedia.endpointpicker"))
+
+;; AirPlay
+(allow mach-lookup
+    (global-name "com.apple.coremedia.endpoint.xpc")
+    (global-name "com.apple.coremedia.endpointstream.xpc")
+    (global-name "com.apple.coremedia.endpointplaybacksession.xpc")
+    (global-name "com.apple.coremedia.endpointpicker.xpc"))
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to