Remove reliance on WebAVMediaSelectionOptionMac for the
authorbdakin@apple.com <bdakin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 21 Apr 2016 19:36:36 +0000 (19:36 +0000)
committerbdakin@apple.com <bdakin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 21 Apr 2016 19:36:36 +0000 (19:36 +0000)
WebPlaybackControlsManager
https://bugs.webkit.org/show_bug.cgi?id=156811
-and corresponding-
rdar://problem/25760523

Reviewed by Jer Noble.

* platform/mac/WebPlaybackSessionInterfaceMac.mm:
(-[WebPlaybackControlsManager setSeekableTimeRanges:]):
(-[WebPlaybackControlsManager setAudioMediaSelectionOptions:withSelectedIndex:]):
(-[WebPlaybackControlsManager setLegibleMediaSelectionOptions:withSelectedIndex:]):
(WebCore::WebPlaybackSessionInterfaceMac::~WebPlaybackSessionInterfaceMac):
(WebCore::WebPlaybackSessionInterfaceMac::setSeekableRanges):
(WebCore::WebPlaybackSessionInterfaceMac::setAudioMediaSelectionOptions):
(WebCore::WebPlaybackSessionInterfaceMac::setLegibleMediaSelectionOptions):
(WebCore::WebPlaybackSessionInterfaceMac::invalidate):
(-[WebAVMediaSelectionOptionMac localizedDisplayName]): Deleted.
(-[WebAVMediaSelectionOptionMac setLocalizedDisplayName:]): Deleted.
(-[WebPlaybackControlsManager isSeeking]): Deleted.
(-[WebPlaybackControlsManager seekToTime:toleranceBefore:toleranceAfter:]): Deleted.
(-[WebPlaybackControlsManager audioMediaSelectionOptions]): Deleted.
(-[WebPlaybackControlsManager setAudioMediaSelectionOptions:]): Deleted.
(-[WebPlaybackControlsManager currentAudioMediaSelectionOption]): Deleted.
(-[WebPlaybackControlsManager setCurrentAudioMediaSelectionOption:]): Deleted.
(-[WebPlaybackControlsManager legibleMediaSelectionOptions]): Deleted.
(-[WebPlaybackControlsManager setLegibleMediaSelectionOptions:]): Deleted.
(-[WebPlaybackControlsManager currentLegibleMediaSelectionOption]): Deleted.
(-[WebPlaybackControlsManager setCurrentLegibleMediaSelectionOption:]): Deleted.
(-[WebPlaybackControlsManager cancelThumbnailAndAudioAmplitudeSampleGeneration]): Deleted.
(WebCore::mediaSelectionOptions): Deleted.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@199827 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/platform/mac/WebPlaybackSessionInterfaceMac.mm

index a6e048a..30c304d 100644 (file)
@@ -1,3 +1,37 @@
+2016-04-21  Beth Dakin  <bdakin@apple.com>
+
+        Remove reliance on WebAVMediaSelectionOptionMac for the 
+        WebPlaybackControlsManager
+        https://bugs.webkit.org/show_bug.cgi?id=156811
+        -and corresponding-
+        rdar://problem/25760523
+
+        Reviewed by Jer Noble.
+
+        * platform/mac/WebPlaybackSessionInterfaceMac.mm:
+        (-[WebPlaybackControlsManager setSeekableTimeRanges:]):
+        (-[WebPlaybackControlsManager setAudioMediaSelectionOptions:withSelectedIndex:]):
+        (-[WebPlaybackControlsManager setLegibleMediaSelectionOptions:withSelectedIndex:]):
+        (WebCore::WebPlaybackSessionInterfaceMac::~WebPlaybackSessionInterfaceMac):
+        (WebCore::WebPlaybackSessionInterfaceMac::setSeekableRanges):
+        (WebCore::WebPlaybackSessionInterfaceMac::setAudioMediaSelectionOptions):
+        (WebCore::WebPlaybackSessionInterfaceMac::setLegibleMediaSelectionOptions):
+        (WebCore::WebPlaybackSessionInterfaceMac::invalidate):
+        (-[WebAVMediaSelectionOptionMac localizedDisplayName]): Deleted.
+        (-[WebAVMediaSelectionOptionMac setLocalizedDisplayName:]): Deleted.
+        (-[WebPlaybackControlsManager isSeeking]): Deleted.
+        (-[WebPlaybackControlsManager seekToTime:toleranceBefore:toleranceAfter:]): Deleted.
+        (-[WebPlaybackControlsManager audioMediaSelectionOptions]): Deleted.
+        (-[WebPlaybackControlsManager setAudioMediaSelectionOptions:]): Deleted.
+        (-[WebPlaybackControlsManager currentAudioMediaSelectionOption]): Deleted.
+        (-[WebPlaybackControlsManager setCurrentAudioMediaSelectionOption:]): Deleted.
+        (-[WebPlaybackControlsManager legibleMediaSelectionOptions]): Deleted.
+        (-[WebPlaybackControlsManager setLegibleMediaSelectionOptions:]): Deleted.
+        (-[WebPlaybackControlsManager currentLegibleMediaSelectionOption]): Deleted.
+        (-[WebPlaybackControlsManager setCurrentLegibleMediaSelectionOption:]): Deleted.
+        (-[WebPlaybackControlsManager cancelThumbnailAndAudioAmplitudeSampleGeneration]): Deleted.
+        (WebCore::mediaSelectionOptions): Deleted.
+
 2016-04-21  Said Abou-Hallawa  <sabouhallawa@apple.com>
 
         REGRESSION(198782): ImageSource::subsamplingLevelForScale() does not cache the MaximumSubsamplingLevel for this ImageSource
index c7b84a5..2becdc2 100644 (file)
@@ -42,38 +42,15 @@ SOFT_LINK_CLASS_OPTIONAL(AVKit, AVValueTiming)
 
 using namespace WebCore;
 
-@interface WebAVMediaSelectionOptionMac : NSObject {
-    RetainPtr<NSString> _localizedDisplayName;
-}
-@property (retain) NSString *localizedDisplayName;
-@end
-
-@implementation WebAVMediaSelectionOptionMac
-
-- (NSString *)localizedDisplayName
-{
-    return _localizedDisplayName.get();
-}
-
-- (void)setLocalizedDisplayName:(NSString *)name
-{
-    _localizedDisplayName = name;
-}
-
-@end
-
-@interface WebPlaybackControlsManager : NSObject {
+#if USE(APPLE_INTERNAL_SDK) && ENABLE(WEB_PLAYBACK_CONTROLS_MANAGER)
+#import <WebKitAdditions/WebPlaybackControlsControllerAdditions.mm>
+#else
+@interface WebPlaybackControlsManager : NSObject<AVFunctionBarPlaybackControlsControlling> {
     NSTimeInterval _contentDuration;
     RetainPtr<AVValueTiming> _timing;
-    NSTimeInterval _seekToTime;
     RetainPtr<NSArray> _seekableTimeRanges;
     BOOL _hasEnabledAudio;
     BOOL _hasEnabledVideo;
-    RetainPtr<NSArray<AVMediaSelectionOption *>> _audioMediaSelectionOptions;
-    RetainPtr<AVMediaSelectionOption> _currentAudioMediaSelectionOption;
-    RetainPtr<NSArray<AVMediaSelectionOption *>> _legibleMediaSelectionOptions;
-    RetainPtr<AVMediaSelectionOption> _currentLegibleMediaSelectionOption;
-
     float _rate;
 
 @private
@@ -82,29 +59,18 @@ using namespace WebCore;
 
 @property (readwrite) NSTimeInterval contentDuration;
 @property (nonatomic, retain, readwrite) AVValueTiming *timing;
-@property NSTimeInterval seekToTime;
 @property (nonatomic, retain, readwrite) NSArray *seekableTimeRanges;
 @property (readwrite) BOOL hasEnabledAudio;
 @property (readwrite) BOOL hasEnabledVideo;
-@property (nonatomic, retain, readwrite) NSArray<AVMediaSelectionOption *> *audioMediaSelectionOptions;
-@property (nonatomic, retain, readwrite) AVMediaSelectionOption *currentAudioMediaSelectionOption;
-@property (nonatomic, retain, readwrite) NSArray<AVMediaSelectionOption *> *legibleMediaSelectionOptions;
-@property (nonatomic, retain, readwrite) AVMediaSelectionOption *currentLegibleMediaSelectionOption;
-
 @property (nonatomic) float rate;
 
 - (instancetype)initWithWebPlaybackSessionInterfaceMac:(WebCore::WebPlaybackSessionInterfaceMac*)webPlaybackSessionInterfaceMac;
 
 @end
 
-#if USE(APPLE_INTERNAL_SDK)
-#import <WebKitAdditions/WebPlaybackControlsControllerAdditions.mm>
-#endif
-
 @implementation WebPlaybackControlsManager
 
 @synthesize contentDuration=_contentDuration;
-@synthesize seekToTime=_seekToTime;
 @synthesize hasEnabledAudio=_hasEnabledAudio;
 @synthesize hasEnabledVideo=_hasEnabledVideo;
 @synthesize rate=_rate;
@@ -139,88 +105,22 @@ using namespace WebCore;
     _seekableTimeRanges = timeRanges;
 }
 
-- (BOOL)isSeeking
-{
-    return NO;
-}
-
-- (void)seekToTime:(NSTimeInterval)time toleranceBefore:(NSTimeInterval)toleranceBefore toleranceAfter:(NSTimeInterval)toleranceAfter
-{
-    UNUSED_PARAM(toleranceBefore);
-    UNUSED_PARAM(toleranceAfter);
-    _webPlaybackSessionInterfaceMac->webPlaybackSessionModel()->seekToTime(time);
-}
-
-- (NSArray<AVMediaSelectionOption *> *)audioMediaSelectionOptions
-{
-    return _audioMediaSelectionOptions.get();
-}
-
-- (void)setAudioMediaSelectionOptions:(NSArray<AVMediaSelectionOption *> *)audioOptions
-{
-    _audioMediaSelectionOptions = audioOptions;
-}
-
-- (AVMediaSelectionOption *)currentAudioMediaSelectionOption
+- (void)setAudioMediaSelectionOptions:(const Vector<WTF::String>&)options withSelectedIndex:(NSUInteger)selectedIndex
 {
-    return _currentAudioMediaSelectionOption.get();
+    UNUSED_PARAM(options);
+    UNUSED_PARAM(selectedIndex);
 }
 
-- (void)setCurrentAudioMediaSelectionOption:(AVMediaSelectionOption *)audioMediaSelectionOption
+- (void)setLegibleMediaSelectionOptions:(const Vector<WTF::String>&)options withSelectedIndex:(NSUInteger)selectedIndex
 {
-    if (audioMediaSelectionOption == _currentAudioMediaSelectionOption)
-        return;
-
-    _currentAudioMediaSelectionOption = audioMediaSelectionOption;
-
-    NSInteger index = NSNotFound;
-
-    if (audioMediaSelectionOption && self.audioMediaSelectionOptions)
-        index = [self.audioMediaSelectionOptions indexOfObject:audioMediaSelectionOption];
-
-    _webPlaybackSessionInterfaceMac->webPlaybackSessionModel()->selectAudioMediaOption(index != NSNotFound ? index : UINT64_MAX);
-}
-
-- (NSArray<AVMediaSelectionOption *> *)legibleMediaSelectionOptions
-{
-    return _legibleMediaSelectionOptions.get();
-}
-
-- (void)setLegibleMediaSelectionOptions:(NSArray<AVMediaSelectionOption *> *)legibleOptions
-{
-    _legibleMediaSelectionOptions = legibleOptions;
-}
-
-- (AVMediaSelectionOption *)currentLegibleMediaSelectionOption
-{
-    return _currentLegibleMediaSelectionOption.get();
+    UNUSED_PARAM(options);
+    UNUSED_PARAM(selectedIndex);
 }
 
-- (void)setCurrentLegibleMediaSelectionOption:(AVMediaSelectionOption *)legibleMediaSelectionOption
-{
-    if (legibleMediaSelectionOption == _currentLegibleMediaSelectionOption)
-        return;
-
-    _currentLegibleMediaSelectionOption = legibleMediaSelectionOption;
-
-    NSInteger index = NSNotFound;
-
-    if (legibleMediaSelectionOption && self.legibleMediaSelectionOptions)
-        index = [self.legibleMediaSelectionOptions indexOfObject:legibleMediaSelectionOption];
-
-    _webPlaybackSessionInterfaceMac->webPlaybackSessionModel()->selectLegibleMediaOption(index != NSNotFound ? index : UINT64_MAX);
-}
-
-- (void)cancelThumbnailAndAudioAmplitudeSampleGeneration
-{
-}
+@end
 
-#if USE(APPLE_INTERNAL_SDK)
-#import <WebKitAdditions/WebPlaybackControlsControllerThumbnailAdditions.mm>
 #endif
 
-@end
-
 namespace WebCore {
 
 WebPlaybackSessionInterfaceMac::~WebPlaybackSessionInterfaceMac()
@@ -276,35 +176,16 @@ void WebPlaybackSessionInterfaceMac::setSeekableRanges(const TimeRanges& timeRan
     [controlsManager setSeekableTimeRanges:seekableRanges.get()];
 }
 
-static RetainPtr<NSMutableArray> mediaSelectionOptions(const Vector<String>& options)
-{
-    RetainPtr<NSMutableArray> webOptions = adoptNS([[NSMutableArray alloc] initWithCapacity:options.size()]);
-    for (auto& name : options) {
-        RetainPtr<WebAVMediaSelectionOptionMac> webOption = adoptNS([[WebAVMediaSelectionOptionMac alloc] init]);
-        [webOption setLocalizedDisplayName:name];
-        [webOptions addObject:webOption.get()];
-    }
-    return webOptions;
-}
-
 void WebPlaybackSessionInterfaceMac::setAudioMediaSelectionOptions(const Vector<WTF::String>& options, uint64_t selectedIndex)
 {
     WebPlaybackControlsManager* controlsManager = playBackControlsManager();
-
-    RetainPtr<NSMutableArray> webOptions = mediaSelectionOptions(options);
-    [controlsManager setAudioMediaSelectionOptions:webOptions.get()];
-    if (selectedIndex < [webOptions count])
-        [controlsManager setCurrentAudioMediaSelectionOption:[webOptions objectAtIndex:static_cast<NSUInteger>(selectedIndex)]];
+    [controlsManager setAudioMediaSelectionOptions:options withSelectedIndex:selectedIndex];
 }
 
 void WebPlaybackSessionInterfaceMac::setLegibleMediaSelectionOptions(const Vector<WTF::String>& options, uint64_t selectedIndex)
 {
     WebPlaybackControlsManager* controlsManager = playBackControlsManager();
-
-    RetainPtr<NSMutableArray> webOptions = mediaSelectionOptions(options);
-    [controlsManager setLegibleMediaSelectionOptions:webOptions.get()];
-    if (selectedIndex < [webOptions count])
-        [controlsManager setCurrentLegibleMediaSelectionOption:[webOptions objectAtIndex:static_cast<NSUInteger>(selectedIndex)]];
+    [controlsManager setLegibleMediaSelectionOptions:options withSelectedIndex:selectedIndex];
 }
 
 void WebPlaybackSessionInterfaceMac::invalidate()