source: webkit/trunk/Source/WebCore/testing/MockPreviewLoaderClient.cpp

Last change on this file was 214266, checked in by [email protected], 8 years ago

[QuickLook] Rename QuickLookHandle to PreviewLoader
https://bugs.webkit.org/show_bug.cgi?id=169961

Reviewed by Andreas Kling.

Source/WebCore:

  • WebCore.xcodeproj/project.pbxproj:
  • loader/EmptyClients.cpp:
  • loader/FrameLoaderClient.h:
  • loader/ResourceLoader.cpp:

(WebCore::ResourceLoader::isQuickLookResource):

  • loader/ResourceLoader.h:
  • loader/SubresourceLoader.cpp:

(WebCore::SubresourceLoader::shouldCreatePreviewLoaderForResponse):
(WebCore::SubresourceLoader::didReceiveResponse):
(WebCore::SubresourceLoader::didReceiveData):
(WebCore::SubresourceLoader::didReceiveBuffer):
(WebCore::SubresourceLoader::didFinishLoading):
(WebCore::SubresourceLoader::didFail):
(WebCore::SubresourceLoader::shouldCreateQuickLookHandleForResponse): Deleted.

  • loader/SubresourceLoader.h:
  • loader/ios/PreviewLoader.h: Copied from Source/WebCore/loader/ios/QuickLook.h.
  • loader/ios/PreviewLoader.mm: Added.

(testingClient):
(emptyClient):
(-[WebPreviewLoader initWithResourceLoader:resourceResponse:]):
(-[WebPreviewLoader appendDataArray:]):
(-[WebPreviewLoader finishedAppending]):
(-[WebPreviewLoader failed]):
(-[WebPreviewLoader _sendDidReceiveResponseIfNecessary]):
(-[WebPreviewLoader connection:didReceiveData:lengthReceived:]):
(-[WebPreviewLoader connectionDidFinishLoading:]):
(isQuickLookPasswordError):
(-[WebPreviewLoader connection:didFailWithError:]):
(WebCore::PreviewLoader::PreviewLoader):
(WebCore::PreviewLoader::~PreviewLoader):
(WebCore::PreviewLoader::shouldCreateForMIMEType):
(WebCore::PreviewLoader::create):
(WebCore::PreviewLoader::didReceiveData):
(WebCore::PreviewLoader::didReceiveBuffer):
(WebCore::PreviewLoader::didFinishLoading):
(WebCore::PreviewLoader::didFail):
(WebCore::PreviewLoader::setClientForTesting):

  • loader/ios/QuickLook.h:

(): Deleted.

  • loader/ios/QuickLook.mm:

(WebCore::QLPreviewGetSupportedMIMETypesSet):
(WebCore::removeQLPreviewConverterForURL):
(WebCore::registerQLPreviewConverterIfNeeded):
(WebCore::QLPreviewProtocol):
(WebCore::isQuickLookPreviewURL):
(qlPreviewConverterDictionaryMutex): Deleted.
(QLPreviewConverterDictionary): Deleted.
(QLContentDictionary): Deleted.
(addQLPreviewConverterWithFileForURL): Deleted.
(createQLPreviewProtocol): Deleted.
(testingClient): Deleted.
(emptyClient): Deleted.
(-[WebPreviewLoader initWithResourceLoader:resourceResponse:quickLookHandle:]): Deleted.
(-[WebPreviewLoader appendDataArray:]): Deleted.
(-[WebPreviewLoader finishedAppending]): Deleted.
(-[WebPreviewLoader failed]): Deleted.
(-[WebPreviewLoader _sendDidReceiveResponseIfNecessary]): Deleted.
(-[WebPreviewLoader connection:didReceiveData:lengthReceived:]): Deleted.
(-[WebPreviewLoader connectionDidFinishLoading:]): Deleted.
(isQuickLookPasswordError): Deleted.
(-[WebPreviewLoader connection:didFailWithError:]): Deleted.
(WebCore::QuickLookHandle::QuickLookHandle): Deleted.
(WebCore::QuickLookHandle::~QuickLookHandle): Deleted.
(WebCore::QuickLookHandle::shouldCreateForMIMEType): Deleted.
(WebCore::QuickLookHandle::create): Deleted.
(WebCore::QuickLookHandle::didReceiveData): Deleted.
(WebCore::QuickLookHandle::didReceiveBuffer): Deleted.
(WebCore::QuickLookHandle::didFinishLoading): Deleted.
(WebCore::QuickLookHandle::didFail): Deleted.
(WebCore::QuickLookHandle::setClientForTesting): Deleted.

  • platform/network/ResourceHandle.h:
  • platform/network/ios/PreviewLoaderClient.h: Renamed from Source/WebCore/platform/network/ios/QuickLookHandleClient.h.

(WebCore::PreviewLoaderClient::~PreviewLoaderClient):

  • testing/Internals.cpp:

(WebCore::Internals::resetToConsistentState):
(WebCore::Internals::setQuickLookPassword):

  • testing/MockPreviewLoaderClient.cpp: Renamed from Source/WebCore/testing/MockQuickLookHandleClient.cpp.

(WebCore::MockPreviewLoaderClient::singleton):
(WebCore::MockPreviewLoaderClient::didRequestPassword):

  • testing/MockPreviewLoaderClient.h: Renamed from Source/WebCore/testing/MockQuickLookHandleClient.h.

Source/WebKit/mac:

  • WebCoreSupport/WebFrameLoaderClient.h:
  • WebCoreSupport/WebFrameLoaderClient.mm:

(WebFrameLoaderClient::createPreviewLoaderClient):
(WebFrameLoaderClient::createQuickLookHandleClient): Deleted.

Source/WebKit2:

  • WebKit2.xcodeproj/project.pbxproj:
  • WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
  • WebProcess/WebCoreSupport/ios/WebFrameLoaderClientIOS.mm:

(WebKit::WebFrameLoaderClient::createPreviewLoaderClient):
(WebKit::WebFrameLoaderClient::createQuickLookHandleClient): Deleted.

  • WebProcess/WebCoreSupport/ios/WebPreviewLoaderClient.cpp: Renamed from Source/WebKit2/WebProcess/WebCoreSupport/ios/WebQuickLookHandleClient.cpp.

(WebKit::WebPreviewLoaderClient::WebPreviewLoaderClient):
(WebKit::WebPreviewLoaderClient::~WebPreviewLoaderClient):
(WebKit::WebPreviewLoaderClient::didReceiveDataArray):
(WebKit::WebPreviewLoaderClient::didFinishLoading):
(WebKit::WebPreviewLoaderClient::didFail):
(WebKit::WebPreviewLoaderClient::didRequestPassword):
(WebKit::WebPreviewLoaderClient::didReceivePassword):

  • WebProcess/WebCoreSupport/ios/WebPreviewLoaderClient.h: Renamed from Source/WebKit2/WebProcess/WebCoreSupport/ios/WebQuickLookHandleClient.h.
  • WebProcess/WebPage/ios/WebPageIOS.mm:

(WebKit::WebPage::didReceivePasswordForQuickLookDocument):

File size: 2.0 KB
Line 
1/*
2 * Copyright (C) 2017 Apple Inc. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 *
13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23 * THE POSSIBILITY OF SUCH DAMAGE.
24 */
25
26#include "config.h"
27#include "MockPreviewLoaderClient.h"
28
29#if USE(QUICK_LOOK)
30
31#include <wtf/MainThread.h>
32#include <wtf/RunLoop.h>
33
34namespace WebCore {
35
36MockPreviewLoaderClient& MockPreviewLoaderClient::singleton()
37{
38 static NeverDestroyed<MockPreviewLoaderClient> sharedClient;
39 return sharedClient.get();
40}
41
42void MockPreviewLoaderClient::didRequestPassword(Function<void(const String&)>&& completionHandler)
43{
44 ASSERT(isMainThread());
45 RunLoop::current().dispatch([completionHandler = WTFMove(completionHandler), password = m_password] {
46 completionHandler(password);
47 });
48}
49
50} // namespace WebCore
51
52#endif // USE(QUICK_LOOK)
Note: See TracBrowser for help on using the repository browser.