WebKit Bugzilla
Attachment 347525 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-20180820121622.patch (text/plain), 83.11 KB, created by
Olivia Barnett
on 2018-08-20 12:16:22 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Olivia Barnett
Created:
2018-08-20 12:16:22 PDT
Size:
83.11 KB
patch
obsolete
>Subversion Revision: 234705 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 0db94146ba134afeb3a3e94531ef9262b791e6b0..690226ad3d08c82d220b72bebbd3de17f2a16f05 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,45 @@ >+2018-08-20 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: >+ >+ * 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 share sheet. >+ >+ * page/Navigator.idl: >+ Implements NavigatorShare. >+ >+ * page/NavigatorShare.idl: Added. >+ Added defintion of share function returning a promise. >+ >+ * page/ShareData.h: Added. >+ * page/ShareData.idl: Added. >+ Definition of ShareData struct containing title, text, url. >+ > 2018-08-08 Simon Fraser <simon.fraser@apple.com> > > Add a WebKit2 logging channel for ActivityState >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index b854c601526f4042875433994e5781d73e4bb17a..56b8e0445b1d3c436f9a41a799b4fe8bad057ca1 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,90 @@ >+2018-08-20 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: >+ * 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. >+ >+ * UIProcess/PageClient.h: >+ (WebKit::PageClient::handleRunShareSheet): >+ Page client implementation call to invoke share sheet. >+ >+ * UIProcess/WebPageProxy.cpp: >+ (WebKit::WebPageProxy::runShareSheet): >+ (WebKit::WebPageProxy::didCancelForShareSheet): >+ * 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/WebShareSheetResultListenerProxy.cp: Added. >+ * UIProcess/WebShareSheetResultListenerProxy.cpp: Added. >+ (WebKit::WebShareSheetResultListenerProxy::WebShareSheetResultListenerProxy): >+ (WebKit::WebShareSheetResultListenerProxy::~WebShareSheetResultListenerProxy): >+ (WebKit::WebShareSheetResultListenerProxy::cancel): >+ (WebKit::WebShareSheetResultListenerProxy::invalidate): >+ * UIProcess/WebShareSheetResultListenerProxy.h: Added. >+ (WebKit::WebShareSheetResultListenerProxy::create): >+ Listener for dismissal of share sheet. >+ >+ * UIProcess/ios/PageClientImplIOS.h: >+ * UIProcess/ios/PageClientImplIOS.mm: >+ (WebKit::PageClientImpl::handleRunShareSheet): >+ Page client implementation call to invoke share sheet. >+ >+ * UIProcess/ios/WKContentViewInteraction.h: >+ * UIProcess/ios/WKContentViewInteraction.mm: >+ (-[WKContentView cleanupInteraction]): >+ (-[WKContentView _showShareSheet:resultListener: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 dealloc]): >+ (-[WKShareSheet presentWithParameters:resultListener: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): >+ * WebProcess/WebCoreSupport/WebChromeClient.h: >+ Call to page to invoke share sheet. >+ >+ * WebProcess/WebPage/WebPage.cpp: >+ (WebKit::WebPage::didCancelForShareSheet): >+ (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: >+ * WebProcess/WebPage/WebShareSheetResultListener.cpp: Added. >+ (WebKit::WebShareSheetResultListener::create): >+ (WebKit::WebShareSheetResultListener::WebShareSheetResultListener): >+ (WebKit::WebShareSheetResultListener::~WebShareSheetResultListener): >+ * WebProcess/WebPage/WebShareSheetResultListener.h: Added. >+ (WebKit::WebShareSheetResultListener::disconnectFromPage): >+ ShareSheet result listener for when share sheet is dismissed. >+ > 2018-08-08 Commit Queue <commit-queue@webkit.org> > > Unreviewed, rolling out r234314, r234320, and r234321. >diff --git a/Source/WebKitLegacy/ios/ChangeLog b/Source/WebKitLegacy/ios/ChangeLog >index ec2642abf237684f885badeeab9830696112b5c9..79fd9d3a9145b3deaa5b3a88dae3dc997bf3c814 100644 >--- a/Source/WebKitLegacy/ios/ChangeLog >+++ b/Source/WebKitLegacy/ios/ChangeLog >@@ -1,3 +1,16 @@ >+2018-08-20 Olivia Barnett <obarnett@apple.com> >+ >+ Consider implementing 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-07-04 Tim Horton <timothy_horton@apple.com> > > Introduce PLATFORM(IOSMAC) >diff --git a/Source/WebKitLegacy/mac/ChangeLog b/Source/WebKitLegacy/mac/ChangeLog >index 7ba849e8d610b84c22d72efa9f4066ae38d41f27..16aaa9f8977b6231e7fd47e5b77842601ca2ab96 100644 >--- a/Source/WebKitLegacy/mac/ChangeLog >+++ b/Source/WebKitLegacy/mac/ChangeLog >@@ -1,3 +1,16 @@ >+2018-08-20 Olivia Barnett <obarnett@apple.com> >+ >+ Consider implementing 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 definition of runShareSheet. >+ > 2018-08-08 Jonathan Bedard <jbedard@apple.com> > > Follow-up build fix for r234685 >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 379275fff22049211764641d4374c554bff17843..ee20be5467e463aa090fe458de04a431f891d1cc 100644 >--- a/Source/WebCore/Sources.txt >+++ b/Source/WebCore/Sources.txt >@@ -2779,6 +2779,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 8f3a91741ea1015071784ffb600490846a7370a1..8a86e78a4a48f50a9fa7cca2df5706366ed67db0 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, ); }; }; >@@ -6318,6 +6319,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>"; }; >@@ -19386,6 +19390,7 @@ > 7C5BEA3B1E9EE77100CC517B /* NavigatorLanguage.idl */, > 7C5BEA3C1E9EE77100CC517B /* NavigatorOnLine.idl */, > 5182C24B1F313AE00059BA7C /* NavigatorServiceWorker.idl */, >+ 1DC553FD211BA12A004B780E /* NavigatorShare.idl */, > 00146288103CD1DE000B20DB /* OriginAccessEntry.cpp */, > 00146289103CD1DE000B20DB /* OriginAccessEntry.h */, > 65FEA86809833ADE00BED4AB /* Page.cpp */, >@@ -19476,6 +19481,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 */, >@@ -30278,6 +30285,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 */, >diff --git a/Source/WebCore/loader/EmptyClients.cpp b/Source/WebCore/loader/EmptyClients.cpp >index 357665593e6eba4d79652557247bd4dc3eb3a11e..39ad1e5d861b6b722a5e4663db874da0226f4a96 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(Frame&, ShareDataWithParsedURL&, WTF::CompletionHandler<void(bool)>&&) >+{ >+} > > PAL::SessionID EmptyFrameLoaderClient::sessionID() const > { >diff --git a/Source/WebCore/loader/EmptyClients.h b/Source/WebCore/loader/EmptyClients.h >index 9d052b0b9523fbc846693f22dc5fc78aa380765c..c43dedfe146ead9d173425eb45f41b8cda732970 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(Frame&, ShareDataWithParsedURL&, WTF::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 e058fa8a9296a569f95dc2eb5ea00fe2b81a4152..eaacdfbe94406d04542843a37c33fedeb83d7f09 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(Frame& frame, ShareDataWithParsedURL& shareData, CompletionHandler<void(bool)>&& callback) >+{ >+ m_client.runShareSheet(frame, 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..00a5b29404b4523f252e86e784a37dce03d27e9f 100644 >--- a/Source/WebCore/page/Chrome.h >+++ b/Source/WebCore/page/Chrome.h >@@ -58,6 +58,7 @@ class PopupMenuClient; > class PopupOpeningObserver; > class SearchPopupMenu; > >+struct ShareDataWithParsedURL; > struct DateTimeChooserParameters; > struct ViewportArguments; > struct WindowFeatures; >@@ -159,6 +160,7 @@ public: > #endif > > void runOpenPanel(Frame&, FileChooser&); >+ void runShareSheet(Frame&, 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..051ea41568f9a1930c5bbdfe6d3f17fb60f90304 100644 >--- a/Source/WebCore/page/ChromeClient.h >+++ b/Source/WebCore/page/ChromeClient.h >@@ -103,6 +103,7 @@ struct DateTimeChooserParameters; > struct GraphicsDeviceAdapter; > struct ViewportArguments; > struct WindowFeatures; >+struct ShareDataWithParsedURL; > > enum class RouteSharingPolicy; > >@@ -282,6 +283,8 @@ public: > #endif > > virtual void runOpenPanel(Frame&, FileChooser&) = 0; >+ virtual void runShareSheet(Frame&, 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..6dbf16cc27bd57c782128263ed90a3475a7eb71f 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,35 @@ bool Navigator::onLine() const > return platformStrategies()->loaderStrategy()->isOnLine(); > } > >+void Navigator::share(ScriptExecutionContext& context, ShareData data, Ref<DeferredPromise>&& promise) >+{ >+ if (m_frame->page()) { >+ if (!data.title && !data.url && !data.text) { >+ promise->reject(TypeError); >+ return; >+ } >+ >+ URL url = context.completeURL(data.url); >+ if (!url.isValid()) >+ promise->reject(TypeError); >+ >+ ShareDataWithParsedURL shareData = { >+ data, >+ url, >+ }; >+ >+ m_frame->page()->chrome().runShareSheet(*m_frame, shareData, [documentReference = makeWeakPtr(m_frame->document()), promise = WTFMove(promise)] (bool wasGranted) mutable { >+ if (wasGranted) { >+ promise->resolve(); >+ return; >+ } >+ promise->reject(Exception { AbortError, "Aborted by AbortSignal."_s }); >+ return; >+ }); >+ } >+ 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..39815c1bf4d5d20bb2eb8a2ff3db1910c7fb74a5 >--- /dev/null >+++ b/Source/WebCore/page/NavigatorShare.idl >@@ -0,0 +1,34 @@ >+/* >+ * 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 >+] interface NavigatorShare { >+ [CallWith=ScriptExecutionContext] Promise<void> share(ShareData shareData); >+}; >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 a782baac9d45bb3c9d0b8992622faa6252aa184d..d4e561c48ac1e62005ce0e4f039c4c3f66ede92f 100644 >--- a/Source/WebKit/Scripts/webkit/messages.py >+++ b/Source/WebKit/Scripts/webkit/messages.py >@@ -382,6 +382,7 @@ def headers_for_type(type): > 'WebCore::AutoplayEventFlags': ['<WebCore/AutoplayEvent.h>'], > 'WebCore::ExceptionDetails': ['<WebCore/JSDOMExceptionHandling.h>'], > 'WebCore::FileChooserSettings': ['<WebCore/FileChooser.h>'], >+ 'WebCore::ShareData': ['<WebCore/ShareData.h>'], > 'WebCore::FrameLoadType': ['<WebCore/FrameLoaderTypes.h>'], > 'WebCore::GrammarDetail': ['<WebCore/TextCheckerClient.h>'], > 'WebCore::HasInsecureContent': ['<WebCore/FrameLoaderTypes.h>'], >diff --git a/Source/WebKit/Shared/WebCoreArgumentCoders.cpp b/Source/WebKit/Shared/WebCoreArgumentCoders.cpp >index 92d324ca7a9e2c62bbbe9c44eb329d68af0c411e..6982fb4d8c8ca0446fa717391e56ad90f67ce9db 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> >@@ -1908,7 +1909,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 3a5cc681c1f29717d784aa4d1047e0883f8fb8cc..58ce5bec2cebe9b837f8bafd5447dfe8e8679f8b 100644 >--- a/Source/WebKit/Shared/WebCoreArgumentCoders.h >+++ b/Source/WebKit/Shared/WebCoreArgumentCoders.h >@@ -103,6 +103,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/UIProcess/PageClient.h b/Source/WebKit/UIProcess/PageClient.h >index 7ea82baf0d797c02e536c40a954585f5dd0c02a6..6fefde471d8fb6db8b57dbf2ad381f07238082b1 100644 >--- a/Source/WebKit/UIProcess/PageClient.h >+++ b/Source/WebKit/UIProcess/PageClient.h >@@ -79,6 +79,7 @@ struct DictionaryPopupInfo; > struct Highlight; > struct TextIndicatorData; > struct ViewportAttributes; >+struct ShareDataWithParsedURL; > > template <typename> class RectEdges; > using FloatBoxExtent = RectEdges<float>; >@@ -109,6 +110,7 @@ class WebContextMenuProxy; > class WebEditCommandProxy; > class WebFrameProxy; > class WebOpenPanelResultListenerProxy; >+class WebShareSheetResultListenerProxy; > class WebPageProxy; > class WebPopupMenuProxy; > >@@ -200,6 +202,7 @@ public: > virtual void handleDownloadRequest(DownloadProxy*) = 0; > > virtual bool handleRunOpenPanel(WebPageProxy*, WebFrameProxy*, API::OpenPanelParameters*, WebOpenPanelResultListenerProxy*) { return false; } >+ virtual bool handleRunShareSheet(WebPageProxy*, WebFrameProxy*, const WebCore::ShareDataWithParsedURL&, WebShareSheetResultListenerProxy*, 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 7a6f27532f6033914d783c06492e9df7c2ec91a0..ce872bd344582c4428738409fdc0780becdf9106 100644 >--- a/Source/WebKit/UIProcess/WebPageProxy.cpp >+++ b/Source/WebKit/UIProcess/WebPageProxy.cpp >@@ -119,6 +119,7 @@ > #include "WebProcessProxy.h" > #include "WebProtectionSpace.h" > #include "WebResourceLoadStatisticsStore.h" >+#include "WebShareSheetResultListenerProxy.h" > #include "WebURLSchemeHandler.h" > #include "WebUserContentControllerProxy.h" > #include "WebsiteDataStore.h" >@@ -145,6 +146,7 @@ > #include <WebCore/RenderEmbeddedObject.h> > #include <WebCore/SSLKeyGenerator.h> > #include <WebCore/SerializedCryptoKeyWrap.h> >+#include <WebCore/ShareData.h> > #include <WebCore/SharedBuffer.h> > #include <WebCore/ShouldTreatAsContinuingLoad.h> > #include <WebCore/TextCheckerClient.h> >@@ -4666,6 +4668,21 @@ void WebPageProxy::runOpenPanel(uint64_t frameID, const SecurityOriginData& fram > } > } > >+void WebPageProxy::runShareSheet(uint64_t frameID, const ShareDataWithParsedURL& shareData, uint64_t contextID) >+{ >+ CompletionHandler<void(bool)> completionHandler = [this, protectedThis = makeRef(*this), contextID] (bool access) { >+ m_process->send(Messages::WebPage::RunShareSheetResponse(access, contextID), m_pageID); >+ }; >+ >+ WebFrameProxy* frame = m_process->webFrame(frameID); >+ MESSAGE_CHECK(frame); >+ >+ m_shareSheetResultListener = WebShareSheetResultListenerProxy::create(this); >+ >+ if (!m_pageClient.handleRunShareSheet(this, frame, shareData, m_shareSheetResultListener.get(), WTFMove(completionHandler))) >+ didCancelForShareSheet(); >+} >+ > void WebPageProxy::printFrame(uint64_t frameID) > { > ASSERT(!m_isPerformingDOMPrintOperation); >@@ -5333,7 +5350,17 @@ void WebPageProxy::didCancelForOpenPanel() > m_openPanelResultListener->invalidate(); > m_openPanelResultListener = nullptr; > } >- >+ >+void WebPageProxy::didCancelForShareSheet() >+{ >+ if (!isValid()) >+ return; >+ >+ m_process->send(Messages::WebPage::DidCancelForShareSheet(), m_pageID); >+ m_shareSheetResultListener->invalidate(); >+ m_shareSheetResultListener = 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 6a5b259fcaea6d8928f09889c798045eb10d8815..53d60e13c739ac528fb45c98282c622deba4cb2d 100644 >--- a/Source/WebKit/UIProcess/WebPageProxy.h >+++ b/Source/WebKit/UIProcess/WebPageProxy.h >@@ -182,6 +182,7 @@ struct DataListSuggestionInformation; > struct DictionaryPopupInfo; > struct ExceptionDetails; > struct FileChooserSettings; >+struct ShareData; > struct GlobalWindowIdentifier; > struct MediaStreamRequest; > struct SecurityOriginData; >@@ -244,6 +245,7 @@ class WebKeyboardEvent; > class WebURLSchemeHandler; > class WebMouseEvent; > class WebOpenPanelResultListenerProxy; >+class WebShareSheetResultListenerProxy; > class WebPageGroup; > class WebProcessProxy; > class WebUserContentControllerProxy; >@@ -1005,6 +1007,7 @@ public: > #endif > void didChooseFilesForOpenPanel(const Vector<String>&); > void didCancelForOpenPanel(); >+ void didCancelForShareSheet(); > > WebPageCreationParameters creationParameters(); > >@@ -1481,6 +1484,7 @@ private: > void didChangeViewportProperties(const WebCore::ViewportAttributes&); > void pageDidScroll(); > void runOpenPanel(uint64_t frameID, const WebCore::SecurityOriginData&, const WebCore::FileChooserSettings&); >+ void runShareSheet(uint64_t frameID, const WebCore::ShareDataWithParsedURL&, uint64_t contextID); > 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&&); >@@ -1932,6 +1936,7 @@ private: > RefPtr<API::HitTestResult> m_lastMouseMoveHitTestResult; > > RefPtr<WebOpenPanelResultListenerProxy> m_openPanelResultListener; >+ RefPtr<WebShareSheetResultListenerProxy> m_shareSheetResultListener; > GeolocationPermissionRequestManagerProxy m_geolocationPermissionRequestManager; > NotificationPermissionRequestManagerProxy m_notificationPermissionRequestManager; > >diff --git a/Source/WebKit/UIProcess/WebPageProxy.messages.in b/Source/WebKit/UIProcess/WebPageProxy.messages.in >index b31f5f0be34cc948927a9b136d0cc32c51bc9c2a..0d744a88411ba108793888630823f527de3aaff2 100644 >--- a/Source/WebKit/UIProcess/WebPageProxy.messages.in >+++ b/Source/WebKit/UIProcess/WebPageProxy.messages.in >@@ -76,6 +76,8 @@ 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(uint64_t frameID, struct WebCore::ShareDataWithParsedURL shareData, uint64_t contextID) >+ > PrintFrame(uint64_t frameID) -> () > RunModal() > NotifyScrollerThumbIsVisibleInRect(WebCore::IntRect scrollerThumb) >diff --git a/Source/WebKit/UIProcess/WebShareSheetResultListenerProxy.cp b/Source/WebKit/UIProcess/WebShareSheetResultListenerProxy.cp >new file mode 100644 >index 0000000000000000000000000000000000000000..d503e6ab0258c1aec8b2241fdba0362aa6added0 >--- /dev/null >+++ b/Source/WebKit/UIProcess/WebShareSheetResultListenerProxy.cp >@@ -0,0 +1,79 @@ >+/* >+ * Copyright (C) 2010 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. >+ */ >+ >+#include "config.h" >+#include "WebOpenPanelResultListenerProxy.h" >+ >+#include "APIArray.h" >+#include "APIString.h" >+#include "WebPageProxy.h" >+#include <WebCore/URL.h> >+#include <wtf/Vector.h> >+ >+using namespace WebCore; >+ >+namespace WebKit { >+ >+WebOpenPanelResultListenerProxy::WebOpenPanelResultListenerProxy(WebPageProxy* page) >+ : m_page(page) >+{ >+} >+ >+WebOpenPanelResultListenerProxy::~WebOpenPanelResultListenerProxy() >+{ >+} >+ >+#if PLATFORM(IOS) >+void WebOpenPanelResultListenerProxy::chooseFiles(const Vector<WTF::String>& filenames, const String& displayString, const API::Data* iconImageData) >+{ >+ if (!m_page) >+ return; >+ >+ m_page->didChooseFilesForOpenPanelWithDisplayStringAndIcon(filenames, displayString, iconImageData); >+} >+#endif >+ >+void WebOpenPanelResultListenerProxy::chooseFiles(const Vector<String>& filenames) >+{ >+ if (!m_page) >+ return; >+ >+ m_page->didChooseFilesForOpenPanel(filenames); >+} >+ >+void WebOpenPanelResultListenerProxy::cancel() >+{ >+ if (!m_page) >+ return; >+ >+ m_page->didCancelForOpenPanel(); >+} >+ >+void WebOpenPanelResultListenerProxy::invalidate() >+{ >+ m_page = nullptr; >+} >+ >+} // namespace WebKit >diff --git a/Source/WebKit/UIProcess/WebShareSheetResultListenerProxy.cpp b/Source/WebKit/UIProcess/WebShareSheetResultListenerProxy.cpp >new file mode 100644 >index 0000000000000000000000000000000000000000..c934d29107d8e8a653d656ac618c741e7aa0639f >--- /dev/null >+++ b/Source/WebKit/UIProcess/WebShareSheetResultListenerProxy.cpp >@@ -0,0 +1,60 @@ >+/* >+ * Copyright (C) 2010 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. >+ */ >+ >+#include "config.h" >+#include "WebShareSheetResultListenerProxy.h" >+ >+#include "APIArray.h" >+#include "APIString.h" >+#include "WebPageProxy.h" >+#include <WebCore/URL.h> >+#include <wtf/Vector.h> >+ >+using namespace WebCore; >+ >+namespace WebKit { >+ >+WebShareSheetResultListenerProxy::WebShareSheetResultListenerProxy(WebPageProxy* page) >+ : m_page(page) >+{ >+} >+ >+WebShareSheetResultListenerProxy::~WebShareSheetResultListenerProxy() >+{ >+} >+ >+void WebShareSheetResultListenerProxy::cancel() >+{ >+ if (!m_page) >+ return; >+ m_page->didCancelForShareSheet(); >+} >+ >+void WebShareSheetResultListenerProxy::invalidate() >+{ >+ m_page = nullptr; >+} >+ >+} // namespace WebKit >diff --git a/Source/WebKit/UIProcess/WebShareSheetResultListenerProxy.h b/Source/WebKit/UIProcess/WebShareSheetResultListenerProxy.h >new file mode 100644 >index 0000000000000000000000000000000000000000..fd645c6beb0dbc71d57d7c5c39b5287dd4742238 >--- /dev/null >+++ b/Source/WebKit/UIProcess/WebShareSheetResultListenerProxy.h >@@ -0,0 +1,59 @@ >+/* >+ * Copyright (C) 2010-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. >+ */ >+ >+#pragma once >+ >+#include "APIObject.h" >+#include <wtf/Forward.h> >+#include <wtf/RefPtr.h> >+ >+namespace API { >+class Array; >+class Data; >+} >+ >+namespace WebKit { >+ >+class WebPageProxy; >+ >+class WebShareSheetResultListenerProxy : public API::ObjectImpl<API::Object::Type::FramePolicyListener> { >+public: >+ static Ref<WebShareSheetResultListenerProxy> create(WebPageProxy* page) >+ { >+ return adoptRef(*new WebShareSheetResultListenerProxy(page)); >+ } >+ >+ virtual ~WebShareSheetResultListenerProxy(); >+ >+ void cancel(); >+ void invalidate(); >+ >+private: >+ explicit WebShareSheetResultListenerProxy(WebPageProxy*); >+ >+ RefPtr<WebPageProxy> m_page; >+}; >+ >+} // namespace WebKit >diff --git a/Source/WebKit/UIProcess/ios/PageClientImplIOS.h b/Source/WebKit/UIProcess/ios/PageClientImplIOS.h >index a71fd426886ca7029592d73618f4fdeeb0469484..f55ae272f65f33073b92a8d7ccda4c772f64aa50 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 handleRunShareSheet(WebPageProxy*, WebFrameProxy*, const WebCore::ShareDataWithParsedURL&, WebShareSheetResultListenerProxy*, 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 f90a2f8a755d9b638244566ddd096270703e2115..b0a03a688db0dc6a92ea405bd64221f1b35e7b70 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/PromisedBlobInfo.h> >+#import <WebCore/ShareData.h> > #import <WebCore/SharedBuffer.h> > #import <WebCore/TextIndicator.h> > #import <WebCore/ValidationBubble.h> >@@ -571,6 +572,12 @@ bool PageClientImpl::handleRunOpenPanel(WebPageProxy*, WebFrameProxy*, API::Open > return true; > } > >+bool PageClientImpl::handleRunShareSheet(WebPageProxy*, WebFrameProxy*, const ShareDataWithParsedURL& shareData, WebShareSheetResultListenerProxy* listener, WTF::CompletionHandler<void(bool)>&& completionHandler) >+{ >+ [m_contentView _showShareSheet:shareData resultListener:listener 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 cc45c5cff220d325765f0a0721e11b9985149469..0032798634b243c63c409029ce31cc5788be311a 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 PromisedBlobInfo; > enum class RouteSharingPolicy; >+struct ShareDataWithParsedURL; > } > > #if ENABLE(DRAG_SUPPORT) >@@ -76,6 +78,7 @@ class InputViewUpdateDeferrer; > class NativeWebTouchEvent; > class SmartMagnificationController; > class WebOpenPanelResultListenerProxy; >+class WebShareSheetResultListenerProxy; > class WebPageProxy; > } > >@@ -174,6 +177,7 @@ struct WKAutoCorrectionData { > #endif > RetainPtr<WKFormInputSession> _formInputSession; > RetainPtr<WKFileUploadPanel> _fileUploadPanel; >+ RetainPtr<WKShareSheet> _shareSheet; > RetainPtr<UIGestureRecognizer> _previewGestureRecognizer; > RetainPtr<UIGestureRecognizer> _previewSecondaryGestureRecognizer; > Vector<bool> _focusStateStack; >@@ -262,7 +266,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 +321,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 resultListener:(WebKit::WebShareSheetResultListenerProxy*)listener 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 8cee7b7f699c0f45f47a27064d9569e20f3cc2ad..4d4f6b1727d7ffe3db2607ba8993b726f93b5227 100644 >--- a/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm >+++ b/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm >@@ -63,6 +63,7 @@ > #import "WebEvent.h" > #import "WebIOSEventFactory.h" > #import "WebPageMessages.h" >+#import <WebCore/ShareData.h> > #import "WebProcessProxy.h" > #import "_WKActivatedElementInfoInternal.h" > #import "_WKElementAction.h" >@@ -778,6 +779,12 @@ static inline bool hasAssistedNode(WebKit::AssistedNodeInformation assistedNodeI > _fileUploadPanel = nil; > } > >+ if (_shareSheet) { >+ [_shareSheet setDelegate:nil]; >+ [_shareSheet dismiss]; >+ _shareSheet = nil; >+ } >+ > _inputViewUpdateDeferrer = nullptr; > _assistedNodeInformation = { }; > >@@ -4628,6 +4635,28 @@ static bool isAssistableInputType(InputType type) > [_fileUploadPanel presentWithParameters:parameters resultListener:listener]; > } > >+- (void)_showShareSheet:(const ShareDataWithParsedURL&)data resultListener:(WebShareSheetResultListenerProxy*)listener completionHandler:(WTF::CompletionHandler<void(bool)>&&)completionHandler >+{ >+ ASSERT(!_shareSheet); >+ if (_shareSheet) >+ return; >+ >+ _shareSheet = adoptNS([[WKShareSheet alloc] initWithView:self]); >+ [_shareSheet setDelegate:self]; >+ >+ NSMutableArray *shareDataArray = [[NSMutableArray alloc] init]; >+ if ([data.shareData.title length] > 0) >+ [shareDataArray addObject:(NSString*)data.shareData.title]; >+ >+ if ([data.shareData.text length] > 0) >+ [shareDataArray addObject:(NSString*)data.shareData.text]; >+ >+ if (data.url.isNull()) >+ [shareDataArray addObject:(NSURL*)data.url]; >+ >+ [_shareSheet presentWithParameters:shareDataArray resultListener:listener completionHandler:WTFMove(completionHandler)]; >+} >+ > - (void)fileUploadPanelDidDismiss:(WKFileUploadPanel *)fileUploadPanel > { > ASSERT(_fileUploadPanel.get() == fileUploadPanel); >@@ -4636,6 +4665,14 @@ static bool isAssistableInputType(InputType type) > _fileUploadPanel = nil; > } > >+- (void)shareSheetDidDismiss:(WKShareSheet *)shareSheet >+{ >+ ASSERT(_shareSheet.get() == 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..148f7231ef601e86c681cbc4ec805ff95866cdba >--- /dev/null >+++ b/Source/WebKit/UIProcess/ios/forms/WKShareSheet.h >@@ -0,0 +1,62 @@ >+/* >+ * 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/UIViewController.h> >+#import <wtf/BlockPtr.h> >+#import <wtf/Forward.h> >+#import <wtf/Vector.h> >+#import <wtf/WeakObjCPtr.h> >+#import <wtf/text/WTFString.h> >+ >+namespace WTF { >+class TextStream; >+} >+ >+@class WKContentView; >+@protocol WKShareSheetDelegate; >+ >+namespace API { >+} >+ >+namespace WebKit { >+class WebShareSheetResultListenerProxy; >+} >+ >+@interface WKShareSheet : UIViewController >+@property (nonatomic, assign) id <WKShareSheetDelegate> delegate; >+- (instancetype)initWithView:(WKContentView *)view; >+- (void)presentWithParameters:(NSArray*)parameters resultListener:(WebKit::WebShareSheetResultListenerProxy*)listener completionHandler:(WTF::CompletionHandler<void(bool)>&&)completionHandler; >+ >+- (void)dismiss; >+@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..e71b6ec391d6639c1f02aff9b6fd6dab5b7b14e1 >--- /dev/null >+++ b/Source/WebKit/UIProcess/ios/forms/WKShareSheet.mm >@@ -0,0 +1,156 @@ >+/* >+ * 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 "WebShareSheetResultListenerProxy.h" >+#import <MobileCoreServices/MobileCoreServices.h> >+#import <WebCore/LocalizedStrings.h> >+#import <wtf/RetainPtr.h> >+ >+using namespace WebKit; >+ >+#pragma clang diagnostic push >+#pragma clang diagnostic ignored "-Wdeprecated-declarations" >+ >+#pragma mark - _WKFileUploadItem >+ >+@interface _WKShareSheetItem : NSObject >+@end >+ >+@implementation _WKShareSheetItem { >+} >+ >+@end >+ >+#pragma mark - WKFileUploadPanel >+ >+@interface WKFileUploadPanel () <UIPopoverControllerDelegate, UINavigationControllerDelegate, UIDocumentMenuDelegate> >+@end >+ >+@implementation WKShareSheet { >+ WKContentView *_view; >+ RefPtr<WebKit::WebShareSheetResultListenerProxy> _listener; >+ RetainPtr<UIActivityViewController> _shareSheetViewController; >+ RetainPtr<UIViewController> _presentationViewController; >+#pragma clang diagnostic push >+#pragma clang diagnostic ignored "-Wdeprecated-declarations" >+#pragma clang diagnostic pop >+} >+ >+- (instancetype)initWithView:(WKContentView *)view >+{ >+ if (!(self = [super init])) >+ return nil; >+ _view = view; >+ return self; >+} >+ >+- (void)dealloc >+{ >+ [super dealloc]; >+} >+ >+#pragma mark - Panel Completion (one of these must be called) >+ >+#pragma mark - Present / Dismiss API >+ >+- (void)presentWithParameters:(NSArray*)parameters resultListener:(WebKit::WebShareSheetResultListenerProxy*)listener completionHandler:(WTF::CompletionHandler<void(bool)>&&)completionHandler >+{ >+ ASSERT(!_listener); >+ _listener = listener; >+ >+ UIActivityViewController *shareSheetController = [[UIActivityViewController alloc] initWithActivityItems:parameters applicationActivities:nil]; >+ >+ auto completionHandlerBlock = BlockPtr<void((NSString *activityType, BOOL completed, NSArray *returnedItems, NSError *activityError))>::fromCallable([completionHandler = WTFMove(completionHandler), shareSheet = self](NSString *activityType, BOOL completed, NSArray *returnedItems, NSError *activityError) mutable { >+ completionHandler(completed); >+ [shareSheet dismiss]; >+ }); >+ >+ shareSheetController.completionWithItemsHandler = completionHandlerBlock.get(); >+ _shareSheetViewController = adoptNS(shareSheetController); >+ [self _presentFullscreenViewController:_shareSheetViewController.get() animated:NO]; >+} >+ >+- (void)_dispatchDidDismiss >+{ >+ if ([_delegate respondsToSelector:@selector(shareSheetDidDismiss:)]) >+ [_delegate shareSheetDidDismiss:self]; >+} >+ >+- (void)_cancel >+{ >+ if (_listener) >+ _listener->cancel(); >+ >+ [self _dispatchDidDismiss]; >+} >+ >+- (void)dismiss >+{ >+ [[UIViewController _viewControllerForFullScreenPresentationFromView:_view] 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; >+ }]; >+ } >+ } >+} >+ >+#pragma mark - Presenting View Controllers >+ >+- (void)_presentFullscreenViewController:(UIViewController *)viewController animated:(BOOL)animated >+{ >+ [self _dismissDisplayAnimated:NO]; >+ >+ _presentationViewController = [UIViewController _viewControllerForFullScreenPresentationFromView:_view]; >+ [_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 c833c1fee5b333a6a57a1f213946975309605754..fe82a27977208fc0fc6406874e3d34f8fb52fadb 100644 >--- a/Source/WebKit/WebKit.xcodeproj/project.pbxproj >+++ b/Source/WebKit/WebKit.xcodeproj/project.pbxproj >@@ -570,6 +570,12 @@ > 1CA8B954127C891500576C2B /* WebInspectorUIMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1C8E2DAD1278C5B200BC7BD0 /* WebInspectorUIMac.mm */; }; > 1CBBE4A019B66C53006B7D81 /* WebInspectorUIMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1CBBE49E19B66C53006B7D81 /* WebInspectorUIMessageReceiver.cpp */; }; > 1CBBE4A119B66C53006B7D81 /* WebInspectorUIMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 1CBBE49F19B66C53006B7D81 /* WebInspectorUIMessages.h */; }; >+ 1DB01943211CF002009FB3E8 /* WKShareSheet.h in Headers */ = {isa = PBXBuildFile; fileRef = 1DE0D095211CC21300439B5F /* WKShareSheet.h */; }; >+ 1DB01944211CF005009FB3E8 /* WKShareSheet.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1DBBB061211CC3CB00502ECC /* WKShareSheet.mm */; }; >+ 1DC867E321248F4000ECAB94 /* WebShareSheetResultListenerProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 1DC867E221248EF900ECAB94 /* WebShareSheetResultListenerProxy.h */; }; >+ 1DC867E521248F4600ECAB94 /* WebShareSheetResultListenerProxy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1DC867E421248F4600ECAB94 /* WebShareSheetResultListenerProxy.cpp */; }; >+ 1DEC03E2212484E700E1998B /* WebShareSheetResultListener.h in Headers */ = {isa = PBXBuildFile; fileRef = 1DEC03E1212484E700E1998B /* WebShareSheetResultListener.h */; }; >+ 1DEC03E42124872000E1998B /* WebShareSheetResultListener.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1DEC03E32124872000E1998B /* WebShareSheetResultListener.cpp */; }; > 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 */; }; > 1F7506AD1859161C00EC0FF7 /* WKWebProcessPlugInFrame.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1F01816A1858DC1500F92884 /* WKWebProcessPlugInFrame.mm */; }; >@@ -3034,6 +3040,12 @@ > 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>"; }; >+ 1DBBB061211CC3CB00502ECC /* WKShareSheet.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WKShareSheet.mm; path = ios/forms/WKShareSheet.mm; sourceTree = "<group>"; }; >+ 1DC867E221248EF900ECAB94 /* WebShareSheetResultListenerProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebShareSheetResultListenerProxy.h; sourceTree = "<group>"; }; >+ 1DC867E421248F4600ECAB94 /* WebShareSheetResultListenerProxy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebShareSheetResultListenerProxy.cpp; sourceTree = "<group>"; }; >+ 1DE0D095211CC21300439B5F /* WKShareSheet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WKShareSheet.h; path = ios/forms/WKShareSheet.h; sourceTree = "<group>"; }; >+ 1DEC03E1212484E700E1998B /* WebShareSheetResultListener.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebShareSheetResultListener.h; sourceTree = "<group>"; }; >+ 1DEC03E32124872000E1998B /* WebShareSheetResultListener.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebShareSheetResultListener.cpp; 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>"; }; >@@ -7389,6 +7401,8 @@ > BC7B621312A4219A00D174A4 /* WebPageGroupProxy.h */, > 2D5C9D0319C81D8F00B3C5C1 /* WebPageOverlay.cpp */, > 2D5C9D0419C81D8F00B3C5C1 /* WebPageOverlay.h */, >+ 1DEC03E32124872000E1998B /* WebShareSheetResultListener.cpp */, >+ 1DEC03E1212484E700E1998B /* WebShareSheetResultListener.h */, > BCA0EF7E12331E78007D3CFB /* WebUndoStep.cpp */, > BCA0EF7D12331E78007D3CFB /* WebUndoStep.h */, > 51D1242A1E6D41BC002B2820 /* WebURLSchemeHandlerProxy.cpp */, >@@ -7571,6 +7585,8 @@ > 7A9CD8C21C779AD600D9F6C7 /* WebResourceLoadStatisticsStore.messages.in */, > 6B821DDB1EEF05DD00D7AF4A /* WebResourceLoadStatisticsTelemetry.cpp */, > 6B821DDA1EEF05DD00D7AF4A /* WebResourceLoadStatisticsTelemetry.h */, >+ 1DC867E421248F4600ECAB94 /* WebShareSheetResultListenerProxy.cpp */, >+ 1DC867E221248EF900ECAB94 /* WebShareSheetResultListenerProxy.h */, > 51D124241E6D3CC3002B2820 /* WebURLSchemeHandler.cpp */, > 51D124251E6D3CC3002B2820 /* WebURLSchemeHandler.h */, > 51E8B68D1E712873001B7132 /* WebURLSchemeTask.cpp */, >@@ -8700,6 +8716,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 */, >@@ -9607,6 +9625,8 @@ > 7C361D731927FA360036A59D /* WebScriptMessageHandler.h in Headers */, > D3B9484911FF4B6500032B39 /* WebSearchPopupMenu.h in Headers */, > 51BEB62C1F3A5AD7005029B9 /* WebServiceWorkerProvider.h in Headers */, >+ 1DEC03E2212484E700E1998B /* WebShareSheetResultListener.h in Headers */, >+ 1DC867E321248F4000ECAB94 /* WebShareSheetResultListenerProxy.h in Headers */, > 5C8DD3801FE4521600F2A556 /* WebsiteAutoplayPolicy.h in Headers */, > 1A4832D71A9CDF96008B4DFE /* WebsiteData.h in Headers */, > 1A4832D11A9BDC2F008B4DFE /* WebsiteDataRecord.h in Headers */, >@@ -9919,6 +9939,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 */, >@@ -11501,6 +11522,8 @@ > D3B9484811FF4B6500032B39 /* WebSearchPopupMenu.cpp in Sources */, > 4131F3E21F9880840059995A /* WebServiceWorkerFetchTaskClient.cpp in Sources */, > 51BEB62B1F3A5AD7005029B9 /* WebServiceWorkerProvider.cpp in Sources */, >+ 1DEC03E42124872000E1998B /* WebShareSheetResultListener.cpp in Sources */, >+ 1DC867E521248F4600ECAB94 /* WebShareSheetResultListenerProxy.cpp in Sources */, > 1A4832D61A9CDF96008B4DFE /* WebsiteData.cpp in Sources */, > 1A4832D91A9D1FD2008B4DFE /* WebsiteDataRecord.cpp in Sources */, > 1A53C2A91A32572B004E8C70 /* WebsiteDataStore.cpp in Sources */, >@@ -11719,6 +11742,7 @@ > F4F59AD62065AEB1006CAA46 /* WKSelectMenuListViewController.mm 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 */, >diff --git a/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp b/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp >index c0652f16dcd87f91641d56a47cf92fee3d53a6f5..3d5de324fc4def395a627d8cb75498c6a4a11a6e 100644 >--- a/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp >+++ b/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp >@@ -55,6 +55,7 @@ > #include "WebProcessPoolMessages.h" > #include "WebProcessProxyMessages.h" > #include "WebSearchPopupMenu.h" >+#include "WebShareSheetResultListener.h" > #include <WebCore/ApplicationCacheStorage.h> > #include <WebCore/AXObjectCache.h> > #include <WebCore/ColorChooser.h> >@@ -811,6 +812,13 @@ 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(Frame& frame, ShareDataWithParsedURL& shareData, CompletionHandler<void(bool)>&& callback) >+{ >+ auto* webFrame = WebFrame::fromCoreFrame(frame); >+ ASSERT(webFrame); >+ m_page.runShareSheet(frame, webFrame->frameID(), 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..c00ade70b17a27f3aacbaf9080d21bd1b648cb22 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::Frame&, 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 d6b96556866d98560b0b2ef4e3da85e5573933ea..9a044fd20d2ab30dd21c0c0bf2a8ad81037e675c 100644 >--- a/Source/WebKit/WebProcess/WebPage/WebPage.cpp >+++ b/Source/WebKit/WebProcess/WebPage/WebPage.cpp >@@ -118,6 +118,7 @@ > #include "WebProcessPoolMessages.h" > #include "WebProcessProxyMessages.h" > #include "WebProgressTrackerClient.h" >+#include "WebShareSheetResultListener.h" > #include "WebSocketProvider.h" > #include "WebStorageNamespaceProvider.h" > #include "WebURLSchemeHandlerProxy.h" >@@ -3709,6 +3710,11 @@ void WebPage::didCancelForOpenPanel() > { > m_activeOpenPanelResultListener = nullptr; > } >+ >+void WebPage::didCancelForShareSheet() >+{ >+ m_activeShareSheetResultListener = nullptr; >+} > > #if ENABLE(SANDBOX_EXTENSIONS) > void WebPage::extendSandboxForFilesFromOpenPanel(SandboxExtension::HandleArray&& handles) >@@ -6051,6 +6057,12 @@ static uint64_t nextRequestStorageAccessContextId() > static uint64_t nextContextId = 0; > return ++nextContextId; > } >+ >+static uint64_t nextShareSheetContextId() >+{ >+ static uint64_t nextContextId = 0; >+ return ++nextContextId; >+} > > void WebPage::hasStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, CompletionHandler<void(bool)>&& callback) > { >@@ -6082,6 +6094,24 @@ void WebPage::storageAccessResponse(bool wasGranted, uint64_t contextId) > callback(wasGranted); > } > #endif >+ >+void WebPage::runShareSheet(Frame& frame, uint64_t frameID, ShareDataWithParsedURL& shareData, WTF::CompletionHandler<void(bool)>&& callback) >+{ >+ auto contextID = nextShareSheetContextId(); >+ auto addResult = m_shareSheetResponseCallbackMap.add(contextID, WTFMove(callback)); >+ ASSERT(addResult.isNewEntry); >+ if (addResult.iterator->value) >+ send(Messages::WebPageProxy::RunShareSheet(frameID, WTFMove(shareData), contextID)); >+ else >+ callback(false); >+} >+ >+void WebPage::runShareSheetResponse(bool wasGranted, uint64_t contextId) >+{ >+ auto callback = m_shareSheetResponseCallbackMap.take(contextId); >+ ASSERT(callback); >+ callback(wasGranted); >+} > > #if ENABLE(ATTACHMENT_ELEMENT) > >diff --git a/Source/WebKit/WebProcess/WebPage/WebPage.h b/Source/WebKit/WebProcess/WebPage/WebPage.h >index cbbc48cdd26b256728e70406998421b8f41dafb8..4612da5323adae88916c1bf8f862d64069b6467f 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> >@@ -171,6 +172,7 @@ struct KeypressCommand; > struct PromisedBlobInfo; > struct TextCheckingResult; > struct ViewportArguments; >+struct ShareData; > > > >@@ -216,6 +218,7 @@ class WebURLSchemeHandlerProxy; > class WebMouseEvent; > class WebNotificationClient; > class WebOpenPanelResultListener; >+class WebShareSheetResultListener; > class WebPageGroupProxy; > class WebPageOverlay; > class PlaybackSessionManager; >@@ -1072,6 +1075,8 @@ public: > void storageAccessResponse(bool wasGranted, uint64_t contextId); > #endif > >+ void runShareSheet(WebCore::Frame&, uint64_t frameID, WebCore::ShareDataWithParsedURL&, WTF::CompletionHandler<void(bool)>&& callback); >+ > #if ENABLE(ATTACHMENT_ELEMENT) > void insertAttachment(const String& identifier, const WebCore::AttachmentDisplayOptions&, const String& filename, std::optional<String> contentType, const IPC::DataReference&, CallbackID); > void requestAttachmentInfo(const String& identifier, CallbackID); >@@ -1294,6 +1299,7 @@ private: > > void didChooseFilesForOpenPanel(const Vector<String>&); > void didCancelForOpenPanel(); >+ void didCancelForShareSheet(); > > #if PLATFORM(IOS) > void didChooseFilesForOpenPanelWithDisplayStringAndIcon(const Vector<String>&, const String& displayString, const IPC::DataReference& iconData); >@@ -1567,6 +1573,7 @@ private: > #endif > > RefPtr<WebOpenPanelResultListener> m_activeOpenPanelResultListener; >+ RefPtr<WebShareSheetResultListener> m_activeShareSheetResultListener; > RefPtr<NotificationPermissionRequestManager> m_notificationPermissionRequestManager; > > Ref<WebUserContentController> m_userContentController; >@@ -1729,7 +1736,9 @@ 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 granted)>> m_shareSheetResponseCallbackMap; >+ void runShareSheetResponse(bool wasGranted, uint64_t contextId); > > #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 1c44d77e6524d636623e4246f256a5716b1c0379..e798224d53dfa9a944b3ac54ffc3ef5d0e82dee8 100644 >--- a/Source/WebKit/WebProcess/WebPage/WebPage.messages.in >+++ b/Source/WebKit/WebProcess/WebPage/WebPage.messages.in >@@ -291,6 +291,9 @@ messages -> WebPage LegacyReceiver { > #endif > DidChooseFilesForOpenPanel(Vector<String> fileURLs) > DidCancelForOpenPanel() >+ DidCancelForShareSheet() >+ RunShareSheetResponse(bool wasGranted, uint64_t contextId) >+ > #if ENABLE(SANDBOX_EXTENSIONS) > ExtendSandboxForFilesFromOpenPanel(WebKit::SandboxExtension::HandleArray sandboxExtensions) > #endif >diff --git a/Source/WebKit/WebProcess/WebPage/WebShareSheetResultListener.cpp b/Source/WebKit/WebProcess/WebPage/WebShareSheetResultListener.cpp >new file mode 100644 >index 0000000000000000000000000000000000000000..7d980dd6cd8872370012e6c6219a466bce65c9ae >--- /dev/null >+++ b/Source/WebKit/WebProcess/WebPage/WebShareSheetResultListener.cpp >@@ -0,0 +1,45 @@ >+/* >+ * Copyright (C) 2010 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. >+ */ >+ >+#include "config.h" >+#include "WebShareSheetResultListener.h" >+ >+namespace WebKit { >+ >+Ref<WebShareSheetResultListener> WebShareSheetResultListener::create(WebPage& page) >+{ >+ return adoptRef(*new WebShareSheetResultListener(page)); >+} >+ >+WebShareSheetResultListener::WebShareSheetResultListener(WebPage& page) >+ : m_page(&page) >+{ >+} >+ >+WebShareSheetResultListener::~WebShareSheetResultListener() >+{ >+} >+ >+} // namespace WebKit >diff --git a/Source/WebKit/WebProcess/WebPage/WebShareSheetResultListener.h b/Source/WebKit/WebProcess/WebPage/WebShareSheetResultListener.h >new file mode 100644 >index 0000000000000000000000000000000000000000..bfe7cc8d6b5e0d7911055b619dc559260a3573e1 >--- /dev/null >+++ b/Source/WebKit/WebProcess/WebPage/WebShareSheetResultListener.h >@@ -0,0 +1,52 @@ >+/* >+ * Copyright (C) 2010 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. >+ */ >+ >+#pragma once >+ >+#include <wtf/Forward.h> >+#include <wtf/Ref.h> >+#include <wtf/RefCounted.h> >+ >+namespace WebCore { >+} >+ >+namespace WebKit { >+ >+class WebPage; >+ >+class WebShareSheetResultListener : public RefCounted<WebShareSheetResultListener> { >+public: >+ static Ref<WebShareSheetResultListener> create(WebPage&); >+ ~WebShareSheetResultListener(); >+ >+ void disconnectFromPage() { m_page = 0; } >+ >+private: >+ WebShareSheetResultListener(WebPage&); >+ >+ WebPage* m_page; >+}; >+ >+} // namespace WebKit >diff --git a/Source/WebKitLegacy/ios/WebCoreSupport/WebChromeClientIOS.h b/Source/WebKitLegacy/ios/WebCoreSupport/WebChromeClientIOS.h >index bc1583c1636b78a0792d484d02e4e93b834845f3..eb24d5760882cebc83b79b32ca9c9fe8a03b9fc1 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::Frame&, 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..cb5482a3fb314a3818ddace11e13d905c312b07e 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(Frame&, 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..887048795f575fb183744e0cc523ad5994ddc1f6 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::Frame&, 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..a823a725f296779dcb86a8eea4c95257779253bf 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(Frame&, 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