WebKit Bugzilla
Attachment 348022 Details for
Bug 171100
: Implement the Web Share API
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-171100-20180824105451.patch (text/plain), 70.90 KB, created by
Olivia Barnett
on 2018-08-24 10:54:54 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Olivia Barnett
Created:
2018-08-24 10:54:54 PDT
Size:
70.90 KB
patch
obsolete
>Subversion Revision: 235320 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 0db27f8d3b6356c0d282988952996b01dbb6fd48..79c6ff991fd00963e7c24cea0af90bbda25d4c2b 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,50 @@ >+2018-08-21 Olivia Barnett <obarnett@apple.com> >+ >+ Implement the Web Share API >+ https://bugs.webkit.org/show_bug.cgi?id=171100 >+ <rdar://problem/31751734> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ No new tests (OOPS!). >+ >+ * DerivedSources.make: >+ * Sources.txt: >+ * WebCore.xcodeproj/project.pbxproj: >+ * features.json: >+ * loader/EmptyClients.cpp: >+ (WebCore::EmptyChromeClient::runShareSheet): >+ * loader/EmptyClients.h: >+ Added empty runShareSheet function. >+ >+ * page/Chrome.cpp: >+ (WebCore::Chrome::runShareSheet): >+ * page/Chrome.h: >+ Added call to runShareSheet on client. >+ >+ * page/ChromeClient.h: >+ Virtual runShareSheet function. >+ >+ * page/Navigator.cpp: >+ (WebCore::Navigator::share): >+ * page/Navigator.h: >+ Share function that returns a promise and invokes the share sheet. >+ >+ * page/Navigator.idl: >+ Implements NavigatorShare >+ >+ * page/NavigatorShare.idl: Added. >+ Added definition of share function returning a promise. >+ >+ * page/RuntimeEnabledFeatures.h: >+ (WebCore::RuntimeEnabledFeatures::setWebShareEnabled): >+ (WebCore::RuntimeEnabledFeatures::webShareEnabled const): >+ Added RuntimeEnabledFeature switch. >+ >+ * page/ShareData.h: Added. >+ * page/ShareData.idl: Added. >+ Definition of ShareData struct. >+ > 2018-08-24 Andy Estes <aestes@apple.com> > > [Apple Pay] Allow $0 totals >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index 1256dd7b46a4b1e3f7057e2bde2305e04fafde99..5fe7038ccc0f0540a01bce0b1c824e62d8b1d832 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,84 @@ >+2018-08-21 Olivia Barnett <obarnett@apple.com> >+ >+ Implement the Web Share API >+ https://bugs.webkit.org/show_bug.cgi?id=171100 >+ <rdar://problem/31751734> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * Scripts/webkit/messages.py: >+ ShareDataWithParsedURL special case for header for type. >+ >+ * Shared/ShareSheetCallbackID.h: >+ Added a typedef for a share sheet callback id. >+ >+ * Shared/WebCoreArgumentCoders.cpp: >+ (IPC::ArgumentCoder<ShareData>::encode): >+ (IPC::ArgumentCoder<ShareData>::decode): >+ (IPC::ArgumentCoder<ShareDataWithParsedURL>::encode): >+ (IPC::ArgumentCoder<ShareDataWithParsedURL>::decode): >+ * Shared/WebCoreArgumentCoders.h: >+ Added encoding and decoding functionality for new structs. >+ >+ * Shared/WebPreferences.yaml: >+ * UIProcess/API/C/WKPreferences.cpp: >+ (WKPreferencesSetWebShareEnabled): >+ (WKPreferencesGetWebShareEnabled): >+ * UIProcess/API/C/WKPreferencesRefPrivate.h: >+ Added switch for RuntimeEnabledFeature. >+ >+ * UIProcess/PageClient.h: >+ (WebKit::PageClient::showShareSheet): >+ Page client call to invoke share sheet. >+ >+ * UIProcess/WebPageProxy.cpp: >+ (WebKit::WebPageProxy::runShareSheet): >+ * UIProcess/WebPageProxy.h: >+ * UIProcess/WebPageProxy.messages.in: >+ Web page proxy handling of call to invoke share sheet. >+ Creates completion handler to send to WKShareSheet.mm >+ Completion handler sends message to WebPage with message id. >+ >+ * UIProcess/ios/PageClientImplIOS.h: >+ * UIProcess/ios/PageClientImplIOS.mm: >+ (WebKit::PageClientImpl::showShareSheet): >+ Page client implementation call to invoke share sheet. >+ >+ * UIProcess/ios/WKContentViewInteraction.h: >+ * UIProcess/ios/WKContentViewInteraction.mm: >+ (-[WKContentView cleanupInteraction]): >+ (-[WKContentView _showShareSheet:completionHandler:]): >+ (-[WKContentView shareSheetDidDismiss:]): >+ Call to WKShareSheet to invoke the share sheet and callback. >+ >+ * UIProcess/ios/forms/WKShareSheet.h: Added. >+ * UIProcess/ios/forms/WKShareSheet.mm: Added. >+ (-[WKShareSheet initWithView:]): >+ (-[WKShareSheet presentWithParameters:completionHandler:]): >+ (-[WKShareSheet _dispatchDidDismiss]): >+ (-[WKShareSheet _cancel]): >+ (-[WKShareSheet dismiss]): >+ (-[WKShareSheet _dismissDisplayAnimated:]): >+ (-[WKShareSheet _presentFullscreenViewController:animated:]): >+ Completion handler call and creation of share sheet with parameters. >+ >+ * WebKit.xcodeproj/project.pbxproj: >+ >+ * WebProcess/WebCoreSupport/WebChromeClient.cpp: >+ (WebKit::WebChromeClient::runShareSheet): >+ Call to page to invoke share sheet. >+ >+ * WebProcess/WebCoreSupport/WebChromeClient.h: >+ * WebProcess/WebPage/WebPage.cpp: >+ (WebKit::nextShareSheetContextId): >+ (WebKit::WebPage::runShareSheet): >+ (WebKit::WebPage::runShareSheetResponse): >+ WebPage calls proxy and saves context id for promise. >+ >+ * WebProcess/WebPage/WebPage.h: >+ * WebProcess/WebPage/WebPage.messages.in: >+ Callback for completed response. >+ > 2018-08-23 Carlos Garcia Campos <cgarcia@igalia.com> > > [GTK][WPE] Add API to inject/register user content in isolated worlds >diff --git a/Source/WebKitLegacy/ios/ChangeLog b/Source/WebKitLegacy/ios/ChangeLog >index 8043219c0f35a9404dd4b90ebc1f302817b1c04e..623b980eecd5e2f2e34b7d9b80208fc4ffeeaa1c 100644 >--- a/Source/WebKitLegacy/ios/ChangeLog >+++ b/Source/WebKitLegacy/ios/ChangeLog >@@ -1,3 +1,16 @@ >+2018-08-21 Olivia Barnett <obarnett@apple.com> >+ >+ Implement the Web Share API >+ https://bugs.webkit.org/show_bug.cgi?id=171100 >+ <rdar://problem/31751734> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * WebCoreSupport/WebChromeClientIOS.h: >+ * WebCoreSupport/WebChromeClientIOS.mm: >+ (WebChromeClientIOS::runShareSheet): >+ Empty declaration of runShareSheet. >+ > 2018-08-21 Ryosuke Niwa <rniwa@webkit.org> > > Replace booleans for modifier keys in UIEventWithKeyState with OptionSet<Modifier> >diff --git a/Source/WebKitLegacy/mac/ChangeLog b/Source/WebKitLegacy/mac/ChangeLog >index dee686d4d4ab0520c5acc024330bef65776c1bec..01e9e4eb761bf98b4f2d7a5965960a3f27b411fa 100644 >--- a/Source/WebKitLegacy/mac/ChangeLog >+++ b/Source/WebKitLegacy/mac/ChangeLog >@@ -1,3 +1,16 @@ >+2018-08-21 Olivia Barnett <obarnett@apple.com> >+ >+ Implement the Web Share API >+ https://bugs.webkit.org/show_bug.cgi?id=171100 >+ <rdar://problem/31751734> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * WebCoreSupport/WebChromeClient.h: >+ * WebCoreSupport/WebChromeClient.mm: >+ (WebChromeClient::runShareSheet): >+ Empty declaration of runShareSheet. >+ > 2018-08-23 Mark Lam <mark.lam@apple.com> > > Move vmEntryGlobalObject() to VM from CallFrame. >diff --git a/Source/WebCore/DerivedSources.make b/Source/WebCore/DerivedSources.make >index 6c9b2ce6b61c0059d69e7a99460aa70aec8c0a4d..46681f9daf9a75e640fdd1d2aab1a5a57210cc8f 100644 >--- a/Source/WebCore/DerivedSources.make >+++ b/Source/WebCore/DerivedSources.make >@@ -776,6 +776,8 @@ JS_BINDING_IDLS = \ > $(WebCore)/page/NavigatorID.idl \ > $(WebCore)/page/NavigatorLanguage.idl \ > $(WebCore)/page/NavigatorOnLine.idl \ >+ $(WebCore)/page/NavigatorShare.idl \ >+ $(WebCore)/page/ShareData.idl \ > $(WebCore)/page/NavigatorServiceWorker.idl \ > $(WebCore)/page/Performance.idl \ > $(WebCore)/page/PerformanceEntry.idl \ >diff --git a/Source/WebCore/Sources.txt b/Source/WebCore/Sources.txt >index 9769989a640029cd8fc1c29c3f03c4bd2f69d729..a400b3c0502e266f66983f7a35908c85714aecd0 100644 >--- a/Source/WebCore/Sources.txt >+++ b/Source/WebCore/Sources.txt >@@ -2783,6 +2783,8 @@ JSNavigatorLanguage.cpp > JSNavigatorMediaCapabilities.cpp > JSNavigatorMediaDevices.cpp > JSNavigatorOnLine.cpp >+JSNavigatorShare.cpp >+JSShareData.cpp > JSNavigatorServiceWorker.cpp > JSNavigatorUserMedia.cpp > JSNavigatorWebDriver.cpp >diff --git a/Source/WebCore/WebCore.xcodeproj/project.pbxproj b/Source/WebCore/WebCore.xcodeproj/project.pbxproj >index 6a55d13aff49422e5a87665029b7300915a5a162..3ab6d06b8f3c0b5f8d27707e384199725b2c6e0a 100644 >--- a/Source/WebCore/WebCore.xcodeproj/project.pbxproj >+++ b/Source/WebCore/WebCore.xcodeproj/project.pbxproj >@@ -642,6 +642,7 @@ > 1CAF34830A6C405200ABE06E /* WebScriptObjectPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 1CAF34800A6C405200ABE06E /* WebScriptObjectPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; }; > 1CCDF5BE1990332400BCEBAD /* SVGToOTFFontConversion.h in Headers */ = {isa = PBXBuildFile; fileRef = 1CCDF5BC1990332400BCEBAD /* SVGToOTFFontConversion.h */; }; > 1CFAE3230A6D6A3F0032593D /* libobjc.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 1CFAE3220A6D6A3F0032593D /* libobjc.dylib */; }; >+ 1D9F0FC12122029B005D8FD4 /* ShareData.h in Headers */ = {isa = PBXBuildFile; fileRef = 1DC55400211BA8C8004B780E /* ShareData.h */; settings = {ATTRIBUTES = (Private, ); }; }; > 1F36EA9C1E21BA1700621E25 /* WebBackgroundTaskController.h in Headers */ = {isa = PBXBuildFile; fileRef = 1F36EA9A1E21BA1700621E25 /* WebBackgroundTaskController.h */; settings = {ATTRIBUTES = (Private, ); }; }; > 1F3C3BEB135CAF3C00B8C1AC /* MediaControls.h in Headers */ = {isa = PBXBuildFile; fileRef = 1F3C3BE9135CAF3C00B8C1AC /* MediaControls.h */; }; > 1F72BF0B187FD45C0009BCB3 /* TileControllerMemoryHandlerIOS.h in Headers */ = {isa = PBXBuildFile; fileRef = 1F72BF09187FD4270009BCB3 /* TileControllerMemoryHandlerIOS.h */; settings = {ATTRIBUTES = (Private, ); }; }; >@@ -6325,6 +6326,9 @@ > 1CDD45E50BA9C84600F90147 /* WebCore.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = WebCore.xcconfig; sourceTree = "<group>"; }; > 1CDD45E60BA9C84600F90147 /* Base.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Base.xcconfig; sourceTree = "<group>"; }; > 1CFAE3220A6D6A3F0032593D /* libobjc.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libobjc.dylib; path = /usr/lib/libobjc.dylib; sourceTree = "<absolute>"; }; >+ 1DC553FD211BA12A004B780E /* NavigatorShare.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = NavigatorShare.idl; sourceTree = "<group>"; }; >+ 1DC553FF211BA841004B780E /* ShareData.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ShareData.idl; sourceTree = "<group>"; }; >+ 1DC55400211BA8C8004B780E /* ShareData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ShareData.h; sourceTree = "<group>"; }; > 1F36EA9A1E21BA1700621E25 /* WebBackgroundTaskController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebBackgroundTaskController.h; sourceTree = "<group>"; }; > 1F36EA9B1E21BA1700621E25 /* WebBackgroundTaskController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebBackgroundTaskController.mm; sourceTree = "<group>"; }; > 1F3C3BE8135CAF3C00B8C1AC /* MediaControls.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MediaControls.cpp; sourceTree = "<group>"; }; >@@ -15252,8 +15256,8 @@ > 41103AA71E39790A00769F14 /* RealtimeOutgoingAudioSourceCocoa.cpp */, > 41103AA81E39790A00769F14 /* RealtimeOutgoingAudioSourceCocoa.h */, > 5CDD833B1E4324BB00621B83 /* RealtimeOutgoingVideoSourceCocoa.cpp */, >- 419242472127B7CC00634FCF /* RealtimeOutgoingVideoSourceCocoa.mm */, > 5CDD833C1E4324BB00621B83 /* RealtimeOutgoingVideoSourceCocoa.h */, >+ 419242472127B7CC00634FCF /* RealtimeOutgoingVideoSourceCocoa.mm */, > 070A9F5E1FFECC70003DF649 /* ScreenDisplayCaptureSourceMac.h */, > 070A9F601FFECC71003DF649 /* ScreenDisplayCaptureSourceMac.mm */, > 07D6373E1BB0B11300256CE9 /* WebAudioSourceProviderAVFObjC.h */, >@@ -19315,6 +19319,7 @@ > 7C5BEA3B1E9EE77100CC517B /* NavigatorLanguage.idl */, > 7C5BEA3C1E9EE77100CC517B /* NavigatorOnLine.idl */, > 5182C24B1F313AE00059BA7C /* NavigatorServiceWorker.idl */, >+ 1DC553FD211BA12A004B780E /* NavigatorShare.idl */, > 00146288103CD1DE000B20DB /* OriginAccessEntry.cpp */, > 00146289103CD1DE000B20DB /* OriginAccessEntry.h */, > 65FEA86809833ADE00BED4AB /* Page.cpp */, >@@ -19405,6 +19410,8 @@ > 7CC6609B1F93057900D500E9 /* SettingsBase.cpp */, > 7CC660991F93057800D500E9 /* SettingsBase.h */, > 7C6EFEEA1F946A2E00FFAD41 /* SettingsDefaultValues.h */, >+ 1DC55400211BA8C8004B780E /* ShareData.h */, >+ 1DC553FF211BA841004B780E /* ShareData.idl */, > 5C688AA21D38126F000B54FA /* SocketProvider.cpp */, > 5C7C88D71D0F1F2B009D2F6D /* SocketProvider.h */, > 626CDE0C1140424C001E5A68 /* SpatialNavigation.cpp */, >@@ -30140,6 +30147,7 @@ > FD45A95B175D41EE00C21EC8 /* ShapeInterval.h in Headers */, > FD45A952175D3F3E00C21EC8 /* ShapeOutsideInfo.h in Headers */, > FD1AF1501656F15100C6D4F7 /* ShapeValue.h in Headers */, >+ 1D9F0FC12122029B005D8FD4 /* ShareData.h in Headers */, > 1A4A954E0B4EDCCB002D8C3C /* SharedBuffer.h in Headers */, > 834DFAD01F7DAE5D00C2725B /* SharedStringHash.h in Headers */, > 93309EA3099EB78C0056E581 /* SharedTimer.h in Headers */, >@@ -31470,6 +31478,7 @@ > AA12DF491743DF83004DAFDF /* PlatformSpeechSynthesizerIOS.mm in Sources */, > CDA29A301CBF74D400901CCF /* PlaybackSessionInterfaceAVKit.mm in Sources */, > CDA29A161CBDA56C00901CCF /* PlaybackSessionInterfaceMac.mm in Sources */, >+ 419242492127B93E00634FCF /* RealtimeOutgoingVideoSourceCocoa.mm in Sources */, > 316DCB8A1E7A6996001B5F87 /* RTCIceTransport.cpp in Sources */, > BC51156E12B1749C00C96754 /* ScrollAnimatorMac.mm in Sources */, > BCEF869F0E844E9D00A85CD5 /* ScrollbarThemeMac.mm in Sources */, >@@ -31590,7 +31599,6 @@ > 538EC8A11F993F9D004D22A8 /* UnifiedSource48.cpp in Sources */, > DE5F85991FA1ABF4006DB63A /* UnifiedSource49-mm.mm in Sources */, > 538EC8A21F993F9D004D22A8 /* UnifiedSource49.cpp in Sources */, >- 419242492127B93E00634FCF /* RealtimeOutgoingVideoSourceCocoa.mm in Sources */, > DE5F859A1FA1ABF4006DB63A /* UnifiedSource50-mm.mm in Sources */, > 538EC8A31F993F9D004D22A8 /* UnifiedSource50.cpp in Sources */, > DE5F86501FA2AF24006DB63A /* UnifiedSource51-mm.mm in Sources */, >diff --git a/Source/WebCore/features.json b/Source/WebCore/features.json >index 16a73ecb1e1dfa8eae6dac0a3614ba5491daeb09..2ece761d1bb4411000b1bc32135949bd2d172b1a 100644 >--- a/Source/WebCore/features.json >+++ b/Source/WebCore/features.json >@@ -1230,7 +1230,7 @@ > { > "name": "Web Share", > "status": { >- "status": "Under Consideration" >+ "status": "In Development" > }, > "url": "https://github.com/WICG/web-share/blob/master/docs/interface.md", > "webkit-url": "https://bugs.webkit.org/show_bug.cgi?id=171100", >diff --git a/Source/WebCore/loader/EmptyClients.cpp b/Source/WebCore/loader/EmptyClients.cpp >index d4b915ddbdf6bb9999c01540ced98833054928a9..7cd2cae6bd01951deeb74f2a09fa0ca025480c9b 100644 >--- a/Source/WebCore/loader/EmptyClients.cpp >+++ b/Source/WebCore/loader/EmptyClients.cpp >@@ -436,6 +436,10 @@ std::unique_ptr<DataListSuggestionPicker> EmptyChromeClient::createDataListSugge > void EmptyChromeClient::runOpenPanel(Frame&, FileChooser&) > { > } >+ >+void EmptyChromeClient::runShareSheet(ShareDataWithParsedURL&, CompletionHandler<void(bool)>&&) >+{ >+} > > PAL::SessionID EmptyFrameLoaderClient::sessionID() const > { >diff --git a/Source/WebCore/loader/EmptyClients.h b/Source/WebCore/loader/EmptyClients.h >index 9d052b0b9523fbc846693f22dc5fc78aa380765c..e40d8b0f8083e1b71913ba69539e81a9702bb45c 100644 >--- a/Source/WebCore/loader/EmptyClients.h >+++ b/Source/WebCore/loader/EmptyClients.h >@@ -137,6 +137,7 @@ class EmptyChromeClient : public ChromeClient { > #endif > > void runOpenPanel(Frame&, FileChooser&) final; >+ void runShareSheet(ShareDataWithParsedURL&, CompletionHandler<void(bool)>&&) final; > void loadIconForFiles(const Vector<String>&, FileIconLoader&) final { } > > void elementDidFocus(Element&) final { } >diff --git a/Source/WebCore/page/Chrome.cpp b/Source/WebCore/page/Chrome.cpp >index 1331cb1236c103a142fc5c19a5ee938f0979a4f7..d78ca359e8cfb071769fcfb6152292e0b56e0cee 100644 >--- a/Source/WebCore/page/Chrome.cpp >+++ b/Source/WebCore/page/Chrome.cpp >@@ -46,6 +46,7 @@ > #include "RenderObject.h" > #include "ResourceHandle.h" > #include "Settings.h" >+#include "ShareData.h" > #include "StorageNamespace.h" > #include "WindowFeatures.h" > #include <JavaScriptCore/VM.h> >@@ -449,6 +450,11 @@ void Chrome::runOpenPanel(Frame& frame, FileChooser& fileChooser) > m_client.runOpenPanel(frame, fileChooser); > } > >+void Chrome::runShareSheet(ShareDataWithParsedURL& shareData, CompletionHandler<void(bool)>&& callback) >+{ >+ m_client.runShareSheet(shareData, WTFMove(callback)); >+} >+ > void Chrome::loadIconForFiles(const Vector<String>& filenames, FileIconLoader& loader) > { > m_client.loadIconForFiles(filenames, loader); >diff --git a/Source/WebCore/page/Chrome.h b/Source/WebCore/page/Chrome.h >index ccbce93556ea94b5c110c5dc357c35d98831a9ff..861f6503a91bafca6cbd669dbbcee6b11c88712e 100644 >--- a/Source/WebCore/page/Chrome.h >+++ b/Source/WebCore/page/Chrome.h >@@ -59,6 +59,7 @@ class PopupOpeningObserver; > class SearchPopupMenu; > > struct DateTimeChooserParameters; >+struct ShareDataWithParsedURL; > struct ViewportArguments; > struct WindowFeatures; > >@@ -159,6 +160,7 @@ public: > #endif > > void runOpenPanel(Frame&, FileChooser&); >+ void runShareSheet(ShareDataWithParsedURL&, CompletionHandler<void(bool)>&&); > void loadIconForFiles(const Vector<String>&, FileIconLoader&); > > void dispatchDisabledAdaptationsDidChange(const OptionSet<DisabledAdaptations>&) const; >diff --git a/Source/WebCore/page/ChromeClient.h b/Source/WebCore/page/ChromeClient.h >index 472b6183fc7bc2dbffbea0a59735e7cab0f50ce9..6b4461584ae3ad31c13f4d91a6e8aff90bf8983f 100644 >--- a/Source/WebCore/page/ChromeClient.h >+++ b/Source/WebCore/page/ChromeClient.h >@@ -101,6 +101,7 @@ class MediaPlayerRequestInstallMissingPluginsCallback; > > struct DateTimeChooserParameters; > struct GraphicsDeviceAdapter; >+struct ShareDataWithParsedURL; > struct ViewportArguments; > struct WindowFeatures; > >@@ -282,6 +283,8 @@ public: > #endif > > virtual void runOpenPanel(Frame&, FileChooser&) = 0; >+ virtual void runShareSheet(ShareDataWithParsedURL&, WTF::CompletionHandler<void(bool)>&& callback) { callback(false); } >+ > // Asynchronous request to load an icon for specified filenames. > virtual void loadIconForFiles(const Vector<String>&, FileIconLoader&) = 0; > >diff --git a/Source/WebCore/page/Navigator.cpp b/Source/WebCore/page/Navigator.cpp >index 78098006b72bc17a6d159fd2ad18dc7f773b659c..314ce269c426d7ed2ed321c9d387fb38856290a6 100644 >--- a/Source/WebCore/page/Navigator.cpp >+++ b/Source/WebCore/page/Navigator.cpp >@@ -23,6 +23,7 @@ > #include "config.h" > #include "Navigator.h" > >+#include "Chrome.h" > #include "CookieJar.h" > #include "DOMMimeTypeArray.h" > #include "DOMPluginArray.h" >@@ -31,6 +32,7 @@ > #include "FrameLoader.h" > #include "FrameLoaderClient.h" > #include "Geolocation.h" >+#include "JSDOMPromiseDeferred.h" > #include "LoaderStrategy.h" > #include "Page.h" > #include "PlatformStrategies.h" >@@ -40,6 +42,7 @@ > #include "Settings.h" > #include <wtf/Language.h> > #include <wtf/StdLibExtras.h> >+#include <wtf/WeakPtr.h> > > > namespace WebCore { >@@ -94,6 +97,40 @@ bool Navigator::onLine() const > return platformStrategies()->loaderStrategy()->isOnLine(); > } > >+void Navigator::share(ScriptExecutionContext& context, ShareData data, Ref<DeferredPromise>&& promise) >+{ >+ if (!m_frame->page()) { >+ promise->reject(TypeError); >+ return; >+ } >+ >+ if (data.title.isEmpty() && data.url.isEmpty() && data.text.isEmpty()) { >+ promise->reject(TypeError); >+ return; >+ } >+ >+ >+ URL url = context.completeURL(data.url); >+ if (!url.isValid()) { >+ promise->reject(TypeError); >+ return; >+ } >+ >+ ShareDataWithParsedURL shareData = { >+ data, >+ url, >+ }; >+ >+ m_frame->page()->chrome().runShareSheet(shareData, [promise = WTFMove(promise)] (bool completed) { >+ if (completed) { >+ promise->resolve(); >+ return; >+ } >+ promise->reject(Exception { AbortError, "Abort due to cancellation of share."_s }); >+ }); >+ return; >+} >+ > DOMPluginArray& Navigator::plugins() > { > if (!m_plugins) >diff --git a/Source/WebCore/page/Navigator.h b/Source/WebCore/page/Navigator.h >index b86ed89daff4b698a9c13790c2d75341f3a06a6a..bd260df7fa707a265013c032c2bcf20459783c2b 100644 >--- a/Source/WebCore/page/Navigator.h >+++ b/Source/WebCore/page/Navigator.h >@@ -20,8 +20,10 @@ > #pragma once > > #include "DOMWindowProperty.h" >+#include "JSDOMPromiseDeferred.h" > #include "NavigatorBase.h" > #include "ScriptWrappable.h" >+#include "ShareData.h" > #include "Supplementable.h" > > namespace WebCore { >@@ -42,6 +44,7 @@ public: > const String& userAgent() const final; > void userAgentChanged(); > bool onLine() const final; >+ void share(ScriptExecutionContext&, ShareData, Ref<DeferredPromise>&&); > > #if PLATFORM(IOS) > bool standalone() const; >diff --git a/Source/WebCore/page/Navigator.idl b/Source/WebCore/page/Navigator.idl >index b37eda900b431d2cbddc3d9af27c6f7abbcb1ae8..69d55c89bf0129fd5fd34885ae1415f791506844 100644 >--- a/Source/WebCore/page/Navigator.idl >+++ b/Source/WebCore/page/Navigator.idl >@@ -35,4 +35,4 @@ Navigator implements NavigatorID; > Navigator implements NavigatorLanguage; > Navigator implements NavigatorOnLine; > Navigator implements NavigatorServiceWorker; >- >+Navigator implements NavigatorShare; >diff --git a/Source/WebCore/page/NavigatorShare.idl b/Source/WebCore/page/NavigatorShare.idl >new file mode 100644 >index 0000000000000000000000000000000000000000..6ab4d3107e6ad724f217bf9a77229f7db79bfd93 >--- /dev/null >+++ b/Source/WebCore/page/NavigatorShare.idl >@@ -0,0 +1,35 @@ >+/* >+ * Copyright (C) 2018 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. >+ * 3. Neither the name of Apple Inc. ("Apple") nor the names of >+ * its contributors may be used to endorse or promote products derived >+ * from this software without specific prior written permission. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE 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 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. >+ */ >+ >+ >+[ >+ NoInterfaceObject, >+ EnabledAtRuntime=WebShare >+] interface NavigatorShare { >+ [CallWith=ScriptExecutionContext] Promise<void> share(ShareData shareData); >+}; >diff --git a/Source/WebCore/page/RuntimeEnabledFeatures.h b/Source/WebCore/page/RuntimeEnabledFeatures.h >index 0e645b341d921f07900a4f15b448385c411c5226..c82bb6c249e2d6881020ebae15c491936259e3d9 100644 >--- a/Source/WebCore/page/RuntimeEnabledFeatures.h >+++ b/Source/WebCore/page/RuntimeEnabledFeatures.h >@@ -86,6 +86,9 @@ public: > > void setCustomPasteboardDataEnabled(bool isEnabled) { m_isCustomPasteboardDataEnabled = isEnabled; } > bool customPasteboardDataEnabled() const { return m_isCustomPasteboardDataEnabled; } >+ >+ void setWebShareEnabled(bool isEnabled) { m_isWebShareEnabled = isEnabled; } >+ bool webShareEnabled() const { return m_isWebShareEnabled; } > > #if ENABLE(ATTACHMENT_ELEMENT) > void setAttachmentElementEnabled(bool areEnabled) { m_isAttachmentElementEnabled = areEnabled; } >@@ -304,6 +307,7 @@ private: > bool m_isDirectoryUploadEnabled { false }; > bool m_areDataTransferItemsEnabled { false }; > bool m_isCustomPasteboardDataEnabled { false }; >+ bool m_isWebShareEnabled { false }; > bool m_inputEventsEnabled { true }; > > #if ENABLE(ATTACHMENT_ELEMENT) >diff --git a/Source/WebCore/page/ShareData.h b/Source/WebCore/page/ShareData.h >new file mode 100644 >index 0000000000000000000000000000000000000000..279f033a264813c21adf90cfa6c3658ac3843f23 >--- /dev/null >+++ b/Source/WebCore/page/ShareData.h >@@ -0,0 +1,42 @@ >+/* >+ * Copyright (C) 2018 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. ``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 >+ * 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 >+#include "URL.h" >+ >+namespace WebCore { >+ >+struct ShareData { >+ String title; >+ String text; >+ String url; >+}; >+ >+struct ShareDataWithParsedURL { >+ ShareData shareData; >+ URL url; >+}; >+ >+} >diff --git a/Source/WebCore/page/ShareData.idl b/Source/WebCore/page/ShareData.idl >new file mode 100644 >index 0000000000000000000000000000000000000000..15b660ea29b9a2297daeb1d6c316004e333150a0 >--- /dev/null >+++ b/Source/WebCore/page/ShareData.idl >@@ -0,0 +1,33 @@ >+/* >+ * Copyright (C) 2018 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. >+ * 3. Neither the name of Apple Inc. ("Apple") nor the names of >+ * its contributors may be used to endorse or promote products derived >+ * from this software without specific prior written permission. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE 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 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. >+ */ >+ >+dictionary ShareData { >+ USVString title; >+ USVString text; >+ USVString url; >+}; >diff --git a/Source/WebKit/Scripts/webkit/messages.py b/Source/WebKit/Scripts/webkit/messages.py >index 7af168c93419cb329452060a410c8703ea10a359..5d5ab40dac669ca529f0f069b7771e49dea2a891 100644 >--- a/Source/WebKit/Scripts/webkit/messages.py >+++ b/Source/WebKit/Scripts/webkit/messages.py >@@ -381,6 +381,7 @@ def headers_for_type(type): > 'WebCore::AutoplayEventFlags': ['<WebCore/AutoplayEvent.h>'], > 'WebCore::ExceptionDetails': ['<WebCore/JSDOMExceptionHandling.h>'], > 'WebCore::FileChooserSettings': ['<WebCore/FileChooser.h>'], >+ 'WebCore::ShareDataWithParsedURL': ['<WebCore/ShareData.h>'], > 'WebCore::FrameLoadType': ['<WebCore/FrameLoaderTypes.h>'], > 'WebCore::GrammarDetail': ['<WebCore/TextCheckerClient.h>'], > 'WebCore::HasInsecureContent': ['<WebCore/FrameLoaderTypes.h>'], >diff --git a/Source/WebKit/Shared/ShareSheetCallbackID.h b/Source/WebKit/Shared/ShareSheetCallbackID.h >new file mode 100644 >index 0000000000000000000000000000000000000000..b57baa216ddaa2e20bbe0f19c814063b63bdc478 >--- /dev/null >+++ b/Source/WebKit/Shared/ShareSheetCallbackID.h >@@ -0,0 +1,28 @@ >+/* >+ * Copyright (C) 2018 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. ``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 >+ * 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. >+ */ >+ >+ >+typedef uint64_t ShareSheetCallbackID; >+ >diff --git a/Source/WebKit/Shared/WebCoreArgumentCoders.cpp b/Source/WebKit/Shared/WebCoreArgumentCoders.cpp >index 365f592c55839c945340120cb7903c1abd09fdfa..4d8df65a6f3475263666416e1252edb25042e588 100644 >--- a/Source/WebKit/Shared/WebCoreArgumentCoders.cpp >+++ b/Source/WebKit/Shared/WebCoreArgumentCoders.cpp >@@ -72,6 +72,7 @@ > #include <WebCore/ServiceWorkerClientData.h> > #include <WebCore/ServiceWorkerClientIdentifier.h> > #include <WebCore/ServiceWorkerData.h> >+#include <WebCore/ShareData.h> > #include <WebCore/TextCheckerClient.h> > #include <WebCore/TextIndicator.h> > #include <WebCore/TimingFunction.h> >@@ -1917,7 +1918,39 @@ bool ArgumentCoder<FileChooserSettings>::decode(Decoder& decoder, FileChooserSet > > return true; > } >+ >+void ArgumentCoder<ShareData>::encode(Encoder& encoder, const ShareData& settings) >+{ >+ encoder << settings.title; >+ encoder << settings.text; >+ encoder << settings.url; >+} >+ >+bool ArgumentCoder<ShareData>::decode(Decoder& decoder, ShareData& settings) >+{ >+ if (!decoder.decode(settings.title)) >+ return false; >+ if (!decoder.decode(settings.text)) >+ return false; >+ if (!decoder.decode(settings.url)) >+ return false; >+ return true; >+} >+ >+void ArgumentCoder<ShareDataWithParsedURL>::encode(Encoder& encoder, const ShareDataWithParsedURL& settings) >+{ >+ encoder << settings.shareData; >+ encoder << settings.url; >+} > >+bool ArgumentCoder<ShareDataWithParsedURL>::decode(Decoder& decoder, ShareDataWithParsedURL& settings) >+{ >+ if (!decoder.decode(settings.shareData)) >+ return false; >+ if (!decoder.decode(settings.url)) >+ return false; >+ return true; >+} > > void ArgumentCoder<GrammarDetail>::encode(Encoder& encoder, const GrammarDetail& detail) > { >diff --git a/Source/WebKit/Shared/WebCoreArgumentCoders.h b/Source/WebKit/Shared/WebCoreArgumentCoders.h >index 8ca760fcffdcd4d8f62f6233929303385aafc35f..f1b1395b25ed093993f1d4a5bb2bfcf609362a8e 100644 >--- a/Source/WebKit/Shared/WebCoreArgumentCoders.h >+++ b/Source/WebKit/Shared/WebCoreArgumentCoders.h >@@ -102,6 +102,8 @@ struct DictionaryPopupInfo; > struct EventTrackingRegions; > struct ExceptionDetails; > struct FileChooserSettings; >+struct ShareData; >+struct ShareDataWithParsedURL; > struct Length; > struct GrammarDetail; > struct MimeClassInfo; >@@ -474,6 +476,16 @@ template<> struct ArgumentCoder<WebCore::FileChooserSettings> { > static void encode(Encoder&, const WebCore::FileChooserSettings&); > static bool decode(Decoder&, WebCore::FileChooserSettings&); > }; >+ >+template<> struct ArgumentCoder<WebCore::ShareData> { >+ static void encode(Encoder&, const WebCore::ShareData&); >+ static bool decode(Decoder&, WebCore::ShareData&); >+}; >+ >+template<> struct ArgumentCoder<WebCore::ShareDataWithParsedURL> { >+ static void encode(Encoder&, const WebCore::ShareDataWithParsedURL&); >+ static bool decode(Decoder&, WebCore::ShareDataWithParsedURL&); >+}; > > template<> struct ArgumentCoder<WebCore::GrammarDetail> { > static void encode(Encoder&, const WebCore::GrammarDetail&); >diff --git a/Source/WebKit/Shared/WebPreferences.yaml b/Source/WebKit/Shared/WebPreferences.yaml >index 260221cb30cd25bf524c22b74e6525187fb8001c..e535396adc337f3e3e9b2c22afb5b405287d8011 100644 >--- a/Source/WebKit/Shared/WebPreferences.yaml >+++ b/Source/WebKit/Shared/WebPreferences.yaml >@@ -757,6 +757,13 @@ CustomPasteboardDataEnabled: > humanReadableDescription: "Enable custom clipboard types and better security model for clipboard API." > webcoreBinding: RuntimeEnabledFeatures > >+WebShareEnabled: >+ type: bool >+ defaultValue: true >+ humanReadableName: "Web Share" >+ humanReadableDescription: "Enable support for share sheet via Web Share API" >+ webcoreBinding: RuntimeEnabledFeatures >+ > ViewportFitEnabled: > type: bool > defaultValue: true >diff --git a/Source/WebKit/UIProcess/API/C/WKPreferences.cpp b/Source/WebKit/UIProcess/API/C/WKPreferences.cpp >index cf3955012d34d9a4db515701fd4be0cd77505707..4f8a878d25822249eef5b21002d328077506df8c 100644 >--- a/Source/WebKit/UIProcess/API/C/WKPreferences.cpp >+++ b/Source/WebKit/UIProcess/API/C/WKPreferences.cpp >@@ -1738,6 +1738,16 @@ bool WKPreferencesGetCustomPasteboardDataEnabled(WKPreferencesRef preferencesRef > return toImpl(preferencesRef)->customPasteboardDataEnabled(); > } > >+void WKPreferencesSetWebShareEnabled(WKPreferencesRef preferencesRef, bool flag) >+{ >+ toImpl(preferencesRef)->setWebShareEnabled(flag); >+} >+ >+bool WKPreferencesGetWebShareEnabled(WKPreferencesRef preferencesRef) >+{ >+ return toImpl(preferencesRef)->webShareEnabled(); >+} >+ > void WKPreferencesSetDownloadAttributeEnabled(WKPreferencesRef preferencesRef, bool flag) > { > toImpl(preferencesRef)->setDownloadAttributeEnabled(flag); >diff --git a/Source/WebKit/UIProcess/API/C/WKPreferencesRefPrivate.h b/Source/WebKit/UIProcess/API/C/WKPreferencesRefPrivate.h >index 7cd482530467285d10e07ebdff1c6e1130abee36..45d6e9e3e263962c4a005e09ec873a078dca4f77 100644 >--- a/Source/WebKit/UIProcess/API/C/WKPreferencesRefPrivate.h >+++ b/Source/WebKit/UIProcess/API/C/WKPreferencesRefPrivate.h >@@ -496,6 +496,10 @@ WK_EXPORT bool WKPreferencesGetDataTransferItemsEnabled(WKPreferencesRef); > // Defaults to false > WK_EXPORT void WKPreferencesSetCustomPasteboardDataEnabled(WKPreferencesRef, bool flag); > WK_EXPORT bool WKPreferencesGetCustomPasteboardDataEnabled(WKPreferencesRef); >+ >+// Defaults to true >+WK_EXPORT void WKPreferencesSetWebShareEnabled(WKPreferencesRef, bool flag); >+WK_EXPORT bool WKPreferencesGetWebShareEnabled(WKPreferencesRef); > > // Defaults to false > WK_EXPORT void WKPreferencesSetUserTimingEnabled(WKPreferencesRef, bool flag); >diff --git a/Source/WebKit/UIProcess/PageClient.h b/Source/WebKit/UIProcess/PageClient.h >index 2683fc8ddb6f1917e9a77e3e2525ec0a425451e5..7e7ef979863e81bdf927c450c34d34e7db7b2a21 100644 >--- a/Source/WebKit/UIProcess/PageClient.h >+++ b/Source/WebKit/UIProcess/PageClient.h >@@ -80,6 +80,7 @@ struct DictionaryPopupInfo; > struct Highlight; > struct TextIndicatorData; > struct ViewportAttributes; >+struct ShareDataWithParsedURL; > > template <typename> class RectEdges; > using FloatBoxExtent = RectEdges<float>; >@@ -201,6 +202,7 @@ public: > virtual void handleDownloadRequest(DownloadProxy*) = 0; > > virtual bool handleRunOpenPanel(WebPageProxy*, WebFrameProxy*, API::OpenPanelParameters*, WebOpenPanelResultListenerProxy*) { return false; } >+ virtual bool showShareSheet(WebPageProxy*, const WebCore::ShareDataWithParsedURL&, WTF::CompletionHandler<void (bool)>&&) { return false; } > > virtual void didChangeContentSize(const WebCore::IntSize&) = 0; > >diff --git a/Source/WebKit/UIProcess/WebPageProxy.cpp b/Source/WebKit/UIProcess/WebPageProxy.cpp >index e072bc21bd6981db10e407f65aea8bbd42431b3c..cad29214ae0abe415516b854e090b662b90d5d56 100644 >--- a/Source/WebKit/UIProcess/WebPageProxy.cpp >+++ b/Source/WebKit/UIProcess/WebPageProxy.cpp >@@ -77,6 +77,7 @@ > #include "PluginProcessManager.h" > #include "PrintInfo.h" > #include "SafeBrowsingResult.h" >+#include "ShareSheetCallbackID.h" > #include "TextChecker.h" > #include "TextCheckerState.h" > #include "UIMessagePortChannelProvider.h" >@@ -146,6 +147,7 @@ > #include <WebCore/ResourceLoadStatistics.h> > #include <WebCore/SSLKeyGenerator.h> > #include <WebCore/SerializedCryptoKeyWrap.h> >+#include <WebCore/ShareData.h> > #include <WebCore/SharedBuffer.h> > #include <WebCore/ShouldSkipSafeBrowsingCheck.h> > #include <WebCore/ShouldTreatAsContinuingLoad.h> >@@ -4624,6 +4626,15 @@ void WebPageProxy::runOpenPanel(uint64_t frameID, const SecurityOriginData& fram > } > } > >+void WebPageProxy::runShareSheet(const ShareDataWithParsedURL& shareData, ShareSheetCallbackID callbackID) >+{ >+ CompletionHandler<void(bool)> completionHandler = [this, protectedThis = makeRef(*this), callbackID] (bool access) { >+ m_process->send(Messages::WebPage::RunShareSheetResponse(access, callbackID), m_pageID); >+ }; >+ >+ m_pageClient.showShareSheet(this, shareData, WTFMove(completionHandler)); >+} >+ > void WebPageProxy::printFrame(uint64_t frameID) > { > ASSERT(!m_isPerformingDOMPrintOperation); >@@ -5286,7 +5297,7 @@ void WebPageProxy::didCancelForOpenPanel() > m_openPanelResultListener->invalidate(); > m_openPanelResultListener = nullptr; > } >- >+ > void WebPageProxy::advanceToNextMisspelling(bool startBeforeSelection) > { > m_process->send(Messages::WebPage::AdvanceToNextMisspelling(startBeforeSelection), m_pageID); >diff --git a/Source/WebKit/UIProcess/WebPageProxy.h b/Source/WebKit/UIProcess/WebPageProxy.h >index d6934d4a9cf62878905b4ddfd7ab8baa2592aebf..9f5d36dcadd9ace4c6561def71c6fe23d39ceab0 100644 >--- a/Source/WebKit/UIProcess/WebPageProxy.h >+++ b/Source/WebKit/UIProcess/WebPageProxy.h >@@ -187,6 +187,7 @@ struct FileChooserSettings; > struct GlobalWindowIdentifier; > struct MediaStreamRequest; > struct SecurityOriginData; >+struct ShareData; > struct TextAlternativeWithRange; > struct TextCheckingResult; > struct ViewportAttributes; >@@ -1475,6 +1476,7 @@ private: > void didChangeViewportProperties(const WebCore::ViewportAttributes&); > void pageDidScroll(); > void runOpenPanel(uint64_t frameID, const WebCore::SecurityOriginData&, const WebCore::FileChooserSettings&); >+ void runShareSheet(const WebCore::ShareDataWithParsedURL&, uint64_t callbackID); > void printFrame(uint64_t frameID); > void exceededDatabaseQuota(uint64_t frameID, const String& originIdentifier, const String& databaseName, const String& displayName, uint64_t currentQuota, uint64_t currentOriginUsage, uint64_t currentDatabaseUsage, uint64_t expectedUsage, Messages::WebPageProxy::ExceededDatabaseQuota::DelayedReply&&); > void reachedApplicationCacheOriginQuota(const String& originIdentifier, uint64_t currentQuota, uint64_t totalBytesNeeded, Messages::WebPageProxy::ReachedApplicationCacheOriginQuota::DelayedReply&&); >diff --git a/Source/WebKit/UIProcess/WebPageProxy.messages.in b/Source/WebKit/UIProcess/WebPageProxy.messages.in >index b8c01c02e798bb07062a50b86160e48a06e815d8..38e6518f8340b43f850f4af8061b2d011c815d8d 100644 >--- a/Source/WebKit/UIProcess/WebPageProxy.messages.in >+++ b/Source/WebKit/UIProcess/WebPageProxy.messages.in >@@ -76,6 +76,7 @@ messages -> WebPageProxy { > RunBeforeUnloadConfirmPanel(uint64_t frameID, struct WebCore::SecurityOriginData frameSecurityOrigin, String message) -> (bool shouldClose) Delayed > PageDidScroll() > RunOpenPanel(uint64_t frameID, struct WebCore::SecurityOriginData frameSecurityOrigin, struct WebCore::FileChooserSettings parameters) >+ RunShareSheet(struct WebCore::ShareDataWithParsedURL shareData, uint64_t callbackID) > PrintFrame(uint64_t frameID) -> () > RunModal() > NotifyScrollerThumbIsVisibleInRect(WebCore::IntRect scrollerThumb) >diff --git a/Source/WebKit/UIProcess/ios/PageClientImplIOS.h b/Source/WebKit/UIProcess/ios/PageClientImplIOS.h >index 415e669e81be65a3e9d4d07411e9753e7b5e9c43..2e393b2814f7e0bb6248cb63283a9fea7b53756b 100644 >--- a/Source/WebKit/UIProcess/ios/PageClientImplIOS.h >+++ b/Source/WebKit/UIProcess/ios/PageClientImplIOS.h >@@ -144,6 +144,8 @@ private: > void showPlaybackTargetPicker(bool hasVideo, const WebCore::IntRect& elementRect, WebCore::RouteSharingPolicy, const String&) override; > > bool handleRunOpenPanel(WebPageProxy*, WebFrameProxy*, API::OpenPanelParameters*, WebOpenPanelResultListenerProxy*) override; >+ bool showShareSheet(WebPageProxy*, const WebCore::ShareDataWithParsedURL&, WTF::CompletionHandler<void(bool)>&&) override; >+ > void disableDoubleTapGesturesDuringTapIfNecessary(uint64_t requestID) override; > double minimumZoomScale() const override; > WebCore::FloatRect documentRect() const override; >diff --git a/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm b/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm >index 629b29913dc0b9628244b17a6d355a5593ff4d63..cadc68e250a8ae0c82c89453f3fb80f544f163d7 100644 >--- a/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm >+++ b/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm >@@ -54,6 +54,7 @@ > #import <WebCore/NotImplemented.h> > #import <WebCore/PlatformScreen.h> > #import <WebCore/PromisedAttachmentInfo.h> >+#import <WebCore/ShareData.h> > #import <WebCore/SharedBuffer.h> > #import <WebCore/TextIndicator.h> > #import <WebCore/ValidationBubble.h> >@@ -569,6 +570,12 @@ bool PageClientImpl::handleRunOpenPanel(WebPageProxy*, WebFrameProxy*, API::Open > return true; > } > >+bool PageClientImpl::showShareSheet(WebPageProxy*, const ShareDataWithParsedURL& shareData, WTF::CompletionHandler<void(bool)>&& completionHandler) >+{ >+ [m_contentView _showShareSheet:shareData completionHandler:WTFMove(completionHandler)]; >+ return true; >+} >+ > void PageClientImpl::showInspectorHighlight(const WebCore::Highlight& highlight) > { > [m_contentView _showInspectorHighlight:highlight]; >diff --git a/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h b/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h >index a22830adff3c84b7b5ae4dde9fb3a412ba7622e5..c2625363c152f2059de2138a7cbcc776f1d3202f 100644 >--- a/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h >+++ b/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h >@@ -38,6 +38,7 @@ > #import "WKFileUploadPanel.h" > #import "WKFormPeripheral.h" > #import "WKKeyboardScrollingAnimator.h" >+#import "WKShareSheet.h" > #import "WKSyntheticClickTapGestureRecognizer.h" > #import <UIKit/UIView.h> > #import <WebCore/Color.h> >@@ -63,6 +64,7 @@ class IntSize; > class SelectionRect; > struct PromisedAttachmentInfo; > enum class RouteSharingPolicy; >+struct ShareDataWithParsedURL; > } > > #if ENABLE(DRAG_SUPPORT) >@@ -174,6 +176,7 @@ struct WKAutoCorrectionData { > #endif > RetainPtr<WKFormInputSession> _formInputSession; > RetainPtr<WKFileUploadPanel> _fileUploadPanel; >+ RetainPtr<WKShareSheet> _shareSheet; > RetainPtr<UIGestureRecognizer> _previewGestureRecognizer; > RetainPtr<UIGestureRecognizer> _previewSecondaryGestureRecognizer; > Vector<bool> _focusStateStack; >@@ -262,7 +265,7 @@ struct WKAutoCorrectionData { > > @end > >-@interface WKContentView (WKInteraction) <UIGestureRecognizerDelegate, UITextAutoscrolling, UITextInputMultiDocument, UITextInputPrivate, UIWebFormAccessoryDelegate, UIWebTouchEventsGestureRecognizerDelegate, UIWKInteractionViewProtocol, WKActionSheetAssistantDelegate, WKFileUploadPanelDelegate, WKKeyboardScrollable >+@interface WKContentView (WKInteraction) <UIGestureRecognizerDelegate, UITextAutoscrolling, UITextInputMultiDocument, UITextInputPrivate, UIWebFormAccessoryDelegate, UIWebTouchEventsGestureRecognizerDelegate, UIWKInteractionViewProtocol, WKActionSheetAssistantDelegate, WKFileUploadPanelDelegate, WKShareSheetDelegate, WKKeyboardScrollable > #if ENABLE(DATA_INTERACTION) > , UIDragInteractionDelegate, UIDropInteractionDelegate > #endif >@@ -317,6 +320,7 @@ FOR_EACH_WKCONTENTVIEW_ACTION(DECLARE_WKCONTENTVIEW_ACTION_FOR_WEB_VIEW) > - (void)_overflowScrollingDidEnd; > - (void)_showPlaybackTargetPicker:(BOOL)hasVideo fromRect:(const WebCore::IntRect&)elementRect routeSharingPolicy:(WebCore::RouteSharingPolicy)policy routingContextUID:(NSString *)contextUID; > - (void)_showRunOpenPanel:(API::OpenPanelParameters*)parameters resultListener:(WebKit::WebOpenPanelResultListenerProxy*)listener; >+- (void)_showShareSheet:(const WebCore::ShareDataWithParsedURL&)shareData completionHandler:(WTF::CompletionHandler<void(bool)>&&)completionHandler; > - (void)accessoryDone; > - (void)_didHandleKeyEvent:(::WebEvent *)event eventWasHandled:(BOOL)eventWasHandled; > - (Vector<WebKit::OptionItem>&) assistedNodeSelectOptions; >diff --git a/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm b/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm >index f75c13b04515024fd689eaabe6de44e0a830766d..05101cdddc2ad9f0ad2d069dde22f2ed9f190a73 100644 >--- a/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm >+++ b/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm >@@ -84,6 +84,7 @@ > #import <WebCore/PromisedAttachmentInfo.h> > #import <WebCore/RuntimeApplicationChecks.h> > #import <WebCore/Scrollbar.h> >+#import <WebCore/ShareData.h> > #import <WebCore/TextIndicator.h> > #import <WebCore/VisibleSelection.h> > #import <WebCore/WebCoreNSURLExtras.h> >@@ -779,6 +780,12 @@ static inline bool hasAssistedNode(WebKit::AssistedNodeInformation assistedNodeI > _fileUploadPanel = nil; > } > >+ if (_shareSheet) { >+ [_shareSheet setDelegate:nil]; >+ [_shareSheet dismiss]; >+ _shareSheet = nil; >+ } >+ > _inputViewUpdateDeferrer = nullptr; > _assistedNodeInformation = { }; > >@@ -4685,6 +4692,18 @@ static bool isAssistableInputType(InputType type) > [_fileUploadPanel presentWithParameters:parameters resultListener:listener]; > } > >+- (void)_showShareSheet:(const ShareDataWithParsedURL&)data completionHandler:(CompletionHandler<void(bool)>&&)completionHandler >+{ >+ ASSERT(!_shareSheet); >+ if (_shareSheet) >+ return; >+ >+ _shareSheet = adoptNS([[WKShareSheet alloc] initWithView:self]); >+ [_shareSheet setDelegate:self]; >+ >+ [_shareSheet presentWithParameters:data completionHandler:WTFMove(completionHandler)]; >+} >+ > - (void)fileUploadPanelDidDismiss:(WKFileUploadPanel *)fileUploadPanel > { > ASSERT(_fileUploadPanel.get() == fileUploadPanel); >@@ -4693,6 +4712,14 @@ static bool isAssistableInputType(InputType type) > _fileUploadPanel = nil; > } > >+- (void)shareSheetDidDismiss:(WKShareSheet *)shareSheet >+{ >+ ASSERT(_shareSheet == shareSheet); >+ >+ [_shareSheet setDelegate:nil]; >+ _shareSheet = nil; >+} >+ > #pragma mark - UITextInputMultiDocument > > - (void)_restoreFocusWithToken:(id <NSCopying, NSSecureCoding>)token >diff --git a/Source/WebKit/UIProcess/ios/forms/WKShareSheet.h b/Source/WebKit/UIProcess/ios/forms/WKShareSheet.h >new file mode 100644 >index 0000000000000000000000000000000000000000..787e97d2fc311660625abf555308706e3073fd2e >--- /dev/null >+++ b/Source/WebKit/UIProcess/ios/forms/WKShareSheet.h >@@ -0,0 +1,53 @@ >+/* >+ * Copyright (C) 2018 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. >+ */ >+ >+#if PLATFORM(IOS) >+ >+#import <UIKit/UIKit.h> >+#import <WebCore/ShareData.h> >+#import <wtf/BlockPtr.h> >+#import <wtf/Forward.h> >+#import <wtf/Vector.h> >+#import <wtf/WeakObjCPtr.h> >+#import <wtf/text/WTFString.h> >+ >+@class WKContentView; >+@protocol WKShareSheetDelegate; >+ >+@interface WKShareSheet : UIViewController >+- (instancetype)initWithView:(WKContentView *)view; >+ >+- (void)presentWithParameters:(const WebCore::ShareDataWithParsedURL&)data completionHandler:(WTF::CompletionHandler<void(bool)>&&)completionHandler; >+- (void)dismiss; >+ >+@property (nonatomic, assign) id <WKShareSheetDelegate> delegate; >+@end >+ >+@protocol WKShareSheetDelegate <NSObject> >+@optional >+- (void)shareSheetDidDismiss:(WKShareSheet *)shareSheet; >+@end >+ >+#endif // PLATFORM(IOS) >diff --git a/Source/WebKit/UIProcess/ios/forms/WKShareSheet.mm b/Source/WebKit/UIProcess/ios/forms/WKShareSheet.mm >new file mode 100644 >index 0000000000000000000000000000000000000000..3fbd8eed1606af8c509120f9642115a0145cd8b6 >--- /dev/null >+++ b/Source/WebKit/UIProcess/ios/forms/WKShareSheet.mm >@@ -0,0 +1,143 @@ >+/* >+ * Copyright (C) 2018 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 "WKShareSheet.h" >+ >+#if PLATFORM(IOS) >+ >+#import "APIArray.h" >+#import "APIData.h" >+#import "APIOpenPanelParameters.h" >+#import "APIString.h" >+#import "UIKitSPI.h" >+#import "WKContentViewInteraction.h" >+#import "WKData.h" >+#import "WKStringCF.h" >+#import "WKURLCF.h" >+#import "WebIconUtilities.h" >+#import "WebPageProxy.h" >+#import <MobileCoreServices/MobileCoreServices.h> >+#import <WebCore/LocalizedStrings.h> >+#import <WebCore/ShareData.h> >+#import <wtf/RetainPtr.h> >+#import <wtf/WeakObjCPtr.h> >+ >+using namespace WebKit; >+ >+@interface _WKShareSheetItem : NSObject >+@end >+ >+@implementation _WKShareSheetItem >+@end >+ >+@implementation WKShareSheet { >+ WeakObjCPtr<WKContentView> _view; >+ >+ RetainPtr<UIActivityViewController> _shareSheetViewController; >+ RetainPtr<UIViewController> _presentationViewController; >+} >+ >+- (instancetype)initWithView:(WKContentView *)view >+{ >+ if (!(self = [super init])) >+ return nil; >+ _view = view; >+ return self; >+} >+ >+- (void)presentWithParameters:(const WebCore::ShareDataWithParsedURL &)data completionHandler:(WTF::CompletionHandler<void(bool)>&&)completionHandler >+{ >+ auto shareDataArray = adoptNS([[NSMutableArray alloc] init]); >+ bool arrayContainsElements = false; >+ >+ if (!data.shareData.text.isEmpty()) { >+ [shareDataArray addObject:(NSString *)data.shareData.text]; >+ arrayContainsElements = true; >+ } >+ >+ if (!data.url.isNull()) { >+ NSURL *url = (NSURL *)data.url; >+ if (!data.shareData.title.isEmpty()) >+ url._title = data.shareData.title; >+ [shareDataArray addObject:url]; >+ arrayContainsElements = true; >+ } >+ >+ if (!data.shareData.title.isEmpty() && !arrayContainsElements) >+ [shareDataArray addObject:(NSString *)data.shareData.title]; >+ >+ RetainPtr<UIActivityViewController> shareSheetController = adoptNS([[UIActivityViewController alloc] initWithActivityItems:shareDataArray.get() applicationActivities:nil]); >+ >+ auto completionHandlerBlock = BlockPtr<void((NSString *, BOOL completed, NSArray *, NSError *))>::fromCallable([completionHandler = WTFMove(completionHandler), shareSheet = self](NSString *, BOOL completed, NSArray *, NSError *) mutable { >+ completionHandler(completed); >+ [shareSheet dismiss]; >+ }); >+ >+ shareSheetController.get().completionWithItemsHandler = completionHandlerBlock.get(); >+ _shareSheetViewController = shareSheetController; >+ [self _presentFullscreenViewController:_shareSheetViewController.get() animated:YES]; >+} >+ >+- (void)_dispatchDidDismiss >+{ >+ if ([_delegate respondsToSelector:@selector(shareSheetDidDismiss:)]) >+ [_delegate shareSheetDidDismiss:self]; >+} >+ >+- (void)_cancel >+{ >+ [self _dispatchDidDismiss]; >+} >+ >+- (void)dismiss >+{ >+ [[UIViewController _viewControllerForFullScreenPresentationFromView:_view.getAutoreleased()] dismissViewControllerAnimated:YES completion:nil]; >+ _presentationViewController = nil; >+ >+ [self _cancel]; >+} >+ >+- (void)_dismissDisplayAnimated:(BOOL)animated >+{ >+ if (_presentationViewController) { >+ UIViewController *currentPresentedViewController = [_presentationViewController presentedViewController]; >+ if (currentPresentedViewController == self) { >+ [currentPresentedViewController dismissViewControllerAnimated:animated completion:^{ >+ _presentationViewController = nil; >+ }]; >+ } >+ } >+} >+ >+- (void)_presentFullscreenViewController:(UIViewController *)viewController animated:(BOOL)animated >+{ >+ // May need to clear/dismiss VC? >+ _presentationViewController = [UIViewController _viewControllerForFullScreenPresentationFromView:_view.getAutoreleased()]; >+ [_presentationViewController presentViewController:viewController animated:animated completion:nil]; >+} >+ >+@end >+#endif // PLATFORM(IOS) >diff --git a/Source/WebKit/WebKit.xcodeproj/project.pbxproj b/Source/WebKit/WebKit.xcodeproj/project.pbxproj >index 133ee6b635e812feec136a9f160d910eaa57d09d..0232ee5c6c441c2f22ed26984899f9a0a1abebad 100644 >--- a/Source/WebKit/WebKit.xcodeproj/project.pbxproj >+++ b/Source/WebKit/WebKit.xcodeproj/project.pbxproj >@@ -439,6 +439,9 @@ > 1CA8B946127C882A00576C2B /* WebInspectorProxyMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 1CA8B944127C882A00576C2B /* WebInspectorProxyMessages.h */; }; > 1CBBE4A019B66C53006B7D81 /* WebInspectorUIMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1CBBE49E19B66C53006B7D81 /* WebInspectorUIMessageReceiver.cpp */; }; > 1CBBE4A119B66C53006B7D81 /* WebInspectorUIMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 1CBBE49F19B66C53006B7D81 /* WebInspectorUIMessages.h */; }; >+ 1D67B339212E1F6100FAA786 /* ShareSheetCallbackID.h in Headers */ = {isa = PBXBuildFile; fileRef = 1D67B338212E1F6100FAA786 /* ShareSheetCallbackID.h */; }; >+ 1DB01943211CF002009FB3E8 /* WKShareSheet.h in Headers */ = {isa = PBXBuildFile; fileRef = 1DE0D095211CC21300439B5F /* WKShareSheet.h */; }; >+ 1DB01944211CF005009FB3E8 /* WKShareSheet.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1DBBB061211CC3CB00502ECC /* WKShareSheet.mm */; }; > 1F335BC0185B84F0001A201A /* WKWebProcessPlugInLoadDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 1F335BBF185B84D8001A201A /* WKWebProcessPlugInLoadDelegate.h */; settings = {ATTRIBUTES = (Private, ); }; }; > 1F604BAA1889FBB800EE0395 /* _WKRenderingProgressEventsInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 1F604BA71889FA7400EE0395 /* _WKRenderingProgressEventsInternal.h */; }; > 1F7506B11859163700EC0FF7 /* WKWebProcessPlugInFrame.h in Headers */ = {isa = PBXBuildFile; fileRef = 1F0181691858DC1500F92884 /* WKWebProcessPlugInFrame.h */; settings = {ATTRIBUTES = (Private, ); }; }; >@@ -2639,6 +2642,9 @@ > 1CBBE49E19B66C53006B7D81 /* WebInspectorUIMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebInspectorUIMessageReceiver.cpp; sourceTree = "<group>"; }; > 1CBBE49F19B66C53006B7D81 /* WebInspectorUIMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebInspectorUIMessages.h; sourceTree = "<group>"; }; > 1CC417C912C00CCA002BE67B /* TextCheckerCompletion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TextCheckerCompletion.h; sourceTree = "<group>"; }; >+ 1D67B338212E1F6100FAA786 /* ShareSheetCallbackID.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ShareSheetCallbackID.h; sourceTree = "<group>"; }; >+ 1DBBB061211CC3CB00502ECC /* WKShareSheet.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WKShareSheet.mm; path = ios/forms/WKShareSheet.mm; sourceTree = "<group>"; }; >+ 1DE0D095211CC21300439B5F /* WKShareSheet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WKShareSheet.h; path = ios/forms/WKShareSheet.h; sourceTree = "<group>"; }; > 1F0181691858DC1500F92884 /* WKWebProcessPlugInFrame.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKWebProcessPlugInFrame.h; sourceTree = "<group>"; }; > 1F01816A1858DC1500F92884 /* WKWebProcessPlugInFrame.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKWebProcessPlugInFrame.mm; sourceTree = "<group>"; }; > 1F01816B1858DC1500F92884 /* WKWebProcessPlugInFrameInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKWebProcessPlugInFrameInternal.h; sourceTree = "<group>"; }; >@@ -5233,6 +5239,7 @@ > 8313F7E71F7DAE0300B944EB /* SharedStringHashTable.h */, > 83F9644B1FA0F76200C47750 /* SharedStringHashTableReadOnly.cpp */, > 83F9644C1FA0F76300C47750 /* SharedStringHashTableReadOnly.h */, >+ 1D67B338212E1F6100FAA786 /* ShareSheetCallbackID.h */, > 5272B2881406985D0096A5D0 /* StatisticsData.cpp */, > 5272B2891406985D0096A5D0 /* StatisticsData.h */, > 1A5E4DA312D3BD3D0099A2BB /* TextCheckerState.h */, >@@ -8701,6 +8708,8 @@ > F4D5F51C206087A10038BBA8 /* WKQuickboardListViewController.mm */, > F4F59AD42065A5CA006CAA46 /* WKSelectMenuListViewController.h */, > F4F59AD32065A5C9006CAA46 /* WKSelectMenuListViewController.mm */, >+ 1DE0D095211CC21300439B5F /* WKShareSheet.h */, >+ 1DBBB061211CC3CB00502ECC /* WKShareSheet.mm */, > F4D5F519206087A00038BBA8 /* WKTextInputListViewController.h */, > F4D5F51A206087A10038BBA8 /* WKTextInputListViewController.mm */, > 2EB6FBFF203021960017E619 /* WKTimePickerViewController.h */, >@@ -9381,6 +9390,7 @@ > 8313F7EC1F7DAE0800B944EB /* SharedStringHashStore.h in Headers */, > 8313F7EE1F7DAE0800B944EB /* SharedStringHashTable.h in Headers */, > 83F9644E1FA0F76E00C47750 /* SharedStringHashTableReadOnly.h in Headers */, >+ 1D67B339212E1F6100FAA786 /* ShareSheetCallbackID.h in Headers */, > 995226D6207D184600F78420 /* SimulatedInputDispatcher.h in Headers */, > 2DAF06D618BD1A470081CEB1 /* SmartMagnificationController.h in Headers */, > 2DE6943E18BD2A68005C15E5 /* SmartMagnificationControllerMessages.h in Headers */, >@@ -9919,6 +9929,7 @@ > BC407604124FF0270068F20A /* WKSerializedScriptValue.h in Headers */, > 1ADE46B31954EC61000F7985 /* WKSessionStateRef.h in Headers */, > BCDDB32B124EC2AB0048D13C /* WKSharedAPICast.h in Headers */, >+ 1DB01943211CF002009FB3E8 /* WKShareSheet.h in Headers */, > 513E462D1AD837560016234A /* WKSharingServicePickerDelegate.h in Headers */, > 93F549B41E3174B7000E7239 /* WKSnapshotConfiguration.h in Headers */, > BC407606124FF0270068F20A /* WKString.h in Headers */, >@@ -11373,6 +11384,8 @@ > 51CD1C5D1B3493AF00142CA5 /* WKSecurityOriginRef.cpp in Sources */, > BC407603124FF0270068F20A /* WKSerializedScriptValue.cpp in Sources */, > 1ADE46B21954EC61000F7985 /* WKSessionStateRef.cpp in Sources */, >+ 1DB01944211CF005009FB3E8 /* WKShareSheet.mm in Sources */, >+ 513E462E1AD837560016234A /* WKSharingServicePickerDelegate.mm in Sources */, > 93F549B61E3174DA000E7239 /* WKSnapshotConfiguration.mm in Sources */, > BC407605124FF0270068F20A /* WKString.cpp in Sources */, > BC407619124FF0370068F20A /* WKStringCF.mm in Sources */, >diff --git a/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp b/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp >index e7929de037f4ea741bdf05779094d9ad6e4906f2..ba21ac9936dd1dfd7c4764f49a0d9ae1f2156df5 100644 >--- a/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp >+++ b/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp >@@ -810,6 +810,11 @@ void WebChromeClient::runOpenPanel(Frame& frame, FileChooser& fileChooser) > ASSERT(webFrame); > m_page.send(Messages::WebPageProxy::RunOpenPanel(webFrame->frameID(), SecurityOriginData::fromFrame(&frame), fileChooser.settings())); > } >+ >+void WebChromeClient::runShareSheet(ShareDataWithParsedURL& shareData, CompletionHandler<void(bool)>&& callback) >+{ >+ m_page.runShareSheet(shareData, WTFMove(callback)); >+} > > void WebChromeClient::loadIconForFiles(const Vector<String>& filenames, FileIconLoader& loader) > { >diff --git a/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h b/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h >index e5d8e433e4107032466963eaa8ea45a34987776f..730bd85efacc47ebea1581bfa373b248927acc3a 100644 >--- a/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h >+++ b/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h >@@ -187,6 +187,7 @@ private: > #endif > > void runOpenPanel(WebCore::Frame&, WebCore::FileChooser&) final; >+ void runShareSheet(WebCore::ShareDataWithParsedURL&, WTF::CompletionHandler<void(bool)>&&) final; > void loadIconForFiles(const Vector<String>&, WebCore::FileIconLoader&) final; > > #if !PLATFORM(IOS) >diff --git a/Source/WebKit/WebProcess/WebPage/WebPage.cpp b/Source/WebKit/WebProcess/WebPage/WebPage.cpp >index de29f9599dd3511abe6ed678934d9c0ab01232fe..29941579961cd943ba73db58c47fed5a2fe5d863 100644 >--- a/Source/WebKit/WebProcess/WebPage/WebPage.cpp >+++ b/Source/WebKit/WebProcess/WebPage/WebPage.cpp >@@ -61,6 +61,7 @@ > #include "SessionState.h" > #include "SessionStateConversion.h" > #include "SessionTracker.h" >+#include "ShareSheetCallbackID.h" > #include "ShareableBitmap.h" > #include "UserMediaPermissionRequestManager.h" > #include "ViewGestureGeometryCollector.h" >@@ -6067,6 +6068,29 @@ void WebPage::storageAccessResponse(bool wasGranted, uint64_t contextId) > callback(wasGranted); > } > #endif >+ >+static ShareSheetCallbackID nextShareSheetCallbackID() >+{ >+ static ShareSheetCallbackID nextCallbackID = 0; >+ return ++nextCallbackID; >+} >+ >+void WebPage::runShareSheet(ShareDataWithParsedURL& shareData, WTF::CompletionHandler<void(bool)>&& callback) >+{ >+ ShareSheetCallbackID callbackID = nextShareSheetCallbackID(); >+ auto addResult = m_shareSheetResponseCallbackMap.add(callbackID, WTFMove(callback)); >+ ASSERT(addResult.isNewEntry); >+ if (addResult.iterator->value) >+ send(Messages::WebPageProxy::RunShareSheet(WTFMove(shareData), callbackID)); >+ else >+ callback(false); >+} >+ >+void WebPage::runShareSheetResponse(bool wasGranted, uint64_t callbackID) >+{ >+ auto callback = m_shareSheetResponseCallbackMap.take(callbackID); >+ callback(wasGranted); >+} > > #if ENABLE(ATTACHMENT_ELEMENT) > >diff --git a/Source/WebKit/WebProcess/WebPage/WebPage.h b/Source/WebKit/WebProcess/WebPage/WebPage.h >index 6be1cbfc76c336976fb1f21d4091ad7616ed8f02..4ce7d7ad8eaebf8b6ec568106770f38745afc204 100644 >--- a/Source/WebKit/WebProcess/WebPage/WebPage.h >+++ b/Source/WebKit/WebProcess/WebPage/WebPage.h >@@ -61,6 +61,7 @@ > #include <WebCore/PageOverlay.h> > #include <WebCore/PluginData.h> > #include <WebCore/SecurityPolicyViolationEvent.h> >+#include <WebCore/ShareData.h> > #include <WebCore/UserActivity.h> > #include <WebCore/UserContentTypes.h> > #include <WebCore/UserInterfaceLayoutDirection.h> >@@ -172,8 +173,6 @@ struct PromisedAttachmentInfo; > struct TextCheckingResult; > struct ViewportArguments; > >- >- > #if ENABLE(ATTACHMENT_ELEMENT) > class HTMLAttachmentElement; > struct AttachmentDisplayOptions; >@@ -1074,6 +1073,9 @@ public: > void storageAccessResponse(bool wasGranted, uint64_t contextId); > #endif > >+ void runShareSheet(WebCore::ShareDataWithParsedURL&, WTF::CompletionHandler<void(bool)>&& callback); >+ void runShareSheetResponse(bool wasCompleted, uint64_t contextId); >+ > #if ENABLE(ATTACHMENT_ELEMENT) > void insertAttachment(const String& identifier, const WebCore::AttachmentDisplayOptions&, uint64_t fileSize, const String& fileName, std::optional<String> contentType, CallbackID); > void setAttachmentDisplayOptions(const String& identifier, const WebCore::AttachmentDisplayOptions&, CallbackID); >@@ -1728,7 +1730,8 @@ private: > HashMap<String, RefPtr<WebURLSchemeHandlerProxy>> m_schemeToURLSchemeHandlerProxyMap; > HashMap<uint64_t, WebURLSchemeHandlerProxy*> m_identifierToURLSchemeHandlerProxyMap; > >- HashMap<uint64_t, WTF::Function<void (bool granted)>> m_storageAccessResponseCallbackMap; >+ HashMap<uint64_t, WTF::Function<void(bool granted)>> m_storageAccessResponseCallbackMap; >+ HashMap<uint64_t, WTF::Function<void(bool completed)>> m_shareSheetResponseCallbackMap; > > #if ENABLE(APPLICATION_MANIFEST) > HashMap<uint64_t, uint64_t> m_applicationManifestFetchCallbackMap; >diff --git a/Source/WebKit/WebProcess/WebPage/WebPage.messages.in b/Source/WebKit/WebProcess/WebPage/WebPage.messages.in >index 96e487ee62f5a146dada87ed9a8e19af4eddbf1a..9ccf63aed8b421e5f2fcd3cc25d2a26e6a0d2ed7 100644 >--- a/Source/WebKit/WebProcess/WebPage/WebPage.messages.in >+++ b/Source/WebKit/WebProcess/WebPage/WebPage.messages.in >@@ -290,6 +290,7 @@ messages -> WebPage LegacyReceiver { > #endif > DidChooseFilesForOpenPanel(Vector<String> fileURLs) > DidCancelForOpenPanel() >+ RunShareSheetResponse(bool wasGranted, uint64_t callbackID) > #if ENABLE(SANDBOX_EXTENSIONS) > ExtendSandboxForFilesFromOpenPanel(WebKit::SandboxExtension::HandleArray sandboxExtensions) > #endif >diff --git a/Source/WebKitLegacy/ios/WebCoreSupport/WebChromeClientIOS.h b/Source/WebKitLegacy/ios/WebCoreSupport/WebChromeClientIOS.h >index bc1583c1636b78a0792d484d02e4e93b834845f3..341f268aea258fb0e3b0715dc92c40e73a75063a 100644 >--- a/Source/WebKitLegacy/ios/WebCoreSupport/WebChromeClientIOS.h >+++ b/Source/WebKitLegacy/ios/WebCoreSupport/WebChromeClientIOS.h >@@ -47,6 +47,7 @@ private: > bool runJavaScriptPrompt(WebCore::Frame&, const WTF::String& message, const WTF::String& defaultValue, WTF::String& result) final; > > void runOpenPanel(WebCore::Frame&, WebCore::FileChooser&) final; >+ void runShareSheet(WebCore::ShareDataWithParsedURL&, CompletionHandler<void(bool)>&&) final; > > #if ENABLE(TOUCH_EVENTS) > void didPreventDefaultForEvent() final; >diff --git a/Source/WebKitLegacy/ios/WebCoreSupport/WebChromeClientIOS.mm b/Source/WebKitLegacy/ios/WebCoreSupport/WebChromeClientIOS.mm >index c701870f4e0f1ecfc37918bb6b5dc38d1600c77f..4e97ae8232db19bf02bf4525ebcaa4a7124dd2c3 100644 >--- a/Source/WebKitLegacy/ios/WebCoreSupport/WebChromeClientIOS.mm >+++ b/Source/WebKitLegacy/ios/WebCoreSupport/WebChromeClientIOS.mm >@@ -157,6 +157,10 @@ void WebChromeClientIOS::runOpenPanel(Frame&, FileChooser& chooser) > [listener release]; > } > >+void WebChromeClientIOS::runShareSheet(ShareDataWithParsedURL&, CompletionHandler<void(bool)>&&) >+{ >+} >+ > #if ENABLE(IOS_TOUCH_EVENTS) > > void WebChromeClientIOS::didPreventDefaultForEvent() >diff --git a/Source/WebKitLegacy/mac/WebCoreSupport/WebChromeClient.h b/Source/WebKitLegacy/mac/WebCoreSupport/WebChromeClient.h >index 4355a866d641037ba67f1aedccafc07e8ab2d9db..638dd976e2dbbea1ddcd9ff827c3e24591660ce3 100644 >--- a/Source/WebKitLegacy/mac/WebCoreSupport/WebChromeClient.h >+++ b/Source/WebKitLegacy/mac/WebCoreSupport/WebChromeClient.h >@@ -126,6 +126,8 @@ private: > #endif > > void runOpenPanel(WebCore::Frame&, WebCore::FileChooser&) override; >+ void runShareSheet(WebCore::ShareDataWithParsedURL&, CompletionHandler<void(bool)>&&) override; >+ > void loadIconForFiles(const Vector<String>&, WebCore::FileIconLoader&) final; > RefPtr<WebCore::Icon> createIconForFiles(const Vector<String>& filenames) override; > >diff --git a/Source/WebKitLegacy/mac/WebCoreSupport/WebChromeClient.mm b/Source/WebKitLegacy/mac/WebCoreSupport/WebChromeClient.mm >index 2884dfd5fd7c36a93c62020a44e7e95f6f9782fc..e556b58078c0cad90588f8dc45cd00bd8d441c35 100644 >--- a/Source/WebKitLegacy/mac/WebCoreSupport/WebChromeClient.mm >+++ b/Source/WebKitLegacy/mac/WebCoreSupport/WebChromeClient.mm >@@ -776,6 +776,10 @@ void WebChromeClient::runOpenPanel(Frame&, FileChooser& chooser) > END_BLOCK_OBJC_EXCEPTIONS; > } > >+void WebChromeClient::runShareSheet(ShareDataWithParsedURL&, CompletionHandler<void(bool)>&&) >+{ >+} >+ > void WebChromeClient::loadIconForFiles(const Vector<String>& filenames, FileIconLoader& iconLoader) > { > iconLoader.iconLoaded(createIconForFiles(filenames));
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 171100
:
347525
|
347690
|
347979
|
348022
|
348033
|
348037
|
348062
|
348069
|
348071
|
348074
|
348153
|
348163
|
348171
|
348178
|
348225
|
348241
|
348299
|
348315
|
348332
|
348351
|
348366
|
348367
|
348377
|
348378
|
348379
|
348386
|
348391
|
348442