WebKit Bugzilla
Attachment 340400 Details for
Bug 185459
: Download and present System Preview
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-185459-20180515191813.patch (text/plain), 25.29 KB, created by
Dean Jackson
on 2018-05-15 02:18:15 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Dean Jackson
Created:
2018-05-15 02:18:15 PDT
Size:
25.29 KB
patch
obsolete
>Subversion Revision: 231578 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 92e54f5f12bf03019f07fc8053066342d16b2011..aced03cc31ba697a8bd214da7ffaef6b3e0a6d0c 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,16 @@ >+2018-05-14 Dean Jackson <dino@apple.com> >+ >+ Download and present System Preview >+ https://bugs.webkit.org/show_bug.cgi?id=185459 >+ <rdar://problem/40079228> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ If an <a> is a system preview, tell the resource request about it. >+ >+ * html/HTMLAnchorElement.cpp: >+ (WebCore::HTMLAnchorElement::handleClick): >+ > 2018-05-11 Dean Jackson <dino@apple.com> > > System preview badge doesn't show on <picture> elements >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index 51ab048cb46df94f5f4d40b21b2c11e776929a8c..9cc5f92e87c8e8d19ffc7e45fa1185b1ad5bd588 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,72 @@ >+2018-05-14 Dean Jackson <dino@apple.com> >+ >+ Download and present System Preview >+ https://bugs.webkit.org/show_bug.cgi?id=185459 >+ <rdar://problem/40079228> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Extend DownloadClient so that it can handle the case where >+ the download was triggered by a System Preview. In this situation >+ the result (and progress) are piped into QuickLook via the SystemPreviewController. >+ >+ The DownloadProxy class is also extended to handle the destination >+ filename and the size of the content. >+ >+ Lastly, SystemPreviewController is updated to have a start(), show() >+ and cancel() interface, and no longer adjusts page navigation. >+ >+ * UIProcess/Cocoa/DownloadClient.h: >+ * UIProcess/Cocoa/DownloadClient.mm: Handle the SystemPreview case, which >+ doesn't have a download delegate, but instead needs to communicate with >+ the SystemPreviewController, if one exists. >+ (WebKit::DownloadClient::didStart): >+ (WebKit::DownloadClient::didReceiveResponse): >+ (WebKit::DownloadClient::didReceiveData): >+ (WebKit::DownloadClient::didCreateDestination): >+ (WebKit::DownloadClient::processDidCrash): >+ (WebKit::DownloadClient::decideDestinationWithSuggestedFilename): >+ (WebKit::DownloadClient::didFinish): >+ (WebKit::DownloadClient::didFail): >+ (WebKit::DownloadClient::didCancel): >+ (WebKit::DownloadClient::releaseActivityToken): >+ >+ * UIProcess/Cocoa/SystemPreviewControllerCocoa.mm: Implement the new API. >+ (-[_WKPreviewControllerDataSource initWithMIMEType:]): >+ (-[_WKPreviewControllerDataSource previewController:previewItemAtIndex:]): >+ (-[_WKPreviewControllerDataSource setProgress:]): >+ (-[_WKPreviewControllerDataSource finish:]): >+ (-[_WKPreviewControllerDelegate previewControllerDidDismiss:]): >+ (WebKit::SystemPreviewController::start): >+ (WebKit::SystemPreviewController::updateProgress): >+ (WebKit::SystemPreviewController::finish): >+ (WebKit::SystemPreviewController::cancel): >+ (-[_WKPreviewControllerDataSource initWithURL:]): Deleted. >+ (-[_WKPreviewControllerDelegate previewControllerWillDismiss:]): Deleted. >+ (WebKit::SystemPreviewController::canPreview const): Deleted. >+ (WebKit::SystemPreviewController::showPreview): Deleted. >+ * UIProcess/Downloads/DownloadProxy.h: Track the destination file by name >+ and size. Also expose a helper to identify system preview downloads. >+ (WebKit::DownloadProxy::destinationFilename const): >+ (WebKit::DownloadProxy::setDestinationFilename): >+ (WebKit::DownloadProxy::expectedContentLength const): >+ (WebKit::DownloadProxy::setExpectedContentLength): >+ (WebKit::DownloadProxy::bytesLoaded const): >+ (WebKit::DownloadProxy::setBytesLoaded): >+ (WebKit::DownloadProxy::isSystemPreviewDownload const): >+ >+ * UIProcess/SystemPreviewController.cpp: New API. >+ (WebKit::SystemPreviewController::canPreview const): >+ (WebKit::SystemPreviewController::sendPageBack): Deleted. >+ (WebKit::SystemPreviewController::showPreview): Deleted. >+ * UIProcess/SystemPreviewController.h: >+ >+ * UIProcess/WebPageProxy.cpp: >+ (WebKit::m_configurationPreferenceValues): >+ (WebKit::WebPageProxy::reattachToWebProcess): >+ (WebKit::WebPageProxy::resetState): >+ * UIProcess/WebPageProxy.h: >+ > 2018-05-11 Dean Jackson <dino@apple.com> > > WKWebViewContentProvider should know what MIME type it was created to handle >diff --git a/Source/WebCore/html/HTMLAnchorElement.cpp b/Source/WebCore/html/HTMLAnchorElement.cpp >index a73f680e259b64bf4123543108cd6dd420f4e40f..89a38c1782c38c3b3b12a2fe10db730640ec95f6 100644 >--- a/Source/WebCore/html/HTMLAnchorElement.cpp >+++ b/Source/WebCore/html/HTMLAnchorElement.cpp >@@ -418,6 +418,10 @@ void HTMLAnchorElement::handleClick(Event& event) > #endif > > bool isSystemPreview = false; >+#if USE(SYSTEM_PREVIEW) >+ isSystemPreview = isSystemPreviewLink(); >+#endif >+ > ShouldSendReferrer shouldSendReferrer = hasRel(Relation::NoReferrer) ? NeverSendReferrer : MaybeSendReferrer; > auto newFrameOpenerPolicy = hasRel(Relation::NoOpener) ? std::make_optional(NewFrameOpenerPolicy::Suppress) : std::nullopt; > frame->loader().urlSelected(completedURL, target(), &event, LockHistory::No, LockBackForwardList::No, shouldSendReferrer, document().shouldOpenExternalURLsPolicyToPropagate(), newFrameOpenerPolicy, downloadAttribute, isSystemPreview); >diff --git a/Source/WebKit/UIProcess/Cocoa/DownloadClient.h b/Source/WebKit/UIProcess/Cocoa/DownloadClient.h >index f163ea08763e6970bcca75a657b36f3bf8f5f096..db3efb79928cd94b0957878f9ac7b18eba9fd7a2 100644 >--- a/Source/WebKit/UIProcess/Cocoa/DownloadClient.h >+++ b/Source/WebKit/UIProcess/Cocoa/DownloadClient.h >@@ -30,6 +30,7 @@ > #if WK_API_ENABLED > > #import "APIDownloadClient.h" >+#import "ProcessThrottler.h" > #import "WeakObjCPtr.h" > > @protocol _WKDownloadDelegate; >@@ -59,6 +60,10 @@ private: > void didCreateDestination(WebProcessPool&, DownloadProxy&, const String&) final; > void processDidCrash(WebProcessPool&, DownloadProxy&) final; > >+#if PLATFORM(IOS) && USE(SYSTEM_PREVIEW) >+ void releaseActivityToken(DownloadProxy&); >+#endif >+ > WeakObjCPtr<id <_WKDownloadDelegate>> m_delegate; > > struct { >@@ -76,6 +81,10 @@ private: > bool downloadDidCreateDestination : 1; > bool downloadProcessDidCrash : 1; > } m_delegateMethods; >+ >+#if PLATFORM(IOS) && USE(SYSTEM_PREVIEW) >+ ProcessThrottler::BackgroundActivityToken m_activityToken; >+#endif > }; > > } // namespace WebKit >diff --git a/Source/WebKit/UIProcess/Cocoa/DownloadClient.mm b/Source/WebKit/UIProcess/Cocoa/DownloadClient.mm >index b65358e721f3f6ccbd658f2b4197d32bc753fa1e..13ae6da7bb30b282a341ffc3cbcc51ace9e52a03 100644 >--- a/Source/WebKit/UIProcess/Cocoa/DownloadClient.mm >+++ b/Source/WebKit/UIProcess/Cocoa/DownloadClient.mm >@@ -32,11 +32,16 @@ > #import "AuthenticationDecisionListener.h" > #import "CompletionHandlerCallChecker.h" > #import "DownloadProxy.h" >+#import "Logging.h" >+#import "SystemPreviewController.h" > #import "WKNSURLAuthenticationChallenge.h" > #import "WKNSURLExtras.h" > #import "WebCredential.h" >+#import "WebPageProxy.h" >+#import "WebProcessProxy.h" > #import "_WKDownloadDelegate.h" > #import "_WKDownloadInternal.h" >+#import <WebCore/FileSystem.h> > #import <WebCore/ResourceError.h> > #import <WebCore/ResourceResponse.h> > #import <wtf/BlockPtr.h> >@@ -69,24 +74,57 @@ DownloadClient::DownloadClient(id <_WKDownloadDelegate> delegate) > > void DownloadClient::didStart(WebProcessPool&, DownloadProxy& downloadProxy) > { >+#if USE(SYSTEM_PREVIEW) >+ if (downloadProxy.isSystemPreviewDownload()) { >+ if (auto* webPage = downloadProxy.originatingPage()) { >+ RELEASE_LOG_IF(webPage->isAlwaysOnLoggingAllowed(), ProcessSuspension, "%p - UIProcess is taking a background assertion because it is downloading a system preview", this); >+ ASSERT(!m_activityToken); >+ m_activityToken = webPage->process().throttler().backgroundActivityToken(); >+ } >+ return; >+ } >+#endif >+ > if (m_delegateMethods.downloadDidStart) > [m_delegate _downloadDidStart:wrapper(downloadProxy)]; > } > > void DownloadClient::didReceiveResponse(WebProcessPool&, DownloadProxy& downloadProxy, const WebCore::ResourceResponse& response) > { >+#if USE(SYSTEM_PREVIEW) >+ if (downloadProxy.isSystemPreviewDownload()) { >+ downloadProxy.setExpectedContentLength(response.expectedContentLength()); >+ downloadProxy.setBytesLoaded(0); >+ if (auto* webPage = downloadProxy.originatingPage()) { >+ webPage->systemPreviewController()->start(response.mimeType()); >+ webPage->systemPreviewController()->updateProgress(0); >+ } >+ return; >+ } >+#endif >+ > if (m_delegateMethods.downloadDidReceiveResponse) > [m_delegate _download:wrapper(downloadProxy) didReceiveResponse:response.nsURLResponse()]; > } > > void DownloadClient::didReceiveData(WebProcessPool&, DownloadProxy& downloadProxy, uint64_t length) > { >+#if USE(SYSTEM_PREVIEW) >+ if (downloadProxy.isSystemPreviewDownload()) { >+ downloadProxy.setBytesLoaded(downloadProxy.bytesLoaded() + length); >+ if (auto* webPage = downloadProxy.originatingPage()) >+ webPage->systemPreviewController()->updateProgress(static_cast<float>(downloadProxy.bytesLoaded()) / downloadProxy.expectedContentLength()); >+ return; >+ } >+#endif >+ > if (m_delegateMethods.downloadDidReceiveData) > [m_delegate _download:wrapper(downloadProxy) didReceiveData:length]; > } > > void DownloadClient::didReceiveAuthenticationChallenge(WebProcessPool&, DownloadProxy& downloadProxy, AuthenticationChallengeProxy& authenticationChallenge) > { >+ // FIXME: System Preview needs code here. > if (!m_delegateMethods.downloadDidReceiveAuthenticationChallengeCompletionHandler) { > authenticationChallenge.listener()->performDefaultHandling(); > return; >@@ -126,18 +164,42 @@ void DownloadClient::didReceiveAuthenticationChallenge(WebProcessPool&, Download > > void DownloadClient::didCreateDestination(WebProcessPool&, DownloadProxy& downloadProxy, const String& destination) > { >+#if USE(SYSTEM_PREVIEW) >+ if (downloadProxy.isSystemPreviewDownload()) { >+ downloadProxy.setDestinationFilename(destination); >+ return; >+ } >+#endif >+ > if (m_delegateMethods.downloadDidCreateDestination) > [m_delegate _download:wrapper(downloadProxy) didCreateDestination:destination]; > } > > void DownloadClient::processDidCrash(WebProcessPool&, DownloadProxy& downloadProxy) > { >+#if USE(SYSTEM_PREVIEW) >+ if (downloadProxy.isSystemPreviewDownload()) { >+ if (m_activityToken) >+ releaseActivityToken(downloadProxy); >+ return; >+ } >+#endif >+ > if (m_delegateMethods.downloadProcessDidCrash) > [m_delegate _downloadProcessDidCrash:wrapper(downloadProxy)]; > } > > void DownloadClient::decideDestinationWithSuggestedFilename(WebProcessPool&, DownloadProxy& downloadProxy, const String& filename, Function<void(AllowOverwrite, String)>&& completionHandler) > { >+#if USE(SYSTEM_PREVIEW) >+ if (downloadProxy.isSystemPreviewDownload()) { >+ NSString *temporaryDirectory = WebCore::FileSystem::createTemporaryDirectory(@"SystemPreviews"); >+ NSString *destination = [temporaryDirectory stringByAppendingPathComponent:filename]; >+ completionHandler(AllowOverwrite::Yes, destination); >+ return; >+ } >+#endif >+ > if (!m_delegateMethods.downloadDecideDestinationWithSuggestedFilenameAllowOverwrite && !m_delegateMethods.downloadDecideDestinationWithSuggestedFilenameCompletionHandler) > return completionHandler(AllowOverwrite::No, { }); > >@@ -160,18 +222,50 @@ void DownloadClient::decideDestinationWithSuggestedFilename(WebProcessPool&, Dow > > void DownloadClient::didFinish(WebProcessPool&, DownloadProxy& downloadProxy) > { >+#if USE(SYSTEM_PREVIEW) >+ if (downloadProxy.isSystemPreviewDownload()) { >+ if (auto* webPage = downloadProxy.originatingPage()) { >+ NSURL *destinationURL = [NSURL fileURLWithPath:(NSString *)downloadProxy.destinationFilename()]; >+ webPage->systemPreviewController()->finish(WebCore::URL(destinationURL)); >+ } >+ if (m_activityToken) >+ releaseActivityToken(downloadProxy); >+ return; >+ } >+#endif >+ > if (m_delegateMethods.downloadDidFinish) > [m_delegate _downloadDidFinish:wrapper(downloadProxy)]; > } > > void DownloadClient::didFail(WebProcessPool&, DownloadProxy& downloadProxy, const WebCore::ResourceError& error) > { >+#if USE(SYSTEM_PREVIEW) >+ if (downloadProxy.isSystemPreviewDownload()) { >+ if (auto* webPage = downloadProxy.originatingPage()) >+ webPage->systemPreviewController()->cancel(); >+ if (m_activityToken) >+ releaseActivityToken(downloadProxy); >+ return; >+ } >+#endif >+ > if (m_delegateMethods.downloadDidFail) > [m_delegate _download:wrapper(downloadProxy) didFailWithError:error.nsError()]; > } > > void DownloadClient::didCancel(WebProcessPool&, DownloadProxy& downloadProxy) > { >+#if USE(SYSTEM_PREVIEW) >+ if (downloadProxy.isSystemPreviewDownload()) { >+ if (auto* webPage = downloadProxy.originatingPage()) >+ webPage->systemPreviewController()->cancel(); >+ if (m_activityToken) >+ releaseActivityToken(downloadProxy); >+ return; >+ } >+#endif >+ > if (m_delegateMethods.downloadDidCancel) > [m_delegate _downloadDidCancel:wrapper(downloadProxy)]; > } >@@ -184,6 +278,15 @@ void DownloadClient::willSendRequest(WebProcessPool&, DownloadProxy& downloadPro > completionHandler(WTFMove(request)); > } > >+#if PLATFORM(IOS) && USE(SYSTEM_PREVIEW) >+void DownloadClient::releaseActivityToken(DownloadProxy& downloadProxy) >+{ >+ RELEASE_LOG_IF(downloadProxy.originatingPage()->isAlwaysOnLoggingAllowed(), ProcessSuspension, "%p UIProcess is releasing a background assertion because a system preview download completed", this); >+ ASSERT(m_activityToken); >+ m_activityToken = nullptr; >+} >+#endif >+ > } // namespace WebKit > > #endif // WK_API_ENABLED >diff --git a/Source/WebKit/UIProcess/Cocoa/SystemPreviewControllerCocoa.mm b/Source/WebKit/UIProcess/Cocoa/SystemPreviewControllerCocoa.mm >index d23a22e0cba31d3e5e29188ee1537442b5870e86..4baaeba54a66015f22c02ceb42655ff8efc82850 100644 >--- a/Source/WebKit/UIProcess/Cocoa/SystemPreviewControllerCocoa.mm >+++ b/Source/WebKit/UIProcess/Cocoa/SystemPreviewControllerCocoa.mm >@@ -31,8 +31,10 @@ > #import "APIUIClient.h" > #import "WebPageProxy.h" > >+#import <MobileCoreServices/MobileCoreServices.h> > #import <QuickLook/QuickLook.h> > #import <UIKit/UIViewController.h> >+#import <pal/spi/ios/QuickLookSPI.h> > #import <wtf/SoftLinking.h> > > #if USE(APPLE_INTERNAL_SDK) >@@ -41,22 +43,27 @@ > > SOFT_LINK_FRAMEWORK(QuickLook) > SOFT_LINK_CLASS(QuickLook, QLPreviewController); >+SOFT_LINK_CLASS(QuickLook, QLItem); > > @interface _WKPreviewControllerDataSource : NSObject <QLPreviewControllerDataSource> { >+ RetainPtr<NSItemProvider> _itemProvider; >+ RetainPtr<QLItem> _item; > }; > >-@property (nonatomic) WebCore::URL url; >+@property (strong) NSItemProviderCompletionHandler completionHandler; >+@property (retain) NSString *mimeType; > > @end > > @implementation _WKPreviewControllerDataSource > >-- (id)initWithURL:(const WebCore::URL&)url >+- (id)initWithMIMEType:(NSString*)mimeType > { > if (!(self = [super init])) > return nil; > >- self.url = url; >+ self.mimeType = mimeType; >+ > return self; > } > >@@ -67,7 +74,33 @@ SOFT_LINK_CLASS(QuickLook, QLPreviewController); > > - (id<QLPreviewItem>)previewController:(QLPreviewController *)controller previewItemAtIndex:(NSInteger)index > { >- return (NSURL*)self.url; >+ if (!_item) { >+ _itemProvider = adoptNS([[NSItemProvider alloc] init]); >+ NSString *contentType = @"public.content"; >+#if USE(APPLE_INTERNAL_SDK) >+ contentType = WebKit::getUTIForMIMEType(self.mimeType); >+#endif >+ _item = adoptNS([allocQLItemInstance() initWithPreviewItemProvider:_itemProvider.get() contentType:contentType previewTitle:@"Preview" fileSize:@(0)]); >+ [_item setUseLoadingTimeout:NO]; >+ >+ [_itemProvider registerItemForTypeIdentifier:contentType loadHandler:^(NSItemProviderCompletionHandler completionHandler, Class expectedValueClass, NSDictionary * options) { >+ // This will get called once the download completes. >+ self.completionHandler = completionHandler; >+ }]; >+ } >+ return _item.get(); >+} >+ >+- (void)setProgress:(float)progress >+{ >+ if (_item) >+ [_item setPreviewItemProviderProgress:@(progress)]; >+} >+ >+- (void)finish:(WebCore::URL)url >+{ >+ if (self.completionHandler) >+ self.completionHandler((NSURL*)url, nil); > } > > @end >@@ -88,26 +121,16 @@ SOFT_LINK_CLASS(QuickLook, QLPreviewController); > return self; > } > >-- (void)previewControllerWillDismiss:(QLPreviewController *)controller >+- (void)previewControllerDidDismiss:(QLPreviewController *)controller > { > if (_previewController) >- _previewController->sendPageBack(); >+ _previewController->cancel(); > } > @end > > namespace WebKit { > >-bool SystemPreviewController::canPreview(const String& mimeType) const >-{ >-#if USE(APPLE_INTERNAL_SDK) >- return canShowSystemPreviewForMIMEType(mimeType); >-#else >- UNUSED_PARAM(mimeType); >- return false; >-#endif >-} >- >-void SystemPreviewController::showPreview(const WebCore::URL& url) >+void SystemPreviewController::start(const String& mimeType) > { > // FIXME: Make sure you can't show a preview if we're already previewing. > >@@ -122,16 +145,36 @@ void SystemPreviewController::showPreview(const WebCore::URL& url) > m_qlPreviewControllerDelegate = adoptNS([[_WKPreviewControllerDelegate alloc] initWithSystemPreviewController:this]); > [m_qlPreviewController setDelegate:m_qlPreviewControllerDelegate.get()]; > >- m_qlPreviewControllerDataSource = adoptNS([[_WKPreviewControllerDataSource alloc] initWithURL:url]); >+ m_qlPreviewControllerDataSource = adoptNS([[_WKPreviewControllerDataSource alloc] initWithMIMEType:mimeType]); > [m_qlPreviewController setDataSource:m_qlPreviewControllerDataSource.get()]; >- } else >- m_qlPreviewControllerDataSource.get().url = url; > >- [m_qlPreviewController reloadData]; >+ } > > [presentingViewController presentViewController:m_qlPreviewController.get() animated:YES completion:nullptr]; > } > >+void SystemPreviewController::updateProgress(float progress) >+{ >+ if (m_qlPreviewControllerDataSource) >+ [m_qlPreviewControllerDataSource setProgress:progress]; >+} >+ >+void SystemPreviewController::finish(WebCore::URL url) >+{ >+ if (m_qlPreviewControllerDataSource) >+ [m_qlPreviewControllerDataSource finish:url]; >+} >+ >+void SystemPreviewController::cancel() >+{ >+ if (m_qlPreviewController) >+ [m_qlPreviewController.get() dismissViewControllerAnimated:YES completion:nullptr]; >+ >+ m_qlPreviewControllerDelegate = nullptr; >+ m_qlPreviewControllerDataSource = nullptr; >+ m_qlPreviewController = nullptr; >+} >+ > } > > #endif >diff --git a/Source/WebKit/UIProcess/Downloads/DownloadProxy.h b/Source/WebKit/UIProcess/Downloads/DownloadProxy.h >index f258633c60fa67329307162965920d57cc838ed6..903bc5634b74f5199a34f16212f7f4cefe7f64e7 100644 >--- a/Source/WebKit/UIProcess/Downloads/DownloadProxy.h >+++ b/Source/WebKit/UIProcess/Downloads/DownloadProxy.h >@@ -80,6 +80,19 @@ public: > void setWasUserInitiated(bool value) { m_wasUserInitiated = value; } > bool wasUserInitiated() const { return m_wasUserInitiated; } > >+ String destinationFilename() const { return m_destinationFilename; } >+ void setDestinationFilename(const String& d) { m_destinationFilename = d; } >+ >+ uint64_t expectedContentLength() const { return m_expectedContentLength; } >+ void setExpectedContentLength(uint64_t expectedContentLength) { m_expectedContentLength = expectedContentLength; } >+ >+ uint64_t bytesLoaded() const { return m_bytesLoaded; } >+ void setBytesLoaded(uint64_t bytesLoaded) { m_bytesLoaded = bytesLoaded; } >+ >+#if USE(SYSTEM_PREVIEW) >+ bool isSystemPreviewDownload() const { return request().isSystemPreview(); } >+#endif >+ > private: > explicit DownloadProxy(DownloadProxyMap&, WebProcessPool&, const WebCore::ResourceRequest&); > >@@ -106,6 +119,9 @@ private: > RefPtr<API::Data> m_resumeData; > WebCore::ResourceRequest m_request; > String m_suggestedFilename; >+ String m_destinationFilename; >+ uint64_t m_expectedContentLength { 0 }; >+ uint64_t m_bytesLoaded { 0 }; > > WeakPtr<WebPageProxy> m_originatingPage; > Vector<WebCore::URL> m_redirectChain; >diff --git a/Source/WebKit/UIProcess/SystemPreviewController.cpp b/Source/WebKit/UIProcess/SystemPreviewController.cpp >index d45b819cd4b073902251690dc5f26d17767af69a..c7212dc7d0ea578988308d8cb087def9d05611a9 100644 >--- a/Source/WebKit/UIProcess/SystemPreviewController.cpp >+++ b/Source/WebKit/UIProcess/SystemPreviewController.cpp >@@ -26,8 +26,14 @@ > #include "config.h" > #include "SystemPreviewController.h" > >+#if USE(SYSTEM_PREVIEW) >+ > #include "WebPageProxy.h" > >+#if USE(APPLE_INTERNAL_SDK) >+#import <WebKitAdditions/SystemPreviewTypes.cpp> >+#endif >+ > namespace WebKit { > > SystemPreviewController::SystemPreviewController(WebPageProxy& webPageProxy) >@@ -35,20 +41,16 @@ SystemPreviewController::SystemPreviewController(WebPageProxy& webPageProxy) > { > } > >-void SystemPreviewController::sendPageBack() >-{ >- m_webPageProxy.goBack(); >-} >- >-#if !PLATFORM(IOS) || !USE(QUICK_LOOK) >-bool SystemPreviewController::canPreview(const String&) const >+bool SystemPreviewController::canPreview(const String& mimeType) const > { >+#if USE(APPLE_INTERNAL_SDK) >+ return canShowSystemPreviewForMIMEType(mimeType); >+#else >+ UNUSED_PARAM(mimeType); > return false; >+#endif > } > >-void SystemPreviewController::showPreview(const WebCore::URL&) >-{ > } >-#endif > >-} >+#endif >diff --git a/Source/WebKit/UIProcess/SystemPreviewController.h b/Source/WebKit/UIProcess/SystemPreviewController.h >index 8141810702e6f0d0ce7e4750b01d11c54ac27274..f9d4c9a883140305aa8259f43f42e1928e49221b 100644 >--- a/Source/WebKit/UIProcess/SystemPreviewController.h >+++ b/Source/WebKit/UIProcess/SystemPreviewController.h >@@ -25,10 +25,12 @@ > > #pragma once > >+#if USE(SYSTEM_PREVIEW) >+ > #include <WebCore/URL.h> > #include <wtf/RetainPtr.h> > >-#if PLATFORM(IOS) && USE(QUICK_LOOK) >+#if USE(QUICK_LOOK) > OBJC_CLASS QLPreviewController; > OBJC_CLASS _WKPreviewControllerDataSource; > OBJC_CLASS _WKPreviewControllerDelegate; >@@ -43,14 +45,15 @@ public: > explicit SystemPreviewController(WebPageProxy&); > > bool canPreview(const String& mimeType) const; >- void showPreview(const WebCore::URL&); > >- void sendPageBack(); >+ void start(const String& mimeType); >+ void updateProgress(float); >+ void finish(WebCore::URL); >+ void cancel(); > > private: > WebPageProxy& m_webPageProxy; >- >-#if PLATFORM(IOS) && USE(QUICK_LOOK) >+#if USE(QUICK_LOOK) > RetainPtr<QLPreviewController> m_qlPreviewController; > RetainPtr<_WKPreviewControllerDelegate> m_qlPreviewControllerDelegate; > RetainPtr<_WKPreviewControllerDataSource> m_qlPreviewControllerDataSource; >@@ -59,3 +62,4 @@ private: > > } > >+#endif >diff --git a/Source/WebKit/UIProcess/WebPageProxy.cpp b/Source/WebKit/UIProcess/WebPageProxy.cpp >index d7df4cf81669d23ec70f89f1a4e87d4fa4092aaf..9b568259d43a9f1a63531920c65d5e4a80e657ed 100644 >--- a/Source/WebKit/UIProcess/WebPageProxy.cpp >+++ b/Source/WebKit/UIProcess/WebPageProxy.cpp >@@ -438,7 +438,9 @@ WebPageProxy::WebPageProxy(PageClient& pageClient, WebProcessProxy& process, uin > m_paymentCoordinator = std::make_unique<WebPaymentCoordinatorProxy>(*this); > #endif > >+#if USE(SYSTEM_PREVIEW) > m_systemPreviewController = std::make_unique<SystemPreviewController>(*this); >+#endif > > #if ENABLE(WEB_AUTHN) > m_credentialsMessenger = std::make_unique<WebCredentialsMessengerProxy>(*this); >@@ -750,7 +752,9 @@ void WebPageProxy::reattachToWebProcess(Ref<WebProcessProxy>&& process, API::Nav > m_paymentCoordinator = std::make_unique<WebPaymentCoordinatorProxy>(*this); > #endif > >+#if USE(SYSTEM_PREVIEW) > m_systemPreviewController = std::make_unique<SystemPreviewController>(*this); >+#endif > > #if ENABLE(WEB_AUTHN) > m_credentialsMessenger = std::make_unique<WebCredentialsMessengerProxy>(*this); >@@ -5926,7 +5930,9 @@ void WebPageProxy::resetState(ResetStateReason resetStateReason) > m_paymentCoordinator = nullptr; > #endif > >+#if USE(SYSTEM_PREVIEW) > m_systemPreviewController = nullptr; >+#endif > > #if ENABLE(WEB_AUTHN) > m_credentialsMessenger = nullptr; >diff --git a/Source/WebKit/UIProcess/WebPageProxy.h b/Source/WebKit/UIProcess/WebPageProxy.h >index b0f98675be6df376e745181396540b9f8b1e07e2..f59d58d5173ef662cc74c4912b385c294a968356 100644 >--- a/Source/WebKit/UIProcess/WebPageProxy.h >+++ b/Source/WebKit/UIProcess/WebPageProxy.h >@@ -391,7 +391,9 @@ public: > void setAllowsMediaDocumentInlinePlayback(bool); > #endif > >+#if USE(SYSTEM_PREVIEW) > SystemPreviewController* systemPreviewController() { return m_systemPreviewController.get(); } >+#endif > > #if ENABLE(CONTEXT_MENUS) > API::ContextMenuClient& contextMenuClient() { return *m_contextMenuClient; } >@@ -1852,7 +1854,9 @@ private: > std::unique_ptr<WebPaymentCoordinatorProxy> m_paymentCoordinator; > #endif > >+#if USE(SYSTEM_PREVIEW) > std::unique_ptr<SystemPreviewController> m_systemPreviewController; >+#endif > > #if ENABLE(WEB_AUTHN) > std::unique_ptr<WebCredentialsMessengerProxy> m_credentialsMessenger;
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 185459
:
339909
|
340378
| 340400