Modify Netflix controlsManager quirk to prevent only scrubbing
authorbdakin@apple.com <bdakin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 5 Jun 2017 20:29:24 +0000 (20:29 +0000)
committerbdakin@apple.com <bdakin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 5 Jun 2017 20:29:24 +0000 (20:29 +0000)
commit9dfe674c4af9e1397c0de7fc64a4e8cefa78a572
tree5a9dd9859091a14c02cc62353ab5f6811459852e
parent29c6066bdd964fed3aa834a702236db6ffceff01
Modify Netflix controlsManager quirk to prevent only scrubbing
https://bugs.webkit.org/show_bug.cgi?id=172881
-and corresponding-
rdar://problem/32228660

Reviewed by Andy Estes.

Source/WebCore:

Instead of preventing Netflix from getting a controlsManager at all, this patch
ONLY prevents touch bar scrubbing from working. This means that Netflix will now
get controls in the TouchBar, it means that the play/pause and PiP buttons will be
functional, and it means that the timeline will accurately represent the current
time, BUT users will not be able to use the timeline to scrub the video. This also
allows Netflix to work with other MediaRemote clients such as AirPods.

Remove the quirk code from here, since this is no longer the right place to test
if the MediaElement is hosted at Netflix.
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::bestMediaElementForShowingPlaybackControlsManager):
(WebCore::needsPlaybackControlsManagerQuirk): Deleted.

Pass around a new bool allowsTouchBarScrubbing.
* platform/cocoa/WebPlaybackSessionModel.h:
(WebCore::WebPlaybackSessionModelClient::allowsTouchBarScrubbingChanged):
* platform/cocoa/WebPlaybackSessionModelMediaElement.h:

Here’s where we check if we need quirky behavior.
* platform/cocoa/WebPlaybackSessionModelMediaElement.mm:
(WebCore::WebPlaybackSessionModelMediaElement::updateForEventName):
(WebCore::WebPlaybackSessionModelMediaElement::allowsTouchBarScrubbing):

Return the bool we have plumbed through tracking whether the current site
allowsTouchBarScrubbing from the existing delegate method
canBeginTouchBarScrubbing. We will always return NO for video elements on Netflix,
and this will prevent users from be able to scrub with the TouchBar on Netflix.
* platform/mac/WebPlaybackControlsManager.h:
* platform/mac/WebPlaybackControlsManager.mm:
(-[WebPlaybackControlsManager canBeginTouchBarScrubbing]):

More plumbing.
* platform/mac/WebPlaybackSessionInterfaceMac.h:
* platform/mac/WebPlaybackSessionInterfaceMac.mm:
(WebCore::WebPlaybackSessionInterfaceMac::allowsTouchBarScrubbingChanged):
(WebCore::WebPlaybackSessionInterfaceMac::setPlayBackControlsManager):

Source/WebKit2:

Plumbing for allowsTouchBarScrubbing. See WebCore ChangeLog for more details.

* UIProcess/Cocoa/WebPlaybackSessionManagerProxy.h:
* UIProcess/Cocoa/WebPlaybackSessionManagerProxy.messages.in:
* UIProcess/Cocoa/WebPlaybackSessionManagerProxy.mm:
(WebKit::WebPlaybackSessionModelContext::setAllowsTouchBarScrubbing):
(WebKit::WebPlaybackSessionManagerProxy::setAllowsTouchBarScrubbing):
* WebProcess/cocoa/WebPlaybackSessionManager.h:
* WebProcess/cocoa/WebPlaybackSessionManager.mm:
(WebKit::WebPlaybackSessionInterfaceContext::allowsTouchBarScrubbingChanged):
(WebKit::WebPlaybackSessionManager::allowsTouchBarScrubbingChanged):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@217791 268f45cc-cd09-0410-ab3c-d52691b4dbfc
16 files changed:
Source/WebCore/ChangeLog
Source/WebCore/html/HTMLMediaElement.cpp
Source/WebCore/platform/cocoa/WebPlaybackSessionModel.h
Source/WebCore/platform/cocoa/WebPlaybackSessionModelMediaElement.h
Source/WebCore/platform/cocoa/WebPlaybackSessionModelMediaElement.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/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