Implement the Web Share API for mac
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 12 Sep 2018 00:57:58 +0000 (00:57 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 12 Sep 2018 00:57:58 +0000 (00:57 +0000)
commit58bb1a57108215021aa39b093b94cac1710327b4
treed799be3c7e9871bf16a8458d163fe91979334f58
parentd6fac02d75c203be5d5c3a0ef0b2a356159d518c
Implement the Web Share API for mac
https://bugs.webkit.org/show_bug.cgi?id=189443

Patch by Olivia Barnett <obarnett@apple.com> on 2018-09-11
Reviewed by Tim Horton.

Source/WebKit:

* Shared/WebPreferencesDefaultValues.h:
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView shareSheetDidDismiss:]):
* UIProcess/API/Cocoa/WKWebViewInternal.h:
* UIProcess/API/mac/WKView.mm:
(-[WKView shareSheetDidDismiss:]):
* UIProcess/Cocoa/WebViewImpl.h:
* UIProcess/Cocoa/WebViewImpl.mm:
(WebKit::WebViewImpl::showShareSheet):
(WebKit::WebViewImpl::shareSheetDidDismiss):
Implemented function for WKShareSheetDelegate.

* UIProcess/Cocoa/WKShareSheet.h:
* UIProcess/Cocoa/WKShareSheet.mm:
(-[WKShareSheet initWithView:initWithView:]):
(-[WKShareSheet presentWithParameters:completionHandler:]):
(-[WKShareSheet sharingServicePicker:didChooseSharingService:]):
(-[WKShareSheet _cancel]):
(-[WKShareSheet dismiss]):
(-[WKShareSheet _dismissDisplayAnimated:]):
(-[WKShareSheet invokeShareSheetWithResolution:]):
(-[WKShareSheet initWithView:]): Deleted.
Added mac platform checks and share sheet functionality.

* UIProcess/mac/PageClientImplMac.h:
* UIProcess/mac/PageClientImplMac.mm:
(WebKit::PageClientImpl::showShareSheet):
Allows macos to invoke the system share sheet.

LayoutTests:

* platform/mac-wk2/fast/dom/navigator-detached-no-crash-expected.txt: Added.
* platform/mac-wk2/imported/w3c/web-platform-tests/web-share/idlharness.https-expected.txt: Added.
* platform/mac-wk2/imported/w3c/web-platform-tests/web-share/share-empty.https-expected.txt: Added.
* platform/mac-wk2/imported/w3c/web-platform-tests/web-share/share-securecontext.http-expected.txt: Added.
* platform/mac-wk2/imported/w3c/web-platform-tests/web-share/share-url-invalid.https-expected.txt: Added.
* platform/mac-wk2/imported/w3c/web-platform-tests/web-share/share-without-user-gesture.https-expected.txt: Added.
Updated test expectations.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@235925 268f45cc-cd09-0410-ab3c-d52691b4dbfc
19 files changed:
LayoutTests/ChangeLog
LayoutTests/platform/mac-highsierra/fast/dom/navigator-detached-no-crash-expected.txt
LayoutTests/platform/mac-wk2/fast/dom/navigator-detached-no-crash-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac-wk2/imported/w3c/web-platform-tests/web-share/idlharness.https-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac-wk2/imported/w3c/web-platform-tests/web-share/share-empty.https-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac-wk2/imported/w3c/web-platform-tests/web-share/share-securecontext.http-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac-wk2/imported/w3c/web-platform-tests/web-share/share-url-invalid.https-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac-wk2/imported/w3c/web-platform-tests/web-share/share-without-user-gesture.https-expected.txt [new file with mode: 0644]
Source/WebKit/ChangeLog
Source/WebKit/Shared/WebPreferencesDefaultValues.h
Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm
Source/WebKit/UIProcess/API/Cocoa/WKWebViewInternal.h
Source/WebKit/UIProcess/Cocoa/WKShareSheet.h [moved from Source/WebKit/UIProcess/ios/forms/WKShareSheet.h with 84% similarity]
Source/WebKit/UIProcess/Cocoa/WKShareSheet.mm [moved from Source/WebKit/UIProcess/ios/forms/WKShareSheet.mm with 73% similarity]
Source/WebKit/UIProcess/Cocoa/WebViewImpl.h
Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm
Source/WebKit/UIProcess/mac/PageClientImplMac.h
Source/WebKit/UIProcess/mac/PageClientImplMac.mm
Source/WebKit/WebKit.xcodeproj/project.pbxproj