Diff
Modified: trunk/Source/WebCore/ChangeLog (231794 => 231795)
--- trunk/Source/WebCore/ChangeLog 2018-05-15 08:59:53 UTC (rev 231794)
+++ trunk/Source/WebCore/ChangeLog 2018-05-15 09:50:07 UTC (rev 231795)
@@ -1,3 +1,16 @@
+2018-05-14 Dean Jackson <[email protected]>
+
+ Download and present System Preview
+ https://bugs.webkit.org/show_bug.cgi?id=185459
+ <rdar://problem/40079228>
+
+ Reviewed by Tim Horton.
+
+ If an <a> is a system preview, tell the resource request about it.
+
+ * html/HTMLAnchorElement.cpp:
+ (WebCore::HTMLAnchorElement::handleClick):
+
2018-05-15 Antti Koivisto <[email protected]>
animation-play-state: paused causes very high cpu load because of style invalidation loop
Modified: trunk/Source/WebCore/html/HTMLAnchorElement.cpp (231794 => 231795)
--- trunk/Source/WebCore/html/HTMLAnchorElement.cpp 2018-05-15 08:59:53 UTC (rev 231794)
+++ trunk/Source/WebCore/html/HTMLAnchorElement.cpp 2018-05-15 09:50:07 UTC (rev 231795)
@@ -418,6 +418,10 @@
#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);
Modified: trunk/Source/WebKit/ChangeLog (231794 => 231795)
--- trunk/Source/WebKit/ChangeLog 2018-05-15 08:59:53 UTC (rev 231794)
+++ trunk/Source/WebKit/ChangeLog 2018-05-15 09:50:07 UTC (rev 231795)
@@ -1,3 +1,72 @@
+2018-05-14 Dean Jackson <[email protected]>
+
+ Download and present System Preview
+ https://bugs.webkit.org/show_bug.cgi?id=185459
+ <rdar://problem/40079228>
+
+ Reviewed by Tim Horton.
+
+ 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-14 Brady Eidson <[email protected]>
Add an API test to guard against regressions while re-entering setDefersLoading:.
Modified: trunk/Source/WebKit/UIProcess/Cocoa/DownloadClient.h (231794 => 231795)
--- trunk/Source/WebKit/UIProcess/Cocoa/DownloadClient.h 2018-05-15 08:59:53 UTC (rev 231794)
+++ trunk/Source/WebKit/UIProcess/Cocoa/DownloadClient.h 2018-05-15 09:50:07 UTC (rev 231795)
@@ -30,6 +30,7 @@
#if WK_API_ENABLED
#import "APIDownloadClient.h"
+#import "ProcessThrottler.h"
#import "WeakObjCPtr.h"
@protocol _WKDownloadDelegate;
@@ -59,6 +60,10 @@
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 @@
bool downloadDidCreateDestination : 1;
bool downloadProcessDidCrash : 1;
} m_delegateMethods;
+
+#if PLATFORM(IOS) && USE(SYSTEM_PREVIEW)
+ ProcessThrottler::BackgroundActivityToken m_activityToken;
+#endif
};
} // namespace WebKit
Modified: trunk/Source/WebKit/UIProcess/Cocoa/DownloadClient.mm (231794 => 231795)
--- trunk/Source/WebKit/UIProcess/Cocoa/DownloadClient.mm 2018-05-15 08:59:53 UTC (rev 231794)
+++ trunk/Source/WebKit/UIProcess/Cocoa/DownloadClient.mm 2018-05-15 09:50:07 UTC (rev 231795)
@@ -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,6 +74,17 @@
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)];
}
@@ -75,6 +91,18 @@
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()];
}
@@ -81,6 +109,15 @@
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];
}
@@ -87,6 +124,7 @@
void DownloadClient::didReceiveAuthenticationChallenge(WebProcessPool&, DownloadProxy& downloadProxy, AuthenticationChallengeProxy& authenticationChallenge)
{
+ // FIXME: System Preview needs code here.
if (!m_delegateMethods.downloadDidReceiveAuthenticationChallengeCompletionHandler) {
authenticationChallenge.listener()->performDefaultHandling();
return;
@@ -126,6 +164,13 @@
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];
}
@@ -132,6 +177,14 @@
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)];
}
@@ -138,6 +191,15 @@
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,6 +222,18 @@
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)];
}
@@ -166,6 +240,16 @@
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()];
}
@@ -172,6 +256,16 @@
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 @@
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
Modified: trunk/Source/WebKit/UIProcess/Cocoa/SystemPreviewControllerCocoa.mm (231794 => 231795)
--- trunk/Source/WebKit/UIProcess/Cocoa/SystemPreviewControllerCocoa.mm 2018-05-15 08:59:53 UTC (rev 231794)
+++ trunk/Source/WebKit/UIProcess/Cocoa/SystemPreviewControllerCocoa.mm 2018-05-15 09:50:07 UTC (rev 231795)
@@ -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 = ""
+ self.mimeType = mimeType;
+
return self;
}
@@ -67,9 +74,35 @@
- (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
@interface _WKPreviewControllerDelegate : NSObject <QLPreviewControllerDelegate> {
@@ -88,27 +121,17 @@
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
+void SystemPreviewController::start(const String& mimeType)
{
-#if USE(APPLE_INTERNAL_SDK)
- return canShowSystemPreviewForMIMEType(mimeType);
-#else
- UNUSED_PARAM(mimeType);
- return false;
-#endif
-}
-
-void SystemPreviewController::showPreview(const WebCore::URL& url)
-{
// FIXME: Make sure you can't show a preview if we're already previewing.
UIViewController *presentingViewController = m_webPageProxy.uiClient().presentingViewController();
@@ -122,16 +145,36 @@
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 = ""
- [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
Modified: trunk/Source/WebKit/UIProcess/Downloads/DownloadProxy.h (231794 => 231795)
--- trunk/Source/WebKit/UIProcess/Downloads/DownloadProxy.h 2018-05-15 08:59:53 UTC (rev 231794)
+++ trunk/Source/WebKit/UIProcess/Downloads/DownloadProxy.h 2018-05-15 09:50:07 UTC (rev 231795)
@@ -80,6 +80,19 @@
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 @@
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;
Modified: trunk/Source/WebKit/UIProcess/SystemPreviewController.cpp (231794 => 231795)
--- trunk/Source/WebKit/UIProcess/SystemPreviewController.cpp 2018-05-15 08:59:53 UTC (rev 231794)
+++ trunk/Source/WebKit/UIProcess/SystemPreviewController.cpp 2018-05-15 09:50:07 UTC (rev 231795)
@@ -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 @@
{
}
-void SystemPreviewController::sendPageBack()
+bool SystemPreviewController::canPreview(const String& mimeType) const
{
- m_webPageProxy.goBack();
+#if USE(APPLE_INTERNAL_SDK)
+ return canShowSystemPreviewForMIMEType(mimeType);
+#else
+ UNUSED_PARAM(mimeType);
+ return false;
+#endif
}
-#if !PLATFORM(IOS) || !USE(QUICK_LOOK)
-bool SystemPreviewController::canPreview(const String&) const
-{
- return false;
}
-void SystemPreviewController::showPreview(const WebCore::URL&)
-{
-}
#endif
-
-}
Modified: trunk/Source/WebKit/UIProcess/SystemPreviewController.h (231794 => 231795)
--- trunk/Source/WebKit/UIProcess/SystemPreviewController.h 2018-05-15 08:59:53 UTC (rev 231794)
+++ trunk/Source/WebKit/UIProcess/SystemPreviewController.h 2018-05-15 09:50:07 UTC (rev 231795)
@@ -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 @@
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 @@
}
+#endif
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (231794 => 231795)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2018-05-15 08:59:53 UTC (rev 231794)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2018-05-15 09:50:07 UTC (rev 231795)
@@ -438,7 +438,9 @@
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 @@
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);
@@ -5942,7 +5946,9 @@
m_paymentCoordinator = nullptr;
#endif
+#if USE(SYSTEM_PREVIEW)
m_systemPreviewController = nullptr;
+#endif
#if ENABLE(WEB_AUTHN)
m_credentialsMessenger = nullptr;
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.h (231794 => 231795)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.h 2018-05-15 08:59:53 UTC (rev 231794)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.h 2018-05-15 09:50:07 UTC (rev 231795)
@@ -391,7 +391,9 @@
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; }
@@ -1854,7 +1856,9 @@
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;