Title: [264515] trunk
Revision
264515
Author
[email protected]
Date
2020-07-17 09:10:34 -0700 (Fri, 17 Jul 2020)

Log Message

Unreviewed, reverting r264477.

Broke the internal build

Reverted changeset:

"Use AVRoutePickerView when available for choosing AirPlay
devices"
https://bugs.webkit.org/show_bug.cgi?id=213497
https://trac.webkit.org/changeset/264477

Modified Paths

Removed Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (264514 => 264515)


--- trunk/Source/WebCore/ChangeLog	2020-07-17 16:07:13 UTC (rev 264514)
+++ trunk/Source/WebCore/ChangeLog	2020-07-17 16:10:34 UTC (rev 264515)
@@ -1,5 +1,18 @@
 2020-07-17  Truitt Savell  <[email protected]>
 
+        Unreviewed, reverting r264477.
+
+        Broke the internal build
+
+        Reverted changeset:
+
+        "Use AVRoutePickerView when available for choosing AirPlay
+        devices"
+        https://bugs.webkit.org/show_bug.cgi?id=213497
+        https://trac.webkit.org/changeset/264477
+
+2020-07-17  Truitt Savell  <[email protected]>
+
         Unreviewed, reverting r264482.
 
         Part of an attempted fix for the build

Modified: trunk/Source/WebCore/Modules/mediasession/WebMediaSessionManager.cpp (264514 => 264515)


--- trunk/Source/WebCore/Modules/mediasession/WebMediaSessionManager.cpp	2020-07-17 16:07:13 UTC (rev 264514)
+++ trunk/Source/WebCore/Modules/mediasession/WebMediaSessionManager.cpp	2020-07-17 16:10:34 UTC (rev 264515)
@@ -256,7 +256,7 @@
     ALWAYS_LOG_MEDIASESSIONMANAGER(__func__, m_clientState[index].get());
 
     bool hasActiveRoute = flagsAreSet(m_clientState[index]->flags, MediaProducer::IsPlayingToExternalDevice);
-    targetPicker().showPlaybackTargetPicker(client.platformView(), FloatRect(rect), hasActiveRoute, useDarkAppearance);
+    targetPicker().showPlaybackTargetPicker(FloatRect(rect), hasActiveRoute, useDarkAppearance);
 }
 
 void WebMediaSessionManager::clientStateDidChange(WebMediaSessionManagerClient& client, PlaybackTargetClientContextIdentifier contextId, MediaProducer::MediaStateFlags newFlags)

Modified: trunk/Source/WebCore/Modules/mediasession/WebMediaSessionManager.h (264514 => 264515)


--- trunk/Source/WebCore/Modules/mediasession/WebMediaSessionManager.h	2020-07-17 16:07:13 UTC (rev 264514)
+++ trunk/Source/WebCore/Modules/mediasession/WebMediaSessionManager.h	2020-07-17 16:10:34 UTC (rev 264515)
@@ -31,7 +31,6 @@
 #include "MediaPlaybackTargetPicker.h"
 #include "MediaPlaybackTargetPickerMock.h"
 #include "MediaProducer.h"
-#include "PlatformView.h"
 #include "PlaybackTargetClientContextIdentifier.h"
 #include <wtf/Ref.h>
 #include <wtf/RefPtr.h>

Modified: trunk/Source/WebCore/Modules/mediasession/WebMediaSessionManagerClient.h (264514 => 264515)


--- trunk/Source/WebCore/Modules/mediasession/WebMediaSessionManagerClient.h	2020-07-17 16:07:13 UTC (rev 264514)
+++ trunk/Source/WebCore/Modules/mediasession/WebMediaSessionManagerClient.h	2020-07-17 16:10:34 UTC (rev 264515)
@@ -29,7 +29,6 @@
 
 #include "MediaPlaybackTarget.h"
 #include "MediaProducer.h"
-#include "PlatformView.h"
 #include "PlaybackTargetClientContextIdentifier.h"
 #include <wtf/Ref.h>
 
@@ -44,7 +43,6 @@
     virtual void setShouldPlayToPlaybackTarget(PlaybackTargetClientContextIdentifier, bool) = 0;
     virtual void playbackTargetPickerWasDismissed(PlaybackTargetClientContextIdentifier) = 0;
     virtual bool alwaysOnLoggingAllowed() { return false; }
-    virtual PlatformView* platformView() const = 0;
 };
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/Modules/remoteplayback/RemotePlayback.cpp (264514 => 264515)


--- trunk/Source/WebCore/Modules/remoteplayback/RemotePlayback.cpp	2020-07-17 16:07:13 UTC (rev 264514)
+++ trunk/Source/WebCore/Modules/remoteplayback/RemotePlayback.cpp	2020-07-17 16:10:34 UTC (rev 264515)
@@ -324,9 +324,6 @@
 
 void RemotePlayback::playbackTargetPickerWasDismissed()
 {
-    if (m_promptPromises.isEmpty())
-        return;
-
     // 6.2.2 Prompt user for changing remote playback state [Ctd]
     // https://w3c.github.io/remote-playback/#stop-observing-remote-playback-devices-availability
     // W3C Editor's Draft 15 July 2016

Modified: trunk/Source/WebCore/PAL/ChangeLog (264514 => 264515)


--- trunk/Source/WebCore/PAL/ChangeLog	2020-07-17 16:07:13 UTC (rev 264514)
+++ trunk/Source/WebCore/PAL/ChangeLog	2020-07-17 16:10:34 UTC (rev 264515)
@@ -1,5 +1,18 @@
 2020-07-17  Truitt Savell  <[email protected]>
 
+        Unreviewed, reverting r264477.
+
+        Broke the internal build
+
+        Reverted changeset:
+
+        "Use AVRoutePickerView when available for choosing AirPlay
+        devices"
+        https://bugs.webkit.org/show_bug.cgi?id=213497
+        https://trac.webkit.org/changeset/264477
+
+2020-07-17  Truitt Savell  <[email protected]>
+
         Unreviewed, reverting r264493.
 
         Part of an attempted fix for the build

Modified: trunk/Source/WebCore/PAL/pal/cocoa/AVFoundationSoftLink.h (264514 => 264515)


--- trunk/Source/WebCore/PAL/pal/cocoa/AVFoundationSoftLink.h	2020-07-17 16:07:13 UTC (rev 264514)
+++ trunk/Source/WebCore/PAL/pal/cocoa/AVFoundationSoftLink.h	2020-07-17 16:10:34 UTC (rev 264515)
@@ -84,7 +84,6 @@
 
 #if !PLATFORM(WATCHOS)
 SOFT_LINK_CLASS_FOR_HEADER(PAL, AVRouteDetector)
-SOFT_LINK_CLASS_FOR_HEADER(PAL, AVRoutePickerView)
 SOFT_LINK_CLASS_FOR_HEADER(PAL, AVVideoPerformanceMetrics)
 #endif
 
@@ -292,6 +291,8 @@
 #define AVAudioSessionInterruptionTypeKey PAL::get_AVFoundation_AVAudioSessionInterruptionTypeKey()
 SOFT_LINK_CONSTANT_FOR_HEADER(PAL, AVFoundation, AVAudioSessionInterruptionOptionKey, NSString *)
 #define AVAudioSessionInterruptionOptionKey PAL::get_AVFoundation_AVAudioSessionInterruptionOptionKey()
+SOFT_LINK_CONSTANT_FOR_HEADER(PAL, AVFoundation, AVRouteDetectorMultipleRoutesDetectedDidChangeNotification, NSString *)
+#define AVRouteDetectorMultipleRoutesDetectedDidChangeNotification PAL::get_AVFoundation_AVRouteDetectorMultipleRoutesDetectedDidChangeNotification()
 SOFT_LINK_CONSTANT_FOR_HEADER(PAL, AVFoundation, AVAudioSessionMediaServicesWereResetNotification, NSString *)
 #define AVAudioSessionMediaServicesWereResetNotification PAL::get_AVFoundation_AVAudioSessionMediaServicesWereResetNotification()
 SOFT_LINK_CONSTANT_FOR_HEADER(PAL, AVFoundation, AVAudioSessionRouteChangeNotification, NSString *)
@@ -305,11 +306,4 @@
 #define AVCaptureSessionSetAuthorizedToUseCameraInMultipleForegroundAppLayout softLink_AVFoundation_AVCaptureSessionSetAuthorizedToUseCameraInMultipleForegroundAppLayout
 #endif // PLATFORM(IOS_FAMILY) && !PLATFORM(WATCHOS) && !PLATFORM(APPLETV)
 
-#if !PLATFORM(WATCHOS)
-SOFT_LINK_CONSTANT_FOR_HEADER(PAL, AVFoundation, AVRouteDetectorMultipleRoutesDetectedDidChangeNotification, NSString *)
-#define AVRouteDetectorMultipleRoutesDetectedDidChangeNotification PAL::get_AVFoundation_AVRouteDetectorMultipleRoutesDetectedDidChangeNotification()
-SOFT_LINK_CONSTANT_FOR_HEADER(PAL, AVFoundation, AVOutputContextOutputDevicesDidChangeNotification, NSString *)
-#define AVOutputContextOutputDevicesDidChangeNotification PAL::get_AVFoundation_AVOutputContextOutputDevicesDidChangeNotification()
-#endif // PLATFORM(WATCHOS)
-
 #endif // USE(AVFOUNDATION)

Modified: trunk/Source/WebCore/PAL/pal/cocoa/AVFoundationSoftLink.mm (264514 => 264515)


--- trunk/Source/WebCore/PAL/pal/cocoa/AVFoundationSoftLink.mm	2020-07-17 16:07:13 UTC (rev 264514)
+++ trunk/Source/WebCore/PAL/pal/cocoa/AVFoundationSoftLink.mm	2020-07-17 16:10:34 UTC (rev 264515)
@@ -111,7 +111,6 @@
 #if !PLATFORM(WATCHOS)
 SOFT_LINK_CLASS_FOR_SOURCE_WITH_EXPORT(PAL, AVFoundation, AVRouteDetector, PAL_EXPORT)
 SOFT_LINK_CLASS_FOR_SOURCE_OPTIONAL_WITH_EXPORT(PAL, AVFoundation, AVVideoPerformanceMetrics, PAL_EXPORT)
-SOFT_LINK_CLASS_FOR_SOURCE_OPTIONAL_WITH_EXPORT(PAL, AVFoundation, AVRoutePickerView, PAL_EXPORT)
 #endif
 
 #if !PLATFORM(WATCHOS) && !PLATFORM(APPLETV)
@@ -215,6 +214,7 @@
 SOFT_LINK_CONSTANT_FOR_SOURCE_WITH_EXPORT(PAL, AVFoundation, AVCaptureSessionInterruptionReasonKey, NSString *, PAL_EXPORT)
 SOFT_LINK_CONSTANT_FOR_SOURCE_WITH_EXPORT(PAL, AVFoundation, AVCaptureSessionRuntimeErrorNotification, NSString *, PAL_EXPORT)
 SOFT_LINK_CONSTANT_FOR_SOURCE_WITH_EXPORT(PAL, AVFoundation, AVCaptureSessionWasInterruptedNotification, NSString *, PAL_EXPORT)
+SOFT_LINK_CONSTANT_FOR_SOURCE_WITH_EXPORT(PAL, AVFoundation, AVRouteDetectorMultipleRoutesDetectedDidChangeNotification, NSString *, PAL_EXPORT)
 SOFT_LINK_CONSTANT_FOR_SOURCE_WITH_EXPORT(PAL, AVFoundation, AVURLAssetBoundNetworkInterfaceName, NSString *, PAL_EXPORT)
 SOFT_LINK_CONSTANT_FOR_SOURCE_WITH_EXPORT(PAL, AVFoundation, AVURLAssetClientBundleIdentifierKey, NSString *, PAL_EXPORT)
 SOFT_LINK_CONSTANT_FOR_SOURCE_WITH_EXPORT(PAL, AVFoundation, AVAudioSessionRouteChangeNotification, NSString *, PAL_EXPORT)
@@ -228,9 +228,4 @@
 SOFT_LINK_FUNCTION_FOR_SOURCE(PAL, AVFoundation, AVCaptureSessionSetAuthorizedToUseCameraInMultipleForegroundAppLayout, void, (AVCaptureSession *session), (session))
 #endif // PLATFORM(IOS_FAMILY) && !PLATFORM(WATCHOS) && !PLATFORM(APPLETV)
 
-#if !PLATFORM(WATCHOS)
-SOFT_LINK_CONSTANT_FOR_SOURCE_WITH_EXPORT(PAL, AVFoundation, AVRouteDetectorMultipleRoutesDetectedDidChangeNotification, NSString *, PAL_EXPORT)
-SOFT_LINK_CONSTANT_FOR_SOURCE_WITH_EXPORT(PAL, AVFoundation, AVOutputContextOutputDevicesDidChangeNotification, NSString *, PAL_EXPORT)
-#endif // !PLATFORM(WATCHOS)
-
 #endif // USE(AVFOUNDATION)

Modified: trunk/Source/WebCore/PAL/pal/spi/cocoa/AVFoundationSPI.h (264514 => 264515)


--- trunk/Source/WebCore/PAL/pal/spi/cocoa/AVFoundationSPI.h	2020-07-17 16:07:13 UTC (rev 264514)
+++ trunk/Source/WebCore/PAL/pal/spi/cocoa/AVFoundationSPI.h	2020-07-17 16:10:34 UTC (rev 264515)
@@ -74,7 +74,6 @@
 @interface AVOutputContext : NSObject <NSSecureCoding>
 @property (nonatomic, readonly) NSString *deviceName;
 + (instancetype)outputContext;
-+ (instancetype)iTunesAudioContext;
 + (nullable AVOutputContext *)sharedAudioPresentationOutputContext;
 + (nullable AVOutputContext *)outputContextForID:(NSString *)ID;
 @property (readonly) BOOL supportsMultipleOutputDevices;

Modified: trunk/Source/WebCore/PAL/pal/spi/cocoa/AVKitSPI.h (264514 => 264515)


--- trunk/Source/WebCore/PAL/pal/spi/cocoa/AVKitSPI.h	2020-07-17 16:07:13 UTC (rev 264514)
+++ trunk/Source/WebCore/PAL/pal/spi/cocoa/AVKitSPI.h	2020-07-17 16:10:34 UTC (rev 264515)
@@ -232,8 +232,6 @@
 #if USE(APPLE_INTERNAL_SDK)
 
 #import <AVKit/AVOutputDeviceMenuController.h>
-#import <AVKit/AVRoutePickerView_Private.h>
-#import <AVKit/AVRoutePickerView_WebKitOnly.h>
 
 #else
 
@@ -255,23 +253,6 @@
 
 @end
 
-@protocol AVRoutePickerViewDelegate;
-
-@interface AVRoutePickerView : NSView
-
-- (void)showRoutePickingControlsForOutputContext:(AVOutputContext *)outputContext relativeToRect:(NSRect)positioningRect ofView:(NSView *)positioningView;
-
-@property (nonatomic, nullable, weak) id<AVRoutePickerViewDelegate> delegate;
-@property (nonatomic) BOOL routeListAlwaysHasDarkAppearance;
-
-@end
-
-@protocol AVRoutePickerViewDelegate <NSObject>
-@optional
-- (void)routePickerViewWillBeginPresentingRoutes:(AVRoutePickerView *)routePickerView;
-- (void)routePickerViewDidEndPresentingRoutes:(AVRoutePickerView *)routePickerView;
-@end
-
 NS_ASSUME_NONNULL_END
 
 #endif // USE(APPLE_INTERNAL_SDK)

Modified: trunk/Source/WebCore/SourcesCocoa.txt (264514 => 264515)


--- trunk/Source/WebCore/SourcesCocoa.txt	2020-07-17 16:07:13 UTC (rev 264514)
+++ trunk/Source/WebCore/SourcesCocoa.txt	2020-07-17 16:10:34 UTC (rev 264515)
@@ -274,8 +274,6 @@
 platform/graphics/avfoundation/WebMediaSessionManagerMac.cpp @no-unify
 platform/graphics/avfoundation/objc/AVAssetMIMETypeCache.mm @no-unify
 platform/graphics/avfoundation/objc/AVAssetTrackUtilities.mm @no-unify
-platform/graphics/avfoundation/objc/AVOutputDeviceMenuControllerTargetPicker.mm @no-unify
-platform/graphics/avfoundation/objc/AVRoutePickerViewTargetPicker.mm @no-unify
 platform/graphics/avfoundation/objc/AVStreamDataParserMIMETypeCache.mm @no-unify
 platform/graphics/avfoundation/objc/AudioTrackPrivateAVFObjC.mm @no-unify
 platform/graphics/avfoundation/objc/AudioTrackPrivateMediaSourceAVFObjC.cpp @no-unify

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (264514 => 264515)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2020-07-17 16:07:13 UTC (rev 264514)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2020-07-17 16:10:34 UTC (rev 264515)
@@ -118,7 +118,6 @@
 		073794EC19EE341E00E5A045 /* JSRTCIceServer.h in Headers */ = {isa = PBXBuildFile; fileRef = 073794EA19EE341E00E5A045 /* JSRTCIceServer.h */; };
 		073794FA19F5864E00E5A045 /* RTCDataChannelHandlerMock.h in Headers */ = {isa = PBXBuildFile; fileRef = 073794F419F5864E00E5A045 /* RTCDataChannelHandlerMock.h */; };
 		073794FE19F5864E00E5A045 /* RTCNotifiersMock.h in Headers */ = {isa = PBXBuildFile; fileRef = 073794F819F5864E00E5A045 /* RTCNotifiersMock.h */; };
-		0738E5EC2499839000DA101C /* AVOutputDeviceMenuControllerTargetPicker.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0738E5EA249968AD00DA101C /* AVOutputDeviceMenuControllerTargetPicker.mm */; };
 		073A15542177A42600EA08F2 /* RemoteVideoSample.h in Headers */ = {isa = PBXBuildFile; fileRef = 073A15532177A39A00EA08F2 /* RemoteVideoSample.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		073B87671E4385AC0071C0EC /* AudioSampleBufferList.h in Headers */ = {isa = PBXBuildFile; fileRef = 073B87631E43859D0071C0EC /* AudioSampleBufferList.h */; };
 		073B87691E4385AC0071C0EC /* AudioSampleDataSource.h in Headers */ = {isa = PBXBuildFile; fileRef = 073B87651E43859D0071C0EC /* AudioSampleDataSource.h */; };
@@ -205,7 +204,6 @@
 		07C046CB1E426413007201E7 /* AudioStreamDescription.h in Headers */ = {isa = PBXBuildFile; fileRef = 073B87561E40DCE50071C0EC /* AudioStreamDescription.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		07C1C0E21BFB600100BD2256 /* MediaTrackSupportedConstraints.h in Headers */ = {isa = PBXBuildFile; fileRef = 07C1C0E01BFB600100BD2256 /* MediaTrackSupportedConstraints.h */; };
 		07C1C0E51BFB60ED00BD2256 /* RealtimeMediaSourceSupportedConstraints.h in Headers */ = {isa = PBXBuildFile; fileRef = 07C1C0E41BFB60ED00BD2256 /* RealtimeMediaSourceSupportedConstraints.h */; settings = {ATTRIBUTES = (Private, ); }; };
-		07CB9E72249C36B200A69489 /* AVRoutePickerViewTargetPicker.mm in Sources */ = {isa = PBXBuildFile; fileRef = 07CB9E6F249C226C00A69489 /* AVRoutePickerViewTargetPicker.mm */; };
 		07CE77D516712A6A00C55A47 /* InbandTextTrackPrivateClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 07CE77D416712A6A00C55A47 /* InbandTextTrackPrivateClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		07D12F5C23DE543F0080997D /* ISOVTTCue.h in Headers */ = {isa = PBXBuildFile; fileRef = CD871C651FB52B6700F0B965 /* ISOVTTCue.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		07D637401BB0B11300256CE9 /* WebAudioSourceProviderAVFObjC.h in Headers */ = {isa = PBXBuildFile; fileRef = 07D6373E1BB0B11300256CE9 /* WebAudioSourceProviderAVFObjC.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -5574,9 +5572,6 @@
 		073794F419F5864E00E5A045 /* RTCDataChannelHandlerMock.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RTCDataChannelHandlerMock.h; sourceTree = "<group>"; };
 		073794F719F5864E00E5A045 /* RTCNotifiersMock.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RTCNotifiersMock.cpp; sourceTree = "<group>"; };
 		073794F819F5864E00E5A045 /* RTCNotifiersMock.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RTCNotifiersMock.h; sourceTree = "<group>"; };
-		0738E5E8249968AC00DA101C /* AVOutputDeviceMenuControllerTargetPicker.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AVOutputDeviceMenuControllerTargetPicker.h; sourceTree = "<group>"; };
-		0738E5EA249968AD00DA101C /* AVOutputDeviceMenuControllerTargetPicker.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = AVOutputDeviceMenuControllerTargetPicker.mm; sourceTree = "<group>"; };
-		0738E5EB2499690900DA101C /* AVPlaybackTargetPicker.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AVPlaybackTargetPicker.h; sourceTree = "<group>"; };
 		073A15512177A39800EA08F2 /* RemoteVideoSample.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = RemoteVideoSample.cpp; sourceTree = "<group>"; };
 		073A15532177A39A00EA08F2 /* RemoteVideoSample.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RemoteVideoSample.h; sourceTree = "<group>"; };
 		073B87561E40DCE50071C0EC /* AudioStreamDescription.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AudioStreamDescription.h; sourceTree = "<group>"; };
@@ -5691,8 +5686,6 @@
 		07C1C0E41BFB60ED00BD2256 /* RealtimeMediaSourceSupportedConstraints.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RealtimeMediaSourceSupportedConstraints.h; sourceTree = "<group>"; };
 		07C8AD111D073D630087C5CE /* AVAssetMIMETypeCache.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AVAssetMIMETypeCache.mm; sourceTree = "<group>"; };
 		07C8AD121D073D630087C5CE /* AVAssetMIMETypeCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AVAssetMIMETypeCache.h; sourceTree = "<group>"; };
-		07CB9E6F249C226C00A69489 /* AVRoutePickerViewTargetPicker.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = AVRoutePickerViewTargetPicker.mm; sourceTree = "<group>"; };
-		07CB9E71249C226C00A69489 /* AVRoutePickerViewTargetPicker.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AVRoutePickerViewTargetPicker.h; sourceTree = "<group>"; };
 		07CE77D416712A6A00C55A47 /* InbandTextTrackPrivateClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InbandTextTrackPrivateClient.h; sourceTree = "<group>"; };
 		07D6373E1BB0B11300256CE9 /* WebAudioSourceProviderAVFObjC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebAudioSourceProviderAVFObjC.h; sourceTree = "<group>"; };
 		07D6373F1BB0B11300256CE9 /* WebAudioSourceProviderAVFObjC.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebAudioSourceProviderAVFObjC.mm; sourceTree = "<group>"; };
@@ -27366,11 +27359,6 @@
 				07C8AD111D073D630087C5CE /* AVAssetMIMETypeCache.mm */,
 				CDECA8991EDF447D00DCB08B /* AVAssetTrackUtilities.h */,
 				CDECA8981EDF447D00DCB08B /* AVAssetTrackUtilities.mm */,
-				0738E5E8249968AC00DA101C /* AVOutputDeviceMenuControllerTargetPicker.h */,
-				0738E5EA249968AD00DA101C /* AVOutputDeviceMenuControllerTargetPicker.mm */,
-				0738E5EB2499690900DA101C /* AVPlaybackTargetPicker.h */,
-				07CB9E71249C226C00A69489 /* AVRoutePickerViewTargetPicker.h */,
-				07CB9E6F249C226C00A69489 /* AVRoutePickerViewTargetPicker.mm */,
 				CD11B3DF227CAAA90023AFC7 /* AVStreamDataParserMIMETypeCache.h */,
 				CD11B3E0227CAAA90023AFC7 /* AVStreamDataParserMIMETypeCache.mm */,
 				CD78A2EE1F75648600DE371B /* CDMInstanceFairPlayStreamingAVFObjC.h */,
@@ -34507,8 +34495,6 @@
 				CDECA89A1EDF447D00DCB08B /* AVAssetTrackUtilities.mm in Sources */,
 				CDC675221EAEA9B700727C84 /* AVAudioSessionCaptureDeviceManager.mm in Sources */,
 				070363E3181A1CDC00C074A5 /* AVCaptureDeviceManager.mm in Sources */,
-				0738E5EC2499839000DA101C /* AVOutputDeviceMenuControllerTargetPicker.mm in Sources */,
-				07CB9E72249C36B200A69489 /* AVRoutePickerViewTargetPicker.mm in Sources */,
 				CD11B3E1227CE6F30023AFC7 /* AVStreamDataParserMIMETypeCache.mm in Sources */,
 				CD336F6117F9F64700DDDCD0 /* AVTrackPrivateAVFObjCImpl.mm in Sources */,
 				070363E7181A1CDC00C074A5 /* AVVideoCaptureSource.mm in Sources */,

Modified: trunk/Source/WebCore/platform/graphics/MediaPlaybackTargetPicker.cpp (264514 => 264515)


--- trunk/Source/WebCore/platform/graphics/MediaPlaybackTargetPicker.cpp	2020-07-17 16:07:13 UTC (rev 264514)
+++ trunk/Source/WebCore/platform/graphics/MediaPlaybackTargetPicker.cpp	2020-07-17 16:10:34 UTC (rev 264515)
@@ -73,7 +73,7 @@
     m_pendingActionTimer.startOneShot(pendingActionInterval);
 }
 
-void MediaPlaybackTargetPicker::showPlaybackTargetPicker(PlatformView*, const FloatRect&, bool, bool)
+void MediaPlaybackTargetPicker::showPlaybackTargetPicker(const FloatRect&, bool, bool)
 {
     ASSERT_NOT_REACHED();
 }

Modified: trunk/Source/WebCore/platform/graphics/MediaPlaybackTargetPicker.h (264514 => 264515)


--- trunk/Source/WebCore/platform/graphics/MediaPlaybackTargetPicker.h	2020-07-17 16:07:13 UTC (rev 264514)
+++ trunk/Source/WebCore/platform/graphics/MediaPlaybackTargetPicker.h	2020-07-17 16:10:34 UTC (rev 264515)
@@ -28,7 +28,6 @@
 
 #if ENABLE(WIRELESS_PLAYBACK_TARGET)
 
-#include "PlatformView.h"
 #include <wtf/Ref.h>
 #include <wtf/RunLoop.h>
 
@@ -53,7 +52,7 @@
 
     virtual ~MediaPlaybackTargetPicker();
 
-    virtual void showPlaybackTargetPicker(PlatformView*, const FloatRect&, bool checkActiveRoute, bool useDarkAppearance);
+    virtual void showPlaybackTargetPicker(const FloatRect&, bool checkActiveRoute, bool useDarkAppearance);
     virtual void startingMonitoringPlaybackTargets();
     virtual void stopMonitoringPlaybackTargets();
     virtual void invalidatePlaybackTargets();

Deleted: trunk/Source/WebCore/platform/graphics/avfoundation/objc/AVOutputDeviceMenuControllerTargetPicker.h (264514 => 264515)


--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/AVOutputDeviceMenuControllerTargetPicker.h	2020-07-17 16:07:13 UTC (rev 264514)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/AVOutputDeviceMenuControllerTargetPicker.h	2020-07-17 16:10:34 UTC (rev 264515)
@@ -1,64 +0,0 @@
-/*
- * Copyright (C) 2020 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.
- */
-
-#pragma once
-
-#if ENABLE(WIRELESS_PLAYBACK_TARGET) && !PLATFORM(IOS_FAMILY)
-
-#include "AVPlaybackTargetPicker.h"
-
-OBJC_CLASS AVOutputDeviceMenuController;
-OBJC_CLASS WebAVOutputDeviceMenuControllerHelper;
-
-namespace WebCore {
-
-class AVOutputDeviceMenuControllerTargetPicker final : public AVPlaybackTargetPicker {
-    WTF_MAKE_FAST_ALLOCATED;
-    WTF_MAKE_NONCOPYABLE(AVOutputDeviceMenuControllerTargetPicker);
-public:
-    explicit AVOutputDeviceMenuControllerTargetPicker(AVPlaybackTargetPicker::Client&);
-    virtual ~AVOutputDeviceMenuControllerTargetPicker();
-
-    void availableDevicesDidChange();
-    void currentDeviceDidChange();
-
-private:
-    void showPlaybackTargetPicker(NSView *, const FloatRect&, bool checkActiveRoute, bool useDarkAppearance) final;
-    void startingMonitoringPlaybackTargets() final;
-    void stopMonitoringPlaybackTargets() final;
-    void invalidatePlaybackTargets() final;
-    bool externalOutputDeviceAvailable() final;
-    AVOutputContext* outputContext() final;
-
-    AVOutputDeviceMenuController *devicePicker();
-
-    RetainPtr<AVOutputDeviceMenuController> m_outputDeviceMenuController;
-    RetainPtr<WebAVOutputDeviceMenuControllerHelper> m_outputDeviceMenuControllerDelegate;
-    bool m_showingMenu { false };
-};
-
-} // namespace WebCore
-
-#endif // ENABLE(WIRELESS_PLAYBACK_TARGET)

Deleted: trunk/Source/WebCore/platform/graphics/avfoundation/objc/AVOutputDeviceMenuControllerTargetPicker.mm (264514 => 264515)


--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/AVOutputDeviceMenuControllerTargetPicker.mm	2020-07-17 16:07:13 UTC (rev 264514)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/AVOutputDeviceMenuControllerTargetPicker.mm	2020-07-17 16:10:34 UTC (rev 264515)
@@ -1,200 +0,0 @@
-/*
- * Copyright (C) 2020 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 "AVOutputDeviceMenuControllerTargetPicker.h"
-
-#if ENABLE(WIRELESS_PLAYBACK_TARGET) && !PLATFORM(IOS_FAMILY)
-
-#import "Logging.h"
-#import <WebCore/FloatRect.h>
-#import <objc/runtime.h>
-#import <pal/spi/cocoa/AVFoundationSPI.h>
-#import <pal/spi/cocoa/AVKitSPI.h>
-#import <wtf/MainThread.h>
-
-#import <pal/cf/CoreMediaSoftLink.h>
-#import <pal/cocoa/AVFoundationSoftLink.h>
-
-SOFTLINK_AVKIT_FRAMEWORK()
-SOFT_LINK_CLASS_OPTIONAL(AVKit, AVOutputDeviceMenuController)
-
-using namespace WebCore;
-
-static NSString *externalOutputDeviceAvailableKeyName = @"externalOutputDeviceAvailable";
-static NSString *externalOutputDevicePickedKeyName = @"externalOutputDevicePicked";
-
-@interface WebAVOutputDeviceMenuControllerHelper : NSObject {
-    WeakPtr<AVOutputDeviceMenuControllerTargetPicker> m_callback;
-}
-
-- (instancetype)initWithCallback:(WeakPtr<AVOutputDeviceMenuControllerTargetPicker>&&)callback;
-- (void)clearCallback;
-- (void)observeValueForKeyPath:(id)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context;
-@end
-
-namespace WebCore {
-
-AVOutputDeviceMenuControllerTargetPicker::AVOutputDeviceMenuControllerTargetPicker(AVPlaybackTargetPicker::Client& client)
-    : AVPlaybackTargetPicker(client)
-    , m_outputDeviceMenuControllerDelegate(adoptNS([[WebAVOutputDeviceMenuControllerHelper alloc] initWithCallback:makeWeakPtr(*this)]))
-{
-}
-
-AVOutputDeviceMenuControllerTargetPicker::~AVOutputDeviceMenuControllerTargetPicker()
-{
-    [m_outputDeviceMenuControllerDelegate clearCallback];
-}
-
-AVOutputDeviceMenuController *AVOutputDeviceMenuControllerTargetPicker::devicePicker()
-{
-    if (!getAVOutputDeviceMenuControllerClass())
-        return nullptr;
-
-    if (!m_outputDeviceMenuController) {
-        RetainPtr<AVOutputContext> context = adoptNS([PAL::allocAVOutputContextInstance() init]);
-        m_outputDeviceMenuController = adoptNS([allocAVOutputDeviceMenuControllerInstance() initWithOutputContext:context.get()]);
-
-        [m_outputDeviceMenuController.get() addObserver:m_outputDeviceMenuControllerDelegate.get() forKeyPath:externalOutputDeviceAvailableKeyName options:NSKeyValueObservingOptionNew context:nullptr];
-        [m_outputDeviceMenuController.get() addObserver:m_outputDeviceMenuControllerDelegate.get() forKeyPath:externalOutputDevicePickedKeyName options:NSKeyValueObservingOptionNew context:nullptr];
-
-        ALLOW_DEPRECATED_DECLARATIONS_BEGIN
-        if (m_outputDeviceMenuController.get().externalOutputDeviceAvailable)
-            availableDevicesDidChange();
-        ALLOW_DEPRECATED_DECLARATIONS_END
-    }
-
-    return m_outputDeviceMenuController.get();
-}
-
-void AVOutputDeviceMenuControllerTargetPicker::availableDevicesDidChange()
-{
-    if (client())
-        client()->availableDevicesChanged();
-}
-
-void AVOutputDeviceMenuControllerTargetPicker::currentDeviceDidChange()
-{
-    if (client())
-        client()->currentDeviceChanged();
-}
-
-void AVOutputDeviceMenuControllerTargetPicker::showPlaybackTargetPicker(NSView *, const FloatRect& location, bool hasActiveRoute, bool useDarkAppearance)
-{
-    if (!client() || m_showingMenu)
-        return;
-
-    m_showingMenu = true;
-
-    ALLOW_DEPRECATED_DECLARATIONS_BEGIN
-    bool targetSelected = [devicePicker() showMenuForRect:location appearanceName:(useDarkAppearance ? NSAppearanceNameVibrantDark : NSAppearanceNameVibrantLight) allowReselectionOfSelectedOutputDevice:!hasActiveRoute];
-    ALLOW_DEPRECATED_DECLARATIONS_END
-
-    if (!client())
-        return;
-
-    if (targetSelected != hasActiveRoute)
-        currentDeviceDidChange();
-    else if (!targetSelected && !hasActiveRoute)
-        client()->pickerWasDismissed();
-
-    m_showingMenu = false;
-}
-
-void AVOutputDeviceMenuControllerTargetPicker::startingMonitoringPlaybackTargets()
-{
-    devicePicker();
-}
-
-void AVOutputDeviceMenuControllerTargetPicker::stopMonitoringPlaybackTargets()
-{
-    // Nothing to do, AirPlay takes care of this automatically.
-}
-
-void AVOutputDeviceMenuControllerTargetPicker::invalidatePlaybackTargets()
-{
-    if (m_outputDeviceMenuController) {
-        [m_outputDeviceMenuController removeObserver:m_outputDeviceMenuControllerDelegate.get() forKeyPath:externalOutputDeviceAvailableKeyName];
-        [m_outputDeviceMenuController removeObserver:m_outputDeviceMenuControllerDelegate.get() forKeyPath:externalOutputDevicePickedKeyName];
-        m_outputDeviceMenuController = nullptr;
-    }
-    currentDeviceDidChange();
-}
-
-bool AVOutputDeviceMenuControllerTargetPicker::externalOutputDeviceAvailable()
-{
-    ALLOW_DEPRECATED_DECLARATIONS_BEGIN
-    return devicePicker().externalOutputDeviceAvailable;
-    ALLOW_DEPRECATED_DECLARATIONS_END
-}
-
-AVOutputContext * AVOutputDeviceMenuControllerTargetPicker::outputContext()
-{
-    return m_outputDeviceMenuController ? [m_outputDeviceMenuController.get() outputContext] : nullptr;
-}
-
-} // namespace WebCore
-
-@implementation WebAVOutputDeviceMenuControllerHelper
-- (instancetype)initWithCallback:(WeakPtr<AVOutputDeviceMenuControllerTargetPicker>&&)callback
-{
-    if (!(self = [super init]))
-        return nil;
-
-    m_callback = WTFMove(callback);
-
-    return self;
-}
-
-- (void)clearCallback
-{
-    m_callback = nil;
-}
-
-- (void)observeValueForKeyPath:(id)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
-{
-    UNUSED_PARAM(object);
-    UNUSED_PARAM(change);
-    UNUSED_PARAM(context);
-
-    if (!m_callback)
-        return;
-
-    if (![keyPath isEqualToString:externalOutputDeviceAvailableKeyName] && ![keyPath isEqualToString:externalOutputDevicePickedKeyName])
-        return;
-
-    callOnMainThread([self, protectedSelf = retainPtr(self), keyPath = retainPtr(keyPath)] {
-        if (!m_callback)
-            return;
-
-        if ([keyPath isEqualToString:externalOutputDeviceAvailableKeyName])
-            m_callback->availableDevicesDidChange();
-        else if ([keyPath isEqualToString:externalOutputDevicePickedKeyName])
-            m_callback->currentDeviceDidChange();
-    });
-}
-@end
-
-#endif // ENABLE(WIRELESS_PLAYBACK_TARGET)

Deleted: trunk/Source/WebCore/platform/graphics/avfoundation/objc/AVPlaybackTargetPicker.h (264514 => 264515)


--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/AVPlaybackTargetPicker.h	2020-07-17 16:07:13 UTC (rev 264514)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/AVPlaybackTargetPicker.h	2020-07-17 16:10:34 UTC (rev 264515)
@@ -1,75 +0,0 @@
-/*
- * Copyright (C) 2020 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.
- */
-
-#pragma once
-
-#if ENABLE(WIRELESS_PLAYBACK_TARGET) && !PLATFORM(IOS_FAMILY)
-
-#include <wtf/WeakPtr.h>
-
-OBJC_CLASS AVOutputContext;
-OBJC_CLASS NSView;
-
-namespace WebCore {
-
-class FloatRect;
-
-class AVPlaybackTargetPicker : public CanMakeWeakPtr<AVPlaybackTargetPicker> {
-    WTF_MAKE_FAST_ALLOCATED;
-    WTF_MAKE_NONCOPYABLE(AVPlaybackTargetPicker);
-public:
-    class Client : public CanMakeWeakPtr<Client> {
-    protected:
-        virtual ~Client() = default;
-
-    public:
-        virtual void pickerWasDismissed() = 0;
-        virtual void availableDevicesChanged() = 0;
-        virtual void currentDeviceChanged() = 0;
-    };
-
-    explicit AVPlaybackTargetPicker(Client& client)
-        : m_client(makeWeakPtr(&client))
-    {
-    }
-    virtual ~AVPlaybackTargetPicker() = default;
-
-    virtual void showPlaybackTargetPicker(NSView *, const FloatRect&, bool checkActiveRoute, bool useDarkAppearance) = 0;
-    virtual void startingMonitoringPlaybackTargets() = 0;
-    virtual void stopMonitoringPlaybackTargets() = 0;
-    virtual void invalidatePlaybackTargets() = 0;
-    virtual bool externalOutputDeviceAvailable() = 0;
-
-    virtual AVOutputContext* outputContext() = 0;
-
-    WeakPtr<AVPlaybackTargetPicker::Client> client() const { return m_client; }
-
-private:
-    WeakPtr<AVPlaybackTargetPicker::Client> m_client;
-};
-
-} // namespace WebCore
-
-#endif // ENABLE(WIRELESS_PLAYBACK_TARGET)

Deleted: trunk/Source/WebCore/platform/graphics/avfoundation/objc/AVRoutePickerViewTargetPicker.h (264514 => 264515)


--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/AVRoutePickerViewTargetPicker.h	2020-07-17 16:07:13 UTC (rev 264514)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/AVRoutePickerViewTargetPicker.h	2020-07-17 16:10:34 UTC (rev 264515)
@@ -1,73 +0,0 @@
-/*
- * Copyright (C) 2020 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.
- */
-
-#pragma once
-
-#if ENABLE(WIRELESS_PLAYBACK_TARGET) && !PLATFORM(IOS_FAMILY)
-
-#include "AVPlaybackTargetPicker.h"
-
-OBJC_CLASS AVRouteDetector;
-OBJC_CLASS AVRoutePickerView;
-OBJC_CLASS WebAVRoutePickerViewHelper;
-
-namespace WebCore {
-
-class AVRoutePickerViewTargetPicker final : public AVPlaybackTargetPicker {
-    WTF_MAKE_FAST_ALLOCATED;
-    WTF_MAKE_NONCOPYABLE(AVRoutePickerViewTargetPicker);
-public:
-    explicit AVRoutePickerViewTargetPicker(AVPlaybackTargetPicker::Client&);
-    virtual ~AVRoutePickerViewTargetPicker();
-    
-    static bool isAvailable();
-
-    void availableDevicesDidChange();
-    void currentDeviceDidChange();
-    void devicePickerWasDismissed();
-
-private:
-    void showPlaybackTargetPicker(NSView *, const FloatRect&, bool checkActiveRoute, bool useDarkAppearance) final;
-    void startingMonitoringPlaybackTargets() final;
-    void stopMonitoringPlaybackTargets() final;
-    void invalidatePlaybackTargets() final;
-    bool externalOutputDeviceAvailable() final;
-    AVOutputContext *outputContext() final;
-
-    AVRoutePickerView *devicePicker();
-    AVRouteDetector *routeDetector();
-    AVOutputContext * outputContextInternal();
-    bool hasActiveRoute() const;
-
-    RetainPtr<AVRouteDetector> m_routeDetector;
-    RetainPtr<AVRoutePickerView> m_routePickerView;
-    RetainPtr<AVOutputContext> m_outputContext;
-    RetainPtr<WebAVRoutePickerViewHelper> m_routePickerViewDelegate;
-    bool m_hadActiveRoute { false };
-};
-
-} // namespace WebCore
-
-#endif // ENABLE(WIRELESS_PLAYBACK_TARGET)

Deleted: trunk/Source/WebCore/platform/graphics/avfoundation/objc/AVRoutePickerViewTargetPicker.mm (264514 => 264515)


--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/AVRoutePickerViewTargetPicker.mm	2020-07-17 16:07:13 UTC (rev 264514)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/AVRoutePickerViewTargetPicker.mm	2020-07-17 16:10:34 UTC (rev 264515)
@@ -1,275 +0,0 @@
-/*
- * Copyright (C) 2020 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 "AVRoutePickerViewTargetPicker.h"
-
-#if ENABLE(WIRELESS_PLAYBACK_TARGET) && !PLATFORM(IOS_FAMILY)
-
-#import "Logging.h"
-#import <AVFoundation/AVRouteDetector.h>
-#import <WebCore/FloatRect.h>
-#import <pal/spi/cocoa/AVFoundationSPI.h>
-#import <pal/spi/cocoa/AVKitSPI.h>
-#import <wtf/MainThread.h>
-
-#import <pal/cf/CoreMediaSoftLink.h>
-#import <pal/cocoa/AVFoundationSoftLink.h>
-
-SOFTLINK_AVKIT_FRAMEWORK()
-SOFT_LINK_CLASS_OPTIONAL(AVKit, AVRoutePickerView)
-
-using namespace WebCore;
-
-@interface WebAVRoutePickerViewHelper : NSObject <AVRoutePickerViewDelegate> {
-    WeakPtr<AVRoutePickerViewTargetPicker> m_callback;
-}
-
-- (instancetype)initWithCallback:(WeakPtr<AVRoutePickerViewTargetPicker>&&)callback;
-- (void)clearCallback;
-- (void)notificationHandler:(NSNotification *)notification;
-- (void)routePickerViewDidEndPresentingRoutes:(AVRoutePickerView *)routePickerView;
-@end
-
-namespace WebCore {
-
-bool AVRoutePickerViewTargetPicker::isAvailable()
-{
-    static bool available;
-    static std::once_flag flag;
-    std::call_once(flag, [] () {
-        if (!PAL::getAVRoutePickerViewClass())
-            return;
-
-        if (auto picker = adoptNS([allocAVRoutePickerViewInstance() init]))
-            available = [picker respondsToSelector:@selector(showRoutePickingControlsForOutputContext:relativeToRect:ofView:)];
-    });
-
-    return available;
-}
-
-AVRoutePickerViewTargetPicker::AVRoutePickerViewTargetPicker(AVPlaybackTargetPicker::Client& client)
-    : AVPlaybackTargetPicker(client)
-    , m_routePickerViewDelegate(adoptNS([[WebAVRoutePickerViewHelper alloc] initWithCallback:makeWeakPtr(*this)]))
-{
-    ASSERT(isAvailable());
-}
-
-AVRoutePickerViewTargetPicker::~AVRoutePickerViewTargetPicker()
-{
-    [m_routePickerViewDelegate clearCallback];
-}
-
-AVOutputContext * AVRoutePickerViewTargetPicker::outputContextInternal()
-{
-    if (!m_outputContext) {
-        m_outputContext = [PAL::getAVOutputContextClass() iTunesAudioContext];
-        ASSERT(m_outputContext);
-        if (m_outputContext)
-            [[NSNotificationCenter defaultCenter] addObserver:m_routePickerViewDelegate.get() selector:@selector(notificationHandler:) name:PAL::get_AVFoundation_AVOutputContextOutputDevicesDidChangeNotification() object:m_outputContext.get()];
-    }
-
-    return m_outputContext.get();
-}
-
-AVRoutePickerView *AVRoutePickerViewTargetPicker::devicePicker()
-{
-    if (!m_routePickerView) {
-        m_routePickerView = adoptNS([allocAVRoutePickerViewInstance() init]);
-        [m_routePickerView setDelegate:m_routePickerViewDelegate.get()];
-    }
-
-    return m_routePickerView.get();
-}
-
-AVRouteDetector *AVRoutePickerViewTargetPicker::routeDetector()
-{
-    if (!m_routeDetector) {
-        m_routeDetector = adoptNS([PAL::allocAVRouteDetectorInstance() init]);
-        [[NSNotificationCenter defaultCenter] addObserver:m_routePickerViewDelegate.get() selector:@selector(notificationHandler:) name:PAL::get_AVFoundation_AVRouteDetectorMultipleRoutesDetectedDidChangeNotification() object:m_routeDetector.get()];
-        if ([m_routeDetector multipleRoutesDetected])
-            availableDevicesDidChange();
-    }
-
-    return m_routeDetector.get();
-}
-
-void AVRoutePickerViewTargetPicker::showPlaybackTargetPicker(NSView *view, const FloatRect& rectInScreenCoordinates, bool hasActiveRoute, bool useDarkAppearance)
-{
-    if (!client())
-        return;
-
-    auto *picker = devicePicker();
-    if (useDarkAppearance)
-        picker.routeListAlwaysHasDarkAppearance = YES;
-
-    m_hadActiveRoute = hasActiveRoute;
-
-    auto rectInWindowCoordinates = [view.window convertRectFromScreen:NSMakeRect(rectInScreenCoordinates.x(), rectInScreenCoordinates.y(), 1.0, 1.0)];
-    auto rectInViewCoordinates = [view convertRect:rectInWindowCoordinates fromView:view];
-    [picker showRoutePickingControlsForOutputContext:outputContextInternal() relativeToRect:rectInViewCoordinates ofView:view];
-}
-
-void AVRoutePickerViewTargetPicker::startingMonitoringPlaybackTargets()
-{
-    routeDetector().routeDetectionEnabled = YES;
-}
-
-void AVRoutePickerViewTargetPicker::stopMonitoringPlaybackTargets()
-{
-    if (m_routeDetector)
-        [m_routeDetector setRouteDetectionEnabled:NO];
-}
-
-bool AVRoutePickerViewTargetPicker::externalOutputDeviceAvailable()
-{
-    return routeDetector().multipleRoutesDetected;
-}
-
-AVOutputContext * AVRoutePickerViewTargetPicker::outputContext()
-{
-    return m_outputContext.get();
-}
-
-void AVRoutePickerViewTargetPicker::invalidatePlaybackTargets()
-{
-    if (m_routeDetector) {
-        [[NSNotificationCenter defaultCenter] removeObserver:m_routePickerViewDelegate.get() name:PAL::get_AVFoundation_AVRouteDetectorMultipleRoutesDetectedDidChangeNotification() object:m_routeDetector.get()];
-        [m_routeDetector setRouteDetectionEnabled:NO];
-        m_routePickerView = nullptr;
-    }
-
-    if (m_outputContext) {
-        [[NSNotificationCenter defaultCenter] removeObserver:m_routePickerViewDelegate.get() name:PAL::get_AVFoundation_AVOutputContextOutputDevicesDidChangeNotification() object:m_outputContext.get()];
-        m_outputContext = nullptr;
-    }
-
-    if (m_routePickerView) {
-        [m_routePickerView setDelegate:nil];
-        m_routePickerView = nullptr;
-    }
-    currentDeviceDidChange();
-}
-void AVRoutePickerViewTargetPicker::availableDevicesDidChange()
-{
-    if (client())
-        client()->availableDevicesChanged();
-}
-
-bool AVRoutePickerViewTargetPicker::hasActiveRoute() const
-{
-    if (!m_outputContext)
-        return false;
-
-    if ([m_outputContext respondsToSelector:@selector(supportsMultipleOutputDevices)] && [m_outputContext respondsToSelector:@selector(outputDevices)]&& [m_outputContext supportsMultipleOutputDevices]) {
-        for (AVOutputDevice *outputDevice in [m_outputContext outputDevices]) {
-            if (outputDevice.deviceFeatures & (AVOutputDeviceFeatureVideo | AVOutputDeviceFeatureAudio))
-                return true;
-        }
-
-        return false;
-    }
-
-    if ([m_outputContext respondsToSelector:@selector(outputDevice)]) {
-        if (auto *outputDevice = [m_outputContext outputDevice])
-            return outputDevice.deviceFeatures & (AVOutputDeviceFeatureVideo | AVOutputDeviceFeatureAudio);
-    }
-
-    return [m_outputContext deviceName];
-}
-
-void AVRoutePickerViewTargetPicker::currentDeviceDidChange()
-{
-    auto haveActiveRoute = hasActiveRoute();
-    if (!client() || m_hadActiveRoute == haveActiveRoute)
-        return;
-
-    m_hadActiveRoute = haveActiveRoute;
-    client()->currentDeviceChanged();
-}
-
-void AVRoutePickerViewTargetPicker::devicePickerWasDismissed()
-{
-    if (!client())
-        return;
-    
-    client()->pickerWasDismissed();
-    currentDeviceDidChange();
-}
-
-} // namespace WebCore
-
-@implementation WebAVRoutePickerViewHelper
-- (instancetype)initWithCallback:(WeakPtr<AVRoutePickerViewTargetPicker>&&)callback
-{
-    if (!(self = [super init]))
-        return nil;
-
-    m_callback = WTFMove(callback);
-
-    return self;
-}
-
-- (void)clearCallback
-{
-    m_callback = nil;
-}
-
-- (void)routePickerViewDidEndPresentingRoutes:(AVRoutePickerView *)routePickerView
-{
-    UNUSED_PARAM(routePickerView);
-
-    if (!m_callback)
-        return;
-
-    callOnMainThread([self, protectedSelf = retainPtr(self)] {
-        if (!m_callback)
-            return;
-
-        m_callback->devicePickerWasDismissed();
-    });
-}
-
-- (void)notificationHandler:(NSNotification *)notification
-{
-    UNUSED_PARAM(notification);
-
-    if (!m_callback)
-        return;
-
-    callOnMainThread([self, protectedSelf = retainPtr(self), notification = retainPtr(notification)] {
-        if (!m_callback)
-            return;
-
-        if ([[notification name] isEqualToString:PAL::get_AVFoundation_AVOutputContextOutputDevicesDidChangeNotification()])
-            m_callback->currentDeviceDidChange();
-        else if ([[notification name] isEqualToString:PAL::get_AVFoundation_AVRouteDetectorMultipleRoutesDetectedDidChangeNotification()])
-            m_callback->availableDevicesDidChange();
-    });
-}
-
-@end
-
-#endif // ENABLE(WIRELESS_PLAYBACK_TARGET)

Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlaybackTargetPickerMac.h (264514 => 264515)


--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlaybackTargetPickerMac.h	2020-07-17 16:07:13 UTC (rev 264514)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlaybackTargetPickerMac.h	2020-07-17 16:10:34 UTC (rev 264515)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2015-2020 Apple Inc. All rights reserved.
+ * 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
@@ -28,36 +28,36 @@
 
 #if ENABLE(WIRELESS_PLAYBACK_TARGET) && !PLATFORM(IOS_FAMILY)
 
-#include "AVPlaybackTargetPicker.h"
 #include "MediaPlaybackTargetPicker.h"
 #include <wtf/RetainPtr.h>
 
+OBJC_CLASS AVOutputDeviceMenuController;
+OBJC_CLASS WebAVOutputDeviceMenuControllerHelper;
+
 namespace WebCore {
 
-class MediaPlaybackTargetPickerMac final : public MediaPlaybackTargetPicker, public AVPlaybackTargetPicker::Client {
+class MediaPlaybackTargetPickerMac final : public MediaPlaybackTargetPicker {
     WTF_MAKE_FAST_ALLOCATED;
     WTF_MAKE_NONCOPYABLE(MediaPlaybackTargetPickerMac);
 public:
     explicit MediaPlaybackTargetPickerMac(MediaPlaybackTargetPicker::Client&);
+
     virtual ~MediaPlaybackTargetPickerMac();
 
-    void showPlaybackTargetPicker(PlatformView*, const FloatRect&, bool checkActiveRoute, bool useDarkAppearance) final;
-    void startingMonitoringPlaybackTargets() final;
-    void stopMonitoringPlaybackTargets() final;
-    void invalidatePlaybackTargets() final;
+    void showPlaybackTargetPicker(const FloatRect&, bool checkActiveRoute, bool useDarkAppearance) override;
+    void startingMonitoringPlaybackTargets() override;
+    void stopMonitoringPlaybackTargets() override;
+    void invalidatePlaybackTargets() override;
 
 private:
-    bool externalOutputDeviceAvailable() final;
-    Ref<MediaPlaybackTarget> playbackTarget() final;
+    bool externalOutputDeviceAvailable() override;
+    Ref<MediaPlaybackTarget> playbackTarget() override;
 
-    // AVPlaybackTargetPicker::Client
-    void pickerWasDismissed() final;
-    void availableDevicesChanged() final;
-    void currentDeviceChanged() final;
+    AVOutputDeviceMenuController *devicePicker();
 
-    AVPlaybackTargetPicker& routePicker();
-
-    std::unique_ptr<AVPlaybackTargetPicker> m_routePicker;
+    RetainPtr<AVOutputDeviceMenuController> m_outputDeviceMenuController;
+    RetainPtr<WebAVOutputDeviceMenuControllerHelper> m_outputDeviceMenuControllerDelegate;
+    bool m_showingMenu { false };
 };
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlaybackTargetPickerMac.mm (264514 => 264515)


--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlaybackTargetPickerMac.mm	2020-07-17 16:07:13 UTC (rev 264514)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlaybackTargetPickerMac.mm	2020-07-17 16:10:34 UTC (rev 264515)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2015-2020 Apple Inc. All rights reserved.
+ * 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
@@ -28,8 +28,6 @@
 
 #if ENABLE(WIRELESS_PLAYBACK_TARGET) && !PLATFORM(IOS_FAMILY)
 
-#import "AVOutputDeviceMenuControllerTargetPicker.h"
-#import "AVRoutePickerViewTargetPicker.h"
 #import "Logging.h"
 #import <WebCore/FloatRect.h>
 #import <WebCore/MediaPlaybackTargetCocoa.h>
@@ -46,10 +44,23 @@
 
 using namespace WebCore;
 
+static NSString *externalOutputDeviceAvailableKeyName = @"externalOutputDeviceAvailable";
+static NSString *externalOutputDevicePickedKeyName = @"externalOutputDevicePicked";
+
+@interface WebAVOutputDeviceMenuControllerHelper : NSObject {
+    MediaPlaybackTargetPickerMac* m_callback;
+}
+
+- (instancetype)initWithCallback:(MediaPlaybackTargetPickerMac*)callback;
+- (void)clearCallback;
+- (void)observeValueForKeyPath:(id)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context;
+@end
+
 namespace WebCore {
 
 MediaPlaybackTargetPickerMac::MediaPlaybackTargetPickerMac(MediaPlaybackTargetPicker::Client& client)
     : MediaPlaybackTargetPicker(client)
+    , m_outputDeviceMenuControllerDelegate(adoptNS([[WebAVOutputDeviceMenuControllerHelper alloc] initWithCallback:this]))
 {
 }
 
@@ -56,34 +67,67 @@
 MediaPlaybackTargetPickerMac::~MediaPlaybackTargetPickerMac()
 {
     setClient(nullptr);
+    [m_outputDeviceMenuControllerDelegate clearCallback];
 }
 
 bool MediaPlaybackTargetPickerMac::externalOutputDeviceAvailable()
 {
-    return routePicker().externalOutputDeviceAvailable();
+ALLOW_DEPRECATED_DECLARATIONS_BEGIN
+    return devicePicker().externalOutputDeviceAvailable;
+ALLOW_DEPRECATED_DECLARATIONS_END
 }
 
 Ref<MediaPlaybackTarget> MediaPlaybackTargetPickerMac::playbackTarget()
 {
-    return WebCore::MediaPlaybackTargetCocoa::create(routePicker().outputContext());
+    AVOutputContext* context = m_outputDeviceMenuController ? [m_outputDeviceMenuController.get() outputContext] : nullptr;
+
+    return WebCore::MediaPlaybackTargetCocoa::create(context);
 }
 
-AVPlaybackTargetPicker& MediaPlaybackTargetPickerMac::routePicker()
+AVOutputDeviceMenuController *MediaPlaybackTargetPickerMac::devicePicker()
 {
-    if (m_routePicker)
-        return *m_routePicker;
+    if (!getAVOutputDeviceMenuControllerClass())
+        return nullptr;
 
-    if (AVRoutePickerViewTargetPicker::isAvailable())
-        m_routePicker = makeUnique<AVRoutePickerViewTargetPicker>(*this);
-    else
-        m_routePicker = makeUnique<AVOutputDeviceMenuControllerTargetPicker>(*this);
-    
-    return *m_routePicker;
+    if (!m_outputDeviceMenuController) {
+        LOG(Media, "MediaPlaybackTargetPickerMac::devicePicker - allocating picker");
+
+        RetainPtr<AVOutputContext> context = adoptNS([PAL::allocAVOutputContextInstance() init]);
+        m_outputDeviceMenuController = adoptNS([allocAVOutputDeviceMenuControllerInstance() initWithOutputContext:context.get()]);
+
+        [m_outputDeviceMenuController.get() addObserver:m_outputDeviceMenuControllerDelegate.get() forKeyPath:externalOutputDeviceAvailableKeyName options:NSKeyValueObservingOptionNew context:nullptr];
+        [m_outputDeviceMenuController.get() addObserver:m_outputDeviceMenuControllerDelegate.get() forKeyPath:externalOutputDevicePickedKeyName options:NSKeyValueObservingOptionNew context:nullptr];
+
+        LOG(Media, "MediaPlaybackTargetPickerMac::devicePicker - allocated menu controller %p", m_outputDeviceMenuController.get());
+
+ALLOW_DEPRECATED_DECLARATIONS_BEGIN
+        if (m_outputDeviceMenuController.get().externalOutputDeviceAvailable)
+            availableDevicesDidChange();
+ALLOW_DEPRECATED_DECLARATIONS_END
+    }
+
+    return m_outputDeviceMenuController.get();
 }
 
-void MediaPlaybackTargetPickerMac::showPlaybackTargetPicker(PlatformView* view, const FloatRect& location, bool hasActiveRoute, bool useDarkAppearance)
+void MediaPlaybackTargetPickerMac::showPlaybackTargetPicker(const FloatRect& location, bool hasActiveRoute, bool useDarkAppearance)
 {
-    routePicker().showPlaybackTargetPicker(view, location, hasActiveRoute, useDarkAppearance);
+    if (!client() || m_showingMenu)
+        return;
+
+    LOG(Media, "MediaPlaybackTargetPickerMac::showPlaybackTargetPicker - hasActiveRoute = %i", (int)hasActiveRoute);
+
+    m_showingMenu = true;
+
+ALLOW_DEPRECATED_DECLARATIONS_BEGIN
+    bool targetSelected = [devicePicker() showMenuForRect:location appearanceName:(useDarkAppearance ? NSAppearanceNameVibrantDark : NSAppearanceNameVibrantLight) allowReselectionOfSelectedOutputDevice:!hasActiveRoute];
+ALLOW_DEPRECATED_DECLARATIONS_END
+
+    if (targetSelected != hasActiveRoute)
+        currentDeviceDidChange();
+    else if (!targetSelected && !hasActiveRoute)
+        playbackTargetPickerWasDismissed();
+
+    m_showingMenu = false;
 }
 
 void MediaPlaybackTargetPickerMac::startingMonitoringPlaybackTargets()
@@ -90,13 +134,13 @@
 {
     LOG(Media, "MediaPlaybackTargetPickerMac::startingMonitoringPlaybackTargets");
 
-    routePicker().startingMonitoringPlaybackTargets();
+    devicePicker();
 }
 
 void MediaPlaybackTargetPickerMac::stopMonitoringPlaybackTargets()
 {
     LOG(Media, "MediaPlaybackTargetPickerMac::stopMonitoringPlaybackTargets");
-    routePicker().stopMonitoringPlaybackTargets();
+    // Nothing to do, AirPlay takes care of this automatically.
 }
 
 void MediaPlaybackTargetPickerMac::invalidatePlaybackTargets()
@@ -103,27 +147,59 @@
 {
     LOG(Media, "MediaPlaybackTargetPickerMac::invalidatePlaybackTargets");
 
-    m_routePicker = nullptr;
+    if (m_outputDeviceMenuController) {
+        [m_outputDeviceMenuController removeObserver:m_outputDeviceMenuControllerDelegate.get() forKeyPath:externalOutputDeviceAvailableKeyName];
+        [m_outputDeviceMenuController removeObserver:m_outputDeviceMenuControllerDelegate.get() forKeyPath:externalOutputDevicePickedKeyName];
+        m_outputDeviceMenuController = nullptr;
+    }
     currentDeviceDidChange();
 }
 
-void MediaPlaybackTargetPickerMac::pickerWasDismissed()
+} // namespace WebCore
+
+@implementation WebAVOutputDeviceMenuControllerHelper
+- (instancetype)initWithCallback:(MediaPlaybackTargetPickerMac*)callback
 {
-    playbackTargetPickerWasDismissed();
+    if (!(self = [super init]))
+        return nil;
+
+    m_callback = callback;
+
+    return self;
 }
 
-void MediaPlaybackTargetPickerMac::availableDevicesChanged()
+- (void)clearCallback
 {
-    availableDevicesDidChange();
+    m_callback = nil;
 }
 
-void MediaPlaybackTargetPickerMac::currentDeviceChanged()
+- (void)observeValueForKeyPath:(id)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
 {
-    currentDeviceDidChange();
-}
+    UNUSED_PARAM(object);
+    UNUSED_PARAM(change);
+    UNUSED_PARAM(context);
 
+    if (!m_callback)
+        return;
 
-} // namespace WebCore
+    LOG(Media, "MediaPlaybackTargetPickerMac::observeValueForKeyPath - key = %s", [keyPath UTF8String]);
 
+    if (![keyPath isEqualToString:externalOutputDeviceAvailableKeyName] && ![keyPath isEqualToString:externalOutputDevicePickedKeyName])
+        return;
 
+    RetainPtr<WebAVOutputDeviceMenuControllerHelper> protectedSelf = self;
+    RetainPtr<NSString> protectedKeyPath = keyPath;
+    callOnMainThread([protectedSelf = WTFMove(protectedSelf), protectedKeyPath = WTFMove(protectedKeyPath)] {
+        MediaPlaybackTargetPickerMac* callback = protectedSelf->m_callback;
+        if (!callback)
+            return;
+
+        if ([protectedKeyPath isEqualToString:externalOutputDeviceAvailableKeyName])
+            callback->availableDevicesDidChange();
+        else if ([protectedKeyPath isEqualToString:externalOutputDevicePickedKeyName])
+            callback->currentDeviceDidChange();
+    });
+}
+@end
+
 #endif // ENABLE(WIRELESS_PLAYBACK_TARGET)

Modified: trunk/Source/WebCore/platform/mock/MediaPlaybackTargetPickerMock.cpp (264514 => 264515)


--- trunk/Source/WebCore/platform/mock/MediaPlaybackTargetPickerMock.cpp	2020-07-17 16:07:13 UTC (rev 264514)
+++ trunk/Source/WebCore/platform/mock/MediaPlaybackTargetPickerMock.cpp	2020-07-17 16:10:34 UTC (rev 264515)
@@ -61,7 +61,7 @@
     return WebCore::MediaPlaybackTargetMock::create(m_deviceName, m_state);
 }
 
-void MediaPlaybackTargetPickerMock::showPlaybackTargetPicker(PlatformView*, const FloatRect&, bool checkActiveRoute, bool useDarkAppearance)
+void MediaPlaybackTargetPickerMock::showPlaybackTargetPicker(const FloatRect&, bool checkActiveRoute, bool useDarkAppearance)
 {
     if (!client() || m_showingMenu)
         return;

Modified: trunk/Source/WebCore/platform/mock/MediaPlaybackTargetPickerMock.h (264514 => 264515)


--- trunk/Source/WebCore/platform/mock/MediaPlaybackTargetPickerMock.h	2020-07-17 16:07:13 UTC (rev 264514)
+++ trunk/Source/WebCore/platform/mock/MediaPlaybackTargetPickerMock.h	2020-07-17 16:10:34 UTC (rev 264515)
@@ -43,7 +43,7 @@
 
     virtual ~MediaPlaybackTargetPickerMock();
 
-    void showPlaybackTargetPicker(PlatformView*, const FloatRect&, bool checkActiveRoute, bool useDarkAppearance) override;
+    void showPlaybackTargetPicker(const FloatRect&, bool checkActiveRoute, bool useDarkAppearance) override;
     void startingMonitoringPlaybackTargets() override;
     void stopMonitoringPlaybackTargets() override;
     void invalidatePlaybackTargets() override;

Modified: trunk/Source/WebKit/ChangeLog (264514 => 264515)


--- trunk/Source/WebKit/ChangeLog	2020-07-17 16:07:13 UTC (rev 264514)
+++ trunk/Source/WebKit/ChangeLog	2020-07-17 16:10:34 UTC (rev 264515)
@@ -1,3 +1,16 @@
+2020-07-17  Truitt Savell  <[email protected]>
+
+        Unreviewed, reverting r264477.
+
+        Broke the internal build
+
+        Reverted changeset:
+
+        "Use AVRoutePickerView when available for choosing AirPlay
+        devices"
+        https://bugs.webkit.org/show_bug.cgi?id=213497
+        https://trac.webkit.org/changeset/264477
+
 2020-07-16  Jiewen Tan  <[email protected]>
 
         [WebAuthn] Add a console message: "User gesture is required to use the platform authenticator."

Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.h (264514 => 264515)


--- trunk/Source/WebKit/UIProcess/WebPageProxy.h	2020-07-17 16:07:13 UTC (rev 264514)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.h	2020-07-17 16:10:34 UTC (rev 264515)
@@ -1534,7 +1534,6 @@
     void setShouldPlayToPlaybackTarget(WebCore::PlaybackTargetClientContextIdentifier, bool) final;
     void playbackTargetPickerWasDismissed(WebCore::PlaybackTargetClientContextIdentifier) final;
     bool alwaysOnLoggingAllowed() final { return isAlwaysOnLoggingAllowed(); }
-    PlatformView* platformView() const final;
 #endif
 
     void didChangeBackgroundColor();

Modified: trunk/Source/WebKit/UIProcess/mac/WebPageProxyMac.mm (264514 => 264515)


--- trunk/Source/WebKit/UIProcess/mac/WebPageProxyMac.mm	2020-07-17 16:07:13 UTC (rev 264514)
+++ trunk/Source/WebKit/UIProcess/mac/WebPageProxyMac.mm	2020-07-17 16:10:34 UTC (rev 264515)
@@ -673,11 +673,6 @@
     grantAccessToCurrentPasteboardData(NSPasteboardNameGeneral);
 }
 
-PlatformView* WebPageProxy::platformView() const
-{
-    return [pageClient().platformWindow() contentView];
-}
-
 } // namespace WebKit
 
 #endif // PLATFORM(MAC)

Modified: trunk/Source/WebKitLegacy/mac/ChangeLog (264514 => 264515)


--- trunk/Source/WebKitLegacy/mac/ChangeLog	2020-07-17 16:07:13 UTC (rev 264514)
+++ trunk/Source/WebKitLegacy/mac/ChangeLog	2020-07-17 16:10:34 UTC (rev 264515)
@@ -1,3 +1,16 @@
+2020-07-17  Truitt Savell  <[email protected]>
+
+        Unreviewed, reverting r264477.
+
+        Broke the internal build
+
+        Reverted changeset:
+
+        "Use AVRoutePickerView when available for choosing AirPlay
+        devices"
+        https://bugs.webkit.org/show_bug.cgi?id=213497
+        https://trac.webkit.org/changeset/264477
+
 2020-07-16  Eric Carlson  <[email protected]>
 
         Use AVRoutePickerView when available for choosing AirPlay devices

Modified: trunk/Source/WebKitLegacy/mac/WebView/WebMediaPlaybackTargetPicker.h (264514 => 264515)


--- trunk/Source/WebKitLegacy/mac/WebView/WebMediaPlaybackTargetPicker.h	2020-07-17 16:07:13 UTC (rev 264514)
+++ trunk/Source/WebKitLegacy/mac/WebView/WebMediaPlaybackTargetPicker.h	2020-07-17 16:10:34 UTC (rev 264515)
@@ -32,8 +32,6 @@
 #include <WebCore/WebMediaSessionManagerClient.h>
 #include <wtf/Ref.h>
 
-OBJC_CLASS WebView;
-
 namespace WebCore {
 class FloatRect;
 class MediaPlaybackTarget;
@@ -43,10 +41,10 @@
 class WebMediaPlaybackTargetPicker : public WebCore::WebMediaSessionManagerClient {
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    static std::unique_ptr<WebMediaPlaybackTargetPicker> create(WebView *, WebCore::Page&);
+    static std::unique_ptr<WebMediaPlaybackTargetPicker> create(WebCore::Page&);
 
-    explicit WebMediaPlaybackTargetPicker(WebView *, WebCore::Page&);
-    virtual ~WebMediaPlaybackTargetPicker() = default;
+    explicit WebMediaPlaybackTargetPicker(WebCore::Page&);
+    virtual ~WebMediaPlaybackTargetPicker() { }
 
     void addPlaybackTargetPickerClient(WebCore::PlaybackTargetClientContextIdentifier);
     void removePlaybackTargetPickerClient(WebCore::PlaybackTargetClientContextIdentifier);
@@ -56,18 +54,16 @@
     void setMockMediaPlaybackTargetPickerState(const String&, WebCore::MediaPlaybackTargetContext::State);
     void mockMediaPlaybackTargetPickerDismissPopup();
 
+    // WebMediaSessionManagerClient
+    void setPlaybackTarget(WebCore::PlaybackTargetClientContextIdentifier, Ref<WebCore::MediaPlaybackTarget>&&) override;
+    void externalOutputDeviceAvailableDidChange(WebCore::PlaybackTargetClientContextIdentifier, bool) override;
+    void setShouldPlayToPlaybackTarget(WebCore::PlaybackTargetClientContextIdentifier, bool) override;
+    void playbackTargetPickerWasDismissed(WebCore::PlaybackTargetClientContextIdentifier) override;
+
     void invalidate();
 
 private:
-    // WebMediaSessionManagerClient
-    void setPlaybackTarget(WebCore::PlaybackTargetClientContextIdentifier, Ref<WebCore::MediaPlaybackTarget>&&) final;
-    void externalOutputDeviceAvailableDidChange(WebCore::PlaybackTargetClientContextIdentifier, bool) final;
-    void setShouldPlayToPlaybackTarget(WebCore::PlaybackTargetClientContextIdentifier, bool) final;
-    void playbackTargetPickerWasDismissed(WebCore::PlaybackTargetClientContextIdentifier) final;
-    PlatformView* platformView() const final;
-
     WebCore::Page* m_page;
-    WebView *m_webView;
 };
 
 #endif

Modified: trunk/Source/WebKitLegacy/mac/WebView/WebMediaPlaybackTargetPicker.mm (264514 => 264515)


--- trunk/Source/WebKitLegacy/mac/WebView/WebMediaPlaybackTargetPicker.mm	2020-07-17 16:07:13 UTC (rev 264514)
+++ trunk/Source/WebKitLegacy/mac/WebView/WebMediaPlaybackTargetPicker.mm	2020-07-17 16:10:34 UTC (rev 264515)
@@ -27,19 +27,17 @@
 
 #if ENABLE(WIRELESS_PLAYBACK_TARGET) && !PLATFORM(IOS_FAMILY)
 
-#import "WebView.h"
 #import <WebCore/MediaPlaybackTarget.h>
 #import <WebCore/Page.h>
 #import <WebCore/WebMediaSessionManager.h>
 
-std::unique_ptr<WebMediaPlaybackTargetPicker> WebMediaPlaybackTargetPicker::create(WebView *webView, WebCore::Page& page)
+std::unique_ptr<WebMediaPlaybackTargetPicker> WebMediaPlaybackTargetPicker::create(WebCore::Page& page)
 {
-    return makeUnique<WebMediaPlaybackTargetPicker>(webView, page);
+    return makeUnique<WebMediaPlaybackTargetPicker>(page);
 }
 
-WebMediaPlaybackTargetPicker::WebMediaPlaybackTargetPicker(WebView *webView, WebCore::Page& page)
+WebMediaPlaybackTargetPicker::WebMediaPlaybackTargetPicker(WebCore::Page& page)
     : m_page(&page)
-    , m_webView(webView)
 {
 }
 
@@ -111,14 +109,7 @@
 void WebMediaPlaybackTargetPicker::invalidate()
 {
     m_page = nullptr;
-    m_webView = nil;
     WebCore::WebMediaSessionManager::shared().removeAllPlaybackTargetPickerClients(*this);
 }
 
-PlatformView* WebMediaPlaybackTargetPicker::platformView() const
-{
-    ASSERT(m_webView);
-    return m_webView;
-}
-
 #endif

Modified: trunk/Source/WebKitLegacy/mac/WebView/WebView.mm (264514 => 264515)


--- trunk/Source/WebKitLegacy/mac/WebView/WebView.mm	2020-07-17 16:07:13 UTC (rev 264514)
+++ trunk/Source/WebKitLegacy/mac/WebView/WebView.mm	2020-07-17 16:10:34 UTC (rev 264515)
@@ -9743,7 +9743,7 @@
 - (WebMediaPlaybackTargetPicker *) _devicePicker
 {
     if (!_private->m_playbackTargetPicker)
-        _private->m_playbackTargetPicker = WebMediaPlaybackTargetPicker::create(self, *_private->page);
+        _private->m_playbackTargetPicker = WebMediaPlaybackTargetPicker::create(*_private->page);
 
     return _private->m_playbackTargetPicker.get();
 }

Modified: trunk/Tools/ChangeLog (264514 => 264515)


--- trunk/Tools/ChangeLog	2020-07-17 16:07:13 UTC (rev 264514)
+++ trunk/Tools/ChangeLog	2020-07-17 16:10:34 UTC (rev 264515)
@@ -1,3 +1,16 @@
+2020-07-17  Truitt Savell  <[email protected]>
+
+        Unreviewed, reverting r264477.
+
+        Broke the internal build
+
+        Reverted changeset:
+
+        "Use AVRoutePickerView when available for choosing AirPlay
+        devices"
+        https://bugs.webkit.org/show_bug.cgi?id=213497
+        https://trac.webkit.org/changeset/264477
+
 2020-07-16  Xabier Rodriguez Calvar  <[email protected]>
 
         Rename createBoxPtr into adoptBoxPtr

Modified: trunk/Tools/TestWebKitAPI/Tests/WebCore/cocoa/AVFoundationSoftLinkTest.mm (264514 => 264515)


--- trunk/Tools/TestWebKitAPI/Tests/WebCore/cocoa/AVFoundationSoftLinkTest.mm	2020-07-17 16:07:13 UTC (rev 264514)
+++ trunk/Tools/TestWebKitAPI/Tests/WebCore/cocoa/AVFoundationSoftLinkTest.mm	2020-07-17 16:10:34 UTC (rev 264515)
@@ -184,6 +184,7 @@
     EXPECT_TRUE([AVAudioSessionInterruptionNotification isEqualToString:@"AVAudioSessionInterruptionNotification"]);
     EXPECT_TRUE([AVAudioSessionInterruptionTypeKey isEqualToString:@"AVAudioSessionInterruptionTypeKey"]);
     EXPECT_TRUE([AVAudioSessionInterruptionOptionKey isEqualToString:@"AVAudioSessionInterruptionOptionKey"]);
+    EXPECT_TRUE([AVRouteDetectorMultipleRoutesDetectedDidChangeNotification isEqualToString:@"AVRouteDetectorMultipleRoutesDetectedDidChangeNotification"]);
 #if !PLATFORM(WATCHOS) && !PLATFORM(APPLETV)
     EXPECT_TRUE([AVCaptureSessionErrorKey isEqualToString:@"AVCaptureSessionErrorKey"]);
     EXPECT_TRUE([AVCaptureSessionRuntimeErrorNotification isEqualToString:@"AVCaptureSessionRuntimeErrorNotification"]);
@@ -193,12 +194,6 @@
 #endif
 
 #endif
-    
-#if !PLATFORM(WATCHOS)
-    EXPECT_TRUE([AVRouteDetectorMultipleRoutesDetectedDidChangeNotification isEqualToString:@"AVRouteDetectorMultipleRoutesDetectedDidChangeNotification"]);
-    EXPECT_TRUE([AVOutputContextOutputDevicesDidChangeNotification isEqualToString:@"AVOutputContextOutputDevicesDidChangeNotification"]);
-#endif // PLATFORM(WATCHOS)
-
 }
 
 #endif // PLATFORM(COCOA)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to