[macOS] AVTouchBarMediaSelectionOptions should be created with the correct type
authoraestes@apple.com <aestes@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 23 Apr 2017 11:27:56 +0000 (11:27 +0000)
committeraestes@apple.com <aestes@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 23 Apr 2017 11:27:56 +0000 (11:27 +0000)
commit1145006bdd37d4527a136d6530155ecbfe09c87c
treeffbef200c5b501384763f01a8ec0e6979c5e48b5
parent0969ce31264c5e4ffde51de82fb428379c570df8
[macOS] AVTouchBarMediaSelectionOptions should be created with the correct type
https://bugs.webkit.org/show_bug.cgi?id=171192
<rdar://problem/29875010>

Reviewed by Wenson Hsieh.

Source/WebCore:

AVTouchBarMediaSelectionOption was always being created with type
AVTouchBarMediaSelectionOptionTypeRegular, but we know if a TextTrack is really the legible
off or legible auto track. This change plumbs that information into
WebPlaybackControlsManager so that AVTouchBarMediaSelectionOptions can be created with the
right AVTouchBarMediaSelectionOptionType.

* WebCore.xcodeproj/project.pbxproj:
* page/CaptionUserPreferences.cpp:
(WebCore::CaptionUserPreferences::mediaSelectionOptionForTrack):
* page/CaptionUserPreferences.h:
* platform/MediaSelectionOption.h: Added.
* platform/cocoa/WebPlaybackSessionModel.h:
(WebCore::WebPlaybackSessionModelClient::audioMediaSelectionOptionsChanged):
(WebCore::WebPlaybackSessionModelClient::legibleMediaSelectionOptionsChanged):
* platform/cocoa/WebPlaybackSessionModelMediaElement.h:
* platform/cocoa/WebPlaybackSessionModelMediaElement.mm:
(WebCore::WebPlaybackSessionModelMediaElement::audioMediaSelectionOptions):
(WebCore::WebPlaybackSessionModelMediaElement::legibleMediaSelectionOptions):
* platform/ios/WebPlaybackSessionInterfaceAVKit.h:
* platform/ios/WebPlaybackSessionInterfaceAVKit.mm:
(WebCore::mediaSelectionOptions):
(WebCore::WebPlaybackSessionInterfaceAVKit::audioMediaSelectionOptionsChanged):
(WebCore::WebPlaybackSessionInterfaceAVKit::legibleMediaSelectionOptionsChanged):
* platform/ios/WebVideoFullscreenControllerAVKit.mm:
(WebVideoFullscreenControllerContext::audioMediaSelectionOptionsChanged):
(WebVideoFullscreenControllerContext::legibleMediaSelectionOptionsChanged):
(WebVideoFullscreenControllerContext::audioMediaSelectionOptions):
(WebVideoFullscreenControllerContext::legibleMediaSelectionOptions):
* platform/mac/WebPlaybackControlsManager.h:
* platform/mac/WebPlaybackControlsManager.mm:
(toAVTouchBarMediaSelectionOptionType):
(mediaSelectionOptions):
(-[WebPlaybackControlsManager setAudioMediaSelectionOptions:withSelectedIndex:]):
(-[WebPlaybackControlsManager setLegibleMediaSelectionOptions:withSelectedIndex:]):
(-[WebPlaybackControlsManager webPlaybackSessionInterfaceMac]):
(-[WebPlaybackControlsManager setWebPlaybackSessionInterfaceMac:]):
* platform/mac/WebPlaybackSessionInterfaceMac.h:
* platform/mac/WebPlaybackSessionInterfaceMac.mm:
(WebCore::WebPlaybackSessionInterfaceMac::audioMediaSelectionOptionsChanged):
(WebCore::WebPlaybackSessionInterfaceMac::legibleMediaSelectionOptionsChanged):

Source/WebKit2:

* Shared/WebCoreArgumentCoders.cpp:
(IPC::ArgumentCoder<MediaSelectionOption>::encode):
(IPC::ArgumentCoder<MediaSelectionOption>::decode):
* Shared/WebCoreArgumentCoders.h:
* UIProcess/Cocoa/WebPlaybackSessionManagerProxy.h:
* UIProcess/Cocoa/WebPlaybackSessionManagerProxy.messages.in:
* UIProcess/Cocoa/WebPlaybackSessionManagerProxy.mm:
(WebKit::WebPlaybackSessionModelContext::setAudioMediaSelectionOptions):
(WebKit::WebPlaybackSessionModelContext::setLegibleMediaSelectionOptions):
(WebKit::WebPlaybackSessionManagerProxy::setAudioMediaSelectionOptions):
(WebKit::WebPlaybackSessionManagerProxy::setLegibleMediaSelectionOptions):
* WebProcess/cocoa/WebPlaybackSessionManager.h:
* WebProcess/cocoa/WebPlaybackSessionManager.mm:
(WebKit::WebPlaybackSessionInterfaceContext::audioMediaSelectionOptionsChanged):
(WebKit::WebPlaybackSessionInterfaceContext::legibleMediaSelectionOptionsChanged):
(WebKit::WebPlaybackSessionManager::audioMediaSelectionOptionsChanged):
(WebKit::WebPlaybackSessionManager::legibleMediaSelectionOptionsChanged):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@215672 268f45cc-cd09-0410-ab3c-d52691b4dbfc
23 files changed:
Source/WebCore/ChangeLog
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/page/CaptionUserPreferences.cpp
Source/WebCore/page/CaptionUserPreferences.h
Source/WebCore/platform/MediaSelectionOption.h [new file with mode: 0644]
Source/WebCore/platform/cocoa/WebPlaybackSessionModel.h
Source/WebCore/platform/cocoa/WebPlaybackSessionModelMediaElement.h
Source/WebCore/platform/cocoa/WebPlaybackSessionModelMediaElement.mm
Source/WebCore/platform/ios/WebPlaybackSessionInterfaceAVKit.h
Source/WebCore/platform/ios/WebPlaybackSessionInterfaceAVKit.mm
Source/WebCore/platform/ios/WebVideoFullscreenControllerAVKit.mm
Source/WebCore/platform/mac/WebPlaybackControlsManager.h
Source/WebCore/platform/mac/WebPlaybackControlsManager.mm
Source/WebCore/platform/mac/WebPlaybackSessionInterfaceMac.h
Source/WebCore/platform/mac/WebPlaybackSessionInterfaceMac.mm
Source/WebKit2/ChangeLog
Source/WebKit2/Shared/WebCoreArgumentCoders.cpp
Source/WebKit2/Shared/WebCoreArgumentCoders.h
Source/WebKit2/UIProcess/Cocoa/WebPlaybackSessionManagerProxy.h
Source/WebKit2/UIProcess/Cocoa/WebPlaybackSessionManagerProxy.messages.in
Source/WebKit2/UIProcess/Cocoa/WebPlaybackSessionManagerProxy.mm
Source/WebKit2/WebProcess/cocoa/WebPlaybackSessionManager.h
Source/WebKit2/WebProcess/cocoa/WebPlaybackSessionManager.mm