summaryrefslogtreecommitdiff
path: root/Source/WebKit2/WebProcess/WebCoreSupport
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebKit2/WebProcess/WebCoreSupport')
-rw-r--r--Source/WebKit2/WebProcess/WebCoreSupport/SessionStateConversion.cpp198
-rw-r--r--Source/WebKit2/WebProcess/WebCoreSupport/SessionStateConversion.h (renamed from Source/WebKit2/WebProcess/WebCoreSupport/WebBatteryClient.h)36
-rw-r--r--Source/WebKit2/WebProcess/WebCoreSupport/WebAlternativeTextClient.h20
-rw-r--r--Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp863
-rw-r--r--Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h381
-rw-r--r--Source/WebKit2/WebProcess/WebCoreSupport/WebColorChooser.cpp8
-rw-r--r--Source/WebKit2/WebProcess/WebCoreSupport/WebColorChooser.h6
-rw-r--r--Source/WebKit2/WebProcess/WebCoreSupport/WebContextMenuClient.cpp25
-rw-r--r--Source/WebKit2/WebProcess/WebCoreSupport/WebContextMenuClient.h29
-rw-r--r--Source/WebKit2/WebProcess/WebCoreSupport/WebDatabaseManager.cpp167
-rw-r--r--Source/WebKit2/WebProcess/WebCoreSupport/WebDatabaseManager.h80
-rw-r--r--Source/WebKit2/WebProcess/WebCoreSupport/WebDatabaseManager.messages.in34
-rw-r--r--Source/WebKit2/WebProcess/WebCoreSupport/WebDeviceProximityClient.cpp (renamed from Source/WebKit2/WebProcess/WebCoreSupport/WebBatteryClient.cpp)36
-rw-r--r--Source/WebKit2/WebProcess/WebCoreSupport/WebDeviceProximityClient.h (renamed from Source/WebKit2/WebProcess/WebCoreSupport/WebNetworkInfoClient.h)43
-rw-r--r--Source/WebKit2/WebProcess/WebCoreSupport/WebDiagnosticLoggingClient.cpp86
-rw-r--r--Source/WebKit2/WebProcess/WebCoreSupport/WebDiagnosticLoggingClient.h52
-rw-r--r--Source/WebKit2/WebProcess/WebCoreSupport/WebDragClient.cpp10
-rw-r--r--Source/WebKit2/WebProcess/WebCoreSupport/WebDragClient.h19
-rw-r--r--Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp224
-rw-r--r--Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.h209
-rw-r--r--Source/WebKit2/WebProcess/WebCoreSupport/WebErrors.h11
-rw-r--r--Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp795
-rw-r--r--Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.h347
-rw-r--r--Source/WebKit2/WebProcess/WebCoreSupport/WebGeolocationClient.cpp8
-rw-r--r--Source/WebKit2/WebProcess/WebCoreSupport/WebGeolocationClient.h14
-rw-r--r--Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorClient.cpp185
-rw-r--r--Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorClient.h74
-rw-r--r--Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorFrontendClient.cpp122
-rw-r--r--Source/WebKit2/WebProcess/WebCoreSupport/WebNavigatorContentUtilsClient.h (renamed from Source/WebKit2/WebProcess/WebCoreSupport/WebNetworkInfoClient.cpp)53
-rw-r--r--Source/WebKit2/WebProcess/WebCoreSupport/WebNotificationClient.cpp21
-rw-r--r--Source/WebKit2/WebProcess/WebCoreSupport/WebNotificationClient.h19
-rw-r--r--Source/WebKit2/WebProcess/WebCoreSupport/WebPasteboardOverrides.cpp111
-rw-r--r--Source/WebKit2/WebProcess/WebCoreSupport/WebPasteboardOverrides.h (renamed from Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorFrontendClient.h)51
-rw-r--r--Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp450
-rw-r--r--Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.h132
-rw-r--r--Source/WebKit2/WebProcess/WebCoreSupport/WebPlugInClient.cpp11
-rw-r--r--Source/WebKit2/WebProcess/WebCoreSupport/WebPlugInClient.h12
-rw-r--r--Source/WebKit2/WebProcess/WebCoreSupport/WebPopupMenu.cpp8
-rw-r--r--Source/WebKit2/WebProcess/WebCoreSupport/WebPopupMenu.h11
-rw-r--r--Source/WebKit2/WebProcess/WebCoreSupport/WebProgressTrackerClient.cpp9
-rw-r--r--Source/WebKit2/WebProcess/WebCoreSupport/WebProgressTrackerClient.h8
-rw-r--r--Source/WebKit2/WebProcess/WebCoreSupport/WebSearchPopupMenu.cpp12
-rw-r--r--Source/WebKit2/WebProcess/WebCoreSupport/WebSearchPopupMenu.h10
-rw-r--r--Source/WebKit2/WebProcess/WebCoreSupport/WebUserMediaClient.cpp65
-rw-r--r--Source/WebKit2/WebProcess/WebCoreSupport/WebUserMediaClient.h52
-rw-r--r--Source/WebKit2/WebProcess/WebCoreSupport/WebValidationMessageClient.cpp103
-rw-r--r--Source/WebKit2/WebProcess/WebCoreSupport/WebValidationMessageClient.h54
-rw-r--r--Source/WebKit2/WebProcess/WebCoreSupport/WebVibrationClient.cpp4
-rw-r--r--Source/WebKit2/WebProcess/WebCoreSupport/WebVibrationClient.h6
-rw-r--r--Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebDragClientGtk.cpp23
-rw-r--r--Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebEditorClientGtk.cpp114
-rw-r--r--Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebErrorsGtk.cpp9
-rw-r--r--Source/WebKit2/WebProcess/WebCoreSupport/soup/WebFrameNetworkingContext.cpp46
-rw-r--r--Source/WebKit2/WebProcess/WebCoreSupport/soup/WebFrameNetworkingContext.h16
54 files changed, 3057 insertions, 2435 deletions
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/SessionStateConversion.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/SessionStateConversion.cpp
new file mode 100644
index 000000000..28f757ffe
--- /dev/null
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/SessionStateConversion.cpp
@@ -0,0 +1,198 @@
+/*
+ * Copyright (C) 2014 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 "SessionStateConversion.h"
+
+#include "SessionState.h"
+#include <WebCore/BlobData.h>
+#include <WebCore/FormData.h>
+#include <WebCore/HistoryItem.h>
+
+using namespace WebCore;
+
+namespace WebKit {
+
+static HTTPBody toHTTPBody(const FormData& formData)
+{
+ HTTPBody httpBody;
+
+ for (const auto& formDataElement : formData.elements()) {
+ HTTPBody::Element element;
+
+ switch (formDataElement.m_type) {
+ case FormDataElement::Type::Data:
+ element.type = HTTPBody::Element::Type::Data;
+ element.data = formDataElement.m_data;
+ break;
+
+ case FormDataElement::Type::EncodedFile:
+ element.filePath = formDataElement.m_filename;
+ element.fileStart = formDataElement.m_fileStart;
+ if (formDataElement.m_fileLength != BlobDataItem::toEndOfFile)
+ element.fileLength = formDataElement.m_fileLength;
+ if (formDataElement.m_expectedFileModificationTime != invalidFileTime())
+ element.expectedFileModificationTime = formDataElement.m_expectedFileModificationTime;
+ break;
+
+ case FormDataElement::Type::EncodedBlob:
+ element.blobURLString = formDataElement.m_url.string();
+ break;
+ }
+
+ httpBody.elements.append(WTFMove(element));
+ }
+
+ return httpBody;
+}
+
+static FrameState toFrameState(const HistoryItem& historyItem)
+{
+ FrameState frameState;
+
+ frameState.urlString = historyItem.urlString();
+ frameState.originalURLString = historyItem.originalURLString();
+ frameState.referrer = historyItem.referrer();
+ frameState.target = historyItem.target();
+
+ frameState.documentState = historyItem.documentState();
+ if (RefPtr<SerializedScriptValue> stateObject = historyItem.stateObject())
+ frameState.stateObjectData = stateObject->data();
+
+ frameState.documentSequenceNumber = historyItem.documentSequenceNumber();
+ frameState.itemSequenceNumber = historyItem.itemSequenceNumber();
+
+ frameState.scrollPosition = historyItem.scrollPosition();
+ frameState.pageScaleFactor = historyItem.pageScaleFactor();
+
+ if (FormData* formData = const_cast<HistoryItem&>(historyItem).formData()) {
+ HTTPBody httpBody = toHTTPBody(*formData);
+ httpBody.contentType = historyItem.formContentType();
+
+ frameState.httpBody = WTFMove(httpBody);
+ }
+
+#if PLATFORM(IOS)
+ frameState.exposedContentRect = historyItem.exposedContentRect();
+ frameState.unobscuredContentRect = historyItem.unobscuredContentRect();
+ frameState.minimumLayoutSizeInScrollViewCoordinates = historyItem.minimumLayoutSizeInScrollViewCoordinates();
+ frameState.contentSize = historyItem.contentSize();
+ frameState.scaleIsInitial = historyItem.scaleIsInitial();
+#endif
+
+ for (auto& childHistoryItem : historyItem.children()) {
+ FrameState childFrameState = toFrameState(childHistoryItem);
+ frameState.children.append(WTFMove(childFrameState));
+ }
+
+ return frameState;
+}
+
+PageState toPageState(const WebCore::HistoryItem& historyItem)
+{
+ PageState pageState;
+
+ pageState.title = historyItem.title();
+ pageState.mainFrameState = toFrameState(historyItem);
+ pageState.shouldOpenExternalURLsPolicy = historyItem.shouldOpenExternalURLsPolicy();
+
+ return pageState;
+}
+
+static PassRefPtr<FormData> toFormData(const HTTPBody& httpBody)
+{
+ auto formData = FormData::create();
+
+ for (const auto& element : httpBody.elements) {
+ switch (element.type) {
+ case HTTPBody::Element::Type::Data:
+ formData->appendData(element.data.data(), element.data.size());
+ break;
+
+ case HTTPBody::Element::Type::File:
+ formData->appendFileRange(element.filePath, element.fileStart, element.fileLength.value_or(BlobDataItem::toEndOfFile), element.expectedFileModificationTime.value_or(invalidFileTime()));
+ break;
+
+ case HTTPBody::Element::Type::Blob:
+ formData->appendBlob(URL(URL(), element.blobURLString));
+ break;
+ }
+ }
+
+ return WTFMove(formData);
+}
+
+static void applyFrameState(HistoryItem& historyItem, const FrameState& frameState)
+{
+ historyItem.setOriginalURLString(frameState.originalURLString);
+ historyItem.setReferrer(frameState.referrer);
+ historyItem.setTarget(frameState.target);
+
+ historyItem.setDocumentState(frameState.documentState);
+
+ if (frameState.stateObjectData) {
+ Vector<uint8_t> stateObjectData = frameState.stateObjectData.value();
+ historyItem.setStateObject(SerializedScriptValue::adopt(WTFMove(stateObjectData)));
+ }
+
+ historyItem.setDocumentSequenceNumber(frameState.documentSequenceNumber);
+ historyItem.setItemSequenceNumber(frameState.itemSequenceNumber);
+
+ historyItem.setScrollPosition(frameState.scrollPosition);
+ historyItem.setPageScaleFactor(frameState.pageScaleFactor);
+
+ if (frameState.httpBody) {
+ const auto& httpBody = frameState.httpBody.value();
+ historyItem.setFormContentType(httpBody.contentType);
+
+ historyItem.setFormData(toFormData(httpBody));
+ }
+
+#if PLATFORM(IOS)
+ historyItem.setExposedContentRect(frameState.exposedContentRect);
+ historyItem.setUnobscuredContentRect(frameState.unobscuredContentRect);
+ historyItem.setMinimumLayoutSizeInScrollViewCoordinates(frameState.minimumLayoutSizeInScrollViewCoordinates);
+ historyItem.setContentSize(frameState.contentSize);
+ historyItem.setScaleIsInitial(frameState.scaleIsInitial);
+#endif
+
+ for (const auto& childFrameState : frameState.children) {
+ Ref<HistoryItem> childHistoryItem = HistoryItem::create(childFrameState.urlString, String());
+ applyFrameState(childHistoryItem, childFrameState);
+
+ historyItem.addChildItem(WTFMove(childHistoryItem));
+ }
+}
+
+Ref<HistoryItem> toHistoryItem(const PageState& pageState)
+{
+ Ref<HistoryItem> historyItem = HistoryItem::create(pageState.mainFrameState.urlString, pageState.title);
+ historyItem->setShouldOpenExternalURLsPolicy(pageState.shouldOpenExternalURLsPolicy);
+ applyFrameState(historyItem, pageState.mainFrameState);
+
+ return historyItem;
+}
+
+} // namespace WebKit
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebBatteryClient.h b/Source/WebKit2/WebProcess/WebCoreSupport/SessionStateConversion.h
index cb94db6aa..bee9d228c 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/WebBatteryClient.h
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/SessionStateConversion.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012 Intel Corporation. All rights reserved.
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -23,36 +23,22 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef WebBatteryClient_h
-#define WebBatteryClient_h
+#ifndef SessionStateConversion_h
+#define SessionStateConversion_h
-#if ENABLE(BATTERY_STATUS)
+#include <wtf/Forward.h>
-#include <WebCore/BatteryClient.h>
+namespace WebCore {
+class HistoryItem;
+};
namespace WebKit {
-class WebPage;
-
-class WebBatteryClient : public WebCore::BatteryClient {
-public:
- WebBatteryClient(WebPage* page)
- : m_page(page)
- {
- }
-
- virtual ~WebBatteryClient() { }
+struct PageState;
-private:
- virtual void startUpdating() override;
- virtual void stopUpdating() override;
- virtual void batteryControllerDestroyed() override;
-
- WebPage* m_page;
-};
+PageState toPageState(const WebCore::HistoryItem&);
+Ref<WebCore::HistoryItem> toHistoryItem(const PageState&);
} // namespace WebKit
-#endif // ENABLE(BATTERY_STATUS)
-
-#endif // WebBatteryClient_h
+#endif // SessionStateConversion_h
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebAlternativeTextClient.h b/Source/WebKit2/WebProcess/WebCoreSupport/WebAlternativeTextClient.h
index 307946ed2..4520e9d69 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/WebAlternativeTextClient.h
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebAlternativeTextClient.h
@@ -10,10 +10,10 @@
* 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 COMPUTER, INC. ``AS IS'' AND ANY
+ * 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 COMPUTER, INC. OR
+ * 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
@@ -37,17 +37,17 @@ class WebAlternativeTextClient : public WebCore::AlternativeTextClient {
public:
WebAlternativeTextClient(WebPage *);
virtual ~WebAlternativeTextClient();
- virtual void pageDestroyed() override;
+ void pageDestroyed() override;
#if USE(AUTOCORRECTION_PANEL)
- virtual void showCorrectionAlternative(WebCore::AlternativeTextType, const WebCore::FloatRect& boundingBoxOfReplacedString, const String& replacedString, const String& replacementString, const Vector<String>& alternativeReplacementStrings) override;
- virtual void dismissAlternative(WebCore::ReasonForDismissingAlternativeText) override;
- virtual String dismissAlternativeSoon(WebCore::ReasonForDismissingAlternativeText) override;
- virtual void recordAutocorrectionResponse(WebCore::AutocorrectionResponseType, const String& replacedString, const String& replacementString) override;
+ void showCorrectionAlternative(WebCore::AlternativeTextType, const WebCore::FloatRect& boundingBoxOfReplacedString, const String& replacedString, const String& replacementString, const Vector<String>& alternativeReplacementStrings) override;
+ void dismissAlternative(WebCore::ReasonForDismissingAlternativeText) override;
+ String dismissAlternativeSoon(WebCore::ReasonForDismissingAlternativeText) override;
+ void recordAutocorrectionResponse(WebCore::AutocorrectionResponse, const String& replacedString, const String& replacementString) override;
#endif
#if USE(DICTATION_ALTERNATIVES)
- virtual void showDictationAlternativeUI(const WebCore::FloatRect& boundingBoxOfDictatedText, uint64_t dictationContext) override;
- virtual void removeDictationAlternatives(uint64_t dictationContext) override;
- virtual Vector<String> dictationAlternatives(uint64_t dictationContext) override;
+ void showDictationAlternativeUI(const WebCore::FloatRect& boundingBoxOfDictatedText, uint64_t dictationContext) override;
+ void removeDictationAlternatives(uint64_t dictationContext) override;
+ Vector<String> dictationAlternatives(uint64_t dictationContext) override;
#endif
private:
#if PLATFORM(IOS)
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp
index 6bf25a642..091280899 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010, 2011, 2012 Apple Inc. All rights reserved.
+ * Copyright (C) 2010-2017 Apple Inc. All rights reserved.
* Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
*
* Redistribution and use in source and binary forms, with or without
@@ -27,31 +27,35 @@
#include "config.h"
#include "WebChromeClient.h"
+#include "APIArray.h"
+#include "APISecurityOrigin.h"
#include "DrawingArea.h"
+#include "HangDetectionDisabler.h"
#include "InjectedBundleNavigationAction.h"
-#include "InjectedBundleUserMessageCoders.h"
-#include "LayerTreeHost.h"
+#include "InjectedBundleNodeHandle.h"
+#include "NavigationActionData.h"
#include "PageBanner.h"
+#include "UserData.h"
#include "WebColorChooser.h"
#include "WebCoreArgumentCoders.h"
#include "WebFrame.h"
#include "WebFrameLoaderClient.h"
#include "WebFullScreenManager.h"
+#include "WebHitTestResultData.h"
#include "WebImage.h"
-#include "WebOpenPanelParameters.h"
#include "WebOpenPanelResultListener.h"
#include "WebPage.h"
#include "WebPageCreationParameters.h"
#include "WebPageProxyMessages.h"
#include "WebPopupMenu.h"
-#include "WebPreferencesStore.h"
#include "WebProcess.h"
+#include "WebProcessPoolMessages.h"
#include "WebProcessProxyMessages.h"
#include "WebSearchPopupMenu.h"
-#include "WebSecurityOrigin.h"
+#include <WebCore/ApplicationCacheStorage.h>
#include <WebCore/AXObjectCache.h>
#include <WebCore/ColorChooser.h>
-#include <WebCore/DatabaseManager.h>
+#include <WebCore/DatabaseTracker.h>
#include <WebCore/DocumentLoader.h>
#include <WebCore/FileChooser.h>
#include <WebCore/FileIconLoader.h>
@@ -66,13 +70,24 @@
#include <WebCore/MainFrame.h>
#include <WebCore/NotImplemented.h>
#include <WebCore/Page.h>
+#include <WebCore/ScriptController.h>
#include <WebCore/SecurityOrigin.h>
+#include <WebCore/SecurityOriginData.h>
#include <WebCore/Settings.h>
+#if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
+#include "WebPlaybackSessionManager.h"
+#include "WebVideoFullscreenManager.h"
+#endif
+
#if ENABLE(ASYNC_SCROLLING)
#include "RemoteScrollingCoordinator.h"
#endif
+#if USE(COORDINATED_GRAPHICS)
+#include "LayerTreeHost.h"
+#endif
+
#if PLATFORM(GTK)
#include "PrinterListGtk.h"
#endif
@@ -88,21 +103,20 @@ static double area(WebFrame* frame)
return static_cast<double>(size.height()) * size.width();
}
-
-static WebFrame* findLargestFrameInFrameSet(WebPage* page)
+static WebFrame* findLargestFrameInFrameSet(WebPage& page)
{
// Approximate what a user could consider a default target frame for application menu operations.
- WebFrame* mainFrame = page->mainWebFrame();
+ WebFrame* mainFrame = page.mainWebFrame();
if (!mainFrame || !mainFrame->isFrameSet())
- return 0;
+ return nullptr;
- WebFrame* largestSoFar = 0;
+ WebFrame* largestSoFar = nullptr;
- RefPtr<API::Array> frameChildren = mainFrame->childFrames();
+ Ref<API::Array> frameChildren = mainFrame->childFrames();
size_t count = frameChildren->size();
for (size_t i = 0; i < count; ++i) {
- WebFrame* childFrame = frameChildren->at<WebFrame>(i);
+ auto* childFrame = frameChildren->at<WebFrame>(i);
if (!largestSoFar || area(childFrame) > area(largestSoFar))
largestSoFar = childFrame;
}
@@ -110,6 +124,15 @@ static WebFrame* findLargestFrameInFrameSet(WebPage* page)
return largestSoFar;
}
+WebChromeClient::WebChromeClient(WebPage& page)
+ : m_page(page)
+{
+}
+
+inline WebChromeClient::~WebChromeClient()
+{
+}
+
void WebChromeClient::chromeDestroyed()
{
delete this;
@@ -117,44 +140,60 @@ void WebChromeClient::chromeDestroyed()
void WebChromeClient::setWindowRect(const FloatRect& windowFrame)
{
- m_page->sendSetWindowFrame(windowFrame);
+ m_page.sendSetWindowFrame(windowFrame);
}
FloatRect WebChromeClient::windowRect()
{
+#if PLATFORM(IOS)
+ return FloatRect();
+#else
#if PLATFORM(MAC)
- if (m_page->hasCachedWindowFrame())
- return m_page->windowFrameInUnflippedScreenCoordinates();
+ if (m_page.hasCachedWindowFrame())
+ return m_page.windowFrameInUnflippedScreenCoordinates();
#endif
FloatRect newWindowFrame;
- if (!WebProcess::shared().parentProcessConnection()->sendSync(Messages::WebPageProxy::GetWindowFrame(), Messages::WebPageProxy::GetWindowFrame::Reply(newWindowFrame), m_page->pageID()))
+ if (!WebProcess::singleton().parentProcessConnection()->sendSync(Messages::WebPageProxy::GetWindowFrame(), Messages::WebPageProxy::GetWindowFrame::Reply(newWindowFrame), m_page.pageID()))
return FloatRect();
return newWindowFrame;
+#endif
}
FloatRect WebChromeClient::pageRect()
{
- return FloatRect(FloatPoint(), m_page->size());
+ return FloatRect(FloatPoint(), m_page.size());
}
void WebChromeClient::focus()
{
- m_page->send(Messages::WebPageProxy::SetFocus(true));
+ m_page.send(Messages::WebPageProxy::SetFocus(true));
}
void WebChromeClient::unfocus()
{
- m_page->send(Messages::WebPageProxy::SetFocus(false));
+ m_page.send(Messages::WebPageProxy::SetFocus(false));
+}
+
+#if PLATFORM(COCOA)
+
+void WebChromeClient::elementDidFocus(Element& element)
+{
+ m_page.elementDidFocus(&element);
+}
+
+void WebChromeClient::elementDidBlur(Element& element)
+{
+ m_page.elementDidBlur(&element);
}
-#if PLATFORM(MAC)
void WebChromeClient::makeFirstResponder()
{
- m_page->send(Messages::WebPageProxy::MakeFirstResponder());
-}
+ m_page.send(Messages::WebPageProxy::MakeFirstResponder());
+}
+
#endif
bool WebChromeClient::canTakeFocus(FocusDirection)
@@ -165,86 +204,96 @@ bool WebChromeClient::canTakeFocus(FocusDirection)
void WebChromeClient::takeFocus(FocusDirection direction)
{
- m_page->send(Messages::WebPageProxy::TakeFocus(direction));
+ m_page.send(Messages::WebPageProxy::TakeFocus(direction));
}
void WebChromeClient::focusedElementChanged(Element* element)
{
- if (!element)
- return;
- if (!isHTMLInputElement(element))
+ if (!is<HTMLInputElement>(element))
return;
- HTMLInputElement* inputElement = toHTMLInputElement(element);
- if (!inputElement->isText())
+ HTMLInputElement& inputElement = downcast<HTMLInputElement>(*element);
+ if (!inputElement.isText())
return;
- WebFrameLoaderClient* webFrameLoaderClient = toWebFrameLoaderClient(element->document().frame()->loader().client());
- WebFrame* webFrame = webFrameLoaderClient ? webFrameLoaderClient->webFrame() : 0;
+ WebFrame* webFrame = WebFrame::fromCoreFrame(*element->document().frame());
ASSERT(webFrame);
- m_page->injectedBundleFormClient().didFocusTextField(m_page, inputElement, webFrame);
+ m_page.injectedBundleFormClient().didFocusTextField(&m_page, &inputElement, webFrame);
}
void WebChromeClient::focusedFrameChanged(Frame* frame)
{
- WebFrameLoaderClient* webFrameLoaderClient = frame ? toWebFrameLoaderClient(frame->loader().client()) : 0;
- WebFrame* webFrame = webFrameLoaderClient ? webFrameLoaderClient->webFrame() : 0;
+ WebFrame* webFrame = frame ? WebFrame::fromCoreFrame(*frame) : nullptr;
- WebProcess::shared().parentProcessConnection()->send(Messages::WebPageProxy::FocusedFrameChanged(webFrame ? webFrame->frameID() : 0), m_page->pageID());
+ WebProcess::singleton().parentProcessConnection()->send(Messages::WebPageProxy::FocusedFrameChanged(webFrame ? webFrame->frameID() : 0), m_page.pageID());
}
-Page* WebChromeClient::createWindow(Frame* frame, const FrameLoadRequest& request, const WindowFeatures& windowFeatures, const NavigationAction& navigationAction)
+Page* WebChromeClient::createWindow(Frame& frame, const FrameLoadRequest& request, const WindowFeatures& windowFeatures, const NavigationAction& navigationAction)
{
- uint32_t modifiers = static_cast<uint32_t>(InjectedBundleNavigationAction::modifiersForNavigationAction(navigationAction));
- int32_t mouseButton = static_cast<int32_t>(InjectedBundleNavigationAction::mouseButtonForNavigationAction(navigationAction));
-
#if ENABLE(FULLSCREEN_API)
- if (frame->document() && frame->document()->webkitCurrentFullScreenElement())
- frame->document()->webkitCancelFullScreen();
-#else
- UNUSED_PARAM(frame);
+ if (frame.document() && frame.document()->webkitCurrentFullScreenElement())
+ frame.document()->webkitCancelFullScreen();
#endif
+ auto& webProcess = WebProcess::singleton();
+
+ WebFrame* webFrame = WebFrame::fromCoreFrame(frame);
+
+ NavigationActionData navigationActionData;
+ navigationActionData.navigationType = navigationAction.type();
+ navigationActionData.modifiers = InjectedBundleNavigationAction::modifiersForNavigationAction(navigationAction);
+ navigationActionData.mouseButton = InjectedBundleNavigationAction::mouseButtonForNavigationAction(navigationAction);
+ navigationActionData.syntheticClickType = InjectedBundleNavigationAction::syntheticClickTypeForNavigationAction(navigationAction);
+ navigationActionData.userGestureTokenIdentifier = webProcess.userGestureTokenIdentifier(navigationAction.userGestureToken());
+ navigationActionData.canHandleRequest = m_page.canHandleRequest(request.resourceRequest());
+ navigationActionData.shouldOpenExternalURLsPolicy = navigationAction.shouldOpenExternalURLsPolicy();
+ navigationActionData.downloadAttribute = navigationAction.downloadAttribute();
+
uint64_t newPageID = 0;
WebPageCreationParameters parameters;
- if (!WebProcess::shared().parentProcessConnection()->sendSync(Messages::WebPageProxy::CreateNewPage(request.resourceRequest(), windowFeatures, modifiers, mouseButton), Messages::WebPageProxy::CreateNewPage::Reply(newPageID, parameters), m_page->pageID()))
- return 0;
+ if (!webProcess.parentProcessConnection()->sendSync(Messages::WebPageProxy::CreateNewPage(webFrame->frameID(), SecurityOriginData::fromFrame(&frame), request.resourceRequest(), windowFeatures, navigationActionData), Messages::WebPageProxy::CreateNewPage::Reply(newPageID, parameters), m_page.pageID()))
+ return nullptr;
if (!newPageID)
- return 0;
+ return nullptr;
- WebProcess::shared().createWebPage(newPageID, parameters);
- return WebProcess::shared().webPage(newPageID)->corePage();
+ webProcess.createWebPage(newPageID, WTFMove(parameters));
+ return webProcess.webPage(newPageID)->corePage();
}
void WebChromeClient::show()
{
- m_page->show();
+ m_page.show();
}
bool WebChromeClient::canRunModal()
{
- return m_page->canRunModal();
+ return m_page.canRunModal();
}
void WebChromeClient::runModal()
{
- m_page->runModal();
+ m_page.runModal();
+}
+
+void WebChromeClient::reportProcessCPUTime(int64_t cpuTime, ActivityStateForCPUSampling activityState)
+{
+ WebProcess::singleton().send(Messages::WebProcessPool::ReportWebContentCPUTime(cpuTime, static_cast<uint64_t>(activityState)), 0);
}
void WebChromeClient::setToolbarsVisible(bool toolbarsAreVisible)
{
- m_page->send(Messages::WebPageProxy::SetToolbarsAreVisible(toolbarsAreVisible));
+ m_page.send(Messages::WebPageProxy::SetToolbarsAreVisible(toolbarsAreVisible));
}
bool WebChromeClient::toolbarsVisible()
{
- WKBundlePageUIElementVisibility toolbarsVisibility = m_page->injectedBundleUIClient().toolbarsAreVisible(m_page);
- if (toolbarsVisibility != WKBundlePageUIElementVisibilityUnknown)
- return toolbarsVisibility == WKBundlePageUIElementVisible;
+ API::InjectedBundle::PageUIClient::UIElementVisibility toolbarsVisibility = m_page.injectedBundleUIClient().toolbarsAreVisible(&m_page);
+ if (toolbarsVisibility != API::InjectedBundle::PageUIClient::UIElementVisibility::Unknown)
+ return toolbarsVisibility == API::InjectedBundle::PageUIClient::UIElementVisibility::Visible;
bool toolbarsAreVisible = true;
- if (!WebProcess::shared().parentProcessConnection()->sendSync(Messages::WebPageProxy::GetToolbarsAreVisible(), Messages::WebPageProxy::GetToolbarsAreVisible::Reply(toolbarsAreVisible), m_page->pageID()))
+ if (!WebProcess::singleton().parentProcessConnection()->sendSync(Messages::WebPageProxy::GetToolbarsAreVisible(), Messages::WebPageProxy::GetToolbarsAreVisible::Reply(toolbarsAreVisible), m_page.pageID()))
return true;
return toolbarsAreVisible;
@@ -252,17 +301,17 @@ bool WebChromeClient::toolbarsVisible()
void WebChromeClient::setStatusbarVisible(bool statusBarIsVisible)
{
- m_page->send(Messages::WebPageProxy::SetStatusBarIsVisible(statusBarIsVisible));
+ m_page.send(Messages::WebPageProxy::SetStatusBarIsVisible(statusBarIsVisible));
}
bool WebChromeClient::statusbarVisible()
{
- WKBundlePageUIElementVisibility statusbarVisibility = m_page->injectedBundleUIClient().statusBarIsVisible(m_page);
- if (statusbarVisibility != WKBundlePageUIElementVisibilityUnknown)
- return statusbarVisibility == WKBundlePageUIElementVisible;
+ API::InjectedBundle::PageUIClient::UIElementVisibility statusbarVisibility = m_page.injectedBundleUIClient().statusBarIsVisible(&m_page);
+ if (statusbarVisibility != API::InjectedBundle::PageUIClient::UIElementVisibility::Unknown)
+ return statusbarVisibility == API::InjectedBundle::PageUIClient::UIElementVisibility::Visible;
bool statusBarIsVisible = true;
- if (!WebProcess::shared().parentProcessConnection()->sendSync(Messages::WebPageProxy::GetStatusBarIsVisible(), Messages::WebPageProxy::GetStatusBarIsVisible::Reply(statusBarIsVisible), m_page->pageID()))
+ if (!WebProcess::singleton().parentProcessConnection()->sendSync(Messages::WebPageProxy::GetStatusBarIsVisible(), Messages::WebPageProxy::GetStatusBarIsVisible::Reply(statusBarIsVisible), m_page.pageID()))
return true;
return statusBarIsVisible;
@@ -281,17 +330,17 @@ bool WebChromeClient::scrollbarsVisible()
void WebChromeClient::setMenubarVisible(bool menuBarVisible)
{
- m_page->send(Messages::WebPageProxy::SetMenuBarIsVisible(menuBarVisible));
+ m_page.send(Messages::WebPageProxy::SetMenuBarIsVisible(menuBarVisible));
}
bool WebChromeClient::menubarVisible()
{
- WKBundlePageUIElementVisibility menubarVisibility = m_page->injectedBundleUIClient().menuBarIsVisible(m_page);
- if (menubarVisibility != WKBundlePageUIElementVisibilityUnknown)
- return menubarVisibility == WKBundlePageUIElementVisible;
+ API::InjectedBundle::PageUIClient::UIElementVisibility menubarVisibility = m_page.injectedBundleUIClient().menuBarIsVisible(&m_page);
+ if (menubarVisibility != API::InjectedBundle::PageUIClient::UIElementVisibility::Unknown)
+ return menubarVisibility == API::InjectedBundle::PageUIClient::UIElementVisibility::Visible;
bool menuBarIsVisible = true;
- if (!WebProcess::shared().parentProcessConnection()->sendSync(Messages::WebPageProxy::GetMenuBarIsVisible(), Messages::WebPageProxy::GetMenuBarIsVisible::Reply(menuBarIsVisible), m_page->pageID()))
+ if (!WebProcess::singleton().parentProcessConnection()->sendSync(Messages::WebPageProxy::GetMenuBarIsVisible(), Messages::WebPageProxy::GetMenuBarIsVisible::Reply(menuBarIsVisible), m_page.pageID()))
return true;
return menuBarIsVisible;
@@ -299,30 +348,29 @@ bool WebChromeClient::menubarVisible()
void WebChromeClient::setResizable(bool resizable)
{
- m_page->send(Messages::WebPageProxy::SetIsResizable(resizable));
+ m_page.send(Messages::WebPageProxy::SetIsResizable(resizable));
}
-void WebChromeClient::addMessageToConsole(MessageSource, MessageLevel, const String& message, unsigned lineNumber, unsigned /*columnNumber*/, const String& /*sourceID*/)
+void WebChromeClient::addMessageToConsole(MessageSource source, MessageLevel level, const String& message, unsigned lineNumber, unsigned columnNumber, const String& sourceID)
{
// Notify the bundle client.
- m_page->injectedBundleUIClient().willAddMessageToConsole(m_page, message, lineNumber);
-
- notImplemented();
+ m_page.injectedBundleUIClient().willAddMessageToConsole(&m_page, source, level, message, lineNumber, columnNumber, sourceID);
}
bool WebChromeClient::canRunBeforeUnloadConfirmPanel()
{
- return m_page->canRunBeforeUnloadConfirmPanel();
+ return m_page.canRunBeforeUnloadConfirmPanel();
}
-bool WebChromeClient::runBeforeUnloadConfirmPanel(const String& message, Frame* frame)
+bool WebChromeClient::runBeforeUnloadConfirmPanel(const String& message, Frame& frame)
{
- WebFrameLoaderClient* webFrameLoaderClient = toWebFrameLoaderClient(frame->loader().client());
- WebFrame* webFrame = webFrameLoaderClient ? webFrameLoaderClient->webFrame() : 0;
- ASSERT(webFrame);
+ WebFrame* webFrame = WebFrame::fromCoreFrame(frame);
bool shouldClose = false;
- if (!WebProcess::shared().parentProcessConnection()->sendSync(Messages::WebPageProxy::RunBeforeUnloadConfirmPanel(message, webFrame->frameID()), Messages::WebPageProxy::RunBeforeUnloadConfirmPanel::Reply(shouldClose), m_page->pageID()))
+
+ HangDetectionDisabler hangDetectionDisabler;
+
+ if (!WebProcess::singleton().parentProcessConnection()->sendSync(Messages::WebPageProxy::RunBeforeUnloadConfirmPanel(message, webFrame->frameID()), Messages::WebPageProxy::RunBeforeUnloadConfirmPanel::Reply(shouldClose), m_page.pageID(), Seconds::infinity(), IPC::SendSyncOption::InformPlatformProcessWillSuspend))
return false;
return shouldClose;
@@ -337,60 +385,74 @@ void WebChromeClient::closeWindowSoon()
// a close execute synchronously as part of window.close, but other parts
// later on.
- m_page->corePage()->setGroupName(String());
+ m_page.corePage()->setGroupName(String());
- if (WebFrame* frame = m_page->mainWebFrame()) {
+ if (WebFrame* frame = m_page.mainWebFrame()) {
if (Frame* coreFrame = frame->coreFrame())
coreFrame->loader().stopForUserCancel();
}
- m_page->sendClose();
+ m_page.sendClose();
}
-void WebChromeClient::runJavaScriptAlert(Frame* frame, const String& alertText)
+static bool shouldSuppressJavaScriptDialogs(Frame& frame)
{
- WebFrameLoaderClient* webFrameLoaderClient = toWebFrameLoaderClient(frame->loader().client());
- WebFrame* webFrame = webFrameLoaderClient ? webFrameLoaderClient->webFrame() : 0;
+ if (frame.loader().opener() && frame.loader().stateMachine().isDisplayingInitialEmptyDocument() && frame.loader().provisionalDocumentLoader())
+ return true;
+
+ return false;
+}
+
+void WebChromeClient::runJavaScriptAlert(Frame& frame, const String& alertText)
+{
+ if (shouldSuppressJavaScriptDialogs(frame))
+ return;
+
+ WebFrame* webFrame = WebFrame::fromCoreFrame(frame);
ASSERT(webFrame);
// Notify the bundle client.
- m_page->injectedBundleUIClient().willRunJavaScriptAlert(m_page, alertText, webFrame);
+ m_page.injectedBundleUIClient().willRunJavaScriptAlert(&m_page, alertText, webFrame);
- // FIXME (126021): It is not good to change IPC behavior conditionally, and SpinRunLoopWhileWaitingForReply was known to cause trouble in other similar cases.
- unsigned syncSendFlags = (WebCore::AXObjectCache::accessibilityEnabled()) ? IPC::SpinRunLoopWhileWaitingForReply : 0;
- WebProcess::shared().parentProcessConnection()->sendSync(Messages::WebPageProxy::RunJavaScriptAlert(webFrame->frameID(), alertText), Messages::WebPageProxy::RunJavaScriptAlert::Reply(), m_page->pageID(), std::chrono::milliseconds::max(), syncSendFlags);
+ HangDetectionDisabler hangDetectionDisabler;
+
+ WebProcess::singleton().parentProcessConnection()->sendSync(Messages::WebPageProxy::RunJavaScriptAlert(webFrame->frameID(), SecurityOriginData::fromFrame(&frame), alertText), Messages::WebPageProxy::RunJavaScriptAlert::Reply(), m_page.pageID(), Seconds::infinity(), IPC::SendSyncOption::InformPlatformProcessWillSuspend);
}
-bool WebChromeClient::runJavaScriptConfirm(Frame* frame, const String& message)
+bool WebChromeClient::runJavaScriptConfirm(Frame& frame, const String& message)
{
- WebFrameLoaderClient* webFrameLoaderClient = toWebFrameLoaderClient(frame->loader().client());
- WebFrame* webFrame = webFrameLoaderClient ? webFrameLoaderClient->webFrame() : 0;
+ if (shouldSuppressJavaScriptDialogs(frame))
+ return false;
+
+ WebFrame* webFrame = WebFrame::fromCoreFrame(frame);
ASSERT(webFrame);
// Notify the bundle client.
- m_page->injectedBundleUIClient().willRunJavaScriptConfirm(m_page, message, webFrame);
+ m_page.injectedBundleUIClient().willRunJavaScriptConfirm(&m_page, message, webFrame);
+
+ HangDetectionDisabler hangDetectionDisabler;
- // FIXME (126021): It is not good to change IPC behavior conditionally, and SpinRunLoopWhileWaitingForReply was known to cause trouble in other similar cases.
- unsigned syncSendFlags = (WebCore::AXObjectCache::accessibilityEnabled()) ? IPC::SpinRunLoopWhileWaitingForReply : 0;
bool result = false;
- if (!WebProcess::shared().parentProcessConnection()->sendSync(Messages::WebPageProxy::RunJavaScriptConfirm(webFrame->frameID(), message), Messages::WebPageProxy::RunJavaScriptConfirm::Reply(result), m_page->pageID(), std::chrono::milliseconds::max(), syncSendFlags))
+ if (!WebProcess::singleton().parentProcessConnection()->sendSync(Messages::WebPageProxy::RunJavaScriptConfirm(webFrame->frameID(), SecurityOriginData::fromFrame(&frame), message), Messages::WebPageProxy::RunJavaScriptConfirm::Reply(result), m_page.pageID(), Seconds::infinity(), IPC::SendSyncOption::InformPlatformProcessWillSuspend))
return false;
return result;
}
-bool WebChromeClient::runJavaScriptPrompt(Frame* frame, const String& message, const String& defaultValue, String& result)
+bool WebChromeClient::runJavaScriptPrompt(Frame& frame, const String& message, const String& defaultValue, String& result)
{
- WebFrameLoaderClient* webFrameLoaderClient = toWebFrameLoaderClient(frame->loader().client());
- WebFrame* webFrame = webFrameLoaderClient ? webFrameLoaderClient->webFrame() : 0;
+ if (shouldSuppressJavaScriptDialogs(frame))
+ return false;
+
+ WebFrame* webFrame = WebFrame::fromCoreFrame(frame);
ASSERT(webFrame);
// Notify the bundle client.
- m_page->injectedBundleUIClient().willRunJavaScriptPrompt(m_page, message, defaultValue, webFrame);
+ m_page.injectedBundleUIClient().willRunJavaScriptPrompt(&m_page, message, defaultValue, webFrame);
- // FIXME (126021): It is not good to change IPC behavior conditionally, and SpinRunLoopWhileWaitingForReply was known to cause trouble in other similar cases.
- unsigned syncSendFlags = (WebCore::AXObjectCache::accessibilityEnabled()) ? IPC::SpinRunLoopWhileWaitingForReply : 0;
- if (!WebProcess::shared().parentProcessConnection()->sendSync(Messages::WebPageProxy::RunJavaScriptPrompt(webFrame->frameID(), message, defaultValue), Messages::WebPageProxy::RunJavaScriptPrompt::Reply(result), m_page->pageID(), std::chrono::milliseconds::max(), syncSendFlags))
+ HangDetectionDisabler hangDetectionDisabler;
+
+ if (!WebProcess::singleton().parentProcessConnection()->sendSync(Messages::WebPageProxy::RunJavaScriptPrompt(webFrame->frameID(), SecurityOriginData::fromFrame(&frame), message, defaultValue), Messages::WebPageProxy::RunJavaScriptPrompt::Reply(result), m_page.pageID(), Seconds::infinity(), IPC::SendSyncOption::InformPlatformProcessWillSuspend))
return false;
return !result.isNull();
@@ -399,121 +461,129 @@ bool WebChromeClient::runJavaScriptPrompt(Frame* frame, const String& message, c
void WebChromeClient::setStatusbarText(const String& statusbarText)
{
// Notify the bundle client.
- m_page->injectedBundleUIClient().willSetStatusbarText(m_page, statusbarText);
+ m_page.injectedBundleUIClient().willSetStatusbarText(&m_page, statusbarText);
- m_page->send(Messages::WebPageProxy::SetStatusText(statusbarText));
+ m_page.send(Messages::WebPageProxy::SetStatusText(statusbarText));
}
-bool WebChromeClient::shouldInterruptJavaScript()
+KeyboardUIMode WebChromeClient::keyboardUIMode()
{
- bool shouldInterrupt = false;
- if (!WebProcess::shared().parentProcessConnection()->sendSync(Messages::WebPageProxy::ShouldInterruptJavaScript(), Messages::WebPageProxy::ShouldInterruptJavaScript::Reply(shouldInterrupt), m_page->pageID()))
- return false;
-
- return shouldInterrupt;
+ return m_page.keyboardUIMode();
}
-KeyboardUIMode WebChromeClient::keyboardUIMode()
+#if ENABLE(POINTER_LOCK)
+
+bool WebChromeClient::requestPointerLock()
{
- return m_page->keyboardUIMode();
+ m_page.send(Messages::WebPageProxy::RequestPointerLock());
+ return true;
}
-IntRect WebChromeClient::windowResizerRect() const
+void WebChromeClient::requestPointerUnlock()
{
- return m_page->windowResizerRect();
+ m_page.send(Messages::WebPageProxy::RequestPointerUnlock());
}
-void WebChromeClient::invalidateRootView(const IntRect&, bool)
+#endif
+
+void WebChromeClient::invalidateRootView(const IntRect&)
{
// Do nothing here, there's no concept of invalidating the window in the web process.
}
-void WebChromeClient::invalidateContentsAndRootView(const IntRect& rect, bool)
+void WebChromeClient::invalidateContentsAndRootView(const IntRect& rect)
{
- if (Document* document = m_page->corePage()->mainFrame().document()) {
+ if (Document* document = m_page.corePage()->mainFrame().document()) {
if (document->printing())
return;
}
- m_page->drawingArea()->setNeedsDisplayInRect(rect);
+ m_page.drawingArea()->setNeedsDisplayInRect(rect);
}
-void WebChromeClient::invalidateContentsForSlowScroll(const IntRect& rect, bool)
+void WebChromeClient::invalidateContentsForSlowScroll(const IntRect& rect)
{
- if (Document* document = m_page->corePage()->mainFrame().document()) {
+ if (Document* document = m_page.corePage()->mainFrame().document()) {
if (document->printing())
return;
}
- m_page->pageDidScroll();
+ m_page.pageDidScroll();
#if USE(COORDINATED_GRAPHICS)
- m_page->drawingArea()->scroll(rect, IntSize());
-#else
- m_page->drawingArea()->setNeedsDisplayInRect(rect);
+ FrameView* frameView = m_page.mainFrame()->view();
+ if (frameView && frameView->delegatesScrolling()) {
+ m_page.drawingArea()->scroll(rect, IntSize());
+ return;
+ }
#endif
+ m_page.drawingArea()->setNeedsDisplayInRect(rect);
}
void WebChromeClient::scroll(const IntSize& scrollDelta, const IntRect& scrollRect, const IntRect& clipRect)
{
- m_page->pageDidScroll();
- m_page->drawingArea()->scroll(intersection(scrollRect, clipRect), scrollDelta);
+ m_page.pageDidScroll();
+ m_page.drawingArea()->scroll(intersection(scrollRect, clipRect), scrollDelta);
}
-#if USE(TILED_BACKING_STORE)
+#if USE(COORDINATED_GRAPHICS)
void WebChromeClient::delegatedScrollRequested(const IntPoint& scrollOffset)
{
- m_page->pageDidRequestScroll(scrollOffset);
+ m_page.pageDidRequestScroll(scrollOffset);
}
#endif
IntPoint WebChromeClient::screenToRootView(const IntPoint& point) const
{
- return m_page->screenToWindow(point);
+ return m_page.screenToRootView(point);
}
IntRect WebChromeClient::rootViewToScreen(const IntRect& rect) const
{
- return m_page->windowToScreen(rect);
+ return m_page.rootViewToScreen(rect);
+}
+
+#if PLATFORM(IOS)
+IntPoint WebChromeClient::accessibilityScreenToRootView(const IntPoint& point) const
+{
+ return m_page.accessibilityScreenToRootView(point);
}
+IntRect WebChromeClient::rootViewToAccessibilityScreen(const IntRect& rect) const
+{
+ return m_page.rootViewToAccessibilityScreen(rect);
+}
+#endif
+
PlatformPageClient WebChromeClient::platformPageClient() const
{
notImplemented();
return 0;
}
-void WebChromeClient::contentsSizeChanged(Frame* frame, const IntSize& size) const
+void WebChromeClient::contentsSizeChanged(Frame& frame, const IntSize& size) const
{
- if (!m_page->corePage()->settings().frameFlatteningEnabled()) {
+ if (!m_page.corePage()->settings().frameFlatteningEnabled()) {
WebFrame* largestFrame = findLargestFrameInFrameSet(m_page);
if (largestFrame != m_cachedFrameSetLargestFrame.get()) {
m_cachedFrameSetLargestFrame = largestFrame;
- m_page->send(Messages::WebPageProxy::FrameSetLargestFrameChanged(largestFrame ? largestFrame->frameID() : 0));
+ m_page.send(Messages::WebPageProxy::FrameSetLargestFrameChanged(largestFrame ? largestFrame->frameID() : 0));
}
}
- if (&frame->page()->mainFrame() != frame)
+ if (&frame.page()->mainFrame() != &frame)
return;
-#if USE(COORDINATED_GRAPHICS)
- if (m_page->useFixedLayout())
- m_page->drawingArea()->layerTreeHost()->sizeDidChange(size);
-
- m_page->send(Messages::WebPageProxy::DidChangeContentSize(size));
-#endif
-#if PLATFORM(IOS)
- m_page->send(Messages::WebPageProxy::DidChangeContentSize(size));
-#endif
+ m_page.send(Messages::WebPageProxy::DidChangeContentSize(size));
- m_page->drawingArea()->mainFrameContentSizeChanged(size);
+ m_page.drawingArea()->mainFrameContentSizeChanged(size);
- FrameView* frameView = frame->view();
+ FrameView* frameView = frame.view();
if (frameView && !frameView->delegatesScrolling()) {
bool hasHorizontalScrollbar = frameView->horizontalScrollbar();
bool hasVerticalScrollbar = frameView->verticalScrollbar();
if (hasHorizontalScrollbar != m_cachedMainFrameHasHorizontalScrollbar || hasVerticalScrollbar != m_cachedMainFrameHasVerticalScrollbar) {
- m_page->send(Messages::WebPageProxy::DidChangeScrollbarsForMainFrame(hasHorizontalScrollbar, hasVerticalScrollbar));
+ m_page.send(Messages::WebPageProxy::DidChangeScrollbarsForMainFrame(hasHorizontalScrollbar, hasVerticalScrollbar));
m_cachedMainFrameHasHorizontalScrollbar = hasHorizontalScrollbar;
m_cachedMainFrameHasVerticalScrollbar = hasVerticalScrollbar;
@@ -545,21 +615,21 @@ bool WebChromeClient::shouldUnavailablePluginMessageBeButton(RenderEmbeddedObjec
return false;
}
-void WebChromeClient::unavailablePluginButtonClicked(Element* element, RenderEmbeddedObject::PluginUnavailabilityReason pluginUnavailabilityReason) const
+void WebChromeClient::unavailablePluginButtonClicked(Element& element, RenderEmbeddedObject::PluginUnavailabilityReason pluginUnavailabilityReason) const
{
#if ENABLE(NETSCAPE_PLUGIN_API)
- ASSERT(element->hasTagName(objectTag) || element->hasTagName(embedTag) || element->hasTagName(appletTag));
+ ASSERT(element.hasTagName(objectTag) || element.hasTagName(embedTag) || element.hasTagName(appletTag));
ASSERT(pluginUnavailabilityReason == RenderEmbeddedObject::PluginMissing || pluginUnavailabilityReason == RenderEmbeddedObject::InsecurePluginVersion || pluginUnavailabilityReason);
- HTMLPlugInImageElement* pluginElement = static_cast<HTMLPlugInImageElement*>(element);
+ auto& pluginElement = downcast<HTMLPlugInImageElement>(element);
- String frameURLString = pluginElement->document().frame()->loader().documentLoader()->responseURL().string();
- String pageURLString = m_page->mainFrame()->loader().documentLoader()->responseURL().string();
- String pluginURLString = pluginElement->document().completeURL(pluginElement->url()).string();
- URL pluginspageAttributeURL = element->document().completeURL(stripLeadingAndTrailingHTMLSpaces(pluginElement->getAttribute(pluginspageAttr)));
+ String frameURLString = pluginElement.document().frame()->loader().documentLoader()->responseURL().string();
+ String pageURLString = m_page.mainFrame()->loader().documentLoader()->responseURL().string();
+ String pluginURLString = pluginElement.document().completeURL(pluginElement.url()).string();
+ URL pluginspageAttributeURL = pluginElement.document().completeURL(stripLeadingAndTrailingHTMLSpaces(pluginElement.attributeWithoutSynchronization(pluginspageAttr)));
if (!pluginspageAttributeURL.protocolIsInHTTPFamily())
pluginspageAttributeURL = URL();
- m_page->send(Messages::WebPageProxy::UnavailablePluginButtonClicked(pluginUnavailabilityReason, pluginElement->serviceType(), pluginURLString, pluginspageAttributeURL.string(), frameURLString, pageURLString));
+ m_page.send(Messages::WebPageProxy::UnavailablePluginButtonClicked(pluginUnavailabilityReason, pluginElement.serviceType(), pluginURLString, pluginspageAttributeURL.string(), frameURLString, pageURLString));
#else
UNUSED_PARAM(element);
UNUSED_PARAM(pluginUnavailabilityReason);
@@ -576,11 +646,11 @@ void WebChromeClient::mouseDidMoveOverElement(const HitTestResult& hitTestResult
RefPtr<API::Object> userData;
// Notify the bundle client.
- m_page->injectedBundleUIClient().mouseDidMoveOverElement(m_page, hitTestResult, static_cast<WebEvent::Modifiers>(modifierFlags), userData);
+ m_page.injectedBundleUIClient().mouseDidMoveOverElement(&m_page, hitTestResult, static_cast<WebEvent::Modifiers>(modifierFlags), userData);
// Notify the UIProcess.
- WebHitTestResult::Data webHitTestResultData(hitTestResult);
- m_page->send(Messages::WebPageProxy::MouseDidMoveOverElement(webHitTestResultData, modifierFlags, InjectedBundleUserMessageEncoder(userData.get())));
+ WebHitTestResultData webHitTestResultData(hitTestResult);
+ m_page.send(Messages::WebPageProxy::MouseDidMoveOverElement(webHitTestResultData, modifierFlags, UserData(WebProcess::singleton().transformObjectsToHandles(userData.get()).get())));
}
void WebChromeClient::setToolTip(const String& toolTip, TextDirection)
@@ -591,171 +661,168 @@ void WebChromeClient::setToolTip(const String& toolTip, TextDirection)
return;
m_cachedToolTip = toolTip;
- m_page->send(Messages::WebPageProxy::SetToolTip(m_cachedToolTip));
+ m_page.send(Messages::WebPageProxy::SetToolTip(m_cachedToolTip));
}
-void WebChromeClient::print(Frame* frame)
+void WebChromeClient::print(Frame& frame)
{
- WebFrameLoaderClient* webFrameLoaderClient = toWebFrameLoaderClient(frame->loader().client());
- WebFrame* webFrame = webFrameLoaderClient ? webFrameLoaderClient->webFrame() : 0;
+ WebFrame* webFrame = WebFrame::fromCoreFrame(frame);
ASSERT(webFrame);
-#if PLATFORM(GTK) && defined(HAVE_GTK_UNIX_PRINTING)
+#if PLATFORM(GTK) && HAVE(GTK_UNIX_PRINTING)
// When printing synchronously in GTK+ we need to make sure that we have a list of Printers before starting the print operation.
// Getting the list of printers is done synchronously by GTK+, but using a nested main loop that might process IPC messages
// comming from the UI process like EndPrinting. When the EndPriting message is received while the printer list is being populated,
// the print operation is finished unexpectely and the web process crashes, see https://bugs.webkit.org/show_bug.cgi?id=126979.
// The PrinterListGtk class gets the list of printers in the constructor so we just need to ensure there's an instance alive
// during the synchronous print operation.
- RefPtr<PrinterListGtk> printerList = PrinterListGtk::shared();
+ RefPtr<PrinterListGtk> printerList = PrinterListGtk::getOrCreate();
+ if (!printerList) {
+ // PrinterListGtk::getOrCreate() returns nullptr when called while a printers enumeration is ongoing.
+ // This can happen if a synchronous print is started by a JavaScript and another one is inmeditaley started
+ // from a JavaScript event listener. The second print operation is handled by the nested main loop used by GTK+
+ // to enumerate the printers, and we end up here trying to get a reference of an object that is being constructed.
+ // It's very unlikely that the user wants to print twice in a row, and other browsers don't do two print operations
+ // in this particular case either. So, the safest solution is to return early here and ignore the second print.
+ // See https://bugs.webkit.org/show_bug.cgi?id=141035
+ return;
+ }
#endif
- m_page->sendSync(Messages::WebPageProxy::PrintFrame(webFrame->frameID()), Messages::WebPageProxy::PrintFrame::Reply());
+ m_page.sendSync(Messages::WebPageProxy::PrintFrame(webFrame->frameID()), Messages::WebPageProxy::PrintFrame::Reply(), Seconds::infinity(), IPC::SendSyncOption::InformPlatformProcessWillSuspend);
}
-#if ENABLE(SQL_DATABASE)
-void WebChromeClient::exceededDatabaseQuota(Frame* frame, const String& databaseName, DatabaseDetails details)
+void WebChromeClient::exceededDatabaseQuota(Frame& frame, const String& databaseName, DatabaseDetails details)
{
- WebFrameLoaderClient* webFrameLoaderClient = toWebFrameLoaderClient(frame->loader().client());
- WebFrame* webFrame = webFrameLoaderClient ? webFrameLoaderClient->webFrame() : 0;
+ WebFrame* webFrame = WebFrame::fromCoreFrame(frame);
ASSERT(webFrame);
- SecurityOrigin* origin = frame->document()->securityOrigin();
-
- DatabaseManager& dbManager = DatabaseManager::manager();
- uint64_t currentQuota = dbManager.quotaForOrigin(origin);
- uint64_t currentOriginUsage = dbManager.usageForOrigin(origin);
+ auto& origin = frame.document()->securityOrigin();
+ auto originData = SecurityOriginData::fromSecurityOrigin(origin);
+ auto& tracker = DatabaseTracker::singleton();
+ auto currentQuota = tracker.quota(originData);
+ auto currentOriginUsage = tracker.usage(originData);
uint64_t newQuota = 0;
- RefPtr<WebSecurityOrigin> webSecurityOrigin = WebSecurityOrigin::createFromDatabaseIdentifier(origin->databaseIdentifier());
- newQuota = m_page->injectedBundleUIClient().didExceedDatabaseQuota(m_page, webSecurityOrigin.get(), databaseName, details.displayName(), currentQuota, currentOriginUsage, details.currentUsage(), details.expectedUsage());
+ RefPtr<API::SecurityOrigin> securityOrigin = API::SecurityOrigin::create(SecurityOriginData::fromDatabaseIdentifier(SecurityOriginData::fromSecurityOrigin(origin).databaseIdentifier())->securityOrigin());
+ newQuota = m_page.injectedBundleUIClient().didExceedDatabaseQuota(&m_page, securityOrigin.get(), databaseName, details.displayName(), currentQuota, currentOriginUsage, details.currentUsage(), details.expectedUsage());
if (!newQuota) {
- WebProcess::shared().parentProcessConnection()->sendSync(
- Messages::WebPageProxy::ExceededDatabaseQuota(webFrame->frameID(), origin->databaseIdentifier(), databaseName, details.displayName(), currentQuota, currentOriginUsage, details.currentUsage(), details.expectedUsage()),
- Messages::WebPageProxy::ExceededDatabaseQuota::Reply(newQuota), m_page->pageID());
+ WebProcess::singleton().parentProcessConnection()->sendSync(
+ Messages::WebPageProxy::ExceededDatabaseQuota(webFrame->frameID(), SecurityOriginData::fromSecurityOrigin(origin).databaseIdentifier(), databaseName, details.displayName(), currentQuota, currentOriginUsage, details.currentUsage(), details.expectedUsage()),
+ Messages::WebPageProxy::ExceededDatabaseQuota::Reply(newQuota), m_page.pageID(), Seconds::infinity(), IPC::SendSyncOption::InformPlatformProcessWillSuspend);
}
- dbManager.setQuota(origin, newQuota);
+ tracker.setQuota(originData, newQuota);
}
-#endif
-
void WebChromeClient::reachedMaxAppCacheSize(int64_t)
{
notImplemented();
}
-void WebChromeClient::reachedApplicationCacheOriginQuota(SecurityOrigin* origin, int64_t totalBytesNeeded)
+void WebChromeClient::reachedApplicationCacheOriginQuota(SecurityOrigin& origin, int64_t totalBytesNeeded)
{
- RefPtr<WebSecurityOrigin> webSecurityOrigin = WebSecurityOrigin::createFromString(origin->toString());
- m_page->injectedBundleUIClient().didReachApplicationCacheOriginQuota(m_page, webSecurityOrigin.get(), totalBytesNeeded);
-}
+ RefPtr<API::SecurityOrigin> securityOrigin = API::SecurityOrigin::createFromString(origin.toString());
+ if (m_page.injectedBundleUIClient().didReachApplicationCacheOriginQuota(&m_page, securityOrigin.get(), totalBytesNeeded))
+ return;
-#if ENABLE(DASHBOARD_SUPPORT)
-void WebChromeClient::annotatedRegionsChanged()
-{
- notImplemented();
-}
-#endif
+ auto& cacheStorage = m_page.corePage()->applicationCacheStorage();
+ int64_t currentQuota = 0;
+ if (!cacheStorage.calculateQuotaForOrigin(origin, currentQuota))
+ return;
-void WebChromeClient::populateVisitedLinks()
-{
-}
+ uint64_t newQuota = 0;
+ WebProcess::singleton().parentProcessConnection()->sendSync(
+ Messages::WebPageProxy::ReachedApplicationCacheOriginQuota(SecurityOriginData::fromSecurityOrigin(origin).databaseIdentifier(), currentQuota, totalBytesNeeded),
+ Messages::WebPageProxy::ReachedApplicationCacheOriginQuota::Reply(newQuota), m_page.pageID(), Seconds::infinity(), IPC::SendSyncOption::InformPlatformProcessWillSuspend);
-FloatRect WebChromeClient::customHighlightRect(Node*, const AtomicString& /*type*/, const FloatRect& /*lineRect*/)
-{
- notImplemented();
- return FloatRect();
+ cacheStorage.storeUpdatedQuotaForOrigin(&origin, newQuota);
}
-void WebChromeClient::paintCustomHighlight(Node*, const AtomicString& /*type*/, const FloatRect& /*boxRect*/, const FloatRect& /*lineRect*/,
- bool /*behindText*/, bool /*entireLine*/)
+#if ENABLE(DASHBOARD_SUPPORT)
+
+void WebChromeClient::annotatedRegionsChanged()
{
notImplemented();
}
+#endif
+
bool WebChromeClient::shouldReplaceWithGeneratedFileForUpload(const String& path, String& generatedFilename)
{
- generatedFilename = m_page->injectedBundleUIClient().shouldGenerateFileForUpload(m_page, path);
+ generatedFilename = m_page.injectedBundleUIClient().shouldGenerateFileForUpload(&m_page, path);
return !generatedFilename.isNull();
}
String WebChromeClient::generateReplacementFile(const String& path)
{
- return m_page->injectedBundleUIClient().generateFileForUpload(m_page, path);
+ return m_page.injectedBundleUIClient().generateFileForUpload(&m_page, path);
}
#if ENABLE(INPUT_TYPE_COLOR)
-PassOwnPtr<ColorChooser> WebChromeClient::createColorChooser(ColorChooserClient* client, const Color& initialColor)
+
+std::unique_ptr<ColorChooser> WebChromeClient::createColorChooser(ColorChooserClient& client, const Color& initialColor)
{
- return adoptPtr(new WebColorChooser(m_page, client, initialColor));
+ return std::make_unique<WebColorChooser>(&m_page, &client, initialColor);
}
+
#endif
-void WebChromeClient::runOpenPanel(Frame* frame, PassRefPtr<FileChooser> prpFileChooser)
+void WebChromeClient::runOpenPanel(Frame& frame, FileChooser& fileChooser)
{
- if (m_page->activeOpenPanelResultListener())
+ if (m_page.activeOpenPanelResultListener())
return;
- RefPtr<FileChooser> fileChooser = prpFileChooser;
+ m_page.setActiveOpenPanelResultListener(WebOpenPanelResultListener::create(&m_page, &fileChooser));
- m_page->setActiveOpenPanelResultListener(WebOpenPanelResultListener::create(m_page, fileChooser.get()));
-
- WebFrameLoaderClient* webFrameLoaderClient = toWebFrameLoaderClient(frame->loader().client());
- WebFrame* webFrame = webFrameLoaderClient ? webFrameLoaderClient->webFrame() : 0;
+ auto* webFrame = WebFrame::fromCoreFrame(frame);
ASSERT(webFrame);
-
- m_page->send(Messages::WebPageProxy::RunOpenPanel(webFrame->frameID(), fileChooser->settings()));
+ m_page.send(Messages::WebPageProxy::RunOpenPanel(webFrame->frameID(), SecurityOriginData::fromFrame(&frame), fileChooser.settings()));
}
-void WebChromeClient::loadIconForFiles(const Vector<String>& filenames, FileIconLoader* loader)
+void WebChromeClient::loadIconForFiles(const Vector<String>& filenames, FileIconLoader& loader)
{
- loader->notifyFinished(Icon::createIconForFiles(filenames));
+ loader.iconLoaded(Icon::createIconForFiles(filenames));
}
#if !PLATFORM(IOS)
-void WebChromeClient::setCursor(const WebCore::Cursor& cursor)
+
+void WebChromeClient::setCursor(const Cursor& cursor)
{
- m_page->send(Messages::WebPageProxy::SetCursor(cursor));
+ m_page.send(Messages::WebPageProxy::SetCursor(cursor));
}
void WebChromeClient::setCursorHiddenUntilMouseMoves(bool hiddenUntilMouseMoves)
{
- m_page->send(Messages::WebPageProxy::SetCursorHiddenUntilMouseMoves(hiddenUntilMouseMoves));
+ m_page.send(Messages::WebPageProxy::SetCursorHiddenUntilMouseMoves(hiddenUntilMouseMoves));
}
+
#endif
-#if ENABLE(REQUEST_ANIMATION_FRAME) && !USE(REQUEST_ANIMATION_FRAME_TIMER)
+#if !USE(REQUEST_ANIMATION_FRAME_TIMER)
+
void WebChromeClient::scheduleAnimation()
{
#if USE(COORDINATED_GRAPHICS)
- m_page->drawingArea()->layerTreeHost()->scheduleAnimation();
+ m_page.drawingArea()->layerTreeHost()->scheduleAnimation();
#endif
}
-#endif
-void WebChromeClient::formStateDidChange(const Node*)
-{
- notImplemented();
-}
+#endif
-void WebChromeClient::didAssociateFormControls(const Vector<RefPtr<WebCore::Element>>& elements)
+void WebChromeClient::didAssociateFormControls(const Vector<RefPtr<Element>>& elements)
{
- return m_page->injectedBundleFormClient().didAssociateFormControls(m_page, elements);
+ return m_page.injectedBundleFormClient().didAssociateFormControls(&m_page, elements);
}
bool WebChromeClient::shouldNotifyOnFormChanges()
{
- return m_page->injectedBundleFormClient().shouldNotifyOnFormChanges(m_page);
+ return m_page.injectedBundleFormClient().shouldNotifyOnFormChanges(&m_page);
}
bool WebChromeClient::selectItemWritingDirectionIsNatural()
{
-#if PLATFORM(EFL)
- return true;
-#else
return false;
-#endif
}
bool WebChromeClient::selectItemAlignmentFollowsMenuWritingDirection()
@@ -769,28 +836,44 @@ bool WebChromeClient::hasOpenedPopup() const
return false;
}
-PassRefPtr<WebCore::PopupMenu> WebChromeClient::createPopupMenu(WebCore::PopupMenuClient* client) const
+RefPtr<PopupMenu> WebChromeClient::createPopupMenu(PopupMenuClient& client) const
{
- return WebPopupMenu::create(m_page, client);
+ return WebPopupMenu::create(&m_page, &client);
}
-PassRefPtr<WebCore::SearchPopupMenu> WebChromeClient::createSearchPopupMenu(WebCore::PopupMenuClient* client) const
+RefPtr<SearchPopupMenu> WebChromeClient::createSearchPopupMenu(PopupMenuClient& client) const
{
- return WebSearchPopupMenu::create(m_page, client);
+ return WebSearchPopupMenu::create(&m_page, &client);
}
-#if USE(ACCELERATED_COMPOSITING)
GraphicsLayerFactory* WebChromeClient::graphicsLayerFactory() const
{
- return m_page->drawingArea()->graphicsLayerFactory();
+ if (auto drawingArea = m_page.drawingArea())
+ return drawingArea->graphicsLayerFactory();
+ return nullptr;
+}
+
+#if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
+
+RefPtr<DisplayRefreshMonitor> WebChromeClient::createDisplayRefreshMonitor(PlatformDisplayID displayID) const
+{
+ return m_page.drawingArea()->createDisplayRefreshMonitor(displayID);
}
-void WebChromeClient::attachRootGraphicsLayer(Frame*, GraphicsLayer* layer)
+#endif
+
+void WebChromeClient::attachRootGraphicsLayer(Frame&, GraphicsLayer* layer)
{
if (layer)
- m_page->enterAcceleratedCompositingMode(layer);
+ m_page.enterAcceleratedCompositingMode(layer);
else
- m_page->exitAcceleratedCompositingMode();
+ m_page.exitAcceleratedCompositingMode();
+}
+
+void WebChromeClient::attachViewOverlayGraphicsLayer(Frame& frame, GraphicsLayer* graphicsLayer)
+{
+ if (auto drawingArea = m_page.drawingArea())
+ drawingArea->attachViewOverlayGraphicsLayer(&frame, graphicsLayer);
}
void WebChromeClient::setNeedsOneShotDrawingSynchronization()
@@ -800,161 +883,343 @@ void WebChromeClient::setNeedsOneShotDrawingSynchronization()
void WebChromeClient::scheduleCompositingLayerFlush()
{
- if (m_page->drawingArea())
- m_page->drawingArea()->scheduleCompositingLayerFlush();
+ if (m_page.drawingArea())
+ m_page.drawingArea()->scheduleCompositingLayerFlush();
}
+bool WebChromeClient::adjustLayerFlushThrottling(LayerFlushThrottleState::Flags flags)
+{
+ return m_page.drawingArea() && m_page.drawingArea()->adjustLayerFlushThrottling(flags);
+}
bool WebChromeClient::layerTreeStateIsFrozen() const
{
- if (m_page->drawingArea())
- return m_page->drawingArea()->layerTreeStateIsFrozen();
+ if (m_page.drawingArea())
+ return m_page.drawingArea()->layerTreeStateIsFrozen();
return false;
}
-#endif
#if ENABLE(ASYNC_SCROLLING)
-PassRefPtr<ScrollingCoordinator> WebChromeClient::createScrollingCoordinator(Page* page) const
+
+RefPtr<ScrollingCoordinator> WebChromeClient::createScrollingCoordinator(Page& page) const
{
- ASSERT(m_page->corePage() == page);
- if (m_page->drawingArea()->type() == DrawingAreaTypeRemoteLayerTree)
- return RemoteScrollingCoordinator::create(m_page);
+ ASSERT_UNUSED(page, m_page.corePage() == &page);
+ if (m_page.drawingArea()->type() != DrawingAreaTypeRemoteLayerTree)
+ return nullptr;
+ return RemoteScrollingCoordinator::create(&m_page);
+}
- return 0;
+#endif
+
+#if (PLATFORM(IOS) && HAVE(AVKIT)) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
+
+bool WebChromeClient::supportsVideoFullscreen(HTMLMediaElementEnums::VideoFullscreenMode mode)
+{
+ return m_page.videoFullscreenManager().supportsVideoFullscreen(mode);
+}
+
+void WebChromeClient::setUpPlaybackControlsManager(HTMLMediaElement& mediaElement)
+{
+ m_page.playbackSessionManager().setUpPlaybackControlsManager(mediaElement);
}
+
+void WebChromeClient::clearPlaybackControlsManager()
+{
+ m_page.playbackSessionManager().clearPlaybackControlsManager();
+}
+
+void WebChromeClient::enterVideoFullscreenForVideoElement(HTMLVideoElement& videoElement, HTMLMediaElementEnums::VideoFullscreenMode mode)
+{
+ ASSERT(mode != HTMLMediaElementEnums::VideoFullscreenModeNone);
+ m_page.videoFullscreenManager().enterVideoFullscreenForVideoElement(videoElement, mode);
+}
+
+void WebChromeClient::exitVideoFullscreenForVideoElement(HTMLVideoElement& videoElement)
+{
+ m_page.videoFullscreenManager().exitVideoFullscreenForVideoElement(videoElement);
+}
+
#endif
-#if ENABLE(TOUCH_EVENTS)
-void WebChromeClient::needTouchEvents(bool needTouchEvents)
+#if PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)
+
+void WebChromeClient::exitVideoFullscreenToModeWithoutAnimation(HTMLVideoElement& videoElement, HTMLMediaElementEnums::VideoFullscreenMode targetMode)
{
- m_page->send(Messages::WebPageProxy::NeedTouchEvents(needTouchEvents));
+ m_page.videoFullscreenManager().exitVideoFullscreenToModeWithoutAnimation(videoElement, targetMode);
}
+
#endif
#if ENABLE(FULLSCREEN_API)
-bool WebChromeClient::supportsFullScreenForElement(const WebCore::Element*, bool withKeyboard)
+
+bool WebChromeClient::supportsFullScreenForElement(const Element&, bool withKeyboard)
{
- return m_page->fullScreenManager()->supportsFullScreen(withKeyboard);
+ return m_page.fullScreenManager()->supportsFullScreen(withKeyboard);
}
-void WebChromeClient::enterFullScreenForElement(WebCore::Element* element)
+void WebChromeClient::enterFullScreenForElement(Element& element)
{
- m_page->fullScreenManager()->enterFullScreenForElement(element);
+ m_page.fullScreenManager()->enterFullScreenForElement(&element);
}
-void WebChromeClient::exitFullScreenForElement(WebCore::Element* element)
+void WebChromeClient::exitFullScreenForElement(Element* element)
{
- m_page->fullScreenManager()->exitFullScreenForElement(element);
+ m_page.fullScreenManager()->exitFullScreenForElement(element);
}
+
#endif
-void WebChromeClient::dispatchViewportPropertiesDidChange(const ViewportArguments& viewportArguments) const
-{
#if PLATFORM(IOS)
- m_page->send(Messages::WebPageProxy::DidChangeViewportArguments(viewportArguments));
-#else
- UNUSED_PARAM(viewportArguments);
-#endif
-#if USE(TILED_BACKING_STORE)
- if (!m_page->useFixedLayout())
- return;
- m_page->sendViewportAttributesChanged();
+FloatSize WebChromeClient::screenSize() const
+{
+ return m_page.screenSize();
+}
+
+FloatSize WebChromeClient::availableScreenSize() const
+{
+ return m_page.availableScreenSize();
+}
+
#endif
+
+void WebChromeClient::dispatchViewportPropertiesDidChange(const ViewportArguments& viewportArguments) const
+{
+ m_page.viewportPropertiesDidChange(viewportArguments);
}
void WebChromeClient::notifyScrollerThumbIsVisibleInRect(const IntRect& scrollerThumb)
{
- m_page->send(Messages::WebPageProxy::NotifyScrollerThumbIsVisibleInRect(scrollerThumb));
+ m_page.send(Messages::WebPageProxy::NotifyScrollerThumbIsVisibleInRect(scrollerThumb));
}
-void WebChromeClient::recommendedScrollbarStyleDidChange(int32_t newStyle)
+void WebChromeClient::recommendedScrollbarStyleDidChange(ScrollbarStyle newStyle)
{
- m_page->send(Messages::WebPageProxy::RecommendedScrollbarStyleDidChange(newStyle));
+ m_page.send(Messages::WebPageProxy::RecommendedScrollbarStyleDidChange(static_cast<int32_t>(newStyle)));
}
-Color WebChromeClient::underlayColor() const
+std::optional<ScrollbarOverlayStyle> WebChromeClient::preferredScrollbarOverlayStyle()
{
- return m_page->underlayColor();
+ return m_page.scrollbarOverlayStyle();
}
-void WebChromeClient::numWheelEventHandlersChanged(unsigned count)
+Color WebChromeClient::underlayColor() const
{
- m_page->numWheelEventHandlersChanged(count);
+ return m_page.underlayColor();
}
-void WebChromeClient::logDiagnosticMessage(const String& message, const String& description, const String& success)
+void WebChromeClient::pageExtendedBackgroundColorDidChange(Color backgroundColor) const
{
- if (!m_page->corePage()->settings().diagnosticLoggingEnabled())
- return;
+#if PLATFORM(MAC)
+ m_page.send(Messages::WebPageProxy::PageExtendedBackgroundColorDidChange(backgroundColor));
+#else
+ UNUSED_PARAM(backgroundColor);
+#endif
+}
- m_page->injectedBundleDiagnosticLoggingClient().logDiagnosticMessage(m_page, message, description, success);
+void WebChromeClient::wheelEventHandlersChanged(bool hasHandlers)
+{
+ m_page.wheelEventHandlersChanged(hasHandlers);
}
String WebChromeClient::plugInStartLabelTitle(const String& mimeType) const
{
- return m_page->injectedBundleUIClient().plugInStartLabelTitle(mimeType);
+ return m_page.injectedBundleUIClient().plugInStartLabelTitle(mimeType);
}
String WebChromeClient::plugInStartLabelSubtitle(const String& mimeType) const
{
- return m_page->injectedBundleUIClient().plugInStartLabelSubtitle(mimeType);
+ return m_page.injectedBundleUIClient().plugInStartLabelSubtitle(mimeType);
}
String WebChromeClient::plugInExtraStyleSheet() const
{
- return m_page->injectedBundleUIClient().plugInExtraStyleSheet();
+ return m_page.injectedBundleUIClient().plugInExtraStyleSheet();
}
String WebChromeClient::plugInExtraScript() const
{
- return m_page->injectedBundleUIClient().plugInExtraScript();
+ return m_page.injectedBundleUIClient().plugInExtraScript();
}
void WebChromeClient::enableSuddenTermination()
{
- m_page->send(Messages::WebProcessProxy::EnableSuddenTermination());
+ m_page.send(Messages::WebProcessProxy::EnableSuddenTermination());
}
void WebChromeClient::disableSuddenTermination()
{
- m_page->send(Messages::WebProcessProxy::DisableSuddenTermination());
+ m_page.send(Messages::WebProcessProxy::DisableSuddenTermination());
}
-void WebChromeClient::didAddHeaderLayer(GraphicsLayer* headerParent)
+void WebChromeClient::didAddHeaderLayer(GraphicsLayer& headerParent)
{
#if ENABLE(RUBBER_BANDING)
- if (PageBanner* banner = m_page->headerPageBanner())
- banner->didAddParentLayer(headerParent);
+ if (PageBanner* banner = m_page.headerPageBanner())
+ banner->didAddParentLayer(&headerParent);
#else
UNUSED_PARAM(headerParent);
#endif
}
-void WebChromeClient::didAddFooterLayer(GraphicsLayer* footerParent)
+void WebChromeClient::didAddFooterLayer(GraphicsLayer& footerParent)
{
#if ENABLE(RUBBER_BANDING)
- if (PageBanner* banner = m_page->footerPageBanner())
- banner->didAddParentLayer(footerParent);
+ if (PageBanner* banner = m_page.footerPageBanner())
+ banner->didAddParentLayer(&footerParent);
#else
UNUSED_PARAM(footerParent);
#endif
}
-bool WebChromeClient::shouldUseTiledBackingForFrameView(const FrameView* frameView) const
+bool WebChromeClient::shouldUseTiledBackingForFrameView(const FrameView& frameView) const
{
- return m_page->drawingArea()->shouldUseTiledBackingForFrameView(frameView);
+ return m_page.drawingArea()->shouldUseTiledBackingForFrameView(&frameView);
}
-void WebChromeClient::incrementActivePageCount()
+void WebChromeClient::isPlayingMediaDidChange(MediaProducer::MediaStateFlags state, uint64_t sourceElementID)
{
- WebProcess::shared().incrementActiveTaskCount();
+ m_page.send(Messages::WebPageProxy::IsPlayingMediaDidChange(state, sourceElementID));
}
-void WebChromeClient::decrementActivePageCount()
+void WebChromeClient::didPlayMediaPreventedFromPlayingWithoutUserGesture()
+{
+ m_page.send(Messages::WebPageProxy::DidPlayMediaPreventedFromPlayingWithoutUserGesture());
+}
+
+#if ENABLE(MEDIA_SESSION)
+
+void WebChromeClient::hasMediaSessionWithActiveMediaElementsDidChange(bool state)
+{
+ m_page.send(Messages::WebPageProxy::HasMediaSessionWithActiveMediaElementsDidChange(state));
+}
+
+void WebChromeClient::mediaSessionMetadataDidChange(const MediaSessionMetadata& metadata)
+{
+ m_page.send(Messages::WebPageProxy::MediaSessionMetadataDidChange(metadata));
+}
+
+void WebChromeClient::focusedContentMediaElementDidChange(uint64_t elementID)
+{
+ m_page.send(Messages::WebPageProxy::FocusedContentMediaElementDidChange(elementID));
+}
+
+#endif
+
+#if ENABLE(SUBTLE_CRYPTO)
+
+bool WebChromeClient::wrapCryptoKey(const Vector<uint8_t>& key, Vector<uint8_t>& wrappedKey) const
+{
+ bool succeeded;
+ if (!WebProcess::singleton().parentProcessConnection()->sendSync(Messages::WebPageProxy::WrapCryptoKey(key), Messages::WebPageProxy::WrapCryptoKey::Reply(succeeded, wrappedKey), m_page.pageID()))
+ return false;
+ return succeeded;
+}
+
+bool WebChromeClient::unwrapCryptoKey(const Vector<uint8_t>& wrappedKey, Vector<uint8_t>& key) const
+{
+ bool succeeded;
+ if (!WebProcess::singleton().parentProcessConnection()->sendSync(Messages::WebPageProxy::UnwrapCryptoKey(wrappedKey), Messages::WebPageProxy::UnwrapCryptoKey::Reply(succeeded, key), m_page.pageID()))
+ return false;
+ return succeeded;
+}
+
+#endif
+
+#if ENABLE(TELEPHONE_NUMBER_DETECTION) && PLATFORM(MAC)
+
+void WebChromeClient::handleTelephoneNumberClick(const String& number, const IntPoint& point)
+{
+ m_page.handleTelephoneNumberClick(number, point);
+}
+
+#endif
+
+#if ENABLE(SERVICE_CONTROLS)
+
+void WebChromeClient::handleSelectionServiceClick(FrameSelection& selection, const Vector<String>& telephoneNumbers, const IntPoint& point)
+{
+ m_page.handleSelectionServiceClick(selection, telephoneNumbers, point);
+}
+
+bool WebChromeClient::hasRelevantSelectionServices(bool isTextOnly) const
+{
+ return (isTextOnly && WebProcess::singleton().hasSelectionServices()) || WebProcess::singleton().hasRichContentServices();
+}
+
+#endif
+
+bool WebChromeClient::shouldDispatchFakeMouseMoveEvents() const
+{
+ return m_page.shouldDispatchFakeMouseMoveEvents();
+}
+
+void WebChromeClient::handleAutoFillButtonClick(HTMLInputElement& inputElement)
+{
+ RefPtr<API::Object> userData;
+
+ // Notify the bundle client.
+ auto nodeHandle = InjectedBundleNodeHandle::getOrCreate(inputElement);
+ m_page.injectedBundleUIClient().didClickAutoFillButton(m_page, nodeHandle.get(), userData);
+
+ // Notify the UIProcess.
+ m_page.send(Messages::WebPageProxy::HandleAutoFillButtonClick(UserData(WebProcess::singleton().transformObjectsToHandles(userData.get()).get())));
+}
+
+#if ENABLE(WIRELESS_PLAYBACK_TARGET) && !PLATFORM(IOS)
+
+void WebChromeClient::addPlaybackTargetPickerClient(uint64_t contextId)
+{
+ m_page.send(Messages::WebPageProxy::AddPlaybackTargetPickerClient(contextId));
+}
+
+void WebChromeClient::removePlaybackTargetPickerClient(uint64_t contextId)
+{
+ m_page.send(Messages::WebPageProxy::RemovePlaybackTargetPickerClient(contextId));
+}
+
+void WebChromeClient::showPlaybackTargetPicker(uint64_t contextId, const IntPoint& position, bool isVideo)
+{
+ FrameView* frameView = m_page.mainFrame()->view();
+ FloatRect rect(frameView->contentsToRootView(frameView->windowToContents(position)), FloatSize());
+ m_page.send(Messages::WebPageProxy::ShowPlaybackTargetPicker(contextId, rect, isVideo));
+}
+
+void WebChromeClient::playbackTargetPickerClientStateDidChange(uint64_t contextId, MediaProducer::MediaStateFlags state)
+{
+ m_page.send(Messages::WebPageProxy::PlaybackTargetPickerClientStateDidChange(contextId, state));
+}
+
+void WebChromeClient::setMockMediaPlaybackTargetPickerEnabled(bool enabled)
+{
+ m_page.send(Messages::WebPageProxy::SetMockMediaPlaybackTargetPickerEnabled(enabled));
+}
+
+void WebChromeClient::setMockMediaPlaybackTargetPickerState(const String& name, MediaPlaybackTargetContext::State state)
+{
+ m_page.send(Messages::WebPageProxy::SetMockMediaPlaybackTargetPickerState(name, state));
+}
+
+#endif
+
+void WebChromeClient::imageOrMediaDocumentSizeChanged(const IntSize& newSize)
+{
+ m_page.imageOrMediaDocumentSizeChanged(newSize);
+}
+
+#if ENABLE(VIDEO) && USE(GSTREAMER)
+
+void WebChromeClient::requestInstallMissingMediaPlugins(const String& details, const String& description, MediaPlayerRequestInstallMissingPluginsCallback& callback)
+{
+ m_page.requestInstallMissingMediaPlugins(details, description, callback);
+}
+
+#endif
+
+void WebChromeClient::didInvalidateDocumentMarkerRects()
{
- WebProcess::shared().decrementActiveTaskCount();
+ m_page.findController().didInvalidateDocumentMarkerRects();
}
} // namespace WebKit
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h b/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h
index 417268b12..a2d5e7cc4 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010, 2011, 2012 Apple Inc. All rights reserved.
+ * Copyright (C) 2010-2017 Apple Inc. All rights reserved.
* Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
*
* Redistribution and use in source and binary forms, with or without
@@ -24,199 +24,205 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef WebChromeClient_h
-#define WebChromeClient_h
+#pragma once
#include <WebCore/ChromeClient.h>
-#include <WebCore/ViewportArguments.h>
-#include <wtf/text/WTFString.h>
namespace WebKit {
class WebFrame;
class WebPage;
-class WebChromeClient : public WebCore::ChromeClient {
+class WebChromeClient final : public WebCore::ChromeClient {
public:
- WebChromeClient(WebPage* page)
- : m_cachedMainFrameHasHorizontalScrollbar(false)
- , m_cachedMainFrameHasVerticalScrollbar(false)
- , m_page(page)
- {
- }
-
- WebPage* page() const { return m_page; }
+ WebChromeClient(WebPage&);
- virtual void* webView() const { return 0; }
+ WebPage& page() const { return m_page; }
private:
- virtual void chromeDestroyed() override;
+ ~WebChromeClient();
+
+ void chromeDestroyed() final;
- virtual void setWindowRect(const WebCore::FloatRect&) override;
- virtual WebCore::FloatRect windowRect() override;
+ void setWindowRect(const WebCore::FloatRect&) final;
+ WebCore::FloatRect windowRect() final;
- virtual WebCore::FloatRect pageRect() override;
+ WebCore::FloatRect pageRect() final;
- virtual void focus() override;
- virtual void unfocus() override;
+ void focus() final;
+ void unfocus() final;
- virtual bool canTakeFocus(WebCore::FocusDirection) override;
- virtual void takeFocus(WebCore::FocusDirection) override;
+ bool canTakeFocus(WebCore::FocusDirection) final;
+ void takeFocus(WebCore::FocusDirection) final;
- virtual void focusedElementChanged(WebCore::Element*) override;
- virtual void focusedFrameChanged(WebCore::Frame*) override;
+ void focusedElementChanged(WebCore::Element*) final;
+ void focusedFrameChanged(WebCore::Frame*) final;
// The Frame pointer provides the ChromeClient with context about which
// Frame wants to create the new Page. Also, the newly created window
// should not be shown to the user until the ChromeClient of the newly
// created Page has its show method called.
- virtual WebCore::Page* createWindow(WebCore::Frame*, const WebCore::FrameLoadRequest&, const WebCore::WindowFeatures&, const WebCore::NavigationAction&) override;
- virtual void show() override;
+ WebCore::Page* createWindow(WebCore::Frame&, const WebCore::FrameLoadRequest&, const WebCore::WindowFeatures&, const WebCore::NavigationAction&) final;
+ void show() final;
- virtual bool canRunModal() override;
- virtual void runModal() override;
+ bool canRunModal() final;
+ void runModal() final;
+
+ void reportProcessCPUTime(int64_t, WebCore::ActivityStateForCPUSampling) final;
- virtual void setToolbarsVisible(bool) override;
- virtual bool toolbarsVisible() override;
+ void setToolbarsVisible(bool) final;
+ bool toolbarsVisible() final;
- virtual void setStatusbarVisible(bool) override;
- virtual bool statusbarVisible() override;
+ void setStatusbarVisible(bool) final;
+ bool statusbarVisible() final;
- virtual void setScrollbarsVisible(bool) override;
- virtual bool scrollbarsVisible() override;
+ void setScrollbarsVisible(bool) final;
+ bool scrollbarsVisible() final;
- virtual void setMenubarVisible(bool) override;
- virtual bool menubarVisible() override;
+ void setMenubarVisible(bool) final;
+ bool menubarVisible() final;
- virtual void setResizable(bool) override;
+ void setResizable(bool) final;
- virtual void addMessageToConsole(WebCore::MessageSource, WebCore::MessageLevel, const String& message, unsigned lineNumber, unsigned columnNumber, const String& sourceID) override;
+ void addMessageToConsole(JSC::MessageSource, JSC::MessageLevel, const String& message, unsigned lineNumber, unsigned columnNumber, const String& sourceID) final;
- virtual bool canRunBeforeUnloadConfirmPanel() override;
- virtual bool runBeforeUnloadConfirmPanel(const String& message, WebCore::Frame*) override;
+ bool canRunBeforeUnloadConfirmPanel() final;
+ bool runBeforeUnloadConfirmPanel(const String& message, WebCore::Frame&) final;
- virtual void closeWindowSoon() override;
+ void closeWindowSoon() final;
- virtual void runJavaScriptAlert(WebCore::Frame*, const String&) override;
- virtual bool runJavaScriptConfirm(WebCore::Frame*, const String&) override;
- virtual bool runJavaScriptPrompt(WebCore::Frame*, const String& message, const String& defaultValue, String& result) override;
- virtual void setStatusbarText(const String&) override;
- virtual bool shouldInterruptJavaScript() override;
+ void runJavaScriptAlert(WebCore::Frame&, const String&) final;
+ bool runJavaScriptConfirm(WebCore::Frame&, const String&) final;
+ bool runJavaScriptPrompt(WebCore::Frame&, const String& message, const String& defaultValue, String& result) final;
+ void setStatusbarText(const String&) final;
- virtual WebCore::KeyboardUIMode keyboardUIMode() override;
+ WebCore::KeyboardUIMode keyboardUIMode() final;
- virtual WebCore::IntRect windowResizerRect() const override;
-
- // HostWindow member function overrides.
- virtual void invalidateRootView(const WebCore::IntRect&, bool) override;
- virtual void invalidateContentsAndRootView(const WebCore::IntRect&, bool) override;
- virtual void invalidateContentsForSlowScroll(const WebCore::IntRect&, bool) override;
- virtual void scroll(const WebCore::IntSize& scrollDelta, const WebCore::IntRect& scrollRect, const WebCore::IntRect& clipRect) override;
-#if USE(TILED_BACKING_STORE)
- virtual void delegatedScrollRequested(const WebCore::IntPoint& scrollOffset) override;
+ // HostWindow member function finals.
+ void invalidateRootView(const WebCore::IntRect&) final;
+ void invalidateContentsAndRootView(const WebCore::IntRect&) final;
+ void invalidateContentsForSlowScroll(const WebCore::IntRect&) final;
+ void scroll(const WebCore::IntSize& scrollDelta, const WebCore::IntRect& scrollRect, const WebCore::IntRect& clipRect) final;
+
+#if USE(COORDINATED_GRAPHICS)
+ void delegatedScrollRequested(const WebCore::IntPoint& scrollOffset) final;
#endif
- virtual WebCore::IntPoint screenToRootView(const WebCore::IntPoint&) const override;
- virtual WebCore::IntRect rootViewToScreen(const WebCore::IntRect&) const override;
- virtual PlatformPageClient platformPageClient() const override;
- virtual void contentsSizeChanged(WebCore::Frame*, const WebCore::IntSize&) const override;
- virtual void scrollRectIntoView(const WebCore::IntRect&) const override; // Currently only Mac has a non empty implementation.
- virtual bool shouldUnavailablePluginMessageBeButton(WebCore::RenderEmbeddedObject::PluginUnavailabilityReason) const override;
- virtual void unavailablePluginButtonClicked(WebCore::Element*, WebCore::RenderEmbeddedObject::PluginUnavailabilityReason) const override;
+ WebCore::IntPoint screenToRootView(const WebCore::IntPoint&) const final;
+ WebCore::IntRect rootViewToScreen(const WebCore::IntRect&) const final;
- virtual void scrollbarsModeDidChange() const override;
- virtual void mouseDidMoveOverElement(const WebCore::HitTestResult&, unsigned modifierFlags) override;
-
- virtual void setToolTip(const String&, WebCore::TextDirection) override;
-
- virtual void print(WebCore::Frame*) override;
-
-#if ENABLE(SQL_DATABASE)
- virtual void exceededDatabaseQuota(WebCore::Frame*, const String& databaseName, WebCore::DatabaseDetails) override;
+#if PLATFORM(IOS)
+ WebCore::IntPoint accessibilityScreenToRootView(const WebCore::IntPoint&) const final;
+ WebCore::IntRect rootViewToAccessibilityScreen(const WebCore::IntRect&) const final;
#endif
- virtual void reachedMaxAppCacheSize(int64_t spaceNeeded) override;
- virtual void reachedApplicationCacheOriginQuota(WebCore::SecurityOrigin*, int64_t spaceNeeded) override;
+ PlatformPageClient platformPageClient() const final;
+ void contentsSizeChanged(WebCore::Frame&, const WebCore::IntSize&) const final;
+ void scrollRectIntoView(const WebCore::IntRect&) const final; // Currently only Mac has a non empty implementation.
+
+ bool shouldUnavailablePluginMessageBeButton(WebCore::RenderEmbeddedObject::PluginUnavailabilityReason) const final;
+ void unavailablePluginButtonClicked(WebCore::Element&, WebCore::RenderEmbeddedObject::PluginUnavailabilityReason) const final;
+
+ void scrollbarsModeDidChange() const final;
+ void mouseDidMoveOverElement(const WebCore::HitTestResult&, unsigned modifierFlags) final;
+
+ void setToolTip(const String&, WebCore::TextDirection) final;
+
+ void print(WebCore::Frame&) final;
+
+ void exceededDatabaseQuota(WebCore::Frame&, const String& databaseName, WebCore::DatabaseDetails) final;
+
+ void reachedMaxAppCacheSize(int64_t spaceNeeded) final;
+ void reachedApplicationCacheOriginQuota(WebCore::SecurityOrigin&, int64_t spaceNeeded) final;
#if ENABLE(DASHBOARD_SUPPORT)
- virtual void annotatedRegionsChanged() override;
+ void annotatedRegionsChanged() final;
#endif
- virtual void populateVisitedLinks() override;
-
- virtual WebCore::FloatRect customHighlightRect(WebCore::Node*, const WTF::AtomicString& type, const WebCore::FloatRect& lineRect) override;
- virtual void paintCustomHighlight(WebCore::Node*, const AtomicString& type, const WebCore::FloatRect& boxRect, const WebCore::FloatRect& lineRect,
- bool behindText, bool entireLine) override;
-
- virtual bool shouldReplaceWithGeneratedFileForUpload(const String& path, String& generatedFilename) override;
- virtual String generateReplacementFile(const String& path) override;
+ bool shouldReplaceWithGeneratedFileForUpload(const String& path, String& generatedFilename) final;
+ String generateReplacementFile(const String& path) final;
#if ENABLE(INPUT_TYPE_COLOR)
- virtual PassOwnPtr<WebCore::ColorChooser> createColorChooser(WebCore::ColorChooserClient*, const WebCore::Color&) override;
+ std::unique_ptr<WebCore::ColorChooser> createColorChooser(WebCore::ColorChooserClient&, const WebCore::Color&) final;
#endif
#if ENABLE(IOS_TOUCH_EVENTS)
- virtual void didPreventDefaultForEvent() override;
+ void didPreventDefaultForEvent() final;
#endif
#if PLATFORM(IOS)
- virtual void didReceiveMobileDocType() override;
- virtual void setNeedsScrollNotifications(WebCore::Frame*, bool) override;
- virtual void observedContentChange(WebCore::Frame*) override;
- virtual void clearContentChangeObservers(WebCore::Frame*) override;
- virtual void notifyRevealedSelectionByScrollingFrame(WebCore::Frame*) override;
- virtual bool isStopping() override;
-
- virtual void didLayout(LayoutType = NormalLayout) override;
- virtual void didStartOverflowScroll() override;
- virtual void didEndOverflowScroll() override;
+ void didReceiveMobileDocType(bool) final;
+ void setNeedsScrollNotifications(WebCore::Frame&, bool) final;
+ void observedContentChange(WebCore::Frame&) final;
+ void clearContentChangeObservers(WebCore::Frame&) final;
+ void notifyRevealedSelectionByScrollingFrame(WebCore::Frame&) final;
+ bool isStopping() final;
+
+ void didLayout(LayoutType = NormalLayout) final;
+ void didStartOverflowScroll() final;
+ void didEndOverflowScroll() final;
+ bool hasStablePageScaleFactor() const final;
// FIXME: See <rdar://problem/5975559>
- virtual void suppressFormNotifications() override;
- virtual void restoreFormNotifications() override;
+ void suppressFormNotifications() final;
+ void restoreFormNotifications() final;
+
+ void addOrUpdateScrollingLayer(WebCore::Node*, PlatformLayer* scrollingLayer, PlatformLayer* contentsLayer, const WebCore::IntSize& scrollSize, bool allowHorizontalScrollbar, bool allowVerticalScrollbar) final;
+ void removeScrollingLayer(WebCore::Node*, PlatformLayer* scrollingLayer, PlatformLayer* contentsLayer) final;
- virtual void addOrUpdateScrollingLayer(WebCore::Node*, PlatformLayer* scrollingLayer, PlatformLayer* contentsLayer, const WebCore::IntSize& scrollSize, bool allowHorizontalScrollbar, bool allowVerticalScrollbar) override;
- virtual void removeScrollingLayer(WebCore::Node*, PlatformLayer* scrollingLayer, PlatformLayer* contentsLayer) override;
+ void webAppOrientationsUpdated() final;
+ void showPlaybackTargetPicker(bool hasVideo) final;
- virtual void webAppOrientationsUpdated() override;
+ Seconds eventThrottlingDelay() final;
#endif
- virtual void runOpenPanel(WebCore::Frame*, PassRefPtr<WebCore::FileChooser>) override;
- virtual void loadIconForFiles(const Vector<String>&, WebCore::FileIconLoader*) override;
+#if ENABLE(ORIENTATION_EVENTS)
+ int deviceOrientation() const final;
+#endif
+
+ void runOpenPanel(WebCore::Frame&, WebCore::FileChooser&) final;
+ void loadIconForFiles(const Vector<String>&, WebCore::FileIconLoader&) final;
#if !PLATFORM(IOS)
- virtual void setCursor(const WebCore::Cursor&) override;
- virtual void setCursorHiddenUntilMouseMoves(bool) override;
+ void setCursor(const WebCore::Cursor&) final;
+ void setCursorHiddenUntilMouseMoves(bool) final;
#endif
-#if ENABLE(REQUEST_ANIMATION_FRAME) && !USE(REQUEST_ANIMATION_FRAME_TIMER)
- virtual void scheduleAnimation() override;
+
+#if !USE(REQUEST_ANIMATION_FRAME_TIMER)
+ void scheduleAnimation() final;
+#endif
+
+#if ENABLE(POINTER_LOCK)
+ bool requestPointerLock() final;
+ void requestPointerUnlock() final;
#endif
- // Notification that the given form element has changed. This function
- // will be called frequently, so handling should be very fast.
- virtual void formStateDidChange(const WebCore::Node*) override;
+ void didAssociateFormControls(const Vector<RefPtr<WebCore::Element>>&) final;
+ bool shouldNotifyOnFormChanges() final;
- virtual void didAssociateFormControls(const Vector<RefPtr<WebCore::Element>>&) override;
- virtual bool shouldNotifyOnFormChanges() override;
+ bool selectItemWritingDirectionIsNatural() final;
+ bool selectItemAlignmentFollowsMenuWritingDirection() final;
+ bool hasOpenedPopup() const final;
+ RefPtr<WebCore::PopupMenu> createPopupMenu(WebCore::PopupMenuClient&) const final;
+ RefPtr<WebCore::SearchPopupMenu> createSearchPopupMenu(WebCore::PopupMenuClient&) const final;
- virtual bool selectItemWritingDirectionIsNatural() override;
- virtual bool selectItemAlignmentFollowsMenuWritingDirection() override;
- virtual bool hasOpenedPopup() const override;
- virtual PassRefPtr<WebCore::PopupMenu> createPopupMenu(WebCore::PopupMenuClient*) const override;
- virtual PassRefPtr<WebCore::SearchPopupMenu> createSearchPopupMenu(WebCore::PopupMenuClient*) const override;
+ WebCore::GraphicsLayerFactory* graphicsLayerFactory() const final;
+ void attachRootGraphicsLayer(WebCore::Frame&, WebCore::GraphicsLayer*) final;
+ void attachViewOverlayGraphicsLayer(WebCore::Frame&, WebCore::GraphicsLayer*) final;
+ void setNeedsOneShotDrawingSynchronization() final;
+ void scheduleCompositingLayerFlush() final;
+ bool adjustLayerFlushThrottling(WebCore::LayerFlushThrottleState::Flags) final;
-#if USE(ACCELERATED_COMPOSITING)
- virtual WebCore::GraphicsLayerFactory* graphicsLayerFactory() const override;
- virtual void attachRootGraphicsLayer(WebCore::Frame*, WebCore::GraphicsLayer*) override;
- virtual void setNeedsOneShotDrawingSynchronization() override;
- virtual void scheduleCompositingLayerFlush() override;
+#if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
+ RefPtr<WebCore::DisplayRefreshMonitor> createDisplayRefreshMonitor(WebCore::PlatformDisplayID) const final;
+#endif
- virtual CompositingTriggerFlags allowedCompositingTriggers() const
+ CompositingTriggerFlags allowedCompositingTriggers() const final
{
return static_cast<CompositingTriggerFlags>(
ThreeDTransformTrigger |
VideoTrigger |
- PluginTrigger|
+ PluginTrigger|
CanvasTrigger |
#if PLATFORM(IOS)
AnimatedOpacityTrigger | // Allow opacity animations to trigger compositing mode for iPhone: <rdar://problem/7830677>
@@ -224,67 +230,122 @@ private:
AnimationTrigger);
}
- virtual bool layerTreeStateIsFrozen() const override;
-#endif
+ bool layerTreeStateIsFrozen() const final;
#if ENABLE(ASYNC_SCROLLING)
- virtual PassRefPtr<WebCore::ScrollingCoordinator> createScrollingCoordinator(WebCore::Page*) const override;
+ RefPtr<WebCore::ScrollingCoordinator> createScrollingCoordinator(WebCore::Page&) const final;
#endif
-#if ENABLE(TOUCH_EVENTS)
- virtual void needTouchEvents(bool) override;
+#if PLATFORM(IOS)
+ void elementDidRefocus(WebCore::Element&) final;
#endif
-#if PLATFORM(IOS)
- virtual void elementDidFocus(const WebCore::Node*) override;
- virtual void elementDidBlur(const WebCore::Node*) override;
+#if (PLATFORM(IOS) && HAVE(AVKIT)) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
+ bool supportsVideoFullscreen(WebCore::HTMLMediaElementEnums::VideoFullscreenMode) final;
+ void setUpPlaybackControlsManager(WebCore::HTMLMediaElement&) final;
+ void clearPlaybackControlsManager() final;
+ void enterVideoFullscreenForVideoElement(WebCore::HTMLVideoElement&, WebCore::HTMLMediaElementEnums::VideoFullscreenMode) final;
+ void exitVideoFullscreenForVideoElement(WebCore::HTMLVideoElement&) final;
+#endif
+
+#if PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)
+ void exitVideoFullscreenToModeWithoutAnimation(WebCore::HTMLVideoElement&, WebCore::HTMLMediaElementEnums::VideoFullscreenMode) final;
#endif
#if ENABLE(FULLSCREEN_API)
- virtual bool supportsFullScreenForElement(const WebCore::Element*, bool withKeyboard) override;
- virtual void enterFullScreenForElement(WebCore::Element*) override;
- virtual void exitFullScreenForElement(WebCore::Element*) override;
+ bool supportsFullScreenForElement(const WebCore::Element&, bool withKeyboard) final;
+ void enterFullScreenForElement(WebCore::Element&) final;
+ void exitFullScreenForElement(WebCore::Element*) final;
#endif
-#if PLATFORM(MAC)
- virtual void makeFirstResponder() override;
+#if PLATFORM(COCOA)
+ void elementDidFocus(WebCore::Element&) final;
+ void elementDidBlur(WebCore::Element&) final;
+
+ void makeFirstResponder() final;
#endif
- virtual void enableSuddenTermination() override;
- virtual void disableSuddenTermination() override;
-
- virtual void dispatchViewportPropertiesDidChange(const WebCore::ViewportArguments&) const override;
+ void enableSuddenTermination() final;
+ void disableSuddenTermination() final;
+
+#if PLATFORM(IOS)
+ WebCore::FloatSize screenSize() const final;
+ WebCore::FloatSize availableScreenSize() const final;
+#endif
+
+ void dispatchViewportPropertiesDidChange(const WebCore::ViewportArguments&) const final;
+
+ void notifyScrollerThumbIsVisibleInRect(const WebCore::IntRect&) final;
+ void recommendedScrollbarStyleDidChange(WebCore::ScrollbarStyle newStyle) final;
- virtual void notifyScrollerThumbIsVisibleInRect(const WebCore::IntRect&) override;
- virtual void recommendedScrollbarStyleDidChange(int32_t newStyle) override;
+ std::optional<WebCore::ScrollbarOverlayStyle> preferredScrollbarOverlayStyle() final;
- virtual WebCore::Color underlayColor() const override;
+ WebCore::Color underlayColor() const final;
+
+ void pageExtendedBackgroundColorDidChange(WebCore::Color) const final;
- virtual void numWheelEventHandlersChanged(unsigned) override;
+ void wheelEventHandlersChanged(bool) final;
+
+ String plugInStartLabelTitle(const String& mimeType) const final;
+ String plugInStartLabelSubtitle(const String& mimeType) const final;
+ String plugInExtraStyleSheet() const final;
+ String plugInExtraScript() const final;
+
+ void didAddHeaderLayer(WebCore::GraphicsLayer&) final;
+ void didAddFooterLayer(WebCore::GraphicsLayer&) final;
- virtual void logDiagnosticMessage(const String& message, const String& description, const String& success) override;
+ bool shouldUseTiledBackingForFrameView(const WebCore::FrameView&) const final;
- virtual String plugInStartLabelTitle(const String& mimeType) const override;
- virtual String plugInStartLabelSubtitle(const String& mimeType) const override;
- virtual String plugInExtraStyleSheet() const override;
- virtual String plugInExtraScript() const override;
+ void isPlayingMediaDidChange(WebCore::MediaProducer::MediaStateFlags, uint64_t) final;
+ void didPlayMediaPreventedFromPlayingWithoutUserGesture() final;
- virtual void didAddHeaderLayer(WebCore::GraphicsLayer*) override;
- virtual void didAddFooterLayer(WebCore::GraphicsLayer*) override;
+#if ENABLE(MEDIA_SESSION)
+ void hasMediaSessionWithActiveMediaElementsDidChange(bool) final;
+ void mediaSessionMetadataDidChange(const WebCore::MediaSessionMetadata&) final;
+ void focusedContentMediaElementDidChange(uint64_t) final;
+#endif
+
+#if ENABLE(SUBTLE_CRYPTO)
+ bool wrapCryptoKey(const Vector<uint8_t>&, Vector<uint8_t>&) const final;
+ bool unwrapCryptoKey(const Vector<uint8_t>&, Vector<uint8_t>&) const final;
+#endif
+
+#if ENABLE(TELEPHONE_NUMBER_DETECTION) && PLATFORM(MAC)
+ void handleTelephoneNumberClick(const String& number, const WebCore::IntPoint&) final;
+#endif
+
+#if ENABLE(SERVICE_CONTROLS)
+ void handleSelectionServiceClick(WebCore::FrameSelection&, const Vector<String>& telephoneNumbers, const WebCore::IntPoint&) final;
+ bool hasRelevantSelectionServices(bool isTextOnly) const final;
+#endif
- virtual bool shouldUseTiledBackingForFrameView(const WebCore::FrameView*) const override;
+ bool shouldDispatchFakeMouseMoveEvents() const final;
- virtual void incrementActivePageCount() override;
- virtual void decrementActivePageCount() override;
+ void handleAutoFillButtonClick(WebCore::HTMLInputElement&) final;
+
+#if ENABLE(WIRELESS_PLAYBACK_TARGET) && !PLATFORM(IOS)
+ void addPlaybackTargetPickerClient(uint64_t /*contextId*/) final;
+ void removePlaybackTargetPickerClient(uint64_t /*contextId*/) final;
+ void showPlaybackTargetPicker(uint64_t contextId, const WebCore::IntPoint&, bool) final;
+ void playbackTargetPickerClientStateDidChange(uint64_t, WebCore::MediaProducer::MediaStateFlags) final;
+ void setMockMediaPlaybackTargetPickerEnabled(bool) final;
+ void setMockMediaPlaybackTargetPickerState(const String&, WebCore::MediaPlaybackTargetContext::State) final;
+#endif
+
+ void imageOrMediaDocumentSizeChanged(const WebCore::IntSize&) final;
+
+#if ENABLE(VIDEO) && USE(GSTREAMER)
+ void requestInstallMissingMediaPlugins(const String& /*details*/, const String& /*description*/, WebCore::MediaPlayerRequestInstallMissingPluginsCallback&) final;
+#endif
+
+ void didInvalidateDocumentMarkerRects() final;
String m_cachedToolTip;
mutable RefPtr<WebFrame> m_cachedFrameSetLargestFrame;
- mutable bool m_cachedMainFrameHasHorizontalScrollbar;
- mutable bool m_cachedMainFrameHasVerticalScrollbar;
+ mutable bool m_cachedMainFrameHasHorizontalScrollbar { false };
+ mutable bool m_cachedMainFrameHasVerticalScrollbar { false };
- WebPage* m_page;
+ WebPage& m_page;
};
} // namespace WebKit
-
-#endif // WebChromeClient_h
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebColorChooser.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebColorChooser.cpp
index b77918216..15854aec0 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/WebColorChooser.cpp
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebColorChooser.cpp
@@ -43,7 +43,7 @@ WebColorChooser::WebColorChooser(WebPage* page, ColorChooserClient* client, cons
, m_page(page)
{
m_page->setActiveColorChooser(this);
- WebProcess::shared().parentProcessConnection()->send(Messages::WebPageProxy::ShowColorPicker(initialColor, client->elementRectRelativeToRootView()), m_page->pageID());
+ WebProcess::singleton().parentProcessConnection()->send(Messages::WebPageProxy::ShowColorPicker(initialColor, client->elementRectRelativeToRootView()), m_page->pageID());
}
WebColorChooser::~WebColorChooser()
@@ -75,7 +75,7 @@ void WebColorChooser::reattachColorChooser(const Color& color)
m_page->setActiveColorChooser(this);
ASSERT(m_colorChooserClient);
- WebProcess::shared().parentProcessConnection()->send(Messages::WebPageProxy::ShowColorPicker(color, m_colorChooserClient->elementRectRelativeToRootView()), m_page->pageID());
+ WebProcess::singleton().parentProcessConnection()->send(Messages::WebPageProxy::ShowColorPicker(color, m_colorChooserClient->elementRectRelativeToRootView()), m_page->pageID());
}
void WebColorChooser::setSelectedColor(const Color& color)
@@ -86,7 +86,7 @@ void WebColorChooser::setSelectedColor(const Color& color)
if (m_page->activeColorChooser() != this)
return;
- WebProcess::shared().parentProcessConnection()->send(Messages::WebPageProxy::SetColorPickerColor(color), m_page->pageID());
+ WebProcess::singleton().parentProcessConnection()->send(Messages::WebPageProxy::SetColorPickerColor(color), m_page->pageID());
}
void WebColorChooser::endChooser()
@@ -94,7 +94,7 @@ void WebColorChooser::endChooser()
if (!m_page)
return;
- WebProcess::shared().parentProcessConnection()->send(Messages::WebPageProxy::EndColorPicker(), m_page->pageID());
+ WebProcess::singleton().parentProcessConnection()->send(Messages::WebPageProxy::EndColorPicker(), m_page->pageID());
}
} // namespace WebKit
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebColorChooser.h b/Source/WebKit2/WebProcess/WebCoreSupport/WebColorChooser.h
index 0394cc82c..a177b2594 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/WebColorChooser.h
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebColorChooser.h
@@ -48,9 +48,9 @@ public:
void didEndChooser();
void disconnectFromPage();
- virtual void reattachColorChooser(const WebCore::Color&) override;
- virtual void setSelectedColor(const WebCore::Color&) override;
- virtual void endChooser() override;
+ void reattachColorChooser(const WebCore::Color&) override;
+ void setSelectedColor(const WebCore::Color&) override;
+ void endChooser() override;
private:
WebCore::ColorChooserClient* m_colorChooserClient;
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebContextMenuClient.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebContextMenuClient.cpp
index 68c2cad84..c62eb6e49 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/WebContextMenuClient.cpp
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebContextMenuClient.cpp
@@ -49,32 +49,13 @@ void WebContextMenuClient::contextMenuDestroyed()
delete this;
}
-#if USE(CROSS_PLATFORM_CONTEXT_MENUS)
-PassOwnPtr<ContextMenu> WebContextMenuClient::customizeMenu(PassOwnPtr<ContextMenu> menu)
-{
- // WebKit2 ignores this client callback and does context menu customization when it is told to show the menu.
- return menu;
-}
-#else
-PlatformMenuDescription WebContextMenuClient::getCustomMenuFromDefaultItems(ContextMenu* menu)
-{
- // WebKit2 ignores this client callback and does context menu customization when it is told to show the menu.
- return menu->platformDescription();
-}
-#endif
-
-void WebContextMenuClient::contextMenuItemSelected(ContextMenuItem*, const ContextMenu*)
-{
- notImplemented();
-}
-
void WebContextMenuClient::downloadURL(const URL&)
{
// This is handled in the UI process.
ASSERT_NOT_REACHED();
}
-#if !PLATFORM(MAC)
+#if !PLATFORM(COCOA)
void WebContextMenuClient::searchWithGoogle(const Frame* frame)
{
String searchString = frame->editor().selectedText();
@@ -85,8 +66,8 @@ void WebContextMenuClient::searchWithGoogle(const Frame* frame)
String url = "http://www.google.com/search?q=" + encoded + "&ie=UTF-8&oe=UTF-8";
if (Page* page = frame->page()) {
- UserGestureIndicator indicator(DefinitelyProcessingUserGesture);
- page->mainFrame().loader().urlSelected(URL(ParsedURLString, url), String(), 0, false, false, MaybeSendReferrer);
+ UserGestureIndicator indicator(ProcessingUserGesture);
+ page->mainFrame().loader().urlSelected(URL(ParsedURLString, url), String(), 0, LockHistory::No, LockBackForwardList::No, MaybeSendReferrer, ShouldOpenExternalURLsPolicy::ShouldNotAllow);
}
}
#endif
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebContextMenuClient.h b/Source/WebKit2/WebProcess/WebCoreSupport/WebContextMenuClient.h
index a4ad6bef6..cec3142b1 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/WebContextMenuClient.h
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebContextMenuClient.h
@@ -42,24 +42,17 @@ public:
}
private:
- virtual void contextMenuDestroyed();
-
-#if USE(CROSS_PLATFORM_CONTEXT_MENUS)
- virtual PassOwnPtr<WebCore::ContextMenu> customizeMenu(PassOwnPtr<WebCore::ContextMenu>) override;
-#else
- virtual WebCore::PlatformMenuDescription getCustomMenuFromDefaultItems(WebCore::ContextMenu*) override;
-#endif
- virtual void contextMenuItemSelected(WebCore::ContextMenuItem*, const WebCore::ContextMenu*) override;
-
- virtual void downloadURL(const WebCore::URL&) override;
- virtual void searchWithGoogle(const WebCore::Frame*) override;
- virtual void lookUpInDictionary(WebCore::Frame*) override;
- virtual bool isSpeaking() override;
- virtual void speak(const String&) override;
- virtual void stopSpeaking() override;
-
-#if PLATFORM(MAC)
- virtual void searchWithSpotlight() override;
+ void contextMenuDestroyed() override;
+
+ void downloadURL(const WebCore::URL&) override;
+ void searchWithGoogle(const WebCore::Frame*) override;
+ void lookUpInDictionary(WebCore::Frame*) override;
+ bool isSpeaking() override;
+ void speak(const String&) override;
+ void stopSpeaking() override;
+
+#if PLATFORM(COCOA)
+ void searchWithSpotlight() override;
#endif
#if USE(ACCESSIBILITY_CONTEXT_MENUS)
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebDatabaseManager.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebDatabaseManager.cpp
deleted file mode 100644
index 72543e13d..000000000
--- a/Source/WebKit2/WebProcess/WebCoreSupport/WebDatabaseManager.cpp
+++ /dev/null
@@ -1,167 +0,0 @@
-/*
- * Copyright (C) 2010, 2013 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 "WebDatabaseManager.h"
-
-#if ENABLE(SQL_DATABASE)
-
-#include "OriginAndDatabases.h"
-#include "WebCoreArgumentCoders.h"
-#include "WebDatabaseManagerMessages.h"
-#include "WebDatabaseManagerProxyMessages.h"
-#include "WebProcess.h"
-#include "WebProcessCreationParameters.h"
-#include <WebCore/DatabaseDetails.h>
-#include <WebCore/DatabaseManager.h>
-#include <WebCore/SecurityOrigin.h>
-
-using namespace WebCore;
-
-namespace WebKit {
-
-const char* WebDatabaseManager::supplementName()
-{
- return "WebDatabaseManager";
-}
-
-WebDatabaseManager::WebDatabaseManager(WebProcess* process)
- : m_process(process)
-{
- m_process->addMessageReceiver(Messages::WebDatabaseManager::messageReceiverName(), *this);
-}
-
-void WebDatabaseManager::initialize(const WebProcessCreationParameters& parameters)
-{
- DatabaseManager::manager().initialize(parameters.databaseDirectory);
- DatabaseManager::manager().setClient(this);
-}
-
-void WebDatabaseManager::getDatabasesByOrigin(uint64_t callbackID) const
-{
- // FIXME: This could be made more efficient by adding a function to DatabaseManager
- // to get both the origins and the Vector of DatabaseDetails for each origin in one
- // shot. That would avoid taking the numerous locks this requires.
-
- Vector<RefPtr<SecurityOrigin>> origins;
- DatabaseManager::manager().origins(origins);
-
- Vector<OriginAndDatabases> originAndDatabasesVector;
- originAndDatabasesVector.reserveInitialCapacity(origins.size());
-
- for (size_t i = 0; i < origins.size(); ++i) {
- OriginAndDatabases originAndDatabases;
-
- Vector<String> nameVector;
- if (!DatabaseManager::manager().databaseNamesForOrigin(origins[i].get(), nameVector))
- continue;
-
- Vector<DatabaseDetails> detailsVector;
- detailsVector.reserveInitialCapacity(nameVector.size());
- for (size_t j = 0; j < nameVector.size(); j++) {
- DatabaseDetails details = DatabaseManager::manager().detailsForNameAndOrigin(nameVector[j], origins[i].get());
- if (details.name().isNull())
- continue;
-
- detailsVector.append(details);
- }
-
- if (detailsVector.isEmpty())
- continue;
-
- originAndDatabases.originIdentifier = origins[i]->databaseIdentifier();
- originAndDatabases.originQuota = DatabaseManager::manager().quotaForOrigin(origins[i].get());
- originAndDatabases.originUsage = DatabaseManager::manager().usageForOrigin(origins[i].get());
- originAndDatabases.databases.swap(detailsVector);
- originAndDatabasesVector.append(originAndDatabases);
- }
-
- m_process->send(Messages::WebDatabaseManagerProxy::DidGetDatabasesByOrigin(originAndDatabasesVector, callbackID), 0);
-}
-
-void WebDatabaseManager::getDatabaseOrigins(uint64_t callbackID) const
-{
- Vector<RefPtr<SecurityOrigin>> origins;
- DatabaseManager::manager().origins(origins);
-
- size_t numOrigins = origins.size();
-
- Vector<String> identifiers(numOrigins);
- for (size_t i = 0; i < numOrigins; ++i)
- identifiers[i] = origins[i]->databaseIdentifier();
- m_process->send(Messages::WebDatabaseManagerProxy::DidGetDatabaseOrigins(identifiers, callbackID), 0);
-}
-
-void WebDatabaseManager::deleteDatabaseWithNameForOrigin(const String& databaseIdentifier, const String& originIdentifier) const
-{
- RefPtr<SecurityOrigin> origin = SecurityOrigin::createFromDatabaseIdentifier(originIdentifier);
- if (!origin)
- return;
-
- DatabaseManager::manager().deleteDatabase(origin.get(), databaseIdentifier);
-}
-
-void WebDatabaseManager::deleteDatabasesForOrigin(const String& originIdentifier) const
-{
- RefPtr<SecurityOrigin> origin = SecurityOrigin::createFromDatabaseIdentifier(originIdentifier);
- if (!origin)
- return;
-
- DatabaseManager::manager().deleteOrigin(origin.get());
-}
-
-void WebDatabaseManager::deleteAllDatabases() const
-{
- DatabaseManager::manager().deleteAllDatabases();
-}
-
-void WebDatabaseManager::setQuotaForOrigin(const String& originIdentifier, unsigned long long quota) const
-{
- // If the quota is set to a value lower than the current usage, that quota will
- // "stick" but no data will be purged to meet the new quota. This will simply
- // prevent new data from being added to databases in that origin.
-
- RefPtr<SecurityOrigin> origin = SecurityOrigin::createFromDatabaseIdentifier(originIdentifier);
- if (!origin)
- return;
-
- DatabaseManager::manager().setQuota(origin.get(), quota);
-}
-
-void WebDatabaseManager::dispatchDidModifyOrigin(SecurityOrigin* origin)
-{
- // NOTE: This may be called on a non-main thread.
- m_process->send(Messages::WebDatabaseManagerProxy::DidModifyOrigin(origin->databaseIdentifier()), 0);
-}
-
-void WebDatabaseManager::dispatchDidModifyDatabase(WebCore::SecurityOrigin* origin, const String& databaseIdentifier)
-{
- // NOTE: This may be called on a non-main thread.
- m_process->send(Messages::WebDatabaseManagerProxy::DidModifyDatabase(origin->databaseIdentifier(), databaseIdentifier), 0);
-}
-
-} // namespace WebKit
-
-#endif // ENABLE(SQL_DATABASE)
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebDatabaseManager.h b/Source/WebKit2/WebProcess/WebCoreSupport/WebDatabaseManager.h
deleted file mode 100644
index 921f362d1..000000000
--- a/Source/WebKit2/WebProcess/WebCoreSupport/WebDatabaseManager.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Copyright (C) 2010, 2013 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.
- */
-
-#ifndef WebDatabaseManager_h
-#define WebDatabaseManager_h
-
-#if ENABLE(SQL_DATABASE)
-
-#include "MessageReceiver.h"
-#include "WebProcessSupplement.h"
-#include <WebCore/DatabaseManagerClient.h>
-#include <stdint.h>
-#include <wtf/Noncopyable.h>
-
-namespace WebKit {
-
-class WebProcess;
-
-class WebDatabaseManager : public WebCore::DatabaseManagerClient, public WebProcessSupplement, public IPC::MessageReceiver {
- WTF_MAKE_NONCOPYABLE(WebDatabaseManager);
-public:
- explicit WebDatabaseManager(WebProcess*);
-
- static const char* supplementName();
-
- void setQuotaForOrigin(const String& originIdentifier, unsigned long long quota) const;
- void deleteAllDatabases() const;
-
-private:
- // WebProcessSupplement
- virtual void initialize(const WebProcessCreationParameters&) override;
-
- // IPC::MessageReceiver
- virtual void didReceiveMessage(IPC::Connection*, IPC::MessageDecoder&) override;
-
- void getDatabasesByOrigin(uint64_t callbackID) const;
- void getDatabaseOrigins(uint64_t callbackID) const;
- void deleteDatabaseWithNameForOrigin(const String& databaseIdentifier, const String& originIdentifier) const;
- void deleteDatabasesForOrigin(const String& originIdentifier) const;
-
- // WebCore::DatabaseManagerClient
- virtual void dispatchDidModifyOrigin(WebCore::SecurityOrigin*) override;
- virtual void dispatchDidModifyDatabase(WebCore::SecurityOrigin*, const String& databaseIdentifier) override;
-
-#if PLATFORM(IOS)
- virtual void dispatchDidAddNewOrigin(WebCore::SecurityOrigin*) override;
- virtual void dispatchDidDeleteDatabase() override;
- virtual void dispatchDidDeleteDatabaseOrigin() override;
-#endif
-
- WebProcess* m_process;
-};
-
-} // namespace WebKit
-
-#endif // ENABLE(SQL_DATABASE)
-
-#endif // WebDatabaseManager_h
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebDatabaseManager.messages.in b/Source/WebKit2/WebProcess/WebCoreSupport/WebDatabaseManager.messages.in
deleted file mode 100644
index b8f92e2a9..000000000
--- a/Source/WebKit2/WebProcess/WebCoreSupport/WebDatabaseManager.messages.in
+++ /dev/null
@@ -1,34 +0,0 @@
-# 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.
-
-#if ENABLE(SQL_DATABASE)
-
-messages -> WebDatabaseManager {
- void GetDatabasesByOrigin(uint64_t callbackID)
- void GetDatabaseOrigins(uint64_t callbackID)
- void DeleteDatabaseWithNameForOrigin(String databaseIdentifier, String originIdentifier)
- void DeleteDatabasesForOrigin(String originIdentifier)
- void DeleteAllDatabases()
- void SetQuotaForOrigin(String originIdentifier, uint64_t quota)
-}
-
-#endif // ENABLE(SQL_DATABASE)
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebBatteryClient.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebDeviceProximityClient.cpp
index 1d136e4f1..50eaf1e8c 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/WebBatteryClient.cpp
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebDeviceProximityClient.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012 Intel Corporation. All rights reserved.
+ * Copyright 2012 Samsung Electronics. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -24,34 +24,38 @@
*/
#include "config.h"
-#include "WebBatteryClient.h"
+#include "WebDeviceProximityClient.h"
-#if ENABLE(BATTERY_STATUS)
+#if ENABLE(PROXIMITY_EVENTS)
-#include "WebBatteryManager.h"
-#include "WebPage.h"
-#include "WebProcess.h"
-
-using namespace WebCore;
+#include <WebCore/DeviceProximityController.h>
namespace WebKit {
-void WebBatteryClient::startUpdating()
+WebDeviceProximityClient::WebDeviceProximityClient(WebPage* page)
+ : m_page(page)
+ , m_value(std::numeric_limits<double>::infinity())
+ , m_min(-std::numeric_limits<double>::infinity())
+ , m_max(std::numeric_limits<double>::infinity())
{
- WebProcess::shared().supplement<WebBatteryManager>()->registerWebPage(m_page);
}
-void WebBatteryClient::stopUpdating()
+void WebDeviceProximityClient::startUpdating()
{
- WebProcess::shared().supplement<WebBatteryManager>()->unregisterWebPage(m_page);
+ // FIXME : Start getting proximity data from device.
}
-void WebBatteryClient::batteryControllerDestroyed()
+void WebDeviceProximityClient::stopUpdating()
{
- WebProcess::shared().supplement<WebBatteryManager>()->unregisterWebPage(m_page);
- delete this;
+ // FIXME : Stop getting proximity data from device.
+}
+
+bool WebDeviceProximityClient::hasLastData()
+{
+ return m_value == std::numeric_limits<double>::infinity() ? false : true;
}
} // namespace WebKit
-#endif // ENABLE(BATTERY_STATUS)
+#endif // PROXIMITY_EVENTS
+
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebNetworkInfoClient.h b/Source/WebKit2/WebProcess/WebCoreSupport/WebDeviceProximityClient.h
index e90636e87..b49ea6020 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/WebNetworkInfoClient.h
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebDeviceProximityClient.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012 Intel Corporation. All rights reserved.
+ * Copyright 2012 Samsung Electronics. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -23,40 +23,41 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef WebNetworkInfoClient_h
-#define WebNetworkInfoClient_h
+#ifndef WebDeviceProximityClient_h
+#define WebDeviceProximityClient_h
-#if ENABLE(NETWORK_INFO)
+#if ENABLE(PROXIMITY_EVENTS)
-#include <WebCore/NetworkInfoClient.h>
+#include <WebCore/DeviceProximityClient.h>
namespace WebKit {
class WebPage;
-class WebNetworkInfoClient : public WebCore::NetworkInfoClient {
+class WebDeviceProximityClient : public WebCore::DeviceProximityClient {
public:
- WebNetworkInfoClient(WebPage* page)
- : m_page(page)
- {
- }
+ explicit WebDeviceProximityClient(WebPage*);
+ virtual ~WebDeviceProximityClient() { }
- virtual ~WebNetworkInfoClient();
+ void startUpdating();
+ void stopUpdating();
-private:
- virtual void networkInfoControllerDestroyed() override;
-
- virtual double bandwidth() const override;
- virtual bool metered() const override;
-
- virtual void startUpdating() override;
- virtual void stopUpdating() override;
+ bool hasLastData() override;
+ double value() override { return m_value; }
+ double min() override { return m_min; }
+ double max() override { return m_max; }
+private:
WebPage* m_page;
+
+ bool m_isUpdating;
+ double m_value;
+ double m_min;
+ double m_max;
};
} // namespace WebKit
-#endif // ENABLE(NETWORK_INFO)
+#endif // PROXIMITY_EVENTS
+#endif // WebDeviceProximityClient_h
-#endif // WebNetworkInfoClient_h
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebDiagnosticLoggingClient.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebDiagnosticLoggingClient.cpp
new file mode 100644
index 000000000..a5f3440bd
--- /dev/null
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebDiagnosticLoggingClient.cpp
@@ -0,0 +1,86 @@
+/*
+ * Copyright (C) 2014 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 COMPUTER, 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 COMPUTER, 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.
+ */
+
+#include "config.h"
+#include "WebDiagnosticLoggingClient.h"
+
+#include "WebPage.h"
+#include "WebPageProxyMessages.h"
+#include <WebCore/Settings.h>
+
+namespace WebKit {
+
+using namespace WebCore;
+
+WebDiagnosticLoggingClient::WebDiagnosticLoggingClient(WebPage& page)
+ : m_page(page)
+{
+}
+
+WebDiagnosticLoggingClient::~WebDiagnosticLoggingClient()
+{
+}
+
+void WebDiagnosticLoggingClient::logDiagnosticMessage(const String& message, const String& description, WebCore::ShouldSample shouldSample)
+{
+ ASSERT(!m_page.corePage() || m_page.corePage()->settings().diagnosticLoggingEnabled());
+
+ if (!shouldLogAfterSampling(shouldSample))
+ return;
+
+ m_page.send(Messages::WebPageProxy::LogDiagnosticMessage(message, description, ShouldSample::No));
+}
+
+void WebDiagnosticLoggingClient::logDiagnosticMessageWithResult(const String& message, const String& description, WebCore::DiagnosticLoggingResultType result, WebCore::ShouldSample shouldSample)
+{
+ ASSERT(!m_page.corePage() || m_page.corePage()->settings().diagnosticLoggingEnabled());
+
+ if (!shouldLogAfterSampling(shouldSample))
+ return;
+
+ m_page.send(Messages::WebPageProxy::LogDiagnosticMessageWithResult(message, description, result, ShouldSample::No));
+}
+
+void WebDiagnosticLoggingClient::logDiagnosticMessageWithValue(const String& message, const String& description, double value, unsigned significantFigures, WebCore::ShouldSample shouldSample)
+{
+ ASSERT(!m_page.corePage() || m_page.corePage()->settings().diagnosticLoggingEnabled());
+
+ if (!shouldLogAfterSampling(shouldSample))
+ return;
+
+ m_page.send(Messages::WebPageProxy::LogDiagnosticMessageWithValue(message, description, value, significantFigures, ShouldSample::No));
+}
+
+void WebDiagnosticLoggingClient::logDiagnosticMessageWithEnhancedPrivacy(const String& message, const String& description, WebCore::ShouldSample shouldSample)
+{
+ ASSERT(!m_page.corePage() || m_page.corePage()->settings().diagnosticLoggingEnabled());
+
+ if (!shouldLogAfterSampling(shouldSample))
+ return;
+
+ m_page.send(Messages::WebPageProxy::LogDiagnosticMessageWithEnhancedPrivacy(message, description, ShouldSample::No));
+}
+
+} // namespace WebKit
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebDiagnosticLoggingClient.h b/Source/WebKit2/WebProcess/WebCoreSupport/WebDiagnosticLoggingClient.h
new file mode 100644
index 000000000..0b7e545fd
--- /dev/null
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebDiagnosticLoggingClient.h
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2014 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 COMPUTER, 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 COMPUTER, 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.
+ */
+
+#ifndef WebDiagnosticLoggingClient_h
+#define WebDiagnosticLoggingClient_h
+
+#include <WebCore/DiagnosticLoggingClient.h>
+#include <wtf/Forward.h>
+
+namespace WebKit {
+
+class WebPage;
+
+class WebDiagnosticLoggingClient : public WebCore::DiagnosticLoggingClient {
+public:
+ WebDiagnosticLoggingClient(WebPage&);
+ virtual ~WebDiagnosticLoggingClient();
+
+private:
+ void logDiagnosticMessage(const String& message, const String& description, WebCore::ShouldSample) override;
+ void logDiagnosticMessageWithResult(const String& message, const String& description, WebCore::DiagnosticLoggingResultType, WebCore::ShouldSample) override;
+ void logDiagnosticMessageWithValue(const String& message, const String& description, double value, unsigned significantFigures, WebCore::ShouldSample) override;
+ void logDiagnosticMessageWithEnhancedPrivacy(const String& message, const String& description, WebCore::ShouldSample) override;
+
+ WebPage& m_page;
+};
+
+}
+
+#endif
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebDragClient.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebDragClient.cpp
index 93305163a..0f16be9a5 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/WebDragClient.cpp
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebDragClient.cpp
@@ -34,7 +34,7 @@ using namespace WebCore;
namespace WebKit {
-void WebDragClient::willPerformDragDestinationAction(DragDestinationAction action, DragData&)
+void WebDragClient::willPerformDragDestinationAction(DragDestinationAction action, const DragData&)
{
if (action == DragDestinationActionLoad)
m_page->willPerformLoadDragDestinationAction();
@@ -42,11 +42,11 @@ void WebDragClient::willPerformDragDestinationAction(DragDestinationAction actio
m_page->mayPerformUploadDragDestinationAction(); // Upload can happen from a drop event handler, so we should prepare early.
}
-void WebDragClient::willPerformDragSourceAction(DragSourceAction, const IntPoint&, Clipboard&)
+void WebDragClient::willPerformDragSourceAction(DragSourceAction, const IntPoint&, DataTransfer&)
{
}
-DragDestinationAction WebDragClient::actionMaskForDrag(DragData&)
+DragDestinationAction WebDragClient::actionMaskForDrag(const DragData&)
{
return DragDestinationActionAny;
}
@@ -56,8 +56,8 @@ DragSourceAction WebDragClient::dragSourceActionMaskForPoint(const IntPoint&)
return DragSourceActionAny;
}
-#if !PLATFORM(MAC) && !PLATFORM(GTK)
-void WebDragClient::startDrag(DragImageRef, const IntPoint&, const IntPoint&, Clipboard&, Frame&, bool)
+#if !PLATFORM(COCOA) && !PLATFORM(GTK)
+void WebDragClient::startDrag(DragImage, const IntPoint&, const IntPoint&, const FloatPoint&, DataTransfer&, Frame&, DragSourceAction)
{
}
#endif
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebDragClient.h b/Source/WebKit2/WebProcess/WebCoreSupport/WebDragClient.h
index 1117d75ef..a96ee8162 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/WebDragClient.h
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebDragClient.h
@@ -42,18 +42,21 @@ public:
}
private:
- virtual void willPerformDragDestinationAction(WebCore::DragDestinationAction, WebCore::DragData&) override;
- virtual void willPerformDragSourceAction(WebCore::DragSourceAction, const WebCore::IntPoint&, WebCore::Clipboard&) override;
- virtual WebCore::DragDestinationAction actionMaskForDrag(WebCore::DragData&) override;
- virtual WebCore::DragSourceAction dragSourceActionMaskForPoint(const WebCore::IntPoint& windowPoint) override;
+ void willPerformDragDestinationAction(WebCore::DragDestinationAction, const WebCore::DragData&) override;
+ void willPerformDragSourceAction(WebCore::DragSourceAction, const WebCore::IntPoint&, WebCore::DataTransfer&) override;
+ WebCore::DragDestinationAction actionMaskForDrag(const WebCore::DragData&) override;
+ WebCore::DragSourceAction dragSourceActionMaskForPoint(const WebCore::IntPoint& windowPoint) override;
- virtual void startDrag(WebCore::DragImageRef, const WebCore::IntPoint& dragImageOrigin, const WebCore::IntPoint& eventPos, WebCore::Clipboard&, WebCore::Frame&, bool linkDrag = false) override;
+ void startDrag(WebCore::DragImage, const WebCore::IntPoint& dragImageOrigin, const WebCore::IntPoint& eventPos, const WebCore::FloatPoint& dragImageAnchor, WebCore::DataTransfer&, WebCore::Frame&, WebCore::DragSourceAction) override;
-#if PLATFORM(MAC)
- virtual void declareAndWriteDragImage(const String& pasteboardName, WebCore::Element&, const WebCore::URL&, const String&, WebCore::Frame*) override;
+#if PLATFORM(COCOA)
+ void declareAndWriteDragImage(const String& pasteboardName, WebCore::Element&, const WebCore::URL&, const String&, WebCore::Frame*) override;
+#if ENABLE(ATTACHMENT_ELEMENT)
+ void declareAndWriteAttachment(const String& pasteboardName, WebCore::Element&, const WebCore::URL&, const String& path, WebCore::Frame*) override;
+#endif
#endif
- virtual void dragControllerDestroyed() override;
+ void dragControllerDestroyed() override;
WebPage* m_page;
};
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp
index 9059f1e45..9c60ff5a8 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp
@@ -28,11 +28,12 @@
#include "EditorState.h"
#include "WebCoreArgumentCoders.h"
-#include "WebFrameLoaderClient.h"
+#include "WebFrame.h"
#include "WebPage.h"
#include "WebPageProxy.h"
#include "WebPageProxyMessages.h"
#include "WebProcess.h"
+#include "WebUndoStep.h"
#include <WebCore/ArchiveResource.h>
#include <WebCore/DocumentFragment.h>
#include <WebCore/FocusController.h>
@@ -50,9 +51,14 @@
#include <WebCore/TextIterator.h>
#include <WebCore/UndoStep.h>
#include <WebCore/UserTypingGestureIndicator.h>
+#include <WebCore/VisibleUnits.h>
#include <wtf/NeverDestroyed.h>
#include <wtf/text/StringView.h>
+#if PLATFORM(GTK)
+#include <WebCore/PlatformDisplay.h>
+#endif
+
using namespace WebCore;
using namespace HTMLNames;
@@ -64,26 +70,13 @@ static uint64_t generateTextCheckingRequestID()
return uniqueTextCheckingRequestID++;
}
-void WebEditorClient::pageDestroyed()
-{
- delete this;
-}
-
bool WebEditorClient::shouldDeleteRange(Range* range)
{
- bool result = m_page->injectedBundleEditorClient().shouldDeleteRange(m_page, range);
+ bool result = m_page->injectedBundleEditorClient().shouldDeleteRange(*m_page, range);
notImplemented();
return result;
}
-#if ENABLE(DELETION_UI)
-bool WebEditorClient::shouldShowDeleteInterface(HTMLElement*)
-{
- notImplemented();
- return false;
-}
-#endif
-
bool WebEditorClient::smartInsertDeleteEnabled()
{
return m_page->isSmartInsertDeleteEnabled();
@@ -96,7 +89,7 @@ bool WebEditorClient::isSelectTrailingWhitespaceEnabled()
bool WebEditorClient::isContinuousSpellCheckingEnabled()
{
- return WebProcess::shared().textCheckerState().isContinuousSpellCheckingEnabled;
+ return WebProcess::singleton().textCheckerState().isContinuousSpellCheckingEnabled;
}
void WebEditorClient::toggleContinuousSpellChecking()
@@ -106,7 +99,7 @@ void WebEditorClient::toggleContinuousSpellChecking()
bool WebEditorClient::isGrammarCheckingEnabled()
{
- return WebProcess::shared().textCheckerState().isGrammarCheckingEnabled;
+ return WebProcess::singleton().textCheckerState().isGrammarCheckingEnabled;
}
void WebEditorClient::toggleGrammarChecking()
@@ -122,47 +115,52 @@ int WebEditorClient::spellCheckerDocumentTag()
bool WebEditorClient::shouldBeginEditing(Range* range)
{
- bool result = m_page->injectedBundleEditorClient().shouldBeginEditing(m_page, range);
+ bool result = m_page->injectedBundleEditorClient().shouldBeginEditing(*m_page, range);
notImplemented();
return result;
}
bool WebEditorClient::shouldEndEditing(Range* range)
{
- bool result = m_page->injectedBundleEditorClient().shouldEndEditing(m_page, range);
+ bool result = m_page->injectedBundleEditorClient().shouldEndEditing(*m_page, range);
notImplemented();
return result;
}
bool WebEditorClient::shouldInsertNode(Node* node, Range* rangeToReplace, EditorInsertAction action)
{
- bool result = m_page->injectedBundleEditorClient().shouldInsertNode(m_page, node, rangeToReplace, action);
+ bool result = m_page->injectedBundleEditorClient().shouldInsertNode(*m_page, node, rangeToReplace, action);
notImplemented();
return result;
}
bool WebEditorClient::shouldInsertText(const String& text, Range* rangeToReplace, EditorInsertAction action)
{
- bool result = m_page->injectedBundleEditorClient().shouldInsertText(m_page, text.impl(), rangeToReplace, action);
+ bool result = m_page->injectedBundleEditorClient().shouldInsertText(*m_page, text.impl(), rangeToReplace, action);
notImplemented();
return result;
}
bool WebEditorClient::shouldChangeSelectedRange(Range* fromRange, Range* toRange, EAffinity affinity, bool stillSelecting)
{
- bool result = m_page->injectedBundleEditorClient().shouldChangeSelectedRange(m_page, fromRange, toRange, affinity, stillSelecting);
+ bool result = m_page->injectedBundleEditorClient().shouldChangeSelectedRange(*m_page, fromRange, toRange, affinity, stillSelecting);
notImplemented();
return result;
}
bool WebEditorClient::shouldApplyStyle(StyleProperties* style, Range* range)
{
- Ref<MutableStyleProperties> mutableStyle(style->isMutable() ? static_cast<MutableStyleProperties&>(*style) : style->mutableCopy());
- bool result = m_page->injectedBundleEditorClient().shouldApplyStyle(m_page, mutableStyle->ensureCSSStyleDeclaration(), range);
+ Ref<MutableStyleProperties> mutableStyle(style->isMutable() ? Ref<MutableStyleProperties>(static_cast<MutableStyleProperties&>(*style)) : style->mutableCopy());
+ bool result = m_page->injectedBundleEditorClient().shouldApplyStyle(*m_page, mutableStyle->ensureCSSStyleDeclaration(), range);
notImplemented();
return result;
}
+void WebEditorClient::didApplyStyle()
+{
+ notImplemented();
+}
+
bool WebEditorClient::shouldMoveRangeAfterDelete(Range*, Range*)
{
notImplemented();
@@ -173,21 +171,21 @@ void WebEditorClient::didBeginEditing()
{
// FIXME: What good is a notification name, if it's always the same?
static NeverDestroyed<String> WebViewDidBeginEditingNotification(ASCIILiteral("WebViewDidBeginEditingNotification"));
- m_page->injectedBundleEditorClient().didBeginEditing(m_page, WebViewDidBeginEditingNotification.get().impl());
+ m_page->injectedBundleEditorClient().didBeginEditing(*m_page, WebViewDidBeginEditingNotification.get().impl());
notImplemented();
}
void WebEditorClient::respondToChangedContents()
{
static NeverDestroyed<String> WebViewDidChangeNotification(ASCIILiteral("WebViewDidChangeNotification"));
- m_page->injectedBundleEditorClient().didChange(m_page, WebViewDidChangeNotification.get().impl());
+ m_page->injectedBundleEditorClient().didChange(*m_page, WebViewDidChangeNotification.get().impl());
notImplemented();
}
void WebEditorClient::respondToChangedSelection(Frame* frame)
{
static NeverDestroyed<String> WebViewDidChangeSelectionNotification(ASCIILiteral("WebViewDidChangeSelectionNotification"));
- m_page->injectedBundleEditorClient().didChangeSelection(m_page, WebViewDidChangeSelectionNotification.get().impl());
+ m_page->injectedBundleEditorClient().didChangeSelection(*m_page, WebViewDidChangeSelectionNotification.get().impl());
if (!frame)
return;
@@ -198,43 +196,63 @@ void WebEditorClient::respondToChangedSelection(Frame* frame)
#endif
}
+void WebEditorClient::didChangeSelectionAndUpdateLayout()
+{
+ m_page->sendPostLayoutEditorStateIfNeeded();
+}
+
+void WebEditorClient::updateEditorStateAfterLayoutIfEditabilityChanged()
+{
+ m_page->updateEditorStateAfterLayoutIfEditabilityChanged();
+}
+
+void WebEditorClient::discardedComposition(Frame*)
+{
+ m_page->discardedComposition();
+}
+
+void WebEditorClient::canceledComposition()
+{
+ m_page->canceledComposition();
+}
+
void WebEditorClient::didEndEditing()
{
static NeverDestroyed<String> WebViewDidEndEditingNotification(ASCIILiteral("WebViewDidEndEditingNotification"));
- m_page->injectedBundleEditorClient().didEndEditing(m_page, WebViewDidEndEditingNotification.get().impl());
+ m_page->injectedBundleEditorClient().didEndEditing(*m_page, WebViewDidEndEditingNotification.get().impl());
notImplemented();
}
void WebEditorClient::didWriteSelectionToPasteboard()
{
- m_page->injectedBundleEditorClient().didWriteToPasteboard(m_page);
+ m_page->injectedBundleEditorClient().didWriteToPasteboard(*m_page);
}
void WebEditorClient::willWriteSelectionToPasteboard(Range* range)
{
- m_page->injectedBundleEditorClient().willWriteToPasteboard(m_page, range);
+ m_page->injectedBundleEditorClient().willWriteToPasteboard(*m_page, range);
}
void WebEditorClient::getClientPasteboardDataForRange(Range* range, Vector<String>& pasteboardTypes, Vector<RefPtr<SharedBuffer>>& pasteboardData)
{
- m_page->injectedBundleEditorClient().getPasteboardDataForRange(m_page, range, pasteboardTypes, pasteboardData);
+ m_page->injectedBundleEditorClient().getPasteboardDataForRange(*m_page, range, pasteboardTypes, pasteboardData);
}
-void WebEditorClient::registerUndoStep(PassRefPtr<UndoStep> step)
+void WebEditorClient::registerUndoStep(UndoStep& step)
{
// FIXME: Add assertion that the command being reapplied is the same command that is
// being passed to us.
if (m_page->isInRedo())
return;
- RefPtr<WebUndoStep> webStep = WebUndoStep::create(step);
- m_page->addWebUndoStep(webStep->stepID(), webStep.get());
- uint32_t editAction = static_cast<uint32_t>(webStep->step()->editingAction());
+ auto webStep = WebUndoStep::create(&step);
+ auto editAction = static_cast<uint32_t>(webStep->step()->editingAction());
+ m_page->addWebUndoStep(webStep->stepID(), webStep.ptr());
m_page->send(Messages::WebPageProxy::RegisterEditCommandForUndo(webStep->stepID(), editAction));
}
-void WebEditorClient::registerRedoStep(PassRefPtr<UndoStep>)
+void WebEditorClient::registerRedoStep(UndoStep&)
{
}
@@ -279,7 +297,7 @@ void WebEditorClient::redo()
m_page->sendSync(Messages::WebPageProxy::ExecuteUndoRedo(static_cast<uint32_t>(WebPageProxy::Redo)), Messages::WebPageProxy::ExecuteUndoRedo::Reply(result));
}
-#if !PLATFORM(GTK) && !PLATFORM(MAC) && !PLATFORM(EFL)
+#if !PLATFORM(GTK) && !PLATFORM(COCOA)
void WebEditorClient::handleKeyboardEvent(KeyboardEvent* event)
{
if (m_page->handleEditingKeyboardEvent(event))
@@ -294,55 +312,57 @@ void WebEditorClient::handleInputMethodKeydown(KeyboardEvent*)
void WebEditorClient::textFieldDidBeginEditing(Element* element)
{
- if (!isHTMLInputElement(element))
+ if (!is<HTMLInputElement>(*element))
return;
- WebFrameLoaderClient* webFrameLoaderClient = toWebFrameLoaderClient(element->document().frame()->loader().client());
- WebFrame* webFrame = webFrameLoaderClient ? webFrameLoaderClient->webFrame() : 0;
+ WebFrame* webFrame = WebFrame::fromCoreFrame(*element->document().frame());
ASSERT(webFrame);
- m_page->injectedBundleFormClient().textFieldDidBeginEditing(m_page, toHTMLInputElement(element), webFrame);
+ m_page->injectedBundleFormClient().textFieldDidBeginEditing(m_page, downcast<HTMLInputElement>(element), webFrame);
}
void WebEditorClient::textFieldDidEndEditing(Element* element)
{
- if (!isHTMLInputElement(element))
+ if (!is<HTMLInputElement>(*element))
return;
- WebFrameLoaderClient* webFrameLoaderClient = toWebFrameLoaderClient(element->document().frame()->loader().client());
- WebFrame* webFrame = webFrameLoaderClient ? webFrameLoaderClient->webFrame() : 0;
+ WebFrame* webFrame = WebFrame::fromCoreFrame(*element->document().frame());
ASSERT(webFrame);
- m_page->injectedBundleFormClient().textFieldDidEndEditing(m_page, toHTMLInputElement(element), webFrame);
+ m_page->injectedBundleFormClient().textFieldDidEndEditing(m_page, downcast<HTMLInputElement>(element), webFrame);
}
void WebEditorClient::textDidChangeInTextField(Element* element)
{
- if (!isHTMLInputElement(element))
+ if (!is<HTMLInputElement>(*element))
return;
- if (!UserTypingGestureIndicator::processingUserTypingGesture() || UserTypingGestureIndicator::focusedElementAtGestureStart() != element)
- return;
+ bool initiatedByUserTyping = UserTypingGestureIndicator::processingUserTypingGesture() && UserTypingGestureIndicator::focusedElementAtGestureStart() == element;
- WebFrameLoaderClient* webFrameLoaderClient = toWebFrameLoaderClient(element->document().frame()->loader().client());
- WebFrame* webFrame = webFrameLoaderClient ? webFrameLoaderClient->webFrame() : 0;
+ WebFrame* webFrame = WebFrame::fromCoreFrame(*element->document().frame());
ASSERT(webFrame);
- m_page->injectedBundleFormClient().textDidChangeInTextField(m_page, toHTMLInputElement(element), webFrame);
+ m_page->injectedBundleFormClient().textDidChangeInTextField(m_page, downcast<HTMLInputElement>(element), webFrame, initiatedByUserTyping);
}
void WebEditorClient::textDidChangeInTextArea(Element* element)
{
- if (!isHTMLTextAreaElement(element))
+ if (!is<HTMLTextAreaElement>(*element))
return;
- WebFrameLoaderClient* webFrameLoaderClient = toWebFrameLoaderClient(element->document().frame()->loader().client());
- WebFrame* webFrame = webFrameLoaderClient ? webFrameLoaderClient->webFrame() : 0;
+ WebFrame* webFrame = WebFrame::fromCoreFrame(*element->document().frame());
ASSERT(webFrame);
- m_page->injectedBundleFormClient().textDidChangeInTextArea(m_page, toHTMLTextAreaElement(element), webFrame);
+ m_page->injectedBundleFormClient().textDidChangeInTextArea(m_page, downcast<HTMLTextAreaElement>(element), webFrame);
}
+#if !PLATFORM(IOS)
+void WebEditorClient::overflowScrollPositionChanged()
+{
+ notImplemented();
+}
+#endif
+
static bool getActionTypeForKeyEvent(KeyboardEvent* event, WKInputFieldActionType& type)
{
String key = event->keyIdentifier();
@@ -365,38 +385,59 @@ static bool getActionTypeForKeyEvent(KeyboardEvent* event, WKInputFieldActionTyp
return true;
}
+static API::InjectedBundle::FormClient::InputFieldAction toInputFieldAction(WKInputFieldActionType action)
+{
+ switch (action) {
+ case WKInputFieldActionTypeMoveUp:
+ return API::InjectedBundle::FormClient::InputFieldAction::MoveUp;
+ case WKInputFieldActionTypeMoveDown:
+ return API::InjectedBundle::FormClient::InputFieldAction::MoveDown;
+ case WKInputFieldActionTypeCancel:
+ return API::InjectedBundle::FormClient::InputFieldAction::Cancel;
+ case WKInputFieldActionTypeInsertTab:
+ return API::InjectedBundle::FormClient::InputFieldAction::InsertTab;
+ case WKInputFieldActionTypeInsertNewline:
+ return API::InjectedBundle::FormClient::InputFieldAction::InsertNewline;
+ case WKInputFieldActionTypeInsertDelete:
+ return API::InjectedBundle::FormClient::InputFieldAction::InsertDelete;
+ case WKInputFieldActionTypeInsertBacktab:
+ return API::InjectedBundle::FormClient::InputFieldAction::InsertBacktab;
+ }
+
+ ASSERT_NOT_REACHED();
+ return API::InjectedBundle::FormClient::InputFieldAction::Cancel;
+}
+
bool WebEditorClient::doTextFieldCommandFromEvent(Element* element, KeyboardEvent* event)
{
- if (!isHTMLInputElement(element))
+ if (!is<HTMLInputElement>(*element))
return false;
WKInputFieldActionType actionType = static_cast<WKInputFieldActionType>(0);
if (!getActionTypeForKeyEvent(event, actionType))
return false;
- WebFrameLoaderClient* webFrameLoaderClient = toWebFrameLoaderClient(element->document().frame()->loader().client());
- WebFrame* webFrame = webFrameLoaderClient ? webFrameLoaderClient->webFrame() : 0;
+ WebFrame* webFrame = WebFrame::fromCoreFrame(*element->document().frame());
ASSERT(webFrame);
- return m_page->injectedBundleFormClient().shouldPerformActionInTextField(m_page, toHTMLInputElement(element), actionType, webFrame);
+ return m_page->injectedBundleFormClient().shouldPerformActionInTextField(m_page, downcast<HTMLInputElement>(element), toInputFieldAction(actionType), webFrame);
}
void WebEditorClient::textWillBeDeletedInTextField(Element* element)
{
- if (!isHTMLInputElement(element))
+ if (!is<HTMLInputElement>(*element))
return;
- WebFrameLoaderClient* webFrameLoaderClient = toWebFrameLoaderClient(element->document().frame()->loader().client());
- WebFrame* webFrame = webFrameLoaderClient ? webFrameLoaderClient->webFrame() : 0;
+ WebFrame* webFrame = WebFrame::fromCoreFrame(*element->document().frame());
ASSERT(webFrame);
- m_page->injectedBundleFormClient().shouldPerformActionInTextField(m_page, toHTMLInputElement(element), WKInputFieldActionTypeInsertDelete, webFrame);
+ m_page->injectedBundleFormClient().shouldPerformActionInTextField(m_page, downcast<HTMLInputElement>(element), toInputFieldAction(WKInputFieldActionTypeInsertDelete), webFrame);
}
bool WebEditorClient::shouldEraseMarkersAfterChangeSelection(WebCore::TextCheckingType type) const
{
// This prevents erasing spelling markers on OS X Lion or later to match AppKit on these Mac OS X versions.
-#if PLATFORM(MAC) || PLATFORM(EFL)
+#if PLATFORM(COCOA)
return type != TextCheckingTypeSpelling;
#else
UNUSED_PARAM(type);
@@ -414,12 +455,11 @@ void WebEditorClient::learnWord(const String& word)
m_page->send(Messages::WebPageProxy::LearnWord(word));
}
-void WebEditorClient::checkSpellingOfString(const UChar* text, int length, int* misspellingLocation, int* misspellingLength)
+void WebEditorClient::checkSpellingOfString(StringView text, int* misspellingLocation, int* misspellingLength)
{
int32_t resultLocation = -1;
int32_t resultLength = 0;
- // FIXME: It would be nice if we wouldn't have to copy the text here.
- m_page->sendSync(Messages::WebPageProxy::CheckSpellingOfString(String(text, length)),
+ m_page->sendSync(Messages::WebPageProxy::CheckSpellingOfString(text.toStringWithoutCopying()),
Messages::WebPageProxy::CheckSpellingOfString::Reply(resultLocation, resultLength));
*misspellingLocation = resultLocation;
*misspellingLength = resultLength;
@@ -431,23 +471,29 @@ String WebEditorClient::getAutoCorrectSuggestionForMisspelledWord(const String&)
return String();
}
-void WebEditorClient::checkGrammarOfString(const UChar* text, int length, Vector<WebCore::GrammarDetail>& grammarDetails, int* badGrammarLocation, int* badGrammarLength)
+void WebEditorClient::checkGrammarOfString(StringView text, Vector<WebCore::GrammarDetail>& grammarDetails, int* badGrammarLocation, int* badGrammarLength)
{
int32_t resultLocation = -1;
int32_t resultLength = 0;
- // FIXME: It would be nice if we wouldn't have to copy the text here.
- m_page->sendSync(Messages::WebPageProxy::CheckGrammarOfString(String(text, length)),
+ m_page->sendSync(Messages::WebPageProxy::CheckGrammarOfString(text.toStringWithoutCopying()),
Messages::WebPageProxy::CheckGrammarOfString::Reply(grammarDetails, resultLocation, resultLength));
*badGrammarLocation = resultLocation;
*badGrammarLength = resultLength;
}
+static int32_t insertionPointFromCurrentSelection(const VisibleSelection& currentSelection)
+{
+ VisiblePosition selectionStart = currentSelection.visibleStart();
+ VisiblePosition paragraphStart = startOfParagraph(selectionStart);
+ return TextIterator::rangeLength(makeRange(paragraphStart, selectionStart).get());
+}
+
#if USE(UNIFIED_TEXT_CHECKING)
-Vector<TextCheckingResult> WebEditorClient::checkTextOfParagraph(StringView stringView, WebCore::TextCheckingTypeMask checkingTypes)
+Vector<TextCheckingResult> WebEditorClient::checkTextOfParagraph(StringView stringView, WebCore::TextCheckingTypeMask checkingTypes, const VisibleSelection& currentSelection)
{
Vector<TextCheckingResult> results;
- m_page->sendSync(Messages::WebPageProxy::CheckTextOfParagraph(stringView.toStringWithoutCopying(), checkingTypes), Messages::WebPageProxy::CheckTextOfParagraph::Reply(results));
+ m_page->sendSync(Messages::WebPageProxy::CheckTextOfParagraph(stringView.toStringWithoutCopying(), checkingTypes, insertionPointFromCurrentSelection(currentSelection)), Messages::WebPageProxy::CheckTextOfParagraph::Reply(results));
return results;
}
@@ -475,38 +521,46 @@ bool WebEditorClient::spellingUIIsShowing()
return isShowing;
}
-void WebEditorClient::getGuessesForWord(const String& word, const String& context, Vector<String>& guesses)
+void WebEditorClient::getGuessesForWord(const String& word, const String& context, const VisibleSelection& currentSelection, Vector<String>& guesses)
{
- m_page->sendSync(Messages::WebPageProxy::GetGuessesForWord(word, context), Messages::WebPageProxy::GetGuessesForWord::Reply(guesses));
+ m_page->sendSync(Messages::WebPageProxy::GetGuessesForWord(word, context, insertionPointFromCurrentSelection(currentSelection)), Messages::WebPageProxy::GetGuessesForWord::Reply(guesses));
}
-void WebEditorClient::requestCheckingOfString(WTF::PassRefPtr<TextCheckingRequest> prpRequest)
+void WebEditorClient::requestCheckingOfString(TextCheckingRequest& request, const WebCore::VisibleSelection& currentSelection)
{
- RefPtr<TextCheckingRequest> request = prpRequest;
-
uint64_t requestID = generateTextCheckingRequestID();
- m_page->addTextCheckingRequest(requestID, request);
+ m_page->addTextCheckingRequest(requestID, &request);
- m_page->send(Messages::WebPageProxy::RequestCheckingOfString(requestID, request->data()));
+ m_page->send(Messages::WebPageProxy::RequestCheckingOfString(requestID, request.data(), insertionPointFromCurrentSelection(currentSelection)));
}
void WebEditorClient::willSetInputMethodState()
{
}
-void WebEditorClient::setInputMethodState(bool)
+void WebEditorClient::setInputMethodState(bool enabled)
{
+#if PLATFORM(GTK)
+ m_page->setInputMethodState(enabled);
+#else
notImplemented();
+ UNUSED_PARAM(enabled);
+#endif
}
bool WebEditorClient::supportsGlobalSelection()
{
-#if PLATFORM(GTK) && PLATFORM(X11)
- return true;
-#else
- // FIXME: Return true on other X11 platforms when they support global selection.
- return false;
+#if PLATFORM(GTK)
+#if PLATFORM(X11)
+ if (PlatformDisplay::sharedDisplay().type() == PlatformDisplay::Type::X11)
+ return true;
#endif
+#if PLATFORM(WAYLAND)
+ if (PlatformDisplay::sharedDisplay().type() == PlatformDisplay::Type::Wayland)
+ return true;
+#endif
+#endif
+ return false;
}
} // namespace WebKit
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.h b/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.h
index 6b927c6c3..ce2bcc471 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.h
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.h
@@ -23,8 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef WebEditorClient_h
-#define WebEditorClient_h
+#pragma once
#include <WebCore/EditorClient.h>
#include <WebCore/TextCheckerClient.h>
@@ -33,7 +32,7 @@ namespace WebKit {
class WebPage;
-class WebEditorClient : public WebCore::EditorClient, public WebCore::TextCheckerClient {
+class WebEditorClient final : public WebCore::EditorClient, public WebCore::TextCheckerClient {
public:
WebEditorClient(WebPage* page)
: m_page(page)
@@ -41,87 +40,87 @@ public:
}
private:
- virtual void pageDestroyed() override;
-
- virtual bool shouldDeleteRange(WebCore::Range*) override;
- virtual bool smartInsertDeleteEnabled() override;
- virtual bool isSelectTrailingWhitespaceEnabled() override;
- virtual bool isContinuousSpellCheckingEnabled() override;
- virtual void toggleContinuousSpellChecking() override;
- virtual bool isGrammarCheckingEnabled() override;
- virtual void toggleGrammarChecking() override;
- virtual int spellCheckerDocumentTag() override;
+ bool shouldDeleteRange(WebCore::Range*) final;
+ bool smartInsertDeleteEnabled() final;
+ bool isSelectTrailingWhitespaceEnabled() final;
+ bool isContinuousSpellCheckingEnabled() final;
+ void toggleContinuousSpellChecking() final;
+ bool isGrammarCheckingEnabled() final;
+ void toggleGrammarChecking() final;
+ int spellCheckerDocumentTag() final;
- virtual bool shouldBeginEditing(WebCore::Range*) override;
- virtual bool shouldEndEditing(WebCore::Range*) override;
- virtual bool shouldInsertNode(WebCore::Node*, WebCore::Range*, WebCore::EditorInsertAction) override;
- virtual bool shouldInsertText(const String&, WebCore::Range*, WebCore::EditorInsertAction) override;
- virtual bool shouldChangeSelectedRange(WebCore::Range* fromRange, WebCore::Range* toRange, WebCore::EAffinity, bool stillSelecting) override;
+ bool shouldBeginEditing(WebCore::Range*) final;
+ bool shouldEndEditing(WebCore::Range*) final;
+ bool shouldInsertNode(WebCore::Node*, WebCore::Range*, WebCore::EditorInsertAction) final;
+ bool shouldInsertText(const String&, WebCore::Range*, WebCore::EditorInsertAction) final;
+ bool shouldChangeSelectedRange(WebCore::Range* fromRange, WebCore::Range* toRange, WebCore::EAffinity, bool stillSelecting) final;
- virtual bool shouldApplyStyle(WebCore::StyleProperties*, WebCore::Range*) override;
- virtual bool shouldMoveRangeAfterDelete(WebCore::Range*, WebCore::Range*) override;
-
- virtual void didBeginEditing() override;
- virtual void respondToChangedContents() override;
- virtual void respondToChangedSelection(WebCore::Frame*) override;
- virtual void didEndEditing() override;
- virtual void willWriteSelectionToPasteboard(WebCore::Range*) override;
- virtual void didWriteSelectionToPasteboard() override;
- virtual void getClientPasteboardDataForRange(WebCore::Range*, Vector<String>& pasteboardTypes, Vector<RefPtr<WebCore::SharedBuffer>>& pasteboardData) override;
+ bool shouldApplyStyle(WebCore::StyleProperties*, WebCore::Range*) final;
+ void didApplyStyle() final;
+ bool shouldMoveRangeAfterDelete(WebCore::Range*, WebCore::Range*) final;
+
+ void didBeginEditing() final;
+ void respondToChangedContents() final;
+ void respondToChangedSelection(WebCore::Frame*) final;
+ void didChangeSelectionAndUpdateLayout() final;
+ void updateEditorStateAfterLayoutIfEditabilityChanged() final;
+ void discardedComposition(WebCore::Frame*) final;
+ void canceledComposition() final;
+ void didEndEditing() final;
+ void willWriteSelectionToPasteboard(WebCore::Range*) final;
+ void didWriteSelectionToPasteboard() final;
+ void getClientPasteboardDataForRange(WebCore::Range*, Vector<String>& pasteboardTypes, Vector<RefPtr<WebCore::SharedBuffer>>& pasteboardData) final;
- virtual void registerUndoStep(PassRefPtr<WebCore::UndoStep>) override;
- virtual void registerRedoStep(PassRefPtr<WebCore::UndoStep>) override;
- virtual void clearUndoRedoOperations() override;
-
- virtual bool canCopyCut(WebCore::Frame*, bool defaultValue) const override;
- virtual bool canPaste(WebCore::Frame*, bool defaultValue) const override;
- virtual bool canUndo() const override;
- virtual bool canRedo() const override;
+ void registerUndoStep(WebCore::UndoStep&) final;
+ void registerRedoStep(WebCore::UndoStep&) final;
+ void clearUndoRedoOperations() final;
+
+ bool canCopyCut(WebCore::Frame*, bool defaultValue) const final;
+ bool canPaste(WebCore::Frame*, bool defaultValue) const final;
+ bool canUndo() const final;
+ bool canRedo() const final;
- virtual void undo() override;
- virtual void redo() override;
+ void undo() final;
+ void redo() final;
- virtual void handleKeyboardEvent(WebCore::KeyboardEvent*) override;
- virtual void handleInputMethodKeydown(WebCore::KeyboardEvent*) override;
+ void handleKeyboardEvent(WebCore::KeyboardEvent*) final;
+ void handleInputMethodKeydown(WebCore::KeyboardEvent*) final;
- virtual void textFieldDidBeginEditing(WebCore::Element*) override;
- virtual void textFieldDidEndEditing(WebCore::Element*) override;
- virtual void textDidChangeInTextField(WebCore::Element*) override;
- virtual bool doTextFieldCommandFromEvent(WebCore::Element*, WebCore::KeyboardEvent*) override;
- virtual void textWillBeDeletedInTextField(WebCore::Element*) override;
- virtual void textDidChangeInTextArea(WebCore::Element*) override;
-
-#if PLATFORM(MAC)
- virtual NSString *userVisibleString(NSURL *) override;
- virtual WebCore::DocumentFragment* documentFragmentFromAttributedString(NSAttributedString *, Vector< RefPtr<WebCore::ArchiveResource>>&) override;
- virtual void setInsertionPasteboard(const String& pasteboardName) override;
- virtual NSURL* canonicalizeURL(NSURL*) override;
- virtual NSURL* canonicalizeURLString(NSString*) override;
+ void textFieldDidBeginEditing(WebCore::Element*) final;
+ void textFieldDidEndEditing(WebCore::Element*) final;
+ void textDidChangeInTextField(WebCore::Element*) final;
+ bool doTextFieldCommandFromEvent(WebCore::Element*, WebCore::KeyboardEvent*) final;
+ void textWillBeDeletedInTextField(WebCore::Element*) final;
+ void textDidChangeInTextArea(WebCore::Element*) final;
+ void overflowScrollPositionChanged() final;
+
+#if PLATFORM(COCOA)
+ NSString *userVisibleString(NSURL *) final;
+ void setInsertionPasteboard(const String& pasteboardName) final;
+ NSURL *canonicalizeURL(NSURL *) final;
+ NSURL *canonicalizeURLString(NSString *) final;
#endif
#if USE(APPKIT)
- virtual void uppercaseWord() override;
- virtual void lowercaseWord() override;
- virtual void capitalizeWord() override;
-#endif
-#if USE(AUTOMATIC_TEXT_REPLACEMENT)
- virtual void showSubstitutionsPanel(bool show) override;
- virtual bool substitutionsPanelIsShowing() override;
- virtual void toggleSmartInsertDelete() override;
- virtual bool isAutomaticQuoteSubstitutionEnabled() override;
- virtual void toggleAutomaticQuoteSubstitution() override;
- virtual bool isAutomaticLinkDetectionEnabled() override;
- virtual void toggleAutomaticLinkDetection() override;
- virtual bool isAutomaticDashSubstitutionEnabled() override;
- virtual void toggleAutomaticDashSubstitution() override;
- virtual bool isAutomaticTextReplacementEnabled() override;
- virtual void toggleAutomaticTextReplacement() override;
- virtual bool isAutomaticSpellingCorrectionEnabled() override;
- virtual void toggleAutomaticSpellingCorrection() override;
+ void uppercaseWord() final;
+ void lowercaseWord() final;
+ void capitalizeWord() final;
#endif
-#if ENABLE(DELETION_UI)
- virtual bool shouldShowDeleteInterface(WebCore::HTMLElement*) override;
+#if USE(AUTOMATIC_TEXT_REPLACEMENT)
+ void showSubstitutionsPanel(bool show) final;
+ bool substitutionsPanelIsShowing() final;
+ void toggleSmartInsertDelete() final;
+ bool isAutomaticQuoteSubstitutionEnabled() final;
+ void toggleAutomaticQuoteSubstitution() final;
+ bool isAutomaticLinkDetectionEnabled() final;
+ void toggleAutomaticLinkDetection() final;
+ bool isAutomaticDashSubstitutionEnabled() final;
+ void toggleAutomaticDashSubstitution() final;
+ bool isAutomaticTextReplacementEnabled() final;
+ void toggleAutomaticTextReplacement() final;
+ bool isAutomaticSpellingCorrectionEnabled() final;
+ void toggleAutomaticSpellingCorrection() final;
#endif
#if PLATFORM(GTK)
@@ -130,48 +129,48 @@ private:
void updateGlobalSelection(WebCore::Frame*);
#endif
- TextCheckerClient* textChecker() override { return this; }
+ TextCheckerClient* textChecker() final { return this; }
+
+ bool shouldEraseMarkersAfterChangeSelection(WebCore::TextCheckingType) const final;
+ void ignoreWordInSpellDocument(const String&) final;
+ void learnWord(const String&) final;
+ void checkSpellingOfString(StringView, int* misspellingLocation, int* misspellingLength) final;
+ String getAutoCorrectSuggestionForMisspelledWord(const String& misspelledWord) final;
+ void checkGrammarOfString(StringView, Vector<WebCore::GrammarDetail>&, int* badGrammarLocation, int* badGrammarLength) final;
- virtual bool shouldEraseMarkersAfterChangeSelection(WebCore::TextCheckingType) const override;
- virtual void ignoreWordInSpellDocument(const String&) override;
- virtual void learnWord(const String&) override;
- virtual void checkSpellingOfString(const UChar*, int length, int* misspellingLocation, int* misspellingLength) override;
- virtual String getAutoCorrectSuggestionForMisspelledWord(const String& misspelledWord) override;
- virtual void checkGrammarOfString(const UChar*, int length, Vector<WebCore::GrammarDetail>&, int* badGrammarLocation, int* badGrammarLength) override;
#if USE(UNIFIED_TEXT_CHECKING)
- virtual Vector<WebCore::TextCheckingResult> checkTextOfParagraph(StringView, WebCore::TextCheckingTypeMask checkingTypes) override;
+ Vector<WebCore::TextCheckingResult> checkTextOfParagraph(StringView, WebCore::TextCheckingTypeMask checkingTypes, const WebCore::VisibleSelection& currentSelection) final;
#endif
- virtual void updateSpellingUIWithGrammarString(const String&, const WebCore::GrammarDetail&) override;
- virtual void updateSpellingUIWithMisspelledWord(const String&) override;
- virtual void showSpellingUI(bool show) override;
- virtual bool spellingUIIsShowing() override;
- virtual void getGuessesForWord(const String& word, const String& context, Vector<String>& guesses) override;
- virtual void willSetInputMethodState() override;
- virtual void setInputMethodState(bool enabled) override;
- virtual void requestCheckingOfString(WTF::PassRefPtr<WebCore::TextCheckingRequest>) override;
+
+ void updateSpellingUIWithGrammarString(const String&, const WebCore::GrammarDetail&) final;
+ void updateSpellingUIWithMisspelledWord(const String&) final;
+ void showSpellingUI(bool show) final;
+ bool spellingUIIsShowing() final;
+ void getGuessesForWord(const String& word, const String& context, const WebCore::VisibleSelection& currentSelection, Vector<String>& guesses) final;
+ void willSetInputMethodState() final;
+ void setInputMethodState(bool enabled) final;
+ void requestCheckingOfString(WebCore::TextCheckingRequest&, const WebCore::VisibleSelection& currentSelection) final;
+
#if PLATFORM(GTK)
- virtual bool shouldShowUnicodeMenu() override;
+ bool shouldShowUnicodeMenu() final;
#endif
+
#if PLATFORM(IOS)
- virtual void suppressSelectionNotifications() override;
- virtual void restoreSelectionNotifications() override;
- virtual void startDelayingAndCoalescingContentChangeNotifications() override;
- virtual void stopDelayingAndCoalescingContentChangeNotifications() override;
- virtual void writeDataToPasteboard(NSDictionary*) override;
- virtual NSArray *supportedPasteboardTypesForCurrentSelection() override;
- virtual NSArray *readDataFromPasteboard(NSString* type, int index) override;
- virtual bool hasRichlyEditableSelection() override;
- virtual int getPasteboardItemsCount() override;
- virtual WebCore::DocumentFragment* documentFragmentFromDelegate(int index) override;
- virtual bool performsTwoStepPaste(WebCore::DocumentFragment*) override;
- virtual int pasteboardChangeCount() override;
+ void startDelayingAndCoalescingContentChangeNotifications() final;
+ void stopDelayingAndCoalescingContentChangeNotifications() final;
+ void writeDataToPasteboard(NSDictionary*) final;
+ NSArray *supportedPasteboardTypesForCurrentSelection() final;
+ NSArray *readDataFromPasteboard(NSString* type, int index) final;
+ bool hasRichlyEditableSelection() final;
+ int getPasteboardItemsCount() final;
+ RefPtr<WebCore::DocumentFragment> documentFragmentFromDelegate(int index) final;
+ bool performsTwoStepPaste(WebCore::DocumentFragment*) final;
+ int pasteboardChangeCount() final;
#endif
- virtual bool supportsGlobalSelection() override;
+ bool supportsGlobalSelection() final;
WebPage* m_page;
};
} // namespace WebKit
-
-#endif // WebEditorClient_h
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebErrors.h b/Source/WebKit2/WebProcess/WebCoreSupport/WebErrors.h
index d27a0f963..84dd73e3c 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/WebErrors.h
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebErrors.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010, 2011 Apple Inc. All rights reserved.
+ * Copyright (C) 2010-2016 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -23,8 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef WebErrors_h
-#define WebErrors_h
+#pragma once
namespace WebCore {
class URL;
@@ -37,13 +36,15 @@ namespace WebKit {
WebCore::ResourceError cancelledError(const WebCore::ResourceRequest&);
WebCore::ResourceError blockedError(const WebCore::ResourceRequest&);
+WebCore::ResourceError blockedByContentBlockerError(const WebCore::ResourceRequest&);
WebCore::ResourceError cannotShowURLError(const WebCore::ResourceRequest&);
WebCore::ResourceError interruptedForPolicyChangeError(const WebCore::ResourceRequest&);
+#if ENABLE(CONTENT_FILTERING)
+WebCore::ResourceError blockedByContentFilterError(const WebCore::ResourceRequest&);
+#endif
WebCore::ResourceError cannotShowMIMETypeError(const WebCore::ResourceResponse&);
WebCore::ResourceError fileDoesNotExistError(const WebCore::ResourceResponse&);
WebCore::ResourceError pluginWillHandleLoadError(const WebCore::ResourceResponse&);
WebCore::ResourceError internalError(const WebCore::URL&);
} // namespace WebKit
-
-#endif // WebErrors_h
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp
index 06880399f..044f8430a 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010, 2011, 2012 Apple Inc. All rights reserved.
+ * Copyright (C) 2010-2017 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -28,16 +28,19 @@
#include "AuthenticationManager.h"
#include "DataReference.h"
+#include "DrawingArea.h"
#include "InjectedBundle.h"
#include "InjectedBundleBackForwardListItem.h"
#include "InjectedBundleDOMWindowExtension.h"
#include "InjectedBundleNavigationAction.h"
-#include "InjectedBundleUserMessageCoders.h"
#include "NavigationActionData.h"
#include "PluginView.h"
+#include "UserData.h"
+#include "WKBundleAPICast.h"
+#include "WebAutomationSessionProxy.h"
#include "WebBackForwardListProxy.h"
-#include "WebContextMessages.h"
#include "WebCoreArgumentCoders.h"
+#include "WebDocumentLoader.h"
#include "WebErrors.h"
#include "WebEvent.h"
#include "WebFrame.h"
@@ -46,12 +49,14 @@
#include "WebIconDatabaseMessages.h"
#include "WebNavigationDataStore.h"
#include "WebPage.h"
+#include "WebPageGroupProxy.h"
#include "WebPageProxyMessages.h"
#include "WebProcess.h"
-#include "WebProcessProxyMessages.h"
+#include "WebProcessPoolMessages.h"
+#include "WebsitePolicies.h"
#include <JavaScriptCore/APICast.h>
#include <JavaScriptCore/JSObject.h>
-#include <WebCore/AXObjectCache.h>
+#include <WebCore/CachedFrame.h>
#include <WebCore/CertificateInfo.h>
#include <WebCore/Chrome.h>
#include <WebCore/DOMWrapperWorld.h>
@@ -72,8 +77,9 @@
#include <WebCore/PluginData.h>
#include <WebCore/PluginDocument.h>
#include <WebCore/ProgressTracker.h>
-#include <WebCore/ResourceBuffer.h>
#include <WebCore/ResourceError.h>
+#include <WebCore/ScriptController.h>
+#include <WebCore/SecurityOriginData.h>
#include <WebCore/Settings.h>
#include <WebCore/SubframeLoader.h>
#include <WebCore/UIEventWithKeyState.h>
@@ -88,7 +94,8 @@ namespace WebKit {
WebFrameLoaderClient::WebFrameLoaderClient()
: m_frame(0)
, m_hasSentResponseToPluginView(false)
- , m_didCompletePageTransitionAlready(false)
+ , m_didCompletePageTransition(false)
+ , m_frameHasCustomContentProvider(false)
, m_frameCameFromPageCache(false)
{
}
@@ -99,26 +106,23 @@ WebFrameLoaderClient::~WebFrameLoaderClient()
void WebFrameLoaderClient::frameLoaderDestroyed()
{
- if (WebPage* webPage = m_frame->page())
- webPage->injectedBundleLoaderClient().willDestroyFrame(webPage, m_frame);
-
m_frame->invalidate();
// Balances explicit ref() in WebFrame::create().
m_frame->deref();
}
-bool WebFrameLoaderClient::hasWebView() const
+bool WebFrameLoaderClient::hasHTMLView() const
{
- return m_frame->page();
+ return !m_frameHasCustomContentProvider;
}
-void WebFrameLoaderClient::makeRepresentation(DocumentLoader*)
+bool WebFrameLoaderClient::hasWebView() const
{
- notImplemented();
+ return m_frame->page();
}
-void WebFrameLoaderClient::forceLayout()
+void WebFrameLoaderClient::makeRepresentation(DocumentLoader*)
{
notImplemented();
}
@@ -143,10 +147,6 @@ void WebFrameLoaderClient::detachedFromParent2()
// Notify the bundle client.
webPage->injectedBundleLoaderClient().didRemoveFrameFromHierarchy(webPage, m_frame, userData);
-
- // Notify the UIProcess.
- webPage->send(Messages::WebPageProxy::DidRemoveFrameFromHierarchy(m_frame->frameID(), InjectedBundleUserMessageEncoder(userData.get())));
-
}
void WebFrameLoaderClient::detachedFromParent3()
@@ -165,6 +165,7 @@ void WebFrameLoaderClient::assignIdentifierToInitialRequest(unsigned long identi
pageIsProvisionallyLoading = frameLoader->provisionalDocumentLoader() == loader;
webPage->injectedBundleResourceLoadClient().didInitiateLoadForResource(webPage, m_frame, identifier, request, pageIsProvisionallyLoading);
+ webPage->addResourceRequest(identifier, request);
}
void WebFrameLoaderClient::dispatchWillSendRequest(DocumentLoader*, unsigned long identifier, ResourceRequest& request, const ResourceResponse& redirectResponse)
@@ -194,29 +195,15 @@ void WebFrameLoaderClient::dispatchDidReceiveAuthenticationChallenge(DocumentLoa
if (!webPage)
return;
- WebProcess::shared().supplement<AuthenticationManager>()->didReceiveAuthenticationChallenge(m_frame, challenge);
-}
-
-void WebFrameLoaderClient::dispatchDidCancelAuthenticationChallenge(DocumentLoader*, unsigned long /*identifier*/, const AuthenticationChallenge&)
-{
- notImplemented();
+ WebProcess::singleton().supplement<AuthenticationManager>()->didReceiveAuthenticationChallenge(m_frame, challenge);
}
#if USE(PROTECTION_SPACE_AUTH_CALLBACK)
bool WebFrameLoaderClient::canAuthenticateAgainstProtectionSpace(DocumentLoader*, unsigned long, const ProtectionSpace& protectionSpace)
{
- // FIXME: Authentication is a per-resource concept, but we don't do per-resource handling in the UIProcess at the API level quite yet.
- // Once we do, we might need to make sure authentication fits with our solution.
-
- WebPage* webPage = m_frame->page();
- if (!webPage)
- return false;
-
- bool canAuthenticate;
- if (!webPage->sendSync(Messages::WebPageProxy::CanAuthenticateAgainstProtectionSpaceInFrame(m_frame->frameID(), protectionSpace), Messages::WebPageProxy::CanAuthenticateAgainstProtectionSpaceInFrame::Reply(canAuthenticate)))
- return false;
-
- return canAuthenticate;
+ // The WebKit 2 Networking process asks the UIProcess directly, so the WebContent process should never receive this callback.
+ ASSERT_NOT_REACHED();
+ return false;
}
#endif
@@ -238,6 +225,16 @@ void WebFrameLoaderClient::dispatchDidReceiveContentLength(DocumentLoader*, unsi
webPage->injectedBundleResourceLoadClient().didReceiveContentLengthForResource(webPage, m_frame, identifier, dataLength);
}
+#if ENABLE(DATA_DETECTION)
+void WebFrameLoaderClient::dispatchDidFinishDataDetection(NSArray *detectionResults)
+{
+ WebPage* webPage = m_frame->page();
+ if (!webPage)
+ return;
+ webPage->setDataDetectionResults(detectionResults);
+}
+#endif
+
void WebFrameLoaderClient::dispatchDidFinishLoading(DocumentLoader*, unsigned long identifier)
{
WebPage* webPage = m_frame->page();
@@ -245,6 +242,7 @@ void WebFrameLoaderClient::dispatchDidFinishLoading(DocumentLoader*, unsigned lo
return;
webPage->injectedBundleResourceLoadClient().didFinishLoadForResource(webPage, m_frame, identifier);
+ webPage->removeResourceRequest(identifier);
}
void WebFrameLoaderClient::dispatchDidFailLoading(DocumentLoader*, unsigned long identifier, const ResourceError& error)
@@ -254,6 +252,7 @@ void WebFrameLoaderClient::dispatchDidFailLoading(DocumentLoader*, unsigned long
return;
webPage->injectedBundleResourceLoadClient().didFailLoadForResource(webPage, m_frame, identifier, error);
+ webPage->removeResourceRequest(identifier);
}
bool WebFrameLoaderClient::dispatchDidLoadResourceFromMemoryCache(DocumentLoader*, const ResourceRequest&, const ResourceResponse&, int /*length*/)
@@ -262,7 +261,7 @@ bool WebFrameLoaderClient::dispatchDidLoadResourceFromMemoryCache(DocumentLoader
return false;
}
-void WebFrameLoaderClient::dispatchDidHandleOnloadEvents()
+void WebFrameLoaderClient::dispatchDidDispatchOnloadEvents()
{
WebPage* webPage = m_frame->page();
if (!webPage)
@@ -278,15 +277,25 @@ void WebFrameLoaderClient::dispatchDidReceiveServerRedirectForProvisionalLoad()
if (!webPage)
return;
- DocumentLoader* provisionalLoader = m_frame->coreFrame()->loader().provisionalDocumentLoader();
- const String& url = provisionalLoader->url().string();
+ WebDocumentLoader& documentLoader = static_cast<WebDocumentLoader&>(*m_frame->coreFrame()->loader().provisionalDocumentLoader());
+ const String& url = documentLoader.url().string();
RefPtr<API::Object> userData;
// Notify the bundle client.
webPage->injectedBundleLoaderClient().didReceiveServerRedirectForProvisionalLoadForFrame(webPage, m_frame, userData);
// Notify the UIProcess.
- webPage->send(Messages::WebPageProxy::DidReceiveServerRedirectForProvisionalLoadForFrame(m_frame->frameID(), url, InjectedBundleUserMessageEncoder(userData.get())));
+ webPage->send(Messages::WebPageProxy::DidReceiveServerRedirectForProvisionalLoadForFrame(m_frame->frameID(), documentLoader.navigationID(), url, UserData(WebProcess::singleton().transformObjectsToHandles(userData.get()).get())));
+}
+
+void WebFrameLoaderClient::dispatchDidChangeProvisionalURL()
+{
+ WebPage* webPage = m_frame->page();
+ if (!webPage)
+ return;
+
+ WebDocumentLoader& documentLoader = static_cast<WebDocumentLoader&>(*m_frame->coreFrame()->loader().provisionalDocumentLoader());
+ webPage->send(Messages::WebPageProxy::DidChangeProvisionalURLForFrame(m_frame->frameID(), documentLoader.navigationID(), documentLoader.url().string()));
}
void WebFrameLoaderClient::dispatchDidCancelClientRedirect()
@@ -317,11 +326,13 @@ void WebFrameLoaderClient::dispatchDidChangeLocationWithinPage()
RefPtr<API::Object> userData;
+ auto navigationID = static_cast<WebDocumentLoader&>(*m_frame->coreFrame()->loader().documentLoader()).navigationID();
+
// Notify the bundle client.
webPage->injectedBundleLoaderClient().didSameDocumentNavigationForFrame(webPage, m_frame, SameDocumentNavigationAnchorNavigation, userData);
// Notify the UIProcess.
- webPage->send(Messages::WebPageProxy::DidSameDocumentNavigationForFrame(m_frame->frameID(), SameDocumentNavigationAnchorNavigation, m_frame->coreFrame()->document()->url().string(), InjectedBundleUserMessageEncoder(userData.get())));
+ webPage->send(Messages::WebPageProxy::DidSameDocumentNavigationForFrame(m_frame->frameID(), navigationID, SameDocumentNavigationAnchorNavigation, m_frame->coreFrame()->document()->url().string(), UserData(WebProcess::singleton().transformObjectsToHandles(userData.get()).get())));
}
void WebFrameLoaderClient::dispatchDidPushStateWithinPage()
@@ -332,11 +343,13 @@ void WebFrameLoaderClient::dispatchDidPushStateWithinPage()
RefPtr<API::Object> userData;
+ auto navigationID = static_cast<WebDocumentLoader&>(*m_frame->coreFrame()->loader().documentLoader()).navigationID();
+
// Notify the bundle client.
webPage->injectedBundleLoaderClient().didSameDocumentNavigationForFrame(webPage, m_frame, SameDocumentNavigationSessionStatePush, userData);
// Notify the UIProcess.
- webPage->send(Messages::WebPageProxy::DidSameDocumentNavigationForFrame(m_frame->frameID(), SameDocumentNavigationSessionStatePush, m_frame->coreFrame()->document()->url().string(), InjectedBundleUserMessageEncoder(userData.get())));
+ webPage->send(Messages::WebPageProxy::DidSameDocumentNavigationForFrame(m_frame->frameID(), navigationID, SameDocumentNavigationSessionStatePush, m_frame->coreFrame()->document()->url().string(), UserData(WebProcess::singleton().transformObjectsToHandles(userData.get()).get())));
}
void WebFrameLoaderClient::dispatchDidReplaceStateWithinPage()
@@ -347,11 +360,13 @@ void WebFrameLoaderClient::dispatchDidReplaceStateWithinPage()
RefPtr<API::Object> userData;
+ auto navigationID = static_cast<WebDocumentLoader&>(*m_frame->coreFrame()->loader().documentLoader()).navigationID();
+
// Notify the bundle client.
webPage->injectedBundleLoaderClient().didSameDocumentNavigationForFrame(webPage, m_frame, SameDocumentNavigationSessionStateReplace, userData);
// Notify the UIProcess.
- webPage->send(Messages::WebPageProxy::DidSameDocumentNavigationForFrame(m_frame->frameID(), SameDocumentNavigationSessionStateReplace, m_frame->coreFrame()->document()->url().string(), InjectedBundleUserMessageEncoder(userData.get())));
+ webPage->send(Messages::WebPageProxy::DidSameDocumentNavigationForFrame(m_frame->frameID(), navigationID, SameDocumentNavigationSessionStateReplace, m_frame->coreFrame()->document()->url().string(), UserData(WebProcess::singleton().transformObjectsToHandles(userData.get()).get())));
}
void WebFrameLoaderClient::dispatchDidPopStateWithinPage()
@@ -362,11 +377,13 @@ void WebFrameLoaderClient::dispatchDidPopStateWithinPage()
RefPtr<API::Object> userData;
+ auto navigationID = static_cast<WebDocumentLoader&>(*m_frame->coreFrame()->loader().documentLoader()).navigationID();
+
// Notify the bundle client.
webPage->injectedBundleLoaderClient().didSameDocumentNavigationForFrame(webPage, m_frame, SameDocumentNavigationSessionStatePop, userData);
// Notify the UIProcess.
- webPage->send(Messages::WebPageProxy::DidSameDocumentNavigationForFrame(m_frame->frameID(), SameDocumentNavigationSessionStatePop, m_frame->coreFrame()->document()->url().string(), InjectedBundleUserMessageEncoder(userData.get())));
+ webPage->send(Messages::WebPageProxy::DidSameDocumentNavigationForFrame(m_frame->frameID(), navigationID, SameDocumentNavigationSessionStatePop, m_frame->coreFrame()->document()->url().string(), UserData(WebProcess::singleton().transformObjectsToHandles(userData.get()).get())));
}
void WebFrameLoaderClient::dispatchWillClose()
@@ -376,7 +393,7 @@ void WebFrameLoaderClient::dispatchWillClose()
void WebFrameLoaderClient::dispatchDidReceiveIcon()
{
- WebProcess::shared().parentProcessConnection()->send(Messages::WebIconDatabase::DidReceiveIconForPageURL(m_frame->url()), 0);
+ WebProcess::singleton().parentProcessConnection()->send(Messages::WebIconDatabase::DidReceiveIconForPageURL(m_frame->url()), 0);
}
void WebFrameLoaderClient::dispatchDidStartProvisionalLoad()
@@ -394,47 +411,46 @@ void WebFrameLoaderClient::dispatchDidStartProvisionalLoad()
webPage->findController().hideFindUI();
webPage->sandboxExtensionTracker().didStartProvisionalLoad(m_frame);
- DocumentLoader* provisionalLoader = m_frame->coreFrame()->loader().provisionalDocumentLoader();
- const String& url = provisionalLoader->url().string();
+ WebDocumentLoader& provisionalLoader = static_cast<WebDocumentLoader&>(*m_frame->coreFrame()->loader().provisionalDocumentLoader());
+ const String& url = provisionalLoader.url().string();
RefPtr<API::Object> userData;
// Notify the bundle client.
webPage->injectedBundleLoaderClient().didStartProvisionalLoadForFrame(webPage, m_frame, userData);
- String unreachableURL = provisionalLoader->unreachableURL().string();
+ String unreachableURL = provisionalLoader.unreachableURL().string();
// Notify the UIProcess.
- webPage->send(Messages::WebPageProxy::DidStartProvisionalLoadForFrame(m_frame->frameID(), url, unreachableURL, InjectedBundleUserMessageEncoder(userData.get())));
+ webPage->send(Messages::WebPageProxy::DidStartProvisionalLoadForFrame(m_frame->frameID(), provisionalLoader.navigationID(), url, unreachableURL, UserData(WebProcess::singleton().transformObjectsToHandles(userData.get()).get())));
}
+static constexpr unsigned maxTitleLength = 1000; // Closest power of 10 above the W3C recommendation for Title length.
+
void WebFrameLoaderClient::dispatchDidReceiveTitle(const StringWithDirection& title)
{
WebPage* webPage = m_frame->page();
if (!webPage)
return;
+ auto truncatedTitle = truncateFromEnd(title, maxTitleLength);
+
RefPtr<API::Object> userData;
// Notify the bundle client.
- // FIXME: use direction of title.
- webPage->injectedBundleLoaderClient().didReceiveTitleForFrame(webPage, title.string(), m_frame, userData);
+ // FIXME: Use direction of title.
+ webPage->injectedBundleLoaderClient().didReceiveTitleForFrame(webPage, truncatedTitle.string, m_frame, userData);
// Notify the UIProcess.
- webPage->send(Messages::WebPageProxy::DidReceiveTitleForFrame(m_frame->frameID(), title.string(), InjectedBundleUserMessageEncoder(userData.get())));
+ webPage->send(Messages::WebPageProxy::DidReceiveTitleForFrame(m_frame->frameID(), truncatedTitle.string, UserData(WebProcess::singleton().transformObjectsToHandles(userData.get()).get())));
}
-void WebFrameLoaderClient::dispatchDidChangeIcons(WebCore::IconType)
-{
- notImplemented();
-}
-
-void WebFrameLoaderClient::dispatchDidCommitLoad()
+void WebFrameLoaderClient::dispatchDidCommitLoad(std::optional<HasInsecureContent> hasInsecureContent)
{
WebPage* webPage = m_frame->page();
if (!webPage)
return;
- const ResourceResponse& response = m_frame->coreFrame()->loader().documentLoader()->response();
+ WebDocumentLoader& documentLoader = static_cast<WebDocumentLoader&>(*m_frame->coreFrame()->loader().documentLoader());
RefPtr<API::Object> userData;
// Notify the bundle client.
@@ -443,9 +459,7 @@ void WebFrameLoaderClient::dispatchDidCommitLoad()
webPage->sandboxExtensionTracker().didCommitProvisionalLoad(m_frame);
// Notify the UIProcess.
-
- webPage->send(Messages::WebPageProxy::DidCommitLoadForFrame(m_frame->frameID(), response.mimeType(), m_frame->coreFrame()->loader().loadType(), CertificateInfo(response), InjectedBundleUserMessageEncoder(userData.get())));
-
+ webPage->send(Messages::WebPageProxy::DidCommitLoadForFrame(m_frame->frameID(), documentLoader.navigationID(), documentLoader.response().mimeType(), m_frameHasCustomContentProvider, static_cast<uint32_t>(m_frame->coreFrame()->loader().loadType()), valueOrCompute(documentLoader.response().certificateInfo(), [] { return CertificateInfo(); }), m_frame->coreFrame()->document()->isPluginDocument(), hasInsecureContent, UserData(WebProcess::singleton().transformObjectsToHandles(userData.get()).get())));
webPage->didCommitLoad(m_frame);
}
@@ -462,9 +476,22 @@ void WebFrameLoaderClient::dispatchDidFailProvisionalLoad(const ResourceError& e
webPage->sandboxExtensionTracker().didFailProvisionalLoad(m_frame);
+ // FIXME: This is gross. This is necessary because if the client calls WKBundlePageStopLoading() from within the didFailProvisionalLoadWithErrorForFrame
+ // injected bundle client call, that will cause the provisional DocumentLoader to be disconnected from the Frame, and didDistroyNavigation message
+ // to be sent to the UIProcess (and the destruction of the DocumentLoader). If that happens, and we had captured the navigationID before injected bundle
+ // client call, the DidFailProvisionalLoadForFrame would send a navigationID of a destroyed Navigation, and the UIProcess would not be able to find it
+ // in its table.
+ //
+ // A better solution to this problem would be find a clean way to postpone the disconnection of the DocumentLoader from the Frame until
+ // the entire FrameLoaderClient function was complete.
+ uint64_t navigationID = 0;
+ if (auto documentLoader = m_frame->coreFrame()->loader().provisionalDocumentLoader())
+ navigationID = static_cast<WebDocumentLoader*>(documentLoader)->navigationID();
+
// Notify the UIProcess.
- webPage->send(Messages::WebPageProxy::DidFailProvisionalLoadForFrame(m_frame->frameID(), error, InjectedBundleUserMessageEncoder(userData.get())));
-
+ WebCore::Frame* coreFrame = m_frame ? m_frame->coreFrame() : nullptr;
+ webPage->send(Messages::WebPageProxy::DidFailProvisionalLoadForFrame(m_frame->frameID(), SecurityOriginData::fromFrame(coreFrame), navigationID, m_frame->coreFrame()->loader().provisionalLoadErrorBeingHandledURL(), error, UserData(WebProcess::singleton().transformObjectsToHandles(userData.get()).get())));
+
// If we have a load listener, notify it.
if (WebFrame::LoadListener* loadListener = m_frame->loadListener())
loadListener->didFailLoad(m_frame, error.isCancellation());
@@ -478,11 +505,13 @@ void WebFrameLoaderClient::dispatchDidFailLoad(const ResourceError& error)
RefPtr<API::Object> userData;
+ auto navigationID = static_cast<WebDocumentLoader&>(*m_frame->coreFrame()->loader().documentLoader()).navigationID();
+
// Notify the bundle client.
webPage->injectedBundleLoaderClient().didFailLoadWithErrorForFrame(webPage, m_frame, error, userData);
// Notify the UIProcess.
- webPage->send(Messages::WebPageProxy::DidFailLoadForFrame(m_frame->frameID(), error, InjectedBundleUserMessageEncoder(userData.get())));
+ webPage->send(Messages::WebPageProxy::DidFailLoadForFrame(m_frame->frameID(), navigationID, error, UserData(WebProcess::singleton().transformObjectsToHandles(userData.get()).get())));
// If we have a load listener, notify it.
if (WebFrame::LoadListener* loadListener = m_frame->loadListener())
@@ -497,11 +526,13 @@ void WebFrameLoaderClient::dispatchDidFinishDocumentLoad()
RefPtr<API::Object> userData;
+ auto navigationID = static_cast<WebDocumentLoader&>(*m_frame->coreFrame()->loader().documentLoader()).navigationID();
+
// Notify the bundle client.
webPage->injectedBundleLoaderClient().didFinishDocumentLoadForFrame(webPage, m_frame, userData);
// Notify the UIProcess.
- webPage->send(Messages::WebPageProxy::DidFinishDocumentLoadForFrame(m_frame->frameID(), InjectedBundleUserMessageEncoder(userData.get())));
+ webPage->send(Messages::WebPageProxy::DidFinishDocumentLoadForFrame(m_frame->frameID(), navigationID, UserData(WebProcess::singleton().transformObjectsToHandles(userData.get()).get())));
}
void WebFrameLoaderClient::dispatchDidFinishLoad()
@@ -512,11 +543,13 @@ void WebFrameLoaderClient::dispatchDidFinishLoad()
RefPtr<API::Object> userData;
+ auto navigationID = static_cast<WebDocumentLoader&>(*m_frame->coreFrame()->loader().documentLoader()).navigationID();
+
// Notify the bundle client.
webPage->injectedBundleLoaderClient().didFinishLoadForFrame(webPage, m_frame, userData);
// Notify the UIProcess.
- webPage->send(Messages::WebPageProxy::DidFinishLoadForFrame(m_frame->frameID(), InjectedBundleUserMessageEncoder(userData.get())));
+ webPage->send(Messages::WebPageProxy::DidFinishLoadForFrame(m_frame->frameID(), navigationID, UserData(WebProcess::singleton().transformObjectsToHandles(userData.get()).get())));
// If we have a load listener, notify it.
if (WebFrame::LoadListener* loadListener = m_frame->loadListener())
@@ -527,7 +560,7 @@ void WebFrameLoaderClient::dispatchDidFinishLoad()
void WebFrameLoaderClient::forcePageTransitionIfNeeded()
{
- if (m_didCompletePageTransitionAlready)
+ if (m_didCompletePageTransition)
return;
WebPage* webPage = m_frame->page();
@@ -535,10 +568,10 @@ void WebFrameLoaderClient::forcePageTransitionIfNeeded()
return;
webPage->didCompletePageTransition();
- m_didCompletePageTransitionAlready = true;
+ m_didCompletePageTransition = true;
}
-void WebFrameLoaderClient::dispatchDidLayout(LayoutMilestones milestones)
+void WebFrameLoaderClient::dispatchDidReachLayoutMilestone(LayoutMilestones milestones)
{
WebPage* webPage = m_frame->page();
if (!webPage)
@@ -550,30 +583,35 @@ void WebFrameLoaderClient::dispatchDidLayout(LayoutMilestones milestones)
// FIXME: We should consider removing the old didFirstLayout API since this is doing double duty with the
// new didLayout API.
webPage->injectedBundleLoaderClient().didFirstLayoutForFrame(webPage, m_frame, userData);
- webPage->send(Messages::WebPageProxy::DidFirstLayoutForFrame(m_frame->frameID(), InjectedBundleUserMessageEncoder(userData.get())));
+ webPage->send(Messages::WebPageProxy::DidFirstLayoutForFrame(m_frame->frameID(), UserData(WebProcess::singleton().transformObjectsToHandles(userData.get()).get())));
- if (m_frame == m_frame->page()->mainWebFrame()) {
- if (!webPage->corePage()->settings().suppressesIncrementalRendering() && !m_didCompletePageTransitionAlready) {
- webPage->didCompletePageTransition();
- m_didCompletePageTransitionAlready = true;
- }
+#if PLATFORM(MAC)
+ // FIXME: Do this on DidFirstVisuallyNonEmptyLayout when Mac Safari is able to handle it (<rdar://problem/17580021>)
+ if (m_frame->isMainFrame() && !m_didCompletePageTransition && !webPage->corePage()->settings().suppressesIncrementalRendering()) {
+ webPage->didCompletePageTransition();
+ m_didCompletePageTransition = true;
}
-
-#if USE(TILED_BACKING_STORE)
+#endif
+
+#if USE(COORDINATED_GRAPHICS)
// Make sure viewport properties are dispatched on the main frame by the time the first layout happens.
ASSERT(!webPage->useFixedLayout() || m_frame != m_frame->page()->mainWebFrame() || m_frame->coreFrame()->document()->didDispatchViewportPropertiesChanged());
#endif
}
// Send this after DidFirstLayout-specific calls since some clients expect to get those messages first.
- webPage->injectedBundleLoaderClient().didLayout(webPage, milestones, userData);
- webPage->send(Messages::WebPageProxy::DidLayout(milestones, InjectedBundleUserMessageEncoder(userData.get())));
+ webPage->dispatchDidReachLayoutMilestone(milestones);
if (milestones & DidFirstVisuallyNonEmptyLayout) {
+ if (m_frame->isMainFrame() && !m_didCompletePageTransition && !webPage->corePage()->settings().suppressesIncrementalRendering()) {
+ webPage->didCompletePageTransition();
+ m_didCompletePageTransition = true;
+ }
+
// FIXME: We should consider removing the old didFirstVisuallyNonEmptyLayoutForFrame API since this is doing
// double duty with the new didLayout API.
webPage->injectedBundleLoaderClient().didFirstVisuallyNonEmptyLayoutForFrame(webPage, m_frame, userData);
- webPage->send(Messages::WebPageProxy::DidFirstVisuallyNonEmptyLayoutForFrame(m_frame->frameID(), InjectedBundleUserMessageEncoder(userData.get())));
+ webPage->send(Messages::WebPageProxy::DidFirstVisuallyNonEmptyLayoutForFrame(m_frame->frameID(), UserData(WebProcess::singleton().transformObjectsToHandles(userData.get()).get())));
}
}
@@ -588,6 +626,10 @@ void WebFrameLoaderClient::dispatchDidLayout()
webPage->recomputeShortCircuitHorizontalWheelEventsState();
+#if PLATFORM(IOS)
+ webPage->updateSelectionAppearance();
+#endif
+
// NOTE: Unlike the other layout notifications, this does not notify the
// the UIProcess for every call.
@@ -602,12 +644,13 @@ Frame* WebFrameLoaderClient::dispatchCreatePage(const NavigationAction& navigati
{
WebPage* webPage = m_frame->page();
if (!webPage)
- return 0;
+ return nullptr;
// Just call through to the chrome client.
- Page* newPage = webPage->corePage()->chrome().createWindow(m_frame->coreFrame(), FrameLoadRequest(m_frame->coreFrame()->document()->securityOrigin()), WindowFeatures(), navigationAction);
+ FrameLoadRequest request(m_frame->coreFrame()->document()->securityOrigin(), navigationAction.resourceRequest(), LockHistory::No, LockBackForwardList::No, MaybeSendReferrer, AllowNavigationToInvalidURL::Yes, NewFrameOpenerPolicy::Allow, navigationAction.shouldOpenExternalURLsPolicy());
+ Page* newPage = webPage->corePage()->chrome().createWindow(*m_frame->coreFrame(), request, WindowFeatures(), navigationAction);
if (!newPage)
- return 0;
+ return nullptr;
return &newPage->mainFrame();
}
@@ -624,8 +667,10 @@ void WebFrameLoaderClient::dispatchShow()
void WebFrameLoaderClient::dispatchDecidePolicyForResponse(const ResourceResponse& response, const ResourceRequest& request, FramePolicyFunction function)
{
WebPage* webPage = m_frame->page();
- if (!webPage)
+ if (!webPage) {
+ function(PolicyIgnore);
return;
+ }
if (!request.url().string()) {
function(PolicyUse);
@@ -643,27 +688,30 @@ void WebFrameLoaderClient::dispatchDecidePolicyForResponse(const ResourceRespons
bool canShowMIMEType = webPage->canShowMIMEType(response.mimeType());
- uint64_t listenerID = m_frame->setUpPolicyListener(std::move(function));
+ uint64_t listenerID = m_frame->setUpPolicyListener(WTFMove(function));
bool receivedPolicyAction;
uint64_t policyAction;
- uint64_t downloadID;
+ DownloadID downloadID;
- // Notify the UIProcess.
- // FIXME (126021): It is not good to change IPC behavior conditionally, and SpinRunLoopWhileWaitingForReply was known to cause trouble in other similar cases.
- unsigned syncSendFlags = (WebCore::AXObjectCache::accessibilityEnabled()) ? IPC::SpinRunLoopWhileWaitingForReply : 0;
- if (!webPage->sendSync(Messages::WebPageProxy::DecidePolicyForResponseSync(m_frame->frameID(), response, request, canShowMIMEType, listenerID, InjectedBundleUserMessageEncoder(userData.get())), Messages::WebPageProxy::DecidePolicyForResponseSync::Reply(receivedPolicyAction, policyAction, downloadID), std::chrono::milliseconds::max(), syncSendFlags))
+ Ref<WebFrame> protect(*m_frame);
+ WebCore::Frame* coreFrame = m_frame->coreFrame();
+ if (!webPage->sendSync(Messages::WebPageProxy::DecidePolicyForResponseSync(m_frame->frameID(), SecurityOriginData::fromFrame(coreFrame), response, request, canShowMIMEType, listenerID, UserData(WebProcess::singleton().transformObjectsToHandles(userData.get()).get())), Messages::WebPageProxy::DecidePolicyForResponseSync::Reply(receivedPolicyAction, policyAction, downloadID), Seconds::infinity(), IPC::SendSyncOption::InformPlatformProcessWillSuspend)) {
+ m_frame->didReceivePolicyDecision(listenerID, PolicyIgnore, 0, { });
return;
+ }
// We call this synchronously because CFNetwork can only convert a loading connection to a download from its didReceiveResponse callback.
if (receivedPolicyAction)
- m_frame->didReceivePolicyDecision(listenerID, static_cast<PolicyAction>(policyAction), downloadID);
+ m_frame->didReceivePolicyDecision(listenerID, static_cast<PolicyAction>(policyAction), 0, downloadID);
}
-void WebFrameLoaderClient::dispatchDecidePolicyForNewWindowAction(const NavigationAction& navigationAction, const ResourceRequest& request, PassRefPtr<FormState> formState, const String& frameName, FramePolicyFunction function)
+void WebFrameLoaderClient::dispatchDecidePolicyForNewWindowAction(const NavigationAction& navigationAction, const ResourceRequest& request, FormState* formState, const String& frameName, FramePolicyFunction function)
{
WebPage* webPage = m_frame->page();
- if (!webPage)
+ if (!webPage) {
+ function(PolicyIgnore);
return;
+ }
RefPtr<API::Object> userData;
@@ -677,21 +725,29 @@ void WebFrameLoaderClient::dispatchDecidePolicyForNewWindowAction(const Navigati
}
- uint64_t listenerID = m_frame->setUpPolicyListener(std::move(function));
+ uint64_t listenerID = m_frame->setUpPolicyListener(WTFMove(function));
NavigationActionData navigationActionData;
navigationActionData.navigationType = action->navigationType();
navigationActionData.modifiers = action->modifiers();
navigationActionData.mouseButton = action->mouseButton();
+ navigationActionData.syntheticClickType = action->syntheticClickType();
+ navigationActionData.userGestureTokenIdentifier = WebProcess::singleton().userGestureTokenIdentifier(navigationAction.userGestureToken());
+ navigationActionData.canHandleRequest = webPage->canHandleRequest(request);
+ navigationActionData.shouldOpenExternalURLsPolicy = navigationAction.shouldOpenExternalURLsPolicy();
+ navigationActionData.downloadAttribute = navigationAction.downloadAttribute();
- webPage->send(Messages::WebPageProxy::DecidePolicyForNewWindowAction(m_frame->frameID(), navigationActionData, request, frameName, listenerID, InjectedBundleUserMessageEncoder(userData.get())));
+ WebCore::Frame* coreFrame = m_frame ? m_frame->coreFrame() : nullptr;
+ webPage->send(Messages::WebPageProxy::DecidePolicyForNewWindowAction(m_frame->frameID(), SecurityOriginData::fromFrame(coreFrame), navigationActionData, request, frameName, listenerID, UserData(WebProcess::singleton().transformObjectsToHandles(userData.get()).get())));
}
-void WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction(const NavigationAction& navigationAction, const ResourceRequest& request, PassRefPtr<FormState> prpFormState, FramePolicyFunction function)
+void WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction(const NavigationAction& navigationAction, const ResourceRequest& request, FormState* formState, FramePolicyFunction function)
{
WebPage* webPage = m_frame->page();
- if (!webPage)
+ if (!webPage) {
+ function(PolicyIgnore);
return;
+ }
// Always ignore requests with empty URLs.
if (request.isEmpty()) {
@@ -700,7 +756,6 @@ void WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction(const Navigat
}
RefPtr<API::Object> userData;
- RefPtr<FormState> formState = prpFormState;
RefPtr<InjectedBundleNavigationAction> action = InjectedBundleNavigationAction::create(m_frame, navigationAction, formState);
@@ -711,26 +766,30 @@ void WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction(const Navigat
return;
}
- uint64_t listenerID = m_frame->setUpPolicyListener(std::move(function));
+ uint64_t listenerID = m_frame->setUpPolicyListener(WTFMove(function));
bool receivedPolicyAction;
+ uint64_t newNavigationID;
uint64_t policyAction;
- uint64_t downloadID;
+ DownloadID downloadID;
RefPtr<WebFrame> originatingFrame;
switch (action->navigationType()) {
- case NavigationTypeLinkClicked:
- originatingFrame = action->hitTestResult()->frame();
- break;
- case NavigationTypeFormSubmitted:
- case NavigationTypeFormResubmitted:
- if (formState) {
- if (WebFrameLoaderClient* originatingFrameLoaderClient = toWebFrameLoaderClient(formState->sourceDocument()->frame()->loader().client()))
- originatingFrame = originatingFrameLoaderClient->webFrame();
+ case NavigationType::LinkClicked:
+ if (EventTarget* target = navigationAction.event()->target()) {
+ if (Node* node = target->toNode()) {
+ if (Frame* frame = node->document().frame())
+ originatingFrame = WebFrame::fromCoreFrame(*frame);
+ }
}
break;
- case NavigationTypeBackForward:
- case NavigationTypeReload:
- case NavigationTypeOther:
+ case NavigationType::FormSubmitted:
+ case NavigationType::FormResubmitted:
+ if (formState)
+ originatingFrame = WebFrame::fromCoreFrame(*formState->sourceDocument().frame());
+ break;
+ case NavigationType::BackForward:
+ case NavigationType::Reload:
+ case NavigationType::Other:
break;
}
@@ -738,14 +797,48 @@ void WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction(const Navigat
navigationActionData.navigationType = action->navigationType();
navigationActionData.modifiers = action->modifiers();
navigationActionData.mouseButton = action->mouseButton();
+ navigationActionData.syntheticClickType = action->syntheticClickType();
+ navigationActionData.userGestureTokenIdentifier = WebProcess::singleton().userGestureTokenIdentifier(navigationAction.userGestureToken());
+ navigationActionData.canHandleRequest = webPage->canHandleRequest(request);
+ navigationActionData.shouldOpenExternalURLsPolicy = navigationAction.shouldOpenExternalURLsPolicy();
+ navigationActionData.downloadAttribute = navigationAction.downloadAttribute();
+
+ WebCore::Frame* coreFrame = m_frame->coreFrame();
+ WebDocumentLoader* documentLoader = static_cast<WebDocumentLoader*>(coreFrame->loader().policyDocumentLoader());
+ if (!documentLoader)
+ documentLoader = static_cast<WebDocumentLoader*>(coreFrame->loader().documentLoader());
// Notify the UIProcess.
- if (!webPage->sendSync(Messages::WebPageProxy::DecidePolicyForNavigationAction(m_frame->frameID(), navigationActionData, originatingFrame ? originatingFrame->frameID() : 0, navigationAction.resourceRequest(), request, listenerID, InjectedBundleUserMessageEncoder(userData.get())), Messages::WebPageProxy::DecidePolicyForNavigationAction::Reply(receivedPolicyAction, policyAction, downloadID)))
+ Ref<WebFrame> protect(*m_frame);
+ WebCore::Frame* originatingCoreFrame = originatingFrame ? originatingFrame->coreFrame() : nullptr;
+ WebsitePolicies websitePolicies;
+ if (!webPage->sendSync(Messages::WebPageProxy::DecidePolicyForNavigationAction(m_frame->frameID(), SecurityOriginData::fromFrame(coreFrame), documentLoader->navigationID(), navigationActionData, originatingFrame ? originatingFrame->frameID() : 0, SecurityOriginData::fromFrame(originatingCoreFrame), navigationAction.resourceRequest(), request, listenerID, UserData(WebProcess::singleton().transformObjectsToHandles(userData.get()).get())), Messages::WebPageProxy::DecidePolicyForNavigationAction::Reply(receivedPolicyAction, newNavigationID, policyAction, downloadID, websitePolicies))) {
+ m_frame->didReceivePolicyDecision(listenerID, PolicyIgnore, 0, { });
return;
+ }
+
+ // Only setUserContentExtensionsEnabled if it hasn't already been disabled by reloading without content blockers.
+ if (documentLoader->userContentExtensionsEnabled())
+ documentLoader->setUserContentExtensionsEnabled(websitePolicies.contentBlockersEnabled);
+
+ switch (websitePolicies.autoplayPolicy) {
+ case WebsiteAutoplayPolicy::Default:
+ documentLoader->setAutoplayPolicy(AutoplayPolicy::Default);
+ break;
+ case WebsiteAutoplayPolicy::Allow:
+ documentLoader->setAutoplayPolicy(AutoplayPolicy::Allow);
+ break;
+ case WebsiteAutoplayPolicy::AllowWithoutSound:
+ documentLoader->setAutoplayPolicy(AutoplayPolicy::AllowWithoutSound);
+ break;
+ case WebsiteAutoplayPolicy::Deny:
+ documentLoader->setAutoplayPolicy(AutoplayPolicy::Deny);
+ break;
+ }
// We call this synchronously because WebCore cannot gracefully handle a frame load without a synchronous navigation policy reply.
if (receivedPolicyAction)
- m_frame->didReceivePolicyDecision(listenerID, static_cast<PolicyAction>(policyAction), downloadID);
+ m_frame->didReceivePolicyDecision(listenerID, static_cast<PolicyAction>(policyAction), newNavigationID, downloadID);
}
void WebFrameLoaderClient::cancelPolicyCheck()
@@ -765,49 +858,43 @@ void WebFrameLoaderClient::dispatchUnableToImplementPolicy(const ResourceError&
webPage->injectedBundlePolicyClient().unableToImplementPolicy(webPage, m_frame, error, userData);
// Notify the UIProcess.
- webPage->send(Messages::WebPageProxy::UnableToImplementPolicy(m_frame->frameID(), error, InjectedBundleUserMessageEncoder(userData.get())));
+ webPage->send(Messages::WebPageProxy::UnableToImplementPolicy(m_frame->frameID(), error, UserData(WebProcess::singleton().transformObjectsToHandles(userData.get()).get())));
}
-void WebFrameLoaderClient::dispatchWillSendSubmitEvent(PassRefPtr<FormState> prpFormState)
+void WebFrameLoaderClient::dispatchWillSendSubmitEvent(Ref<FormState>&& formState)
{
- WebPage* webPage = m_frame->page();
+ auto* webPage = m_frame->page();
if (!webPage)
return;
- RefPtr<FormState> formState = prpFormState;
- HTMLFormElement* form = formState->form();
+ auto& form = formState->form();
- WebFrameLoaderClient* webFrameLoaderClient = toWebFrameLoaderClient(formState->sourceDocument()->frame()->loader().client());
- WebFrame* sourceFrame = webFrameLoaderClient ? webFrameLoaderClient->webFrame() : 0;
+ ASSERT(formState->sourceDocument().frame());
+ auto* sourceFrame = WebFrame::fromCoreFrame(*formState->sourceDocument().frame());
ASSERT(sourceFrame);
- webPage->injectedBundleFormClient().willSendSubmitEvent(webPage, form, m_frame, sourceFrame, formState->textFieldValues());
+ webPage->injectedBundleFormClient().willSendSubmitEvent(webPage, &form, m_frame, sourceFrame, formState->textFieldValues());
}
-void WebFrameLoaderClient::dispatchWillSubmitForm(PassRefPtr<FormState> prpFormState, FramePolicyFunction function)
+void WebFrameLoaderClient::dispatchWillSubmitForm(FormState& formState, FramePolicyFunction function)
{
WebPage* webPage = m_frame->page();
if (!webPage)
return;
- // FIXME: Pass more of the form state.
- RefPtr<FormState> formState = prpFormState;
-
- HTMLFormElement* form = formState->form();
+ auto& form = formState.form();
- WebFrameLoaderClient* webFrameLoaderClient = toWebFrameLoaderClient(formState->sourceDocument()->frame()->loader().client());
- WebFrame* sourceFrame = webFrameLoaderClient ? webFrameLoaderClient->webFrame() : 0;
+ auto* sourceFrame = WebFrame::fromCoreFrame(*formState.sourceDocument().frame());
ASSERT(sourceFrame);
- const Vector<std::pair<String, String>>& values = formState->textFieldValues();
+ auto& values = formState.textFieldValues();
RefPtr<API::Object> userData;
- webPage->injectedBundleFormClient().willSubmitForm(webPage, form, m_frame, sourceFrame, values, userData);
-
+ webPage->injectedBundleFormClient().willSubmitForm(webPage, &form, m_frame, sourceFrame, values, userData);
- uint64_t listenerID = m_frame->setUpPolicyListener(std::move(function));
+ uint64_t listenerID = m_frame->setUpPolicyListener(WTFMove(function));
- webPage->send(Messages::WebPageProxy::WillSubmitForm(m_frame->frameID(), sourceFrame->frameID(), values, listenerID, InjectedBundleUserMessageEncoder(userData.get())));
+ webPage->send(Messages::WebPageProxy::WillSubmitForm(m_frame->frameID(), sourceFrame->frameID(), values, listenerID, UserData(WebProcess::singleton().transformObjectsToHandles(userData.get()).get())));
}
void WebFrameLoaderClient::revertToProvisionalState(DocumentLoader*)
@@ -821,7 +908,7 @@ void WebFrameLoaderClient::setMainDocumentError(DocumentLoader*, const ResourceE
return;
m_pluginView->manualLoadDidFail(error);
- m_pluginView = 0;
+ m_pluginView = nullptr;
m_hasSentResponseToPluginView = false;
}
@@ -830,9 +917,9 @@ void WebFrameLoaderClient::setMainFrameDocumentReady(bool)
notImplemented();
}
-void WebFrameLoaderClient::startDownload(const ResourceRequest& request, const String& /* suggestedName */)
+void WebFrameLoaderClient::startDownload(const ResourceRequest& request, const String& suggestedName)
{
- m_frame->startDownload(request);
+ m_frame->startDownload(request, suggestedName);
}
void WebFrameLoaderClient::willChangeTitle(DocumentLoader*)
@@ -845,6 +932,22 @@ void WebFrameLoaderClient::didChangeTitle(DocumentLoader*)
notImplemented();
}
+void WebFrameLoaderClient::willReplaceMultipartContent()
+{
+ WebPage* webPage = m_frame->page();
+ if (!webPage)
+ return;
+ webPage->willReplaceMultipartContent(*m_frame);
+}
+
+void WebFrameLoaderClient::didReplaceMultipartContent()
+{
+ WebPage* webPage = m_frame->page();
+ if (!webPage)
+ return;
+ webPage->didReplaceMultipartContent(*m_frame);
+}
+
void WebFrameLoaderClient::committedLoad(DocumentLoader* loader, const char* data, int length)
{
if (!m_pluginView)
@@ -873,8 +976,19 @@ void WebFrameLoaderClient::committedLoad(DocumentLoader* loader, const char* dat
void WebFrameLoaderClient::finishedLoading(DocumentLoader* loader)
{
- if (!m_pluginView)
+ if (!m_pluginView) {
+ if (m_frameHasCustomContentProvider) {
+ WebPage* webPage = m_frame->page();
+ if (!webPage)
+ return;
+
+ RefPtr<SharedBuffer> mainResourceData = loader->mainResourceData();
+ IPC::DataReference dataReference(reinterpret_cast<const uint8_t*>(mainResourceData ? mainResourceData->data() : 0), mainResourceData ? mainResourceData->size() : 0);
+ webPage->send(Messages::WebPageProxy::DidFinishLoadingDataForCustomContentProvider(loader->response().suggestedFilename(), dataReference));
+ }
+
return;
+ }
// If we just received an empty response without any data, we won't have sent a response to the plug-in view.
// Make sure to do this before calling manualLoadDidFinishLoading.
@@ -887,7 +1001,7 @@ void WebFrameLoaderClient::finishedLoading(DocumentLoader* loader)
}
m_pluginView->manualLoadDidFinishLoading();
- m_pluginView = 0;
+ m_pluginView = nullptr;
m_hasSentResponseToPluginView = false;
}
@@ -901,12 +1015,12 @@ void WebFrameLoaderClient::updateGlobalHistory()
WebNavigationDataStore data;
data.url = loader->url().string();
- // FIXME: use direction of title.
- data.title = loader->title().string();
+ // FIXME: Use direction of title.
+ data.title = loader->title().string;
data.originalRequest = loader->originalRequestCopy();
data.response = loader->response();
- WebProcess::shared().parentProcessConnection()->send(Messages::WebProcessProxy::DidNavigateWithNavigationData(webPage->pageID(), data, m_frame->frameID()), 0);
+ webPage->send(Messages::WebPageProxy::DidNavigateWithNavigationData(data, m_frame->frameID()));
}
void WebFrameLoaderClient::updateGlobalHistoryRedirectLinks()
@@ -920,14 +1034,14 @@ void WebFrameLoaderClient::updateGlobalHistoryRedirectLinks()
// Client redirect
if (!loader->clientRedirectSourceForHistory().isNull()) {
- WebProcess::shared().parentProcessConnection()->send(Messages::WebProcessProxy::DidPerformClientRedirect(webPage->pageID(),
- loader->clientRedirectSourceForHistory(), loader->clientRedirectDestinationForHistory(), m_frame->frameID()), 0);
+ webPage->send(Messages::WebPageProxy::DidPerformClientRedirect(
+ loader->clientRedirectSourceForHistory(), loader->clientRedirectDestinationForHistory(), m_frame->frameID()));
}
// Server redirect
if (!loader->serverRedirectSourceForHistory().isNull()) {
- WebProcess::shared().parentProcessConnection()->send(Messages::WebProcessProxy::DidPerformServerRedirect(webPage->pageID(),
- loader->serverRedirectSourceForHistory(), loader->serverRedirectDestinationForHistory(), m_frame->frameID()), 0);
+ webPage->send(Messages::WebPageProxy::DidPerformServerRedirect(
+ loader->serverRedirectSourceForHistory(), loader->serverRedirectDestinationForHistory(), m_frame->frameID()));
}
}
@@ -952,7 +1066,7 @@ bool WebFrameLoaderClient::shouldGoToHistoryItem(HistoryItem* item) const
if (!shouldGoToBackForwardListItem)
return false;
- webPage->send(Messages::WebPageProxy::WillGoToBackForwardListItem(itemID, InjectedBundleUserMessageEncoder(userData.get())));
+ webPage->send(Messages::WebPageProxy::WillGoToBackForwardListItem(itemID, UserData(WebProcess::singleton().transformObjectsToHandles(userData.get()).get())));
return true;
}
@@ -966,10 +1080,10 @@ void WebFrameLoaderClient::didDisplayInsecureContent()
webPage->injectedBundleLoaderClient().didDisplayInsecureContentForFrame(webPage, m_frame, userData);
- webPage->send(Messages::WebPageProxy::DidDisplayInsecureContentForFrame(m_frame->frameID(), InjectedBundleUserMessageEncoder(userData.get())));
+ webPage->send(Messages::WebPageProxy::DidDisplayInsecureContentForFrame(m_frame->frameID(), UserData(WebProcess::singleton().transformObjectsToHandles(userData.get()).get())));
}
-void WebFrameLoaderClient::didRunInsecureContent(SecurityOrigin*, const URL&)
+void WebFrameLoaderClient::didRunInsecureContent(SecurityOrigin&, const URL&)
{
WebPage* webPage = m_frame->page();
if (!webPage)
@@ -979,7 +1093,7 @@ void WebFrameLoaderClient::didRunInsecureContent(SecurityOrigin*, const URL&)
webPage->injectedBundleLoaderClient().didRunInsecureContentForFrame(webPage, m_frame, userData);
- webPage->send(Messages::WebPageProxy::DidRunInsecureContentForFrame(m_frame->frameID(), InjectedBundleUserMessageEncoder(userData.get())));
+ webPage->send(Messages::WebPageProxy::DidRunInsecureContentForFrame(m_frame->frameID(), UserData(WebProcess::singleton().transformObjectsToHandles(userData.get()).get())));
}
void WebFrameLoaderClient::didDetectXSS(const URL&, bool)
@@ -992,7 +1106,7 @@ void WebFrameLoaderClient::didDetectXSS(const URL&, bool)
webPage->injectedBundleLoaderClient().didDetectXSSForFrame(webPage, m_frame, userData);
- webPage->send(Messages::WebPageProxy::DidDetectXSSForFrame(m_frame->frameID(), InjectedBundleUserMessageEncoder(userData.get())));
+ webPage->send(Messages::WebPageProxy::DidDetectXSSForFrame(m_frame->frameID(), UserData(WebProcess::singleton().transformObjectsToHandles(userData.get()).get())));
}
ResourceError WebFrameLoaderClient::cancelledError(const ResourceRequest& request)
@@ -1005,6 +1119,11 @@ ResourceError WebFrameLoaderClient::blockedError(const ResourceRequest& request)
return WebKit::blockedError(request);
}
+ResourceError WebFrameLoaderClient::blockedByContentBlockerError(const ResourceRequest& request)
+{
+ return WebKit::blockedByContentBlockerError(request);
+}
+
ResourceError WebFrameLoaderClient::cannotShowURLError(const ResourceRequest& request)
{
return WebKit::cannotShowURLError(request);
@@ -1015,6 +1134,13 @@ ResourceError WebFrameLoaderClient::interruptedForPolicyChangeError(const Resour
return WebKit::interruptedForPolicyChangeError(request);
}
+#if ENABLE(CONTENT_FILTERING)
+ResourceError WebFrameLoaderClient::blockedByContentFilterError(const ResourceRequest& request)
+{
+ return WebKit::blockedByContentFilterError(request);
+}
+#endif
+
ResourceError WebFrameLoaderClient::cannotShowMIMETypeError(const ResourceResponse& response)
{
return WebKit::cannotShowMIMETypeError(response);
@@ -1080,19 +1206,34 @@ void WebFrameLoaderClient::frameLoadCompleted()
if (!webPage)
return;
- if (m_frame == m_frame->page()->mainWebFrame() && !m_didCompletePageTransitionAlready) {
+ if (m_frame->isMainFrame() && !m_didCompletePageTransition) {
webPage->didCompletePageTransition();
- m_didCompletePageTransitionAlready = true;
+ m_didCompletePageTransition = true;
}
}
-void WebFrameLoaderClient::saveViewStateToItem(HistoryItem*)
+void WebFrameLoaderClient::saveViewStateToItem(HistoryItem& historyItem)
{
- notImplemented();
+#if PLATFORM(IOS)
+ if (m_frame->isMainFrame())
+ m_frame->page()->savePageState(historyItem);
+#else
+ UNUSED_PARAM(historyItem);
+#endif
}
void WebFrameLoaderClient::restoreViewState()
{
+#if PLATFORM(IOS)
+ Frame& frame = *m_frame->coreFrame();
+ HistoryItem* currentItem = frame.loader().history().currentItem();
+ if (FrameView* view = frame.view()) {
+ if (m_frame->isMainFrame())
+ m_frame->page()->restorePageState(*currentItem);
+ else if (!view->wasScrolledByUser())
+ view->setScrollPosition(currentItem->scrollPosition());
+ }
+#else
// Inform the UI process of the scale factor.
double scaleFactor = m_frame->coreFrame()->loader().history().currentItem()->pageScaleFactor();
@@ -1102,8 +1243,9 @@ void WebFrameLoaderClient::restoreViewState()
// FIXME: This should not be necessary. WebCore should be correctly invalidating
// the view on restores from the back/forward cache.
- if (m_frame == m_frame->page()->mainWebFrame())
+ if (m_frame->page() && m_frame == m_frame->page()->mainWebFrame())
m_frame->page()->drawingArea()->setNeedsDisplay();
+#endif
}
void WebFrameLoaderClient::provisionalLoadStarted()
@@ -1112,9 +1254,9 @@ void WebFrameLoaderClient::provisionalLoadStarted()
if (!webPage)
return;
- if (m_frame == m_frame->page()->mainWebFrame()) {
+ if (m_frame->isMainFrame()) {
webPage->didStartPageTransition();
- m_didCompletePageTransitionAlready = false;
+ m_didCompletePageTransition = false;
}
}
@@ -1130,20 +1272,24 @@ void WebFrameLoaderClient::prepareForDataSourceReplacement()
notImplemented();
}
-PassRefPtr<DocumentLoader> WebFrameLoaderClient::createDocumentLoader(const ResourceRequest& request, const SubstituteData& substituteData)
+Ref<DocumentLoader> WebFrameLoaderClient::createDocumentLoader(const ResourceRequest& request, const SubstituteData& substituteData)
{
return m_frame->page()->createDocumentLoader(*m_frame->coreFrame(), request, substituteData);
}
+void WebFrameLoaderClient::updateCachedDocumentLoader(WebCore::DocumentLoader& loader)
+{
+ m_frame->page()->updateCachedDocumentLoader(static_cast<WebDocumentLoader&>(loader), *m_frame->coreFrame());
+}
+
void WebFrameLoaderClient::setTitle(const StringWithDirection& title, const URL& url)
{
WebPage* webPage = m_frame->page();
if (!webPage || !webPage->pageGroup()->isVisibleToHistoryClient())
return;
- // FIXME: use direction of title.
- WebProcess::shared().parentProcessConnection()->send(Messages::WebProcessProxy::DidUpdateHistoryTitle(webPage->pageID(),
- title.string(), url.string(), m_frame->frameID()), 0);
+ // FIXME: Use direction of title.
+ webPage->send(Messages::WebPageProxy::DidUpdateHistoryTitle(title.string, url.string(), m_frame->frameID()));
}
String WebFrameLoaderClient::userAgent(const URL& url)
@@ -1152,53 +1298,78 @@ String WebFrameLoaderClient::userAgent(const URL& url)
if (!webPage)
return String();
- return webPage->userAgent(url);
+ return webPage->userAgent(m_frame, url);
+}
+
+String WebFrameLoaderClient::overrideContentSecurityPolicy() const
+{
+ WebPage* webPage = m_frame->page();
+ if (!webPage)
+ return String();
+
+ return webPage->overrideContentSecurityPolicy();
}
-void WebFrameLoaderClient::savePlatformDataToCachedFrame(CachedFrame*)
+void WebFrameLoaderClient::savePlatformDataToCachedFrame(CachedFrame* cachedFrame)
{
+ WebPage* webPage = m_frame->page();
+ if (!webPage)
+ return;
+
+ HasInsecureContent hasInsecureContent;
+ if (webPage->sendSync(Messages::WebPageProxy::HasInsecureContent(), Messages::WebPageProxy::HasInsecureContent::Reply(hasInsecureContent)))
+ cachedFrame->setHasInsecureContent(hasInsecureContent);
}
void WebFrameLoaderClient::transitionToCommittedFromCachedFrame(CachedFrame*)
{
+ const ResourceResponse& response = m_frame->coreFrame()->loader().documentLoader()->response();
+ m_frameHasCustomContentProvider = m_frame->isMainFrame() && m_frame->page()->shouldUseCustomContentProviderForResponse(response);
+ m_frameCameFromPageCache = true;
}
void WebFrameLoaderClient::transitionToCommittedForNewPage()
{
WebPage* webPage = m_frame->page();
- Color backgroundColor = webPage->drawsTransparentBackground() ? Color::transparent : Color::white;
- bool isMainFrame = webPage->mainWebFrame() == m_frame;
+ Color backgroundColor = webPage->drawsBackground() ? Color::white : Color::transparent;
+ bool isMainFrame = m_frame->isMainFrame();
bool isTransparent = !webPage->drawsBackground();
bool shouldUseFixedLayout = isMainFrame && webPage->useFixedLayout();
bool shouldDisableScrolling = isMainFrame && !webPage->mainFrameIsScrollable();
- bool shouldHideScrollbars = shouldUseFixedLayout || shouldDisableScrolling;
+ bool shouldHideScrollbars = shouldDisableScrolling;
IntRect fixedVisibleContentRect;
-#if USE(TILED_BACKING_STORE)
+#if USE(COORDINATED_GRAPHICS)
if (m_frame->coreFrame()->view())
fixedVisibleContentRect = m_frame->coreFrame()->view()->fixedVisibleContentRect();
+ if (shouldUseFixedLayout)
+ shouldHideScrollbars = true;
#endif
+ const ResourceResponse& response = m_frame->coreFrame()->loader().documentLoader()->response();
+ m_frameHasCustomContentProvider = isMainFrame && webPage->shouldUseCustomContentProviderForResponse(response);
m_frameCameFromPageCache = false;
ScrollbarMode defaultScrollbarMode = shouldHideScrollbars ? ScrollbarAlwaysOff : ScrollbarAuto;
m_frame->coreFrame()->createView(webPage->size(), backgroundColor, isTransparent,
- IntSize(), fixedVisibleContentRect, shouldUseFixedLayout,
+ webPage->fixedLayoutSize(), fixedVisibleContentRect, shouldUseFixedLayout,
defaultScrollbarMode, /* lock */ shouldHideScrollbars, defaultScrollbarMode, /* lock */ shouldHideScrollbars);
if (int minimumLayoutWidth = webPage->minimumLayoutSize().width()) {
int minimumLayoutHeight = std::max(webPage->minimumLayoutSize().height(), 1);
int maximumSize = std::numeric_limits<int>::max();
m_frame->coreFrame()->view()->enableAutoSizeMode(true, IntSize(minimumLayoutWidth, minimumLayoutHeight), IntSize(maximumSize, maximumSize));
- m_frame->coreFrame()->view()->setAutoSizeFixedMinimumHeight(webPage->size().height());
+
+ if (webPage->autoSizingShouldExpandToViewHeight())
+ m_frame->coreFrame()->view()->setAutoSizeFixedMinimumHeight(webPage->size().height());
}
m_frame->coreFrame()->view()->setProhibitsScrolling(shouldDisableScrolling);
m_frame->coreFrame()->view()->setVisualUpdatesAllowedByClient(!webPage->shouldExtendIncrementalRenderingSuppression());
-#if PLATFORM(MAC)
- m_frame->coreFrame()->view()->setExposedRect(webPage->drawingArea()->exposedRect());
+#if PLATFORM(COCOA)
+ m_frame->coreFrame()->view()->setViewExposedRect(webPage->drawingArea()->viewExposedRect());
#endif
#if PLATFORM(IOS)
m_frame->coreFrame()->view()->setDelegatesScrolling(true);
@@ -1207,7 +1378,7 @@ void WebFrameLoaderClient::transitionToCommittedForNewPage()
if (webPage->scrollPinningBehavior() != DoNotPin)
m_frame->coreFrame()->view()->setScrollPinningBehavior(webPage->scrollPinningBehavior());
-#if USE(TILED_BACKING_STORE)
+#if USE(COORDINATED_GRAPHICS)
if (shouldUseFixedLayout) {
m_frame->coreFrame()->view()->setDelegatesScrolling(shouldUseFixedLayout);
m_frame->coreFrame()->view()->setPaintsEntireContents(shouldUseFixedLayout);
@@ -1222,7 +1393,8 @@ void WebFrameLoaderClient::didSaveToPageCache()
if (!webPage)
return;
- webPage->send(Messages::WebPageProxy::DidSaveToPageCache());
+ if (m_frame->isMainFrame())
+ webPage->send(Messages::WebPageProxy::DidSaveToPageCache());
}
void WebFrameLoaderClient::didRestoreFromPageCache()
@@ -1239,39 +1411,45 @@ void WebFrameLoaderClient::dispatchDidBecomeFrameset(bool value)
webPage->send(Messages::WebPageProxy::FrameDidBecomeFrameSet(m_frame->frameID(), value));
}
-void WebFrameLoaderClient::convertMainResourceLoadToDownload(DocumentLoader *documentLoader, const ResourceRequest& request, const ResourceResponse& response)
+bool WebFrameLoaderClient::canCachePage() const
{
- m_frame->convertMainResourceLoadToDownload(documentLoader, request, response);
+ // We cannot cache frames that have custom representations because they are
+ // rendered in the UIProcess.
+ return !m_frameHasCustomContentProvider;
}
-PassRefPtr<Frame> WebFrameLoaderClient::createFrame(const URL& url, const String& name, HTMLFrameOwnerElement* ownerElement,
- const String& referrer, bool /*allowsScrolling*/, int /*marginWidth*/, int /*marginHeight*/)
+void WebFrameLoaderClient::convertMainResourceLoadToDownload(DocumentLoader *documentLoader, SessionID sessionID, const ResourceRequest& request, const ResourceResponse& response)
{
- WebPage* webPage = m_frame->page();
+ m_frame->convertMainResourceLoadToDownload(documentLoader, sessionID, request, response);
+}
- RefPtr<WebFrame> subframe = WebFrame::createSubframe(webPage, name, ownerElement);
+RefPtr<Frame> WebFrameLoaderClient::createFrame(const URL& url, const String& name, HTMLFrameOwnerElement& ownerElement,
+ const String& referrer, bool /*allowsScrolling*/, int /*marginWidth*/, int /*marginHeight*/)
+{
+ auto* webPage = m_frame->page();
- Frame* coreSubframe = subframe->coreFrame();
+ auto subframe = WebFrame::createSubframe(webPage, name, &ownerElement);
+ auto* coreSubframe = subframe->coreFrame();
if (!coreSubframe)
- return 0;
+ return nullptr;
// The creation of the frame may have run arbitrary JavaScript that removed it from the page already.
if (!coreSubframe->page())
- return 0;
+ return nullptr;
m_frame->coreFrame()->loader().loadURLIntoChildFrame(url, referrer, coreSubframe);
// The frame's onload handler may have removed it from the document.
if (!subframe->coreFrame())
- return 0;
+ return nullptr;
ASSERT(subframe->coreFrame() == coreSubframe);
if (!coreSubframe->tree().parent())
- return 0;
+ return nullptr;
return coreSubframe;
}
-PassRefPtr<Widget> WebFrameLoaderClient::createPlugin(const IntSize&, HTMLPlugInElement* pluginElement, const URL& url, const Vector<String>& paramNames, const Vector<String>& paramValues, const String& mimeType, bool loadManually)
+RefPtr<Widget> WebFrameLoaderClient::createPlugin(const IntSize&, HTMLPlugInElement& pluginElement, const URL& url, const Vector<String>& paramNames, const Vector<String>& paramValues, const String& mimeType, bool loadManually)
{
ASSERT(paramNames.size() == paramValues.size());
ASSERT(m_frame->page());
@@ -1283,165 +1461,141 @@ PassRefPtr<Widget> WebFrameLoaderClient::createPlugin(const IntSize&, HTMLPlugIn
parameters.mimeType = mimeType;
parameters.isFullFramePlugin = loadManually;
parameters.shouldUseManualLoader = parameters.isFullFramePlugin && !m_frameCameFromPageCache;
-#if PLATFORM(MAC)
+#if PLATFORM(COCOA)
parameters.layerHostingMode = m_frame->page()->layerHostingMode();
#endif
-#if PLUGIN_ARCHITECTURE(X11)
- // FIXME: This should really be X11-specific plug-in quirks.
- if (equalIgnoringCase(mimeType, "application/x-shockwave-flash")) {
- // Currently we don't support transparency and windowed mode.
- // Inject wmode=opaque to make Flash work in these conditions.
- size_t wmodeIndex = parameters.names.find("wmode");
- if (wmodeIndex == notFound) {
- parameters.names.append("wmode");
- parameters.values.append("opaque");
- } else if (equalIgnoringCase(parameters.values[wmodeIndex], "window"))
- parameters.values[wmodeIndex] = "opaque";
- } else if (equalIgnoringCase(mimeType, "application/x-webkit-test-netscape")) {
- parameters.names.append("windowedPlugin");
- parameters.values.append("false");
- }
-#endif
-
#if ENABLE(NETSCAPE_PLUGIN_API)
- RefPtr<Plugin> plugin = m_frame->page()->createPlugin(m_frame, pluginElement, parameters, parameters.mimeType);
+ auto plugin = m_frame->page()->createPlugin(m_frame, &pluginElement, parameters, parameters.mimeType);
if (!plugin)
- return 0;
+ return nullptr;
- return PluginView::create(pluginElement, plugin.release(), parameters);
+ return PluginView::create(pluginElement, plugin.releaseNonNull(), parameters);
#else
UNUSED_PARAM(pluginElement);
- return 0;
+ return nullptr;
#endif
}
void WebFrameLoaderClient::recreatePlugin(Widget* widget)
{
#if ENABLE(NETSCAPE_PLUGIN_API)
- ASSERT(widget && widget->isPluginViewBase());
+ ASSERT(widget);
+ ASSERT(widget->isPluginViewBase());
ASSERT(m_frame->page());
- PluginView* pluginView = static_cast<PluginView*>(widget);
+ auto& pluginView = static_cast<PluginView&>(*widget);
String newMIMEType;
- RefPtr<Plugin> plugin = m_frame->page()->createPlugin(m_frame, pluginView->pluginElement(), pluginView->initialParameters(), newMIMEType);
- pluginView->recreateAndInitialize(plugin.release());
+ auto plugin = m_frame->page()->createPlugin(m_frame, pluginView.pluginElement(), pluginView.initialParameters(), newMIMEType);
+ pluginView.recreateAndInitialize(plugin.releaseNonNull());
#else
UNUSED_PARAM(widget);
#endif
}
-void WebFrameLoaderClient::redirectDataToPlugin(Widget* pluginWidget)
+void WebFrameLoaderClient::redirectDataToPlugin(Widget& pluginWidget)
{
- if (pluginWidget)
- m_pluginView = static_cast<PluginView*>(pluginWidget);
+ m_pluginView = static_cast<PluginView*>(&pluginWidget);
}
#if ENABLE(WEBGL)
+
WebCore::WebGLLoadPolicy WebFrameLoaderClient::webGLPolicyForURL(const String& url) const
{
- if (WebPage* webPage = m_frame->page())
+ if (auto* webPage = m_frame->page())
return webPage->webGLPolicyForURL(m_frame, url);
- return WebGLAllow;
+ return WebGLAllowCreation;
+}
+
+WebCore::WebGLLoadPolicy WebFrameLoaderClient::resolveWebGLPolicyForURL(const String& url) const
+{
+ if (auto* webPage = m_frame->page())
+ return webPage->resolveWebGLPolicyForURL(m_frame, url);
+
+ return WebGLAllowCreation;
}
-#endif // ENABLE(WEBGL)
-PassRefPtr<Widget> WebFrameLoaderClient::createJavaAppletWidget(const IntSize& pluginSize, HTMLAppletElement* appletElement, const URL&, const Vector<String>& paramNames, const Vector<String>& paramValues)
+#endif
+
+RefPtr<Widget> WebFrameLoaderClient::createJavaAppletWidget(const IntSize& pluginSize, HTMLAppletElement& appletElement, const URL&, const Vector<String>& paramNames, const Vector<String>& paramValues)
{
#if ENABLE(NETSCAPE_PLUGIN_API)
- RefPtr<Widget> plugin = createPlugin(pluginSize, appletElement, URL(), paramNames, paramValues, appletElement->serviceType(), false);
+ auto plugin = createPlugin(pluginSize, appletElement, URL(), paramNames, paramValues, appletElement.serviceType(), false);
if (!plugin) {
- if (WebPage* webPage = m_frame->page()) {
- String frameURLString = m_frame->coreFrame()->loader().documentLoader()->responseURL().string();
- String pageURLString = webPage->corePage()->mainFrame().loader().documentLoader()->responseURL().string();
- webPage->send(Messages::WebPageProxy::DidFailToInitializePlugin(appletElement->serviceType(), frameURLString, pageURLString));
+ if (auto* webPage = m_frame->page()) {
+ auto frameURLString = m_frame->coreFrame()->loader().documentLoader()->responseURL().string();
+ auto pageURLString = webPage->corePage()->mainFrame().loader().documentLoader()->responseURL().string();
+ webPage->send(Messages::WebPageProxy::DidFailToInitializePlugin(appletElement.serviceType(), frameURLString, pageURLString));
}
}
- return plugin.release();
+ return plugin;
#else
UNUSED_PARAM(pluginSize);
UNUSED_PARAM(appletElement);
UNUSED_PARAM(paramNames);
UNUSED_PARAM(paramValues);
- return 0;
+ return nullptr;
#endif
}
-#if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
-PassRefPtr<Widget> WebFrameLoaderClient::createMediaPlayerProxyPlugin(const IntSize&, HTMLMediaElement*, const URL&, const Vector<String>&, const Vector<String>&, const String&)
-{
- notImplemented();
- return 0;
-}
-
-void WebFrameLoaderClient::hideMediaPlayerProxyPlugin(Widget*)
-{
- notImplemented();
-}
-
-void WebFrameLoaderClient::showMediaPlayerProxyPlugin(Widget*)
-{
- notImplemented();
-}
-#endif
-
static bool pluginSupportsExtension(const PluginData& pluginData, const String& extension)
{
- ASSERT(extension.lower() == extension);
-
- for (size_t i = 0; i < pluginData.mimes().size(); ++i) {
- const MimeClassInfo& mimeClassInfo = pluginData.mimes()[i];
-
+ ASSERT(extension.convertToASCIILowercase() == extension);
+ Vector<MimeClassInfo> mimes;
+ Vector<size_t> mimePluginIndices;
+ pluginData.getWebVisibleMimesAndPluginIndices(mimes, mimePluginIndices);
+ for (auto& mimeClassInfo : mimes) {
if (mimeClassInfo.extensions.contains(extension))
return true;
}
return false;
}
-ObjectContentType WebFrameLoaderClient::objectContentType(const URL& url, const String& mimeTypeIn, bool shouldPreferPlugInsForImages)
+ObjectContentType WebFrameLoaderClient::objectContentType(const URL& url, const String& mimeTypeIn)
{
- // FIXME: This should be merged with WebCore::FrameLoader::defaultObjectContentType when the plugin code
- // is consolidated.
+ // FIXME: This should eventually be merged with WebCore::FrameLoader::defaultObjectContentType.
String mimeType = mimeTypeIn;
if (mimeType.isEmpty()) {
- String extension = url.path().substring(url.path().reverseFind('.') + 1).lower();
+ String path = url.path();
+ auto dotPosition = path.reverseFind('.');
+ if (dotPosition == notFound)
+ return ObjectContentType::Frame;
+ String extension = path.substring(dotPosition + 1).convertToASCIILowercase();
// Try to guess the MIME type from the extension.
mimeType = MIMETypeRegistry::getMIMETypeForExtension(extension);
-
if (mimeType.isEmpty()) {
// Check if there's a plug-in around that can handle the extension.
if (WebPage* webPage = m_frame->page()) {
if (pluginSupportsExtension(webPage->corePage()->pluginData(), extension))
- return ObjectContentNetscapePlugin;
+ return ObjectContentType::PlugIn;
}
+ return ObjectContentType::Frame;
}
}
- if (mimeType.isEmpty())
- return ObjectContentFrame;
+ if (MIMETypeRegistry::isSupportedImageMIMEType(mimeType))
+ return ObjectContentType::Image;
- bool plugInSupportsMIMEType = false;
if (WebPage* webPage = m_frame->page()) {
- const PluginData& pluginData = webPage->corePage()->pluginData();
- if (pluginData.supportsMimeType(mimeType, PluginData::AllPlugins) && webFrame()->coreFrame()->loader().subframeLoader().allowPlugins(NotAboutToInstantiatePlugin))
- plugInSupportsMIMEType = true;
- else if (pluginData.supportsMimeType(mimeType, PluginData::OnlyApplicationPlugins))
- plugInSupportsMIMEType = true;
+ auto allowedPluginTypes = webFrame()->coreFrame()->loader().subframeLoader().allowPlugins()
+ ? PluginData::AllPlugins : PluginData::OnlyApplicationPlugins;
+ if (webPage->corePage()->pluginData().supportsMimeType(mimeType, allowedPluginTypes))
+ return ObjectContentType::PlugIn;
}
-
- if (MIMETypeRegistry::isSupportedImageMIMEType(mimeType))
- return shouldPreferPlugInsForImages && plugInSupportsMIMEType ? ObjectContentNetscapePlugin : ObjectContentImage;
-
- if (plugInSupportsMIMEType)
- return ObjectContentNetscapePlugin;
if (MIMETypeRegistry::isSupportedNonImageMIMEType(mimeType))
- return ObjectContentFrame;
+ return ObjectContentType::Frame;
- return ObjectContentNone;
+#if PLATFORM(IOS)
+ // iOS can render PDF in <object>/<embed> via PDFDocumentImage.
+ if (MIMETypeRegistry::isPDFOrPostScriptMIMEType(mimeType))
+ return ObjectContentType::Image;
+#endif
+
+ return ObjectContentType::None;
}
String WebFrameLoaderClient::overrideMediaType() const
@@ -1458,7 +1612,12 @@ void WebFrameLoaderClient::dispatchDidClearWindowObjectInWorld(DOMWrapperWorld&
webPage->injectedBundleLoaderClient().didClearWindowObjectForFrame(webPage, m_frame, world);
-#if HAVE(ACCESSIBILITY) && (PLATFORM(GTK) || PLATFORM(EFL))
+
+ WebAutomationSessionProxy* automationSessionProxy = WebProcess::singleton().automationSessionProxy();
+ if (automationSessionProxy && world.isNormal())
+ automationSessionProxy->didClearWindowObjectForFrame(*m_frame);
+
+#if HAVE(ACCESSIBILITY) && PLATFORM(GTK)
// Ensure the accessibility hierarchy is updated.
webPage->updateAccessibilityTree();
#endif
@@ -1506,7 +1665,7 @@ void WebFrameLoaderClient::registerForIconNotification(bool /*listen*/)
notImplemented();
}
-#if PLATFORM(MAC)
+#if PLATFORM(COCOA)
RemoteAXObjectRef WebFrameLoaderClient::accessibilityRemoteObject()
{
@@ -1517,7 +1676,7 @@ RemoteAXObjectRef WebFrameLoaderClient::accessibilityRemoteObject()
return webPage->accessibilityRemoteObject();
}
-NSCachedURLResponse* WebFrameLoaderClient::willCacheResponse(DocumentLoader*, unsigned long identifier, NSCachedURLResponse* response) const
+NSCachedURLResponse *WebFrameLoaderClient::willCacheResponse(DocumentLoader*, unsigned long identifier, NSCachedURLResponse* response) const
{
WebPage* webPage = m_frame->page();
if (!webPage)
@@ -1526,7 +1685,16 @@ NSCachedURLResponse* WebFrameLoaderClient::willCacheResponse(DocumentLoader*, un
return webPage->injectedBundleResourceLoadClient().shouldCacheResponse(webPage, m_frame, identifier) ? response : nil;
}
-#endif // PLATFORM(MAC)
+NSDictionary *WebFrameLoaderClient::dataDetectionContext()
+{
+ WebPage* webPage = m_frame->page();
+ if (!webPage)
+ return nil;
+
+ return webPage->dataDetectionContext();
+}
+
+#endif // PLATFORM(COCOA)
bool WebFrameLoaderClient::shouldAlwaysUsePluginDocument(const String& /*mimeType*/) const
{
@@ -1540,17 +1708,7 @@ void WebFrameLoaderClient::didChangeScrollOffset()
if (!webPage)
return;
- webPage->drawingArea()->didChangeScrollOffsetForAnyFrame();
-
- if (!m_frame->isMainFrame())
- return;
-
- // If this is called when tearing down a FrameView, the WebCore::Frame's
- // current FrameView will be null.
- if (!m_frame->coreFrame()->view())
- return;
-
- webPage->updateMainFrameScrollOffsetPinning();
+ webPage->didChangeScrollOffsetForFrame(m_frame->coreFrame());
}
bool WebFrameLoaderClient::allowScript(bool enabledPerSettings)
@@ -1583,10 +1741,67 @@ bool WebFrameLoaderClient::shouldForceUniversalAccessFromLocalURL(const WebCore:
return webPage->injectedBundleLoaderClient().shouldForceUniversalAccessFromLocalURL(webPage, url.string());
}
-PassRefPtr<FrameNetworkingContext> WebFrameLoaderClient::createNetworkingContext()
+Ref<FrameNetworkingContext> WebFrameLoaderClient::createNetworkingContext()
{
- RefPtr<WebFrameNetworkingContext> context = WebFrameNetworkingContext::create(m_frame);
- return context.release();
+ return WebFrameNetworkingContext::create(m_frame);
+}
+
+#if ENABLE(CONTENT_FILTERING)
+
+void WebFrameLoaderClient::contentFilterDidBlockLoad(WebCore::ContentFilterUnblockHandler unblockHandler)
+{
+ if (!unblockHandler.needsUIProcess()) {
+ m_frame->coreFrame()->loader().policyChecker().setContentFilterUnblockHandler(WTFMove(unblockHandler));
+ return;
+ }
+
+ if (WebPage* webPage { m_frame->page() })
+ webPage->send(Messages::WebPageProxy::ContentFilterDidBlockLoadForFrame(unblockHandler, m_frame->frameID()));
+}
+
+#endif
+
+#if ENABLE(REQUEST_AUTOCOMPLETE)
+
+void WebFrameLoaderClient::didRequestAutocomplete(Ref<WebCore::FormState>&&)
+{
+}
+
+#endif
+
+void WebFrameLoaderClient::prefetchDNS(const String& hostname)
+{
+ WebProcess::singleton().prefetchDNS(hostname);
+}
+
+void WebFrameLoaderClient::didRestoreScrollPosition()
+{
+ WebPage* webPage = m_frame->page();
+ if (!webPage)
+ return;
+
+ webPage->didRestoreScrollPosition();
+}
+
+bool WebFrameLoaderClient::useIconLoadingClient()
+{
+ return m_useIconLoadingClient;
+}
+
+void WebFrameLoaderClient::getLoadDecisionForIcon(const LinkIcon& icon, uint64_t callbackID)
+{
+ if (WebPage* webPage { m_frame->page() })
+ webPage->send(Messages::WebPageProxy::GetLoadDecisionForIcon(icon, callbackID));
+}
+
+void WebFrameLoaderClient::finishedLoadingIcon(uint64_t loadIdentifier, SharedBuffer* data)
+{
+ if (WebPage* webPage { m_frame->page() }) {
+ if (data)
+ webPage->send(Messages::WebPageProxy::FinishedLoadingIcon(loadIdentifier, { reinterpret_cast<const uint8_t*>(data->data()), data->size() }));
+ else
+ webPage->send(Messages::WebPageProxy::FinishedLoadingIcon(loadIdentifier, { nullptr, 0 }));
+ }
}
} // namespace WebKit
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.h b/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.h
index 98786a64c..1be4c4127 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.h
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010, 2011, 2012 Apple Inc. All rights reserved.
+ * Copyright (C) 2010-2016 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -23,17 +23,20 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef WebFrameLoaderClient_h
-#define WebFrameLoaderClient_h
+#pragma once
#include <WebCore/FrameLoaderClient.h>
+namespace WebCore {
+class SessionID;
+}
+
namespace WebKit {
class PluginView;
class WebFrame;
-class WebFrameLoaderClient : public WebCore::FrameLoaderClient {
+class WebFrameLoaderClient final : public WebCore::FrameLoaderClient {
public:
WebFrameLoaderClient();
~WebFrameLoaderClient();
@@ -41,197 +44,231 @@ public:
void setWebFrame(WebFrame* webFrame) { m_frame = webFrame; }
WebFrame* webFrame() const { return m_frame; }
+ bool frameHasCustomContentProvider() const { return m_frameHasCustomContentProvider; }
+
+ void setUseIconLoadingClient(bool useIconLoadingClient) { m_useIconLoadingClient = useIconLoadingClient; }
+
private:
- virtual void frameLoaderDestroyed() override;
+ void frameLoaderDestroyed() final;
- virtual bool hasHTMLView() const override { return true; }
- virtual bool hasWebView() const override;
+ bool hasHTMLView() const final;
+ bool hasWebView() const final;
- virtual void makeRepresentation(WebCore::DocumentLoader*) override;
- virtual void forceLayout() override;
+ void makeRepresentation(WebCore::DocumentLoader*) final;
#if PLATFORM(IOS)
- virtual void forceLayoutWithoutRecalculatingStyles() override;
+ bool forceLayoutOnRestoreFromPageCache() final;
#endif
- virtual void forceLayoutForNonHTML() override;
+ void forceLayoutForNonHTML() final;
- virtual void setCopiesOnScroll() override;
+ void setCopiesOnScroll() final;
- virtual void detachedFromParent2() override;
- virtual void detachedFromParent3() override;
+ void detachedFromParent2() final;
+ void detachedFromParent3() final;
- virtual void assignIdentifierToInitialRequest(unsigned long identifier, WebCore::DocumentLoader*, const WebCore::ResourceRequest&) override;
+ void assignIdentifierToInitialRequest(unsigned long identifier, WebCore::DocumentLoader*, const WebCore::ResourceRequest&) final;
- virtual void dispatchWillSendRequest(WebCore::DocumentLoader*, unsigned long identifier, WebCore::ResourceRequest&, const WebCore::ResourceResponse& redirectResponse) override;
- virtual bool shouldUseCredentialStorage(WebCore::DocumentLoader*, unsigned long identifier) override;
- virtual void dispatchDidReceiveAuthenticationChallenge(WebCore::DocumentLoader*, unsigned long identifier, const WebCore::AuthenticationChallenge&) override;
- virtual void dispatchDidCancelAuthenticationChallenge(WebCore::DocumentLoader*, unsigned long identifier, const WebCore::AuthenticationChallenge&) override;
+ void dispatchWillSendRequest(WebCore::DocumentLoader*, unsigned long identifier, WebCore::ResourceRequest&, const WebCore::ResourceResponse& redirectResponse) final;
+ bool shouldUseCredentialStorage(WebCore::DocumentLoader*, unsigned long identifier) final;
+ void dispatchDidReceiveAuthenticationChallenge(WebCore::DocumentLoader*, unsigned long identifier, const WebCore::AuthenticationChallenge&) final;
#if USE(PROTECTION_SPACE_AUTH_CALLBACK)
- virtual bool canAuthenticateAgainstProtectionSpace(WebCore::DocumentLoader*, unsigned long identifier, const WebCore::ProtectionSpace&) override;
+ bool canAuthenticateAgainstProtectionSpace(WebCore::DocumentLoader*, unsigned long identifier, const WebCore::ProtectionSpace&) final;
#endif
#if PLATFORM(IOS)
- virtual RetainPtr<CFDictionaryRef> connectionProperties(WebCore::DocumentLoader*, unsigned long identifier) override;
+ RetainPtr<CFDictionaryRef> connectionProperties(WebCore::DocumentLoader*, unsigned long identifier) final;
#endif
- virtual void dispatchDidReceiveResponse(WebCore::DocumentLoader*, unsigned long identifier, const WebCore::ResourceResponse&) override;
- virtual void dispatchDidReceiveContentLength(WebCore::DocumentLoader*, unsigned long identifier, int dataLength) override;
- virtual void dispatchDidFinishLoading(WebCore::DocumentLoader*, unsigned long identifier) override;
- virtual void dispatchDidFailLoading(WebCore::DocumentLoader*, unsigned long identifier, const WebCore::ResourceError&) override;
- virtual bool dispatchDidLoadResourceFromMemoryCache(WebCore::DocumentLoader*, const WebCore::ResourceRequest&, const WebCore::ResourceResponse&, int length) override;
-
- virtual void dispatchDidHandleOnloadEvents() override;
- virtual void dispatchDidReceiveServerRedirectForProvisionalLoad() override;
- virtual void dispatchDidCancelClientRedirect() override;
- virtual void dispatchWillPerformClientRedirect(const WebCore::URL&, double interval, double fireDate) override;
- virtual void dispatchDidChangeLocationWithinPage() override;
- virtual void dispatchDidPushStateWithinPage() override;
- virtual void dispatchDidReplaceStateWithinPage() override;
- virtual void dispatchDidPopStateWithinPage() override;
- virtual void dispatchWillClose() override;
- virtual void dispatchDidReceiveIcon() override;
- virtual void dispatchDidStartProvisionalLoad() override;
- virtual void dispatchDidReceiveTitle(const WebCore::StringWithDirection&) override;
- virtual void dispatchDidChangeIcons(WebCore::IconType) override;
- virtual void dispatchDidCommitLoad() override;
- virtual void dispatchDidFailProvisionalLoad(const WebCore::ResourceError&) override;
- virtual void dispatchDidFailLoad(const WebCore::ResourceError&) override;
- virtual void dispatchDidFinishDocumentLoad() override;
- virtual void dispatchDidFinishLoad() override;
-
- virtual void dispatchDidLayout(WebCore::LayoutMilestones) override;
- virtual void dispatchDidLayout() override;
-
- virtual WebCore::Frame* dispatchCreatePage(const WebCore::NavigationAction&) override;
- virtual void dispatchShow() override;
-
- virtual void dispatchDecidePolicyForResponse(const WebCore::ResourceResponse&, const WebCore::ResourceRequest&, WebCore::FramePolicyFunction) override;
- virtual void dispatchDecidePolicyForNewWindowAction(const WebCore::NavigationAction&, const WebCore::ResourceRequest&, PassRefPtr<WebCore::FormState>, const String& frameName, WebCore::FramePolicyFunction) override;
- virtual void dispatchDecidePolicyForNavigationAction(const WebCore::NavigationAction&, const WebCore::ResourceRequest&, PassRefPtr<WebCore::FormState>, WebCore::FramePolicyFunction) override;
- virtual void cancelPolicyCheck() override;
-
- virtual void dispatchUnableToImplementPolicy(const WebCore::ResourceError&) override;
-
- virtual void dispatchWillSendSubmitEvent(PassRefPtr<WebCore::FormState>) override;
- virtual void dispatchWillSubmitForm(PassRefPtr<WebCore::FormState>, WebCore::FramePolicyFunction) override;
-
- virtual void revertToProvisionalState(WebCore::DocumentLoader*) override;
- virtual void setMainDocumentError(WebCore::DocumentLoader*, const WebCore::ResourceError&) override;
-
- virtual void setMainFrameDocumentReady(bool) override;
-
- virtual void startDownload(const WebCore::ResourceRequest&, const String& suggestedName = String()) override;
-
- virtual void willChangeTitle(WebCore::DocumentLoader*) override;
- virtual void didChangeTitle(WebCore::DocumentLoader*) override;
-
- virtual void committedLoad(WebCore::DocumentLoader*, const char*, int) override;
- virtual void finishedLoading(WebCore::DocumentLoader*) override;
-
- virtual void updateGlobalHistory() override;
- virtual void updateGlobalHistoryRedirectLinks() override;
-
- virtual bool shouldGoToHistoryItem(WebCore::HistoryItem*) const override;
-
- virtual void didDisplayInsecureContent() override;
- virtual void didRunInsecureContent(WebCore::SecurityOrigin*, const WebCore::URL&) override;
- virtual void didDetectXSS(const WebCore::URL&, bool didBlockEntirePage) override;
-
- virtual WebCore::ResourceError cancelledError(const WebCore::ResourceRequest&) override;
- virtual WebCore::ResourceError blockedError(const WebCore::ResourceRequest&) override;
- virtual WebCore::ResourceError cannotShowURLError(const WebCore::ResourceRequest&) override;
- virtual WebCore::ResourceError interruptedForPolicyChangeError(const WebCore::ResourceRequest&) override;
-
- virtual WebCore::ResourceError cannotShowMIMETypeError(const WebCore::ResourceResponse&) override;
- virtual WebCore::ResourceError fileDoesNotExistError(const WebCore::ResourceResponse&) override;
- virtual WebCore::ResourceError pluginWillHandleLoadError(const WebCore::ResourceResponse&) override;
-
- virtual bool shouldFallBack(const WebCore::ResourceError&) override;
-
- virtual bool canHandleRequest(const WebCore::ResourceRequest&) const override;
- virtual bool canShowMIMEType(const String& MIMEType) const override;
- virtual bool canShowMIMETypeAsHTML(const String& MIMEType) const override;
- virtual bool representationExistsForURLScheme(const String& URLScheme) const override;
- virtual String generatedMIMETypeForURLScheme(const String& URLScheme) const override;
-
- virtual void frameLoadCompleted() override;
- virtual void saveViewStateToItem(WebCore::HistoryItem*) override;
- virtual void restoreViewState() override;
- virtual void provisionalLoadStarted() override;
- virtual void didFinishLoad() override;
- virtual void prepareForDataSourceReplacement() override;
-
- virtual PassRefPtr<WebCore::DocumentLoader> createDocumentLoader(const WebCore::ResourceRequest&, const WebCore::SubstituteData&);
- virtual void setTitle(const WebCore::StringWithDirection&, const WebCore::URL&) override;
-
- virtual String userAgent(const WebCore::URL&) override;
-
- virtual void savePlatformDataToCachedFrame(WebCore::CachedFrame*) override;
- virtual void transitionToCommittedFromCachedFrame(WebCore::CachedFrame*) override;
-#if PLATFORM(IOS)
- virtual void didRestoreFrameHierarchyForCachedFrame() override;
+ void dispatchDidReceiveResponse(WebCore::DocumentLoader*, unsigned long identifier, const WebCore::ResourceResponse&) final;
+ void dispatchDidReceiveContentLength(WebCore::DocumentLoader*, unsigned long identifier, int dataLength) final;
+ void dispatchDidFinishLoading(WebCore::DocumentLoader*, unsigned long identifier) final;
+ void dispatchDidFailLoading(WebCore::DocumentLoader*, unsigned long identifier, const WebCore::ResourceError&) final;
+ bool dispatchDidLoadResourceFromMemoryCache(WebCore::DocumentLoader*, const WebCore::ResourceRequest&, const WebCore::ResourceResponse&, int length) final;
+#if ENABLE(DATA_DETECTION)
+ void dispatchDidFinishDataDetection(NSArray *detectionResults) final;
#endif
- virtual void transitionToCommittedForNewPage() override;
+
+ void dispatchDidDispatchOnloadEvents() final;
+ void dispatchDidReceiveServerRedirectForProvisionalLoad() final;
+ void dispatchDidChangeProvisionalURL() final;
+ void dispatchDidCancelClientRedirect() final;
+ void dispatchWillPerformClientRedirect(const WebCore::URL&, double interval, double fireDate) final;
+ void dispatchDidChangeLocationWithinPage() final;
+ void dispatchDidPushStateWithinPage() final;
+ void dispatchDidReplaceStateWithinPage() final;
+ void dispatchDidPopStateWithinPage() final;
+ void dispatchWillClose() final;
+ void dispatchDidReceiveIcon() final;
+ void dispatchDidStartProvisionalLoad() final;
+ void dispatchDidReceiveTitle(const WebCore::StringWithDirection&) final;
+ void dispatchDidCommitLoad(std::optional<WebCore::HasInsecureContent>) final;
+ void dispatchDidFailProvisionalLoad(const WebCore::ResourceError&) final;
+ void dispatchDidFailLoad(const WebCore::ResourceError&) final;
+ void dispatchDidFinishDocumentLoad() final;
+ void dispatchDidFinishLoad() final;
- virtual void didSaveToPageCache() override;
- virtual void didRestoreFromPageCache() override;
+ void dispatchDidReachLayoutMilestone(WebCore::LayoutMilestones) final;
+ void dispatchDidLayout() final;
- virtual void dispatchDidBecomeFrameset(bool) override;
+ WebCore::Frame* dispatchCreatePage(const WebCore::NavigationAction&) final;
+ void dispatchShow() final;
+
+ void dispatchDecidePolicyForResponse(const WebCore::ResourceResponse&, const WebCore::ResourceRequest&, WebCore::FramePolicyFunction) final;
+ void dispatchDecidePolicyForNewWindowAction(const WebCore::NavigationAction&, const WebCore::ResourceRequest&, WebCore::FormState*, const String& frameName, WebCore::FramePolicyFunction) final;
+ void dispatchDecidePolicyForNavigationAction(const WebCore::NavigationAction&, const WebCore::ResourceRequest&, WebCore::FormState*, WebCore::FramePolicyFunction) final;
+ void cancelPolicyCheck() final;
+
+ void dispatchUnableToImplementPolicy(const WebCore::ResourceError&) final;
+
+ void dispatchWillSendSubmitEvent(Ref<WebCore::FormState>&&) final;
+ void dispatchWillSubmitForm(WebCore::FormState&, WebCore::FramePolicyFunction) final;
+
+ void revertToProvisionalState(WebCore::DocumentLoader*) final;
+ void setMainDocumentError(WebCore::DocumentLoader*, const WebCore::ResourceError&) final;
+
+ void setMainFrameDocumentReady(bool) final;
+
+ void startDownload(const WebCore::ResourceRequest&, const String& suggestedName = String()) final;
+
+ void willChangeTitle(WebCore::DocumentLoader*) final;
+ void didChangeTitle(WebCore::DocumentLoader*) final;
+
+ void willReplaceMultipartContent() final;
+ void didReplaceMultipartContent() final;
- virtual bool canCachePage() const override { return true; }
- virtual void convertMainResourceLoadToDownload(WebCore::DocumentLoader*, const WebCore::ResourceRequest&, const WebCore::ResourceResponse&) override;
+ void committedLoad(WebCore::DocumentLoader*, const char*, int) final;
+ void finishedLoading(WebCore::DocumentLoader*) final;
- virtual PassRefPtr<WebCore::Frame> createFrame(const WebCore::URL& url, const String& name, WebCore::HTMLFrameOwnerElement* ownerElement,
- const String& referrer, bool allowsScrolling, int marginWidth, int marginHeight) override;
+ void updateGlobalHistory() final;
+ void updateGlobalHistoryRedirectLinks() final;
- virtual PassRefPtr<WebCore::Widget> createPlugin(const WebCore::IntSize&, WebCore::HTMLPlugInElement*, const WebCore::URL&, const Vector<String>&, const Vector<String>&, const String&, bool loadManually) override;
- virtual void recreatePlugin(WebCore::Widget*) override;
- virtual void redirectDataToPlugin(WebCore::Widget* pluginWidget) override;
+ bool shouldGoToHistoryItem(WebCore::HistoryItem*) const final;
+
+ void didDisplayInsecureContent() final;
+ void didRunInsecureContent(WebCore::SecurityOrigin&, const WebCore::URL&) final;
+ void didDetectXSS(const WebCore::URL&, bool didBlockEntirePage) final;
+
+ WebCore::ResourceError cancelledError(const WebCore::ResourceRequest&) final;
+ WebCore::ResourceError blockedError(const WebCore::ResourceRequest&) final;
+ WebCore::ResourceError blockedByContentBlockerError(const WebCore::ResourceRequest&) final;
+ WebCore::ResourceError cannotShowURLError(const WebCore::ResourceRequest&) final;
+ WebCore::ResourceError interruptedForPolicyChangeError(const WebCore::ResourceRequest&) final;
+#if ENABLE(CONTENT_FILTERING)
+ WebCore::ResourceError blockedByContentFilterError(const WebCore::ResourceRequest&) final;
+#endif
-#if ENABLE(WEBGL)
- virtual WebCore::WebGLLoadPolicy webGLPolicyForURL(const String&) const override;
-#endif // ENABLE(WEBGL)
+ WebCore::ResourceError cannotShowMIMETypeError(const WebCore::ResourceResponse&) final;
+ WebCore::ResourceError fileDoesNotExistError(const WebCore::ResourceResponse&) final;
+ WebCore::ResourceError pluginWillHandleLoadError(const WebCore::ResourceResponse&) final;
+
+ bool shouldFallBack(const WebCore::ResourceError&) final;
+
+ bool canHandleRequest(const WebCore::ResourceRequest&) const final;
+ bool canShowMIMEType(const String& MIMEType) const final;
+ bool canShowMIMETypeAsHTML(const String& MIMEType) const final;
+ bool representationExistsForURLScheme(const String& URLScheme) const final;
+ String generatedMIMETypeForURLScheme(const String& URLScheme) const final;
+
+ void frameLoadCompleted() final;
+ void saveViewStateToItem(WebCore::HistoryItem&) final;
+ void restoreViewState() final;
+ void provisionalLoadStarted() final;
+ void didFinishLoad() final;
+ void prepareForDataSourceReplacement() final;
+
+ Ref<WebCore::DocumentLoader> createDocumentLoader(const WebCore::ResourceRequest&, const WebCore::SubstituteData&) final;
+ void updateCachedDocumentLoader(WebCore::DocumentLoader&) final;
- virtual PassRefPtr<WebCore::Widget> createJavaAppletWidget(const WebCore::IntSize&, WebCore::HTMLAppletElement*, const WebCore::URL& baseURL, const Vector<String>& paramNames, const Vector<String>& paramValues) override;
+ void setTitle(const WebCore::StringWithDirection&, const WebCore::URL&) final;
-#if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
- virtual PassRefPtr<WebCore::Widget> createMediaPlayerProxyPlugin(const WebCore::IntSize&, WebCore::HTMLMediaElement*, const WebCore::URL&, const Vector<String>&, const Vector<String>&, const String&) override;
- virtual void hideMediaPlayerProxyPlugin(WebCore::Widget*) override;
- virtual void showMediaPlayerProxyPlugin(WebCore::Widget*) override;
+ String userAgent(const WebCore::URL&) final;
+
+ String overrideContentSecurityPolicy() const final;
+
+ void savePlatformDataToCachedFrame(WebCore::CachedFrame*) final;
+ void transitionToCommittedFromCachedFrame(WebCore::CachedFrame*) final;
+#if PLATFORM(IOS)
+ void didRestoreFrameHierarchyForCachedFrame() final;
#endif
+ void transitionToCommittedForNewPage() final;
+
+ void didSaveToPageCache() final;
+ void didRestoreFromPageCache() final;
+
+ void dispatchDidBecomeFrameset(bool) final;
+
+ bool canCachePage() const final;
+ void convertMainResourceLoadToDownload(WebCore::DocumentLoader*, WebCore::SessionID, const WebCore::ResourceRequest&, const WebCore::ResourceResponse&) final;
- virtual WebCore::ObjectContentType objectContentType(const WebCore::URL&, const String& mimeType, bool shouldPreferPlugInsForImages) override;
- virtual String overrideMediaType() const override;
+ RefPtr<WebCore::Frame> createFrame(const WebCore::URL&, const String& name, WebCore::HTMLFrameOwnerElement&, const String& referrer, bool allowsScrolling, int marginWidth, int marginHeight) final;
+
+ RefPtr<WebCore::Widget> createPlugin(const WebCore::IntSize&, WebCore::HTMLPlugInElement&, const WebCore::URL&, const Vector<String>&, const Vector<String>&, const String&, bool loadManually) final;
+ void recreatePlugin(WebCore::Widget*) final;
+ void redirectDataToPlugin(WebCore::Widget&) final;
+
+#if ENABLE(WEBGL)
+ WebCore::WebGLLoadPolicy webGLPolicyForURL(const String&) const final;
+ WebCore::WebGLLoadPolicy resolveWebGLPolicyForURL(const String&) const final;
+#endif // ENABLE(WEBGL)
+
+ RefPtr<WebCore::Widget> createJavaAppletWidget(const WebCore::IntSize&, WebCore::HTMLAppletElement&, const WebCore::URL& baseURL, const Vector<String>& paramNames, const Vector<String>& paramValues) final;
+
+ WebCore::ObjectContentType objectContentType(const WebCore::URL&, const String& mimeType) final;
+ String overrideMediaType() const final;
- virtual void dispatchDidClearWindowObjectInWorld(WebCore::DOMWrapperWorld&) override;
+ void dispatchDidClearWindowObjectInWorld(WebCore::DOMWrapperWorld&) final;
- virtual void dispatchGlobalObjectAvailable(WebCore::DOMWrapperWorld&) override;
- virtual void dispatchWillDisconnectDOMWindowExtensionFromGlobalObject(WebCore::DOMWindowExtension*) override;
- virtual void dispatchDidReconnectDOMWindowExtensionToGlobalObject(WebCore::DOMWindowExtension*) override;
- virtual void dispatchWillDestroyGlobalObjectForDOMWindowExtension(WebCore::DOMWindowExtension*) override;
+ void dispatchGlobalObjectAvailable(WebCore::DOMWrapperWorld&) final;
+ void dispatchWillDisconnectDOMWindowExtensionFromGlobalObject(WebCore::DOMWindowExtension*) final;
+ void dispatchDidReconnectDOMWindowExtensionToGlobalObject(WebCore::DOMWindowExtension*) final;
+ void dispatchWillDestroyGlobalObjectForDOMWindowExtension(WebCore::DOMWindowExtension*) final;
- virtual void registerForIconNotification(bool listen = true) override;
+ void registerForIconNotification(bool listen = true) final;
-#if PLATFORM(MAC)
- virtual RemoteAXObjectRef accessibilityRemoteObject() override;
+#if PLATFORM(COCOA)
+ RemoteAXObjectRef accessibilityRemoteObject() final;
- virtual NSCachedURLResponse* willCacheResponse(WebCore::DocumentLoader*, unsigned long identifier, NSCachedURLResponse*) const override;
+ NSCachedURLResponse* willCacheResponse(WebCore::DocumentLoader*, unsigned long identifier, NSCachedURLResponse*) const final;
+
+ NSDictionary *dataDetectionContext() final;
#endif
- virtual bool shouldAlwaysUsePluginDocument(const String& /*mimeType*/) const override;
+ bool shouldAlwaysUsePluginDocument(const String& /*mimeType*/) const final;
+
+ void didChangeScrollOffset() final;
+
+ bool allowScript(bool enabledPerSettings) final;
- virtual void didChangeScrollOffset() override;
+ bool shouldForceUniversalAccessFromLocalURL(const WebCore::URL&) final;
- virtual bool allowScript(bool enabledPerSettings) override;
+ Ref<WebCore::FrameNetworkingContext> createNetworkingContext() final;
- virtual bool shouldForceUniversalAccessFromLocalURL(const WebCore::URL&) override;
+#if ENABLE(REQUEST_AUTOCOMPLETE)
+ void didRequestAutocomplete(Ref<WebCore::FormState>&&) final;
+#endif
- virtual PassRefPtr<WebCore::FrameNetworkingContext> createNetworkingContext() override;
+ void forcePageTransitionIfNeeded() final;
- virtual void forcePageTransitionIfNeeded() override;
+#if USE(QUICK_LOOK)
+ RefPtr<WebCore::QuickLookHandleClient> createQuickLookHandleClient(const String& fileName, const String& uti) final;
+#endif
+
+#if ENABLE(CONTENT_FILTERING)
+ void contentFilterDidBlockLoad(WebCore::ContentFilterUnblockHandler) final;
+#endif
+
+ void prefetchDNS(const String&) final;
+
+ void didRestoreScrollPosition() final;
+
+ bool useIconLoadingClient() final;
+ void getLoadDecisionForIcon(const WebCore::LinkIcon&, uint64_t callbackID) final;
+ void finishedLoadingIcon(uint64_t loadIdentifier, WebCore::SharedBuffer*) final;
WebFrame* m_frame;
RefPtr<PluginView> m_pluginView;
bool m_hasSentResponseToPluginView;
- bool m_didCompletePageTransitionAlready;
+ bool m_didCompletePageTransition;
+ bool m_frameHasCustomContentProvider;
bool m_frameCameFromPageCache;
+ bool m_useIconLoadingClient { false };
};
// As long as EmptyFrameLoaderClient exists in WebCore, this can return 0.
@@ -241,5 +278,3 @@ inline WebFrameLoaderClient* toWebFrameLoaderClient(WebCore::FrameLoaderClient&
}
} // namespace WebKit
-
-#endif // WebFrameLoaderClient_h
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebGeolocationClient.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebGeolocationClient.cpp
index c22110383..cf16bc68e 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/WebGeolocationClient.cpp
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebGeolocationClient.cpp
@@ -44,23 +44,23 @@ WebGeolocationClient::~WebGeolocationClient()
void WebGeolocationClient::geolocationDestroyed()
{
- WebProcess::shared().supplement<WebGeolocationManager>()->unregisterWebPage(m_page);
+ WebProcess::singleton().supplement<WebGeolocationManager>()->unregisterWebPage(m_page);
delete this;
}
void WebGeolocationClient::startUpdating()
{
- WebProcess::shared().supplement<WebGeolocationManager>()->registerWebPage(m_page);
+ WebProcess::singleton().supplement<WebGeolocationManager>()->registerWebPage(m_page);
}
void WebGeolocationClient::stopUpdating()
{
- WebProcess::shared().supplement<WebGeolocationManager>()->unregisterWebPage(m_page);
+ WebProcess::singleton().supplement<WebGeolocationManager>()->unregisterWebPage(m_page);
}
void WebGeolocationClient::setEnableHighAccuracy(bool enabled)
{
- WebProcess::shared().supplement<WebGeolocationManager>()->setEnableHighAccuracyForPage(m_page, enabled);
+ WebProcess::singleton().supplement<WebGeolocationManager>()->setEnableHighAccuracyForPage(m_page, enabled);
}
GeolocationPosition* WebGeolocationClient::lastPosition()
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebGeolocationClient.h b/Source/WebKit2/WebProcess/WebCoreSupport/WebGeolocationClient.h
index 7e3adad21..3158e0854 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/WebGeolocationClient.h
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebGeolocationClient.h
@@ -42,16 +42,16 @@ public:
virtual ~WebGeolocationClient();
private:
- virtual void geolocationDestroyed() override;
+ void geolocationDestroyed() override;
- virtual void startUpdating() override;
- virtual void stopUpdating() override;
- virtual void setEnableHighAccuracy(bool) override;
+ void startUpdating() override;
+ void stopUpdating() override;
+ void setEnableHighAccuracy(bool) override;
- virtual WebCore::GeolocationPosition* lastPosition() override;
+ WebCore::GeolocationPosition* lastPosition() override;
- virtual void requestPermission(WebCore::Geolocation*) override;
- virtual void cancelPermissionRequest(WebCore::Geolocation*) override;
+ void requestPermission(WebCore::Geolocation*) override;
+ void cancelPermissionRequest(WebCore::Geolocation*) override;
WebPage* m_page;
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorClient.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorClient.cpp
index 76e0b8d48..02ee1c7bd 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorClient.cpp
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorClient.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2010, 2014, 2015 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -26,133 +26,208 @@
#include "config.h"
#include "WebInspectorClient.h"
-#if ENABLE(INSPECTOR)
-
+#include "DrawingArea.h"
#include "WebInspector.h"
#include "WebPage.h"
#include <WebCore/InspectorController.h>
+#include <WebCore/MainFrame.h>
#include <WebCore/Page.h>
+#include <WebCore/PageOverlayController.h>
+#include <WebCore/Settings.h>
+#include <wtf/CurrentTime.h>
-#if ENABLE(REMOTE_INSPECTOR)
-#include "WebProcess.h"
+#if PLATFORM(IOS)
+#include <WebCore/InspectorOverlay.h>
#endif
using namespace WebCore;
namespace WebKit {
-void WebInspectorClient::inspectorDestroyed()
+class RepaintIndicatorLayerClient final : public GraphicsLayerClient {
+public:
+ RepaintIndicatorLayerClient(WebInspectorClient& inspectorClient)
+ : m_inspectorClient(inspectorClient)
+ {
+ }
+ virtual ~RepaintIndicatorLayerClient() { }
+private:
+ void notifyAnimationEnded(const GraphicsLayer* layer, const String&) override
+ {
+ m_inspectorClient.animationEndedForLayer(layer);
+ }
+
+ WebInspectorClient& m_inspectorClient;
+};
+
+WebInspectorClient::WebInspectorClient(WebPage* page)
+ : m_page(page)
+ , m_highlightOverlay(nullptr)
{
- closeInspectorFrontend();
- delete this;
}
-WebCore::InspectorFrontendChannel* WebInspectorClient::openInspectorFrontend(InspectorController*)
+WebInspectorClient::~WebInspectorClient()
{
- WebPage* inspectorPage = m_page->inspector()->createInspectorPage();
- ASSERT_UNUSED(inspectorPage, inspectorPage);
- return this;
+ for (auto layer : m_paintRectLayers) {
+ layer->removeFromParent();
+ delete layer;
+ }
+
+ if (m_paintRectOverlay && m_page->mainFrame())
+ m_page->mainFrame()->pageOverlayController().uninstallPageOverlay(*m_paintRectOverlay, PageOverlay::FadeMode::Fade);
}
-void WebInspectorClient::closeInspectorFrontend()
+void WebInspectorClient::inspectedPageDestroyed()
{
- if (m_page->inspector())
- m_page->inspector()->didClose();
+ if (WebInspector* inspector = m_page->inspector(WebPage::LazyCreationPolicy::UseExistingOnly))
+ inspector->close();
+
+ delete this;
}
-void WebInspectorClient::bringFrontendToFront()
+Inspector::FrontendChannel* WebInspectorClient::openLocalFrontend(InspectorController* controller)
{
- m_page->inspector()->bringToFront();
+ m_page->inspector()->openFrontendConnection(controller->isUnderTest());
+
+ return m_page->inspector();
}
-void WebInspectorClient::didResizeMainFrame(Frame*)
+void WebInspectorClient::bringFrontendToFront()
{
if (m_page->inspector())
- m_page->inspector()->updateDockingAvailability();
+ m_page->inspector()->bringToFront();
}
-#if ENABLE(REMOTE_INSPECTOR)
-pid_t WebInspectorClient::parentProcessIdentifier() const
+void WebInspectorClient::didResizeMainFrame(Frame*)
{
- return WebProcess::shared().presenterApplicationPid();
+ if (m_page->inspector())
+ m_page->inspector()->updateDockingAvailability();
}
-#endif
void WebInspectorClient::highlight()
{
+ if (!m_page->corePage()->settings().acceleratedCompositingEnabled())
+ return;
+
+#if !PLATFORM(IOS)
if (!m_highlightOverlay) {
- RefPtr<PageOverlay> highlightOverlay = PageOverlay::create(this);
- m_highlightOverlay = highlightOverlay.get();
- m_page->installPageOverlay(highlightOverlay.release(), true);
+ auto highlightOverlay = PageOverlay::create(*this);
+ m_highlightOverlay = highlightOverlay.ptr();
+ m_page->mainFrame()->pageOverlayController().installPageOverlay(WTFMove(highlightOverlay), PageOverlay::FadeMode::Fade);
m_highlightOverlay->setNeedsDisplay();
} else {
m_highlightOverlay->stopFadeOutAnimation();
m_highlightOverlay->setNeedsDisplay();
}
+#else
+ Highlight highlight;
+ m_page->corePage()->inspectorController().getHighlight(highlight, InspectorOverlay::CoordinateSystem::Document);
+ m_page->showInspectorHighlight(highlight);
+#endif
}
void WebInspectorClient::hideHighlight()
{
- if (m_highlightOverlay)
- m_page->uninstallPageOverlay(m_highlightOverlay, true);
+#if !PLATFORM(IOS)
+ if (m_highlightOverlay && m_page->mainFrame())
+ m_page->mainFrame()->pageOverlayController().uninstallPageOverlay(*m_highlightOverlay, PageOverlay::FadeMode::Fade);
+#else
+ m_page->hideInspectorHighlight();
+#endif
}
-bool WebInspectorClient::sendMessageToFrontend(const String& message)
+void WebInspectorClient::showPaintRect(const FloatRect& rect)
{
- WebInspector* inspector = m_page->inspector();
- if (!inspector)
- return false;
+ if (!m_page->corePage()->settings().acceleratedCompositingEnabled())
+ return;
-#if ENABLE(INSPECTOR_SERVER)
- if (inspector->hasRemoteFrontendConnected()) {
- inspector->sendMessageToRemoteFrontend(message);
- return true;
+ if (!m_paintRectOverlay) {
+ m_paintRectOverlay = PageOverlay::create(*this, PageOverlay::OverlayType::Document);
+ m_page->mainFrame()->pageOverlayController().installPageOverlay(*m_paintRectOverlay, PageOverlay::FadeMode::DoNotFade);
}
-#endif
- WebPage* inspectorPage = inspector->inspectorPage();
- if (inspectorPage)
- return doDispatchMessageOnFrontendPage(inspectorPage->corePage(), message);
+ if (!m_paintIndicatorLayerClient)
+ m_paintIndicatorLayerClient = std::make_unique<RepaintIndicatorLayerClient>(*this);
- return false;
+ std::unique_ptr<GraphicsLayer> paintLayer = GraphicsLayer::create(m_page->drawingArea()->graphicsLayerFactory(), *m_paintIndicatorLayerClient);
+
+ paintLayer->setName("paint rect");
+ paintLayer->setAnchorPoint(FloatPoint3D());
+ paintLayer->setPosition(rect.location());
+ paintLayer->setSize(rect.size());
+ paintLayer->setBackgroundColor(Color(1.0f, 0.0f, 0.0f, 0.2f));
+
+ KeyframeValueList fadeKeyframes(AnimatedPropertyOpacity);
+ fadeKeyframes.insert(std::make_unique<FloatAnimationValue>(0, 1));
+
+ fadeKeyframes.insert(std::make_unique<FloatAnimationValue>(0.25, 0));
+
+ RefPtr<Animation> opacityAnimation = Animation::create();
+ opacityAnimation->setDuration(0.25);
+
+ paintLayer->addAnimation(fadeKeyframes, FloatSize(), opacityAnimation.get(), ASCIILiteral("opacity"), 0);
+
+ m_paintRectLayers.add(paintLayer.get());
+
+ GraphicsLayer& overlayRootLayer = m_paintRectOverlay->layer();
+ overlayRootLayer.addChild(paintLayer.release());
}
-bool WebInspectorClient::supportsFrameInstrumentation()
+void WebInspectorClient::animationEndedForLayer(const GraphicsLayer* layer)
{
-#if USE(COORDINATED_GRAPHICS)
- return true;
-#endif
- return false;
+ const_cast<GraphicsLayer*>(layer)->removeFromParent();
+ m_paintRectLayers.remove(const_cast<GraphicsLayer*>(layer));
+ delete layer;
+}
+
+#if PLATFORM(IOS)
+void WebInspectorClient::showInspectorIndication()
+{
+ m_page->showInspectorIndication();
+}
+
+void WebInspectorClient::hideInspectorIndication()
+{
+ m_page->hideInspectorIndication();
}
-void WebInspectorClient::pageOverlayDestroyed(PageOverlay*)
+void WebInspectorClient::didSetSearchingForNode(bool enabled)
{
+ if (enabled)
+ m_page->enableInspectorNodeSearch();
+ else
+ m_page->disableInspectorNodeSearch();
}
+#endif
-void WebInspectorClient::willMoveToWebPage(PageOverlay*, WebPage* webPage)
+void WebInspectorClient::elementSelectionChanged(bool active)
{
- if (webPage)
+ if (m_page->inspector())
+ m_page->inspector()->elementSelectionChanged(active);
+}
+
+void WebInspectorClient::willMoveToPage(PageOverlay&, Page* page)
+{
+ if (page)
return;
// The page overlay is moving away from the web page, reset it.
ASSERT(m_highlightOverlay);
- m_highlightOverlay = 0;
+ m_highlightOverlay = nullptr;
}
-void WebInspectorClient::didMoveToWebPage(PageOverlay*, WebPage*)
+void WebInspectorClient::didMoveToPage(PageOverlay&, Page*)
{
}
-void WebInspectorClient::drawRect(PageOverlay*, WebCore::GraphicsContext& context, const WebCore::IntRect& /*dirtyRect*/)
+void WebInspectorClient::drawRect(PageOverlay&, WebCore::GraphicsContext& context, const WebCore::IntRect& /*dirtyRect*/)
{
m_page->corePage()->inspectorController().drawHighlight(context);
}
-bool WebInspectorClient::mouseEvent(PageOverlay*, const WebMouseEvent&)
+bool WebInspectorClient::mouseEvent(PageOverlay&, const PlatformMouseEvent&)
{
return false;
}
} // namespace WebKit
-
-#endif // ENABLE(INSPECTOR)
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorClient.h b/Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorClient.h
index a086b7b95..96b9a2613 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorClient.h
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorClient.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2010, 2015 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -23,65 +23,67 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef WebInspectorClient_h
-#define WebInspectorClient_h
-
-#if ENABLE(INSPECTOR)
-
-#include "PageOverlay.h"
+#pragma once
#include <WebCore/InspectorClient.h>
-#include <WebCore/InspectorForwarding.h>
+#include <WebCore/PageOverlay.h>
+#include <wtf/HashSet.h>
namespace WebCore {
class GraphicsContext;
+class GraphicsLayer;
class IntRect;
+class PageOverlay;
}
namespace WebKit {
class WebPage;
+class RepaintIndicatorLayerClient;
-class WebInspectorClient : public WebCore::InspectorClient, public WebCore::InspectorFrontendChannel, private PageOverlay::Client {
+class WebInspectorClient : public WebCore::InspectorClient, private WebCore::PageOverlay::Client {
+friend class RepaintIndicatorLayerClient;
public:
- WebInspectorClient(WebPage* page)
- : m_page(page)
- , m_highlightOverlay(0)
- {
- }
+ WebInspectorClient(WebPage*);
+ virtual ~WebInspectorClient();
private:
- virtual void inspectorDestroyed() override;
+ // WebCore::InspectorClient
+ void inspectedPageDestroyed() override;
- virtual InspectorFrontendChannel* openInspectorFrontend(WebCore::InspectorController*) override;
- virtual void closeInspectorFrontend() override;
- virtual void bringFrontendToFront() override;
- virtual void didResizeMainFrame(WebCore::Frame*) override;
+ Inspector::FrontendChannel* openLocalFrontend(WebCore::InspectorController*) override;
+ void bringFrontendToFront() override;
+ void didResizeMainFrame(WebCore::Frame*) override;
-#if ENABLE(REMOTE_INSPECTOR)
- virtual pid_t parentProcessIdentifier() const override;
-#endif
+ void highlight() override;
+ void hideHighlight() override;
+
+#if PLATFORM(IOS)
+ void showInspectorIndication() override;
+ void hideInspectorIndication() override;
- virtual void highlight() override;
- virtual void hideHighlight() override;
+ void didSetSearchingForNode(bool) override;
+#endif
- virtual bool sendMessageToFrontend(const String&) override;
+ void elementSelectionChanged(bool) override;
- virtual bool supportsFrameInstrumentation();
+ bool overridesShowPaintRects() const override { return true; }
+ void showPaintRect(const WebCore::FloatRect&) override;
// PageOverlay::Client
- virtual void pageOverlayDestroyed(PageOverlay*) override;
- virtual void willMoveToWebPage(PageOverlay*, WebPage*) override;
- virtual void didMoveToWebPage(PageOverlay*, WebPage*) override;
- virtual void drawRect(PageOverlay*, WebCore::GraphicsContext&, const WebCore::IntRect&) override;
- virtual bool mouseEvent(PageOverlay*, const WebMouseEvent&) override;
+ void willMoveToPage(WebCore::PageOverlay&, WebCore::Page*) override;
+ void didMoveToPage(WebCore::PageOverlay&, WebCore::Page*) override;
+ void drawRect(WebCore::PageOverlay&, WebCore::GraphicsContext&, const WebCore::IntRect&) override;
+ bool mouseEvent(WebCore::PageOverlay&, const WebCore::PlatformMouseEvent&) override;
+
+ void animationEndedForLayer(const WebCore::GraphicsLayer*);
WebPage* m_page;
- PageOverlay* m_highlightOverlay;
+ WebCore::PageOverlay* m_highlightOverlay;
+
+ RefPtr<WebCore::PageOverlay> m_paintRectOverlay;
+ std::unique_ptr<RepaintIndicatorLayerClient> m_paintIndicatorLayerClient;
+ HashSet<WebCore::GraphicsLayer*> m_paintRectLayers; // Ideally this would be HashSet<std::unique_ptr<GraphicsLayer>> but that doesn't work yet. webkit.org/b/136166
};
} // namespace WebKit
-
-#endif // ENABLE(INSPECTOR)
-
-#endif // WebInspectorClient_h
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorFrontendClient.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorFrontendClient.cpp
deleted file mode 100644
index b3e6e45f9..000000000
--- a/Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorFrontendClient.cpp
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * 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 "WebInspectorFrontendClient.h"
-
-#if ENABLE(INSPECTOR)
-
-#include "WebInspector.h"
-#include "WebPage.h"
-#include <WebCore/InspectorController.h>
-#include <WebCore/NotImplemented.h>
-#include <WebCore/Page.h>
-#include <inspector/InspectorAgentBase.h>
-#include <wtf/text/WTFString.h>
-
-using namespace WebCore;
-
-namespace WebKit {
-
-WebInspectorFrontendClient::WebInspectorFrontendClient(WebPage* page, WebPage* inspectorPage)
- : InspectorFrontendClientLocal(&page->corePage()->inspectorController(), inspectorPage->corePage(), adoptPtr(new Settings()))
- , m_page(page)
-{
-}
-
-String WebInspectorFrontendClient::localizedStringsURL()
-{
- return m_page->inspector()->localizedStringsURL();
-}
-
-void WebInspectorFrontendClient::bringToFront()
-{
- m_page->inspector()->bringToFront();
-}
-
-void WebInspectorFrontendClient::closeWindow()
-{
- m_page->corePage()->inspectorController().disconnectFrontend(Inspector::InspectorDisconnectReason::InspectorDestroyed);
- m_page->inspector()->didClose();
-}
-
-bool WebInspectorFrontendClient::canSave()
-{
- return m_page->inspector()->canSave();
-}
-
-void WebInspectorFrontendClient::save(const String& filename, const String& content, bool base64Encoded, bool forceSaveAs)
-{
- m_page->inspector()->save(filename, content, base64Encoded, forceSaveAs);
-}
-
-void WebInspectorFrontendClient::append(const String& filename, const String& content)
-{
- m_page->inspector()->append(filename, content);
-}
-
-void WebInspectorFrontendClient::attachWindow(DockSide dockSide)
-{
- switch (dockSide) {
- case InspectorFrontendClient::UNDOCKED:
- ASSERT_NOT_REACHED();
- break;
- case InspectorFrontendClient::DOCKED_TO_BOTTOM:
- m_page->inspector()->attachBottom();
- break;
- case InspectorFrontendClient::DOCKED_TO_RIGHT:
- m_page->inspector()->attachRight();
- break;
- }
-}
-
-void WebInspectorFrontendClient::detachWindow()
-{
- m_page->inspector()->detach();
-}
-
-void WebInspectorFrontendClient::setAttachedWindowHeight(unsigned height)
-{
- m_page->inspector()->setAttachedWindowHeight(height);
-}
-
-void WebInspectorFrontendClient::setAttachedWindowWidth(unsigned width)
-{
- m_page->inspector()->setAttachedWindowWidth(width);
-}
-
-void WebInspectorFrontendClient::setToolbarHeight(unsigned height)
-{
- m_page->inspector()->setToolbarHeight(height);
-}
-
-void WebInspectorFrontendClient::inspectedURLChanged(const String& urlString)
-{
- m_page->inspector()->inspectedURLChanged(urlString);
-}
-
-} // namespace WebKit
-
-#endif // ENABLE(INSPECTOR)
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebNetworkInfoClient.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebNavigatorContentUtilsClient.h
index 2fd1a7211..d86d64c67 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/WebNetworkInfoClient.cpp
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebNavigatorContentUtilsClient.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012 Intel Corporation. All rights reserved.
+ * Copyright (C) 2012 Samsung Electronics. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -23,47 +23,30 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "config.h"
-#include "WebNetworkInfoClient.h"
+#ifndef WebNavigatorContentUtilsClient_h
+#define WebNavigatorContentUtilsClient_h
-#if ENABLE(NETWORK_INFO)
+#if ENABLE(NAVIGATOR_CONTENT_UTILS)
-#include "WebNetworkInfoManager.h"
-#include "WebPage.h"
-#include "WebProcess.h"
+#include <WebCore/NavigatorContentUtilsClient.h>
+#include <wtf/text/WTFString.h>
namespace WebKit {
-WebNetworkInfoClient::~WebNetworkInfoClient()
-{
-}
-
-double WebNetworkInfoClient::bandwidth() const
-{
- return WebProcess::shared().supplement<WebNetworkInfoManager>()->bandwidth(m_page);
-}
-
-bool WebNetworkInfoClient::metered() const
-{
- return WebProcess::shared().supplement<WebNetworkInfoManager>()->metered(m_page);
-}
+class WebNavigatorContentUtilsClient : public WebCore::NavigatorContentUtilsClient {
+public:
+ virtual ~WebNavigatorContentUtilsClient() { }
-void WebNetworkInfoClient::startUpdating()
-{
- WebProcess::shared().supplement<WebNetworkInfoManager>()->registerWebPage(m_page);
-}
+private:
+ void registerProtocolHandler(const String& scheme, const URL& baseURL, const URL& url, const String& title) override { }
-void WebNetworkInfoClient::stopUpdating()
-{
- WebProcess::shared().supplement<WebNetworkInfoManager>()->unregisterWebPage(m_page);
-}
+#if ENABLE(CUSTOM_SCHEME_HANDLER)
+ virtual CustomHandlersState isProtocolHandlerRegistered(const String&, const URL&, const URL&) { return CustomHandlersDeclined; }
+ virtual void unregisterProtocolHandler(const String&, const URL&, const URL&) { }
+#endif
+};
-void WebNetworkInfoClient::networkInfoControllerDestroyed()
-{
- WebProcess::shared().supplement<WebNetworkInfoManager>()->unregisterWebPage(m_page);
- delete this;
}
-} // namespace WebKit
-
-#endif // ENABLE(NETWORK_INFO)
+#endif // ENABLE(NAVIGATOR_CONTENT_UTILS)
+#endif // WebNavigatorContentUtilsClient_h
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebNotificationClient.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebNotificationClient.cpp
index f4cf12594..23a140177 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/WebNotificationClient.cpp
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebNotificationClient.cpp
@@ -49,22 +49,22 @@ WebNotificationClient::~WebNotificationClient()
bool WebNotificationClient::show(Notification* notification)
{
- return WebProcess::shared().supplement<WebNotificationManager>()->show(notification, m_page);
+ return WebProcess::singleton().supplement<WebNotificationManager>()->show(notification, m_page);
}
void WebNotificationClient::cancel(Notification* notification)
{
- WebProcess::shared().supplement<WebNotificationManager>()->cancel(notification, m_page);
+ WebProcess::singleton().supplement<WebNotificationManager>()->cancel(notification, m_page);
}
void WebNotificationClient::clearNotifications(ScriptExecutionContext* context)
{
- WebProcess::shared().supplement<WebNotificationManager>()->clearNotifications(context, m_page);
+ WebProcess::singleton().supplement<WebNotificationManager>()->clearNotifications(context, m_page);
}
void WebNotificationClient::notificationObjectDestroyed(Notification* notification)
{
- WebProcess::shared().supplement<WebNotificationManager>()->didDestroyNotification(notification, m_page);
+ WebProcess::singleton().supplement<WebNotificationManager>()->didDestroyNotification(notification, m_page);
}
void WebNotificationClient::notificationControllerDestroyed()
@@ -73,19 +73,24 @@ void WebNotificationClient::notificationControllerDestroyed()
}
#if ENABLE(LEGACY_NOTIFICATIONS)
-void WebNotificationClient::requestPermission(ScriptExecutionContext* context, PassRefPtr<VoidCallback> callback)
+void WebNotificationClient::requestPermission(ScriptExecutionContext* context, RefPtr<WebCore::VoidCallback>&& callback)
{
- m_page->notificationPermissionRequestManager()->startRequest(context->securityOrigin(), callback);
+ m_page->notificationPermissionRequestManager()->startRequest(context->securityOrigin(), WTFMove(callback));
}
#endif
#if ENABLE(NOTIFICATIONS)
-void WebNotificationClient::requestPermission(ScriptExecutionContext* context, PassRefPtr<NotificationPermissionCallback> callback)
+void WebNotificationClient::requestPermission(ScriptExecutionContext* context, RefPtr<NotificationPermissionCallback>&& callback)
{
- m_page->notificationPermissionRequestManager()->startRequest(context->securityOrigin(), callback);
+ m_page->notificationPermissionRequestManager()->startRequest(context->securityOrigin(), WTFMove(callback));
}
#endif
+bool WebNotificationClient::hasPendingPermissionRequests(ScriptExecutionContext* context) const
+{
+ return m_page->notificationPermissionRequestManager()->hasPendingPermissionRequests(context->securityOrigin());
+}
+
void WebNotificationClient::cancelRequestsForPermission(ScriptExecutionContext* context)
{
m_page->notificationPermissionRequestManager()->cancelRequest(context->securityOrigin());
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebNotificationClient.h b/Source/WebKit2/WebProcess/WebCoreSupport/WebNotificationClient.h
index dbd807551..9bc80d1ee 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/WebNotificationClient.h
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebNotificationClient.h
@@ -46,19 +46,20 @@ public:
virtual ~WebNotificationClient();
private:
- virtual bool show(WebCore::Notification*) override;
- virtual void cancel(WebCore::Notification*) override;
- virtual void clearNotifications(WebCore::ScriptExecutionContext*) override;
- virtual void notificationObjectDestroyed(WebCore::Notification*) override;
- virtual void notificationControllerDestroyed() override;
+ bool show(WebCore::Notification*) override;
+ void cancel(WebCore::Notification*) override;
+ void clearNotifications(WebCore::ScriptExecutionContext*) override;
+ void notificationObjectDestroyed(WebCore::Notification*) override;
+ void notificationControllerDestroyed() override;
#if ENABLE(LEGACY_NOTIFICATIONS)
- virtual void requestPermission(WebCore::ScriptExecutionContext*, PassRefPtr<WebCore::VoidCallback>) override;
+ void requestPermission(WebCore::ScriptExecutionContext*, RefPtr<WebCore::VoidCallback>&&) override;
#endif
#if ENABLE(NOTIFICATIONS)
- virtual void requestPermission(WebCore::ScriptExecutionContext*, PassRefPtr<WebCore::NotificationPermissionCallback>) override;
+ void requestPermission(WebCore::ScriptExecutionContext*, RefPtr<WebCore::NotificationPermissionCallback>&&) override;
#endif
- virtual void cancelRequestsForPermission(WebCore::ScriptExecutionContext*) override;
- virtual NotificationClient::Permission checkPermission(WebCore::ScriptExecutionContext*) override;
+ void cancelRequestsForPermission(WebCore::ScriptExecutionContext*) override;
+ bool hasPendingPermissionRequests(WebCore::ScriptExecutionContext*) const override;
+ NotificationClient::Permission checkPermission(WebCore::ScriptExecutionContext*) override;
WebPage* m_page;
};
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebPasteboardOverrides.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebPasteboardOverrides.cpp
new file mode 100644
index 000000000..f1ec6e2aa
--- /dev/null
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebPasteboardOverrides.cpp
@@ -0,0 +1,111 @@
+/*
+ * Copyright (C) 2014 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 "WebPasteboardOverrides.h"
+
+namespace WebKit {
+
+WebPasteboardOverrides& WebPasteboardOverrides::sharedPasteboardOverrides()
+{
+ static NeverDestroyed<WebPasteboardOverrides> sharedOverrides;
+ return sharedOverrides;
+}
+
+WebPasteboardOverrides::WebPasteboardOverrides()
+{
+}
+
+void WebPasteboardOverrides::addOverride(const String& pasteboardName, const String& type, const Vector<uint8_t>& data)
+{
+ auto addResult = m_overridesMap.add(pasteboardName, nullptr);
+
+ if (addResult.isNewEntry) {
+ std::unique_ptr<HashMap<String, Vector<uint8_t>>> typeMap = std::make_unique<HashMap<String, Vector<uint8_t>>>();
+ addResult.iterator->value = WTFMove(typeMap);
+ }
+
+ addResult.iterator->value->set(type, data);
+}
+
+void WebPasteboardOverrides::removeOverride(const String& pasteboardName, const String& type)
+{
+ auto it = m_overridesMap.find(pasteboardName);
+ if (it == m_overridesMap.end())
+ return;
+
+ ASSERT(it->value);
+
+ it->value->remove(type);
+
+ // If this was the last override for this pasteboard, remove its record completely.
+ if (it->value->isEmpty())
+ m_overridesMap.remove(it);
+}
+
+Vector<String> WebPasteboardOverrides::overriddenTypes(const String& pasteboardName)
+{
+ Vector<String> result;
+
+ auto it = m_overridesMap.find(pasteboardName);
+ if (it == m_overridesMap.end())
+ return result;
+
+ ASSERT(it->value);
+
+ for (String& type : it->value->keys())
+ result.append(type);
+
+ return result;
+}
+
+bool WebPasteboardOverrides::getDataForOverride(const String& pasteboardName, const String& type, Vector<uint8_t>& data) const
+{
+ auto pasteboardIterator = m_overridesMap.find(pasteboardName);
+ if (pasteboardIterator == m_overridesMap.end())
+ return false;
+
+ auto typeIterator = pasteboardIterator->value->find(type);
+ if (typeIterator == pasteboardIterator->value->end())
+ return false;
+
+ data = typeIterator->value;
+ return true;
+}
+
+bool WebPasteboardOverrides::getDataForOverride(const String& pasteboardName, const String& type, Vector<char>& data) const
+{
+ Vector<uint8_t> foundBuffer;
+ if (!getDataForOverride(pasteboardName, type, foundBuffer))
+ return false;
+
+ data.clear();
+ data.resize(foundBuffer.size());
+ memcpy(data.data(), foundBuffer.data(), foundBuffer.size());
+
+ return true;
+}
+
+} // namespace WebKit
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorFrontendClient.h b/Source/WebKit2/WebProcess/WebCoreSupport/WebPasteboardOverrides.h
index c377ef5f3..4972d73ff 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorFrontendClient.h
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebPasteboardOverrides.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -23,45 +23,38 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef WebInspectorFrontendClient_h
-#define WebInspectorFrontendClient_h
+#ifndef WebPasteboardOverrides_h
+#define WebPasteboardOverrides_h
-#if ENABLE(INSPECTOR)
-
-#include <WebCore/InspectorFrontendClientLocal.h>
+#include <wtf/HashMap.h>
+#include <wtf/NeverDestroyed.h>
+#include <wtf/Vector.h>
+#include <wtf/text/StringHash.h>
+#include <wtf/text/WTFString.h>
namespace WebKit {
-class WebPage;
-
-class WebInspectorFrontendClient : public WebCore::InspectorFrontendClientLocal {
+class WebPasteboardOverrides {
+ friend class NeverDestroyed<WebPasteboardOverrides>;
public:
- WebInspectorFrontendClient(WebPage* page, WebPage* inspectorPage);
-
-private:
- virtual String localizedStringsURL() override;
+ static WebPasteboardOverrides& sharedPasteboardOverrides();
- virtual void bringToFront() override;
- virtual void closeWindow() override;
+ void addOverride(const String& pasteboardName, const String& type, const Vector<uint8_t>&);
+ void removeOverride(const String& pasteboardName, const String& type);
- virtual bool canSave() override;
- virtual void save(const String&, const String&, bool base64Encoded, bool forceSaveAs) override;
- virtual void append(const String&, const String&) override;
+ Vector<String> overriddenTypes(const String& pasteboardName);
- virtual void attachWindow(DockSide) override;
- virtual void detachWindow() override;
+ bool getDataForOverride(const String& pasteboardName, const String& type, Vector<uint8_t>&) const;
+ bool getDataForOverride(const String& pasteboardName, const String& type, Vector<char>&) const;
- virtual void setAttachedWindowHeight(unsigned) override;
- virtual void setAttachedWindowWidth(unsigned) override;
- virtual void setToolbarHeight(unsigned) override;
-
- virtual void inspectedURLChanged(const String&) override;
+private:
+ WebPasteboardOverrides();
- WebPage* m_page;
+ // The m_overridesMap maps string pasteboard names to pasteboard entries.
+ // Each pasteboard entry is a map of a string type to a data buffer.
+ HashMap<String, std::unique_ptr<HashMap<String, Vector<uint8_t>>>> m_overridesMap;
};
} // namespace WebKit
-#endif // ENABLE(INSPECTOR)
-
-#endif // WebInspectorFrontendClient_h
+#endif // WebPasteboardOverrides_h
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp
index a7d32c36b..c03970ad5 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010, 2011, 2012 Apple Inc. All rights reserved.
+ * Copyright (C) 2010, 2011, 2012, 2015, 2016 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -26,25 +26,29 @@
#include "config.h"
#include "WebPlatformStrategies.h"
+#include "BlobRegistryProxy.h"
#include "BlockingResponseMap.h"
#include "DataReference.h"
+#include "HangDetectionDisabler.h"
+#include "NetworkConnectionToWebProcessMessages.h"
+#include "NetworkProcessConnection.h"
#include "NetworkResourceLoadParameters.h"
#include "PluginInfoStore.h"
#include "SessionTracker.h"
-#include "StorageNamespaceImpl.h"
-#include "WebContextMessages.h"
#include "WebCookieManager.h"
#include "WebCoreArgumentCoders.h"
#include "WebErrors.h"
#include "WebFrame.h"
#include "WebFrameLoaderClient.h"
-#include "WebFrameNetworkingContext.h"
-#include "WebIDBFactoryBackend.h"
+#include "WebLoaderStrategy.h"
#include "WebPage.h"
+#include "WebPasteboardOverrides.h"
+#include "WebPasteboardProxyMessages.h"
#include "WebProcess.h"
#include "WebProcessProxyMessages.h"
#include <WebCore/Color.h>
-#include <WebCore/IDBFactoryBackendInterface.h>
+#include <WebCore/Document.h>
+#include <WebCore/DocumentLoader.h>
#include <WebCore/LoaderStrategy.h>
#include <WebCore/MainFrame.h>
#include <WebCore/NetworkStorageSession.h>
@@ -53,33 +57,26 @@
#include <WebCore/PageGroup.h>
#include <WebCore/PlatformCookieJar.h>
#include <WebCore/PlatformPasteboard.h>
+#include <WebCore/ProgressTracker.h>
#include <WebCore/ResourceError.h>
+#include <WebCore/SessionID.h>
#include <WebCore/StorageNamespace.h>
#include <WebCore/SubframeLoader.h>
#include <WebCore/URL.h>
#include <wtf/Atomics.h>
-#if ENABLE(NETWORK_PROCESS)
-#include "BlobRegistryProxy.h"
-#include "NetworkConnectionToWebProcessMessages.h"
-#include "NetworkProcessConnection.h"
-#include "WebResourceLoadScheduler.h"
+#if PLATFORM(MAC)
+#include "StringUtilities.h"
#endif
-// FIXME: Remove this #ifdef once we don't need the ability to turn the feature off.
-#define ENABLE_UI_PROCESS_STORAGE 1
+#if PLATFORM(GTK)
+#include "WebSelectionData.h"
+#endif
using namespace WebCore;
namespace WebKit {
-#if ENABLE(NETWORK_PROCESS)
-static uint64_t legacySessionID(const NetworkStorageSession &session)
-{
- return session.isPrivateBrowsingSession() ? SessionTracker::legacyPrivateSessionID : SessionTracker::defaultSessionID;
-}
-#endif
-
void WebPlatformStrategies::initialize()
{
static NeverDestroyed<WebPlatformStrategies> platformStrategies;
@@ -87,10 +84,6 @@ void WebPlatformStrategies::initialize()
}
WebPlatformStrategies::WebPlatformStrategies()
-#if ENABLE(NETSCAPE_PLUGIN_API)
- : m_pluginCacheIsPopulated(false)
- , m_shouldRefreshPlugins(false)
-#endif // ENABLE(NETSCAPE_PLUGIN_API)
{
}
@@ -99,14 +92,9 @@ CookiesStrategy* WebPlatformStrategies::createCookiesStrategy()
return this;
}
-DatabaseStrategy* WebPlatformStrategies::createDatabaseStrategy()
-{
- return this;
-}
-
LoaderStrategy* WebPlatformStrategies::createLoaderStrategy()
{
- return this;
+ return &WebProcess::singleton().webLoaderStrategy();
}
PasteboardStrategy* WebPlatformStrategies::createPasteboardStrategy()
@@ -114,467 +102,255 @@ PasteboardStrategy* WebPlatformStrategies::createPasteboardStrategy()
return this;
}
-PluginStrategy* WebPlatformStrategies::createPluginStrategy()
-{
- return this;
-}
-
-SharedWorkerStrategy* WebPlatformStrategies::createSharedWorkerStrategy()
-{
- return this;
-}
-
-StorageStrategy* WebPlatformStrategies::createStorageStrategy()
-{
- return this;
-}
-
-VisitedLinkStrategy* WebPlatformStrategies::createVisitedLinkStrategy()
+BlobRegistry* WebPlatformStrategies::createBlobRegistry()
{
- return this;
+ return new BlobRegistryProxy;
}
// CookiesStrategy
String WebPlatformStrategies::cookiesForDOM(const NetworkStorageSession& session, const URL& firstParty, const URL& url)
{
-#if ENABLE(NETWORK_PROCESS)
- if (WebProcess::shared().usesNetworkProcess()) {
- String result;
- if (!WebProcess::shared().networkConnection()->connection()->sendSync(Messages::NetworkConnectionToWebProcess::CookiesForDOM(legacySessionID(session), firstParty, url), Messages::NetworkConnectionToWebProcess::CookiesForDOM::Reply(result), 0))
- return String();
- return result;
- }
-#endif
-
- return WebCore::cookiesForDOM(session, firstParty, url);
+ String result;
+ if (!WebProcess::singleton().networkConnection().connection().sendSync(Messages::NetworkConnectionToWebProcess::CookiesForDOM(session.sessionID(), firstParty, url), Messages::NetworkConnectionToWebProcess::CookiesForDOM::Reply(result), 0))
+ return String();
+ return result;
}
void WebPlatformStrategies::setCookiesFromDOM(const NetworkStorageSession& session, const URL& firstParty, const URL& url, const String& cookieString)
{
-#if ENABLE(NETWORK_PROCESS)
- if (WebProcess::shared().usesNetworkProcess()) {
- WebProcess::shared().networkConnection()->connection()->send(Messages::NetworkConnectionToWebProcess::SetCookiesFromDOM(legacySessionID(session), firstParty, url, cookieString), 0);
- return;
- }
-#endif
-
- WebCore::setCookiesFromDOM(session, firstParty, url, cookieString);
+ WebProcess::singleton().networkConnection().connection().send(Messages::NetworkConnectionToWebProcess::SetCookiesFromDOM(session.sessionID(), firstParty, url, cookieString), 0);
}
bool WebPlatformStrategies::cookiesEnabled(const NetworkStorageSession& session, const URL& firstParty, const URL& url)
{
-#if ENABLE(NETWORK_PROCESS)
- if (WebProcess::shared().usesNetworkProcess()) {
- bool result;
- if (!WebProcess::shared().networkConnection()->connection()->sendSync(Messages::NetworkConnectionToWebProcess::CookiesEnabled(legacySessionID(session), firstParty, url), Messages::NetworkConnectionToWebProcess::CookiesEnabled::Reply(result), 0))
- return false;
- return result;
- }
-#endif
-
- return WebCore::cookiesEnabled(session, firstParty, url);
+ bool result;
+ if (!WebProcess::singleton().networkConnection().connection().sendSync(Messages::NetworkConnectionToWebProcess::CookiesEnabled(session.sessionID(), firstParty, url), Messages::NetworkConnectionToWebProcess::CookiesEnabled::Reply(result), 0))
+ return false;
+ return result;
}
String WebPlatformStrategies::cookieRequestHeaderFieldValue(const NetworkStorageSession& session, const URL& firstParty, const URL& url)
{
-#if ENABLE(NETWORK_PROCESS)
- if (WebProcess::shared().usesNetworkProcess()) {
- String result;
- if (!WebProcess::shared().networkConnection()->connection()->sendSync(Messages::NetworkConnectionToWebProcess::CookieRequestHeaderFieldValue(legacySessionID(session), firstParty, url), Messages::NetworkConnectionToWebProcess::CookieRequestHeaderFieldValue::Reply(result), 0))
- return String();
- return result;
- }
-#endif
-
- return WebCore::cookieRequestHeaderFieldValue(session, firstParty, url);
-}
-
-bool WebPlatformStrategies::getRawCookies(const NetworkStorageSession& session, const URL& firstParty, const URL& url, Vector<Cookie>& rawCookies)
-{
-#if ENABLE(NETWORK_PROCESS)
- if (WebProcess::shared().usesNetworkProcess()) {
- if (!WebProcess::shared().networkConnection()->connection()->sendSync(Messages::NetworkConnectionToWebProcess::GetRawCookies(legacySessionID(session), firstParty, url), Messages::NetworkConnectionToWebProcess::GetRawCookies::Reply(rawCookies), 0))
- return false;
- return true;
- }
-#endif
-
- return WebCore::getRawCookies(session, firstParty, url, rawCookies);
-}
-
-void WebPlatformStrategies::deleteCookie(const NetworkStorageSession& session, const URL& url, const String& cookieName)
-{
-#if ENABLE(NETWORK_PROCESS)
- if (WebProcess::shared().usesNetworkProcess()) {
- WebProcess::shared().networkConnection()->connection()->send(Messages::NetworkConnectionToWebProcess::DeleteCookie(legacySessionID(session), url, cookieName), 0);
- return;
- }
-#endif
-
- WebCore::deleteCookie(session, url, cookieName);
-}
-
-// DatabaseStrategy
-
-#if ENABLE(SQL_DATABASE)
-AbstractDatabaseServer* WebPlatformStrategies::getDatabaseServer()
-{
- return DatabaseStrategy::getDatabaseServer();
+ return cookieRequestHeaderFieldValue(session.sessionID(), firstParty, url);
}
-#endif // ENABLE(SQL_DATABASE)
-#if ENABLE(INDEXED_DATABASE)
-PassRefPtr<IDBFactoryBackendInterface> WebPlatformStrategies::createIDBFactoryBackend(const String& databaseDirectoryIdentifier)
+String WebPlatformStrategies::cookieRequestHeaderFieldValue(SessionID sessionID, const URL& firstParty, const URL& url)
{
-#if !ENABLE(DATABASE_PROCESS)
- return DatabaseStrategy::createIDBFactoryBackend(databaseDirectoryIdentifier);
-#endif
-
- return WebIDBFactoryBackend::create(databaseDirectoryIdentifier);
+ String result;
+ if (!WebProcess::singleton().networkConnection().connection().sendSync(Messages::NetworkConnectionToWebProcess::CookieRequestHeaderFieldValue(sessionID, firstParty, url), Messages::NetworkConnectionToWebProcess::CookieRequestHeaderFieldValue::Reply(result), 0))
+ return String();
+ return result;
}
-#endif // ENABLE(INDEXED_DATABASE)
-// LoaderStrategy
-
-#if ENABLE(NETWORK_PROCESS)
-ResourceLoadScheduler* WebPlatformStrategies::resourceLoadScheduler()
-{
- static ResourceLoadScheduler* scheduler;
- if (!scheduler) {
- if (WebProcess::shared().usesNetworkProcess())
- scheduler = &WebProcess::shared().webResourceLoadScheduler();
- else
- scheduler = WebCore::resourceLoadScheduler();
- }
-
- return scheduler;
-}
-
-void WebPlatformStrategies::loadResourceSynchronously(NetworkingContext* context, unsigned long resourceLoadIdentifier, const ResourceRequest& request, StoredCredentials storedCredentials, ClientCredentialPolicy clientCredentialPolicy, ResourceError& error, ResourceResponse& response, Vector<char>& data)
-{
- if (!WebProcess::shared().usesNetworkProcess()) {
- LoaderStrategy::loadResourceSynchronously(context, resourceLoadIdentifier, request, storedCredentials, clientCredentialPolicy, error, response, data);
- return;
- }
-
- WebFrameNetworkingContext* webContext = static_cast<WebFrameNetworkingContext*>(context);
- // FIXME: Some entities in WebCore use WebCore's "EmptyFrameLoaderClient" instead of having a proper WebFrameLoaderClient.
- // EmptyFrameLoaderClient shouldn't exist and everything should be using a WebFrameLoaderClient,
- // but in the meantime we have to make sure not to mis-cast.
- WebFrameLoaderClient* webFrameLoaderClient = webContext->webFrameLoaderClient();
- WebFrame* webFrame = webFrameLoaderClient ? webFrameLoaderClient->webFrame() : 0;
- WebPage* webPage = webFrame ? webFrame->page() : 0;
-
- NetworkResourceLoadParameters loadParameters;
- loadParameters.identifier = resourceLoadIdentifier;
- loadParameters.webPageID = webPage ? webPage->pageID() : 0;
- loadParameters.webFrameID = webFrame ? webFrame->frameID() : 0;
- loadParameters.sessionID = webPage ? webPage->sessionID() : SessionTracker::defaultSessionID;
- loadParameters.request = request;
- loadParameters.priority = ResourceLoadPriorityHighest;
- loadParameters.contentSniffingPolicy = SniffContent;
- loadParameters.allowStoredCredentials = storedCredentials;
- loadParameters.clientCredentialPolicy = clientCredentialPolicy;
- loadParameters.shouldClearReferrerOnHTTPSToHTTPRedirect = context->shouldClearReferrerOnHTTPSToHTTPRedirect();
-
- data.resize(0);
-
- if (!WebProcess::shared().networkConnection()->connection()->sendSync(Messages::NetworkConnectionToWebProcess::PerformSynchronousLoad(loadParameters), Messages::NetworkConnectionToWebProcess::PerformSynchronousLoad::Reply(error, response, data), 0)) {
- response = ResourceResponse();
- error = internalError(request.url());
- }
-}
-
-#if ENABLE(BLOB)
-BlobRegistry* WebPlatformStrategies::createBlobRegistry()
+bool WebPlatformStrategies::getRawCookies(const NetworkStorageSession& session, const URL& firstParty, const URL& url, Vector<Cookie>& rawCookies)
{
- if (!WebProcess::shared().usesNetworkProcess())
- return LoaderStrategy::createBlobRegistry();
- return new BlobRegistryProxy;
+ if (!WebProcess::singleton().networkConnection().connection().sendSync(Messages::NetworkConnectionToWebProcess::GetRawCookies(session.sessionID(), firstParty, url), Messages::NetworkConnectionToWebProcess::GetRawCookies::Reply(rawCookies), 0))
+ return false;
+ return true;
}
-#endif
-#endif
-// PluginStrategy
-
-void WebPlatformStrategies::refreshPlugins()
+void WebPlatformStrategies::deleteCookie(const NetworkStorageSession& session, const URL& url, const String& cookieName)
{
-#if ENABLE(NETSCAPE_PLUGIN_API)
- m_cachedPlugins.clear();
- m_pluginCacheIsPopulated = false;
- m_shouldRefreshPlugins = true;
-#endif // ENABLE(NETSCAPE_PLUGIN_API)
+ WebProcess::singleton().networkConnection().connection().send(Messages::NetworkConnectionToWebProcess::DeleteCookie(session.sessionID(), url, cookieName), 0);
}
-void WebPlatformStrategies::getPluginInfo(const WebCore::Page* page, Vector<WebCore::PluginInfo>& plugins)
+void WebPlatformStrategies::addCookie(const NetworkStorageSession& session, const URL& url, const Cookie& cookie)
{
-#if ENABLE(NETSCAPE_PLUGIN_API)
- populatePluginCache();
-
- if (page->mainFrame().loader().subframeLoader().allowPlugins(NotAboutToInstantiatePlugin)) {
- plugins = m_cachedPlugins;
- return;
- }
-
- plugins = m_cachedApplicationPlugins;
-#else
- UNUSED_PARAM(page);
- UNUSED_PARAM(plugins);
-#endif // ENABLE(NETSCAPE_PLUGIN_API)
+ WebProcess::singleton().networkConnection().connection().send(Messages::NetworkConnectionToWebProcess::AddCookie(session.sessionID(), url, cookie), 0);
}
-// SharedWorkerStrategy
-
-bool WebPlatformStrategies::isAvailable() const
-{
- // Shared workers do not work across multiple processes, and using network process is tied to multiple secondary process model.
- return !WebProcess::shared().usesNetworkProcess();
-}
+#if PLATFORM(COCOA)
+// PasteboardStrategy
-#if ENABLE(NETSCAPE_PLUGIN_API)
-void WebPlatformStrategies::populatePluginCache()
+void WebPlatformStrategies::getTypes(Vector<String>& types, const String& pasteboardName)
{
- if (m_pluginCacheIsPopulated)
- return;
-
- ASSERT(m_cachedPlugins.isEmpty());
-
- // FIXME: Should we do something in case of error here?
- if (!WebProcess::shared().parentProcessConnection()->sendSync(Messages::WebProcessProxy::GetPlugins(m_shouldRefreshPlugins), Messages::WebProcessProxy::GetPlugins::Reply(m_cachedPlugins, m_cachedApplicationPlugins), 0))
+ // First check the overrides.
+ // The purpose of the overrides is to avoid messaging back to the UI process.
+ // Therefore, if there are any overridden types, we return just those.
+ types = WebPasteboardOverrides::sharedPasteboardOverrides().overriddenTypes(pasteboardName);
+ if (!types.isEmpty())
return;
- m_shouldRefreshPlugins = false;
- m_pluginCacheIsPopulated = true;
-}
-#endif // ENABLE(NETSCAPE_PLUGIN_API)
-
-// StorageStrategy
-
-PassRefPtr<StorageNamespace> WebPlatformStrategies::localStorageNamespace(PageGroup* pageGroup)
-{
-#if ENABLE(UI_PROCESS_STORAGE)
- return StorageNamespaceImpl::createLocalStorageNamespace(pageGroup);
-#else
- return StorageStrategy::localStorageNamespace(pageGroup);
-#endif
-}
-
-PassRefPtr<StorageNamespace> WebPlatformStrategies::transientLocalStorageNamespace(PageGroup* pageGroup, SecurityOrigin*securityOrigin)
-{
-#if ENABLE(UI_PROCESS_STORAGE)
- UNUSED_PARAM(securityOrigin);
- // FIXME: This could be more clever and made to work across processes.
- return StorageStrategy::sessionStorageNamespace(*pageGroup->pages().begin());
-#else
- return StorageStrategy::transientLocalStorageNamespace(pageGroup, securityOrigin);
-#endif
-}
-
-PassRefPtr<StorageNamespace> WebPlatformStrategies::sessionStorageNamespace(Page* page)
-{
-#if ENABLE(UI_PROCESS_STORAGE)
- return StorageNamespaceImpl::createSessionStorageNamespace(WebPage::fromCorePage(page));
-#else
- return StorageStrategy::sessionStorageNamespace(page);
-#endif
-}
-
-// VisitedLinkStrategy
-
-bool WebPlatformStrategies::isLinkVisited(Page*, LinkHash linkHash, const URL&, const AtomicString&)
-{
- return WebProcess::shared().isLinkVisited(linkHash);
-}
-
-void WebPlatformStrategies::addVisitedLink(Page*, LinkHash linkHash)
-{
- WebProcess::shared().addVisitedLink(linkHash);
+ WebProcess::singleton().parentProcessConnection()->sendSync(Messages::WebPasteboardProxy::GetPasteboardTypes(pasteboardName), Messages::WebPasteboardProxy::GetPasteboardTypes::Reply(types), 0);
}
-#if PLATFORM(MAC)
-// PasteboardStrategy
-
-void WebPlatformStrategies::getTypes(Vector<String>& types, const String& pasteboardName)
+RefPtr<WebCore::SharedBuffer> WebPlatformStrategies::bufferForType(const String& pasteboardType, const String& pasteboardName)
{
- WebProcess::shared().parentProcessConnection()->sendSync(Messages::WebContext::GetPasteboardTypes(pasteboardName),
- Messages::WebContext::GetPasteboardTypes::Reply(types), 0);
-}
+ // First check the overrides.
+ Vector<char> overrideBuffer;
+ if (WebPasteboardOverrides::sharedPasteboardOverrides().getDataForOverride(pasteboardName, pasteboardType, overrideBuffer))
+ return SharedBuffer::adoptVector(overrideBuffer);
-PassRefPtr<WebCore::SharedBuffer> WebPlatformStrategies::bufferForType(const String& pasteboardType, const String& pasteboardName)
-{
+ // Fallback to messaging the UI process for native pasteboard content.
SharedMemory::Handle handle;
uint64_t size = 0;
- WebProcess::shared().parentProcessConnection()->sendSync(Messages::WebContext::GetPasteboardBufferForType(pasteboardName, pasteboardType),
- Messages::WebContext::GetPasteboardBufferForType::Reply(handle, size), 0);
+ WebProcess::singleton().parentProcessConnection()->sendSync(Messages::WebPasteboardProxy::GetPasteboardBufferForType(pasteboardName, pasteboardType), Messages::WebPasteboardProxy::GetPasteboardBufferForType::Reply(handle, size), 0);
if (handle.isNull())
- return 0;
- RefPtr<SharedMemory> sharedMemoryBuffer = SharedMemory::create(handle, SharedMemory::ReadOnly);
+ return nullptr;
+ RefPtr<SharedMemory> sharedMemoryBuffer = SharedMemory::map(handle, SharedMemory::Protection::ReadOnly);
return SharedBuffer::create(static_cast<unsigned char *>(sharedMemoryBuffer->data()), size);
}
void WebPlatformStrategies::getPathnamesForType(Vector<String>& pathnames, const String& pasteboardType, const String& pasteboardName)
{
- WebProcess::shared().parentProcessConnection()->sendSync(Messages::WebContext::GetPasteboardPathnamesForType(pasteboardName, pasteboardType),
- Messages::WebContext::GetPasteboardPathnamesForType::Reply(pathnames), 0);
+ WebProcess::singleton().parentProcessConnection()->sendSync(Messages::WebPasteboardProxy::GetPasteboardPathnamesForType(pasteboardName, pasteboardType), Messages::WebPasteboardProxy::GetPasteboardPathnamesForType::Reply(pathnames), 0);
}
String WebPlatformStrategies::stringForType(const String& pasteboardType, const String& pasteboardName)
{
String value;
- WebProcess::shared().parentProcessConnection()->sendSync(Messages::WebContext::GetPasteboardStringForType(pasteboardName, pasteboardType),
- Messages::WebContext::GetPasteboardStringForType::Reply(value), 0);
+ WebProcess::singleton().parentProcessConnection()->sendSync(Messages::WebPasteboardProxy::GetPasteboardStringForType(pasteboardName, pasteboardType), Messages::WebPasteboardProxy::GetPasteboardStringForType::Reply(value), 0);
return value;
}
long WebPlatformStrategies::copy(const String& fromPasteboard, const String& toPasteboard)
{
uint64_t newChangeCount;
- WebProcess::shared().parentProcessConnection()->sendSync(Messages::WebContext::PasteboardCopy(fromPasteboard, toPasteboard),
- Messages::WebContext::PasteboardCopy::Reply(newChangeCount), 0);
+ WebProcess::singleton().parentProcessConnection()->sendSync(Messages::WebPasteboardProxy::PasteboardCopy(fromPasteboard, toPasteboard), Messages::WebPasteboardProxy::PasteboardCopy::Reply(newChangeCount), 0);
return newChangeCount;
}
long WebPlatformStrategies::changeCount(const WTF::String &pasteboardName)
{
uint64_t changeCount;
- WebProcess::shared().parentProcessConnection()->sendSync(Messages::WebContext::GetPasteboardChangeCount(pasteboardName),
- Messages::WebContext::GetPasteboardChangeCount::Reply(changeCount), 0);
+ WebProcess::singleton().parentProcessConnection()->sendSync(Messages::WebPasteboardProxy::GetPasteboardChangeCount(pasteboardName), Messages::WebPasteboardProxy::GetPasteboardChangeCount::Reply(changeCount), 0);
return changeCount;
}
String WebPlatformStrategies::uniqueName()
{
String pasteboardName;
- WebProcess::shared().parentProcessConnection()->sendSync(Messages::WebContext::GetPasteboardUniqueName(),
- Messages::WebContext::GetPasteboardUniqueName::Reply(pasteboardName), 0);
+ WebProcess::singleton().parentProcessConnection()->sendSync(Messages::WebPasteboardProxy::GetPasteboardUniqueName(), Messages::WebPasteboardProxy::GetPasteboardUniqueName::Reply(pasteboardName), 0);
return pasteboardName;
}
Color WebPlatformStrategies::color(const String& pasteboardName)
{
Color color;
- WebProcess::shared().parentProcessConnection()->sendSync(Messages::WebContext::GetPasteboardColor(pasteboardName),
- Messages::WebContext::GetPasteboardColor::Reply(color), 0);
+ WebProcess::singleton().parentProcessConnection()->sendSync(Messages::WebPasteboardProxy::GetPasteboardColor(pasteboardName), Messages::WebPasteboardProxy::GetPasteboardColor::Reply(color), 0);
return color;
}
URL WebPlatformStrategies::url(const String& pasteboardName)
{
String urlString;
- WebProcess::shared().parentProcessConnection()->sendSync(Messages::WebContext::GetPasteboardURL(pasteboardName),
- Messages::WebContext::GetPasteboardURL::Reply(urlString), 0);
+ WebProcess::singleton().parentProcessConnection()->sendSync(Messages::WebPasteboardProxy::GetPasteboardURL(pasteboardName), Messages::WebPasteboardProxy::GetPasteboardURL::Reply(urlString), 0);
return URL(ParsedURLString, urlString);
}
long WebPlatformStrategies::addTypes(const Vector<String>& pasteboardTypes, const String& pasteboardName)
{
uint64_t newChangeCount;
- WebProcess::shared().parentProcessConnection()->sendSync(Messages::WebContext::AddPasteboardTypes(pasteboardName, pasteboardTypes),
- Messages::WebContext::AddPasteboardTypes::Reply(newChangeCount), 0);
+ WebProcess::singleton().parentProcessConnection()->sendSync(Messages::WebPasteboardProxy::AddPasteboardTypes(pasteboardName, pasteboardTypes), Messages::WebPasteboardProxy::AddPasteboardTypes::Reply(newChangeCount), 0);
return newChangeCount;
}
long WebPlatformStrategies::setTypes(const Vector<String>& pasteboardTypes, const String& pasteboardName)
{
uint64_t newChangeCount;
- WebProcess::shared().parentProcessConnection()->sendSync(Messages::WebContext::SetPasteboardTypes(pasteboardName, pasteboardTypes),
- Messages::WebContext::SetPasteboardTypes::Reply(newChangeCount), 0);
+ WebProcess::singleton().parentProcessConnection()->sendSync(Messages::WebPasteboardProxy::SetPasteboardTypes(pasteboardName, pasteboardTypes), Messages::WebPasteboardProxy::SetPasteboardTypes::Reply(newChangeCount), 0);
return newChangeCount;
}
-long WebPlatformStrategies::setBufferForType(PassRefPtr<SharedBuffer> buffer, const String& pasteboardType, const String& pasteboardName)
+long WebPlatformStrategies::setBufferForType(SharedBuffer* buffer, const String& pasteboardType, const String& pasteboardName)
{
SharedMemory::Handle handle;
if (buffer) {
- RefPtr<SharedMemory> sharedMemoryBuffer = SharedMemory::create(buffer->size());
- memcpy(sharedMemoryBuffer->data(), buffer->data(), buffer->size());
- sharedMemoryBuffer->createHandle(handle, SharedMemory::ReadOnly);
+ RefPtr<SharedMemory> sharedMemoryBuffer = SharedMemory::allocate(buffer->size());
+ // FIXME: Null check prevents crashing, but it is not great that we will have empty pasteboard content for this type,
+ // because we've already set the types.
+ if (sharedMemoryBuffer) {
+ memcpy(sharedMemoryBuffer->data(), buffer->data(), buffer->size());
+ sharedMemoryBuffer->createHandle(handle, SharedMemory::Protection::ReadOnly);
+ }
}
uint64_t newChangeCount;
- WebProcess::shared().parentProcessConnection()->sendSync(Messages::WebContext::SetPasteboardBufferForType(pasteboardName, pasteboardType, handle, buffer ? buffer->size() : 0),
- Messages::WebContext::SetPasteboardBufferForType::Reply(newChangeCount), 0);
+ WebProcess::singleton().parentProcessConnection()->sendSync(Messages::WebPasteboardProxy::SetPasteboardBufferForType(pasteboardName, pasteboardType, handle, buffer ? buffer->size() : 0), Messages::WebPasteboardProxy::SetPasteboardBufferForType::Reply(newChangeCount), 0);
return newChangeCount;
}
long WebPlatformStrategies::setPathnamesForType(const Vector<String>& pathnames, const String& pasteboardType, const String& pasteboardName)
{
uint64_t newChangeCount;
- WebProcess::shared().parentProcessConnection()->sendSync(Messages::WebContext::SetPasteboardPathnamesForType(pasteboardName, pasteboardType, pathnames),
- Messages::WebContext::SetPasteboardPathnamesForType::Reply(newChangeCount), 0);
+ WebProcess::singleton().parentProcessConnection()->sendSync(Messages::WebPasteboardProxy::SetPasteboardPathnamesForType(pasteboardName, pasteboardType, pathnames), Messages::WebPasteboardProxy::SetPasteboardPathnamesForType::Reply(newChangeCount), 0);
return newChangeCount;
}
long WebPlatformStrategies::setStringForType(const String& string, const String& pasteboardType, const String& pasteboardName)
{
uint64_t newChangeCount;
- WebProcess::shared().parentProcessConnection()->sendSync(Messages::WebContext::SetPasteboardStringForType(pasteboardName, pasteboardType, string),
- Messages::WebContext::SetPasteboardStringForType::Reply(newChangeCount), 0);
+ WebProcess::singleton().parentProcessConnection()->sendSync(Messages::WebPasteboardProxy::SetPasteboardStringForType(pasteboardName, pasteboardType, string), Messages::WebPasteboardProxy::SetPasteboardStringForType::Reply(newChangeCount), 0);
return newChangeCount;
}
#if PLATFORM(IOS)
-void WebPlatformStrategies::writeToPasteboard(const WebCore::PasteboardWebContent& content)
+void WebPlatformStrategies::writeToPasteboard(const WebCore::PasteboardWebContent& content, const String& pasteboardName)
{
- WebProcess::shared().parentProcessConnection()->send(Messages::WebContext::WriteWebContentToPasteboard(content), 0);
+ WebProcess::singleton().parentProcessConnection()->send(Messages::WebPasteboardProxy::WriteWebContentToPasteboard(content, pasteboardName), 0);
}
-void WebPlatformStrategies::writeToPasteboard(const WebCore::PasteboardImage& image)
+void WebPlatformStrategies::writeToPasteboard(const WebCore::PasteboardImage& image, const String& pasteboardName)
{
- WebProcess::shared().parentProcessConnection()->send(Messages::WebContext::WriteImageToPasteboard(image), 0);
+ WebProcess::singleton().parentProcessConnection()->send(Messages::WebPasteboardProxy::WriteImageToPasteboard(image, pasteboardName), 0);
}
-void WebPlatformStrategies::writeToPasteboard(const String& pasteboardType, const String& text)
+void WebPlatformStrategies::writeToPasteboard(const String& pasteboardType, const String& text, const String& pasteboardName)
{
- WebProcess::shared().parentProcessConnection()->send(Messages::WebContext::WriteStringToPasteboard(pasteboardType, text), 0);
+ WebProcess::singleton().parentProcessConnection()->send(Messages::WebPasteboardProxy::WriteStringToPasteboard(pasteboardType, text, pasteboardName), 0);
}
-int WebPlatformStrategies::getPasteboardItemsCount()
+int WebPlatformStrategies::getPasteboardItemsCount(const String& pasteboardName)
{
uint64_t itemsCount;
- WebProcess::shared().parentProcessConnection()->sendSync(Messages::WebContext::GetPasteboardItemsCount(),
- Messages::WebContext::GetPasteboardItemsCount::Reply(itemsCount), 0);
+ WebProcess::singleton().parentProcessConnection()->sendSync(Messages::WebPasteboardProxy::GetPasteboardItemsCount(pasteboardName), Messages::WebPasteboardProxy::GetPasteboardItemsCount::Reply(itemsCount), 0);
return itemsCount;
}
-PassRefPtr<WebCore::SharedBuffer> WebPlatformStrategies::readBufferFromPasteboard(int index, const String& pasteboardType)
+RefPtr<WebCore::SharedBuffer> WebPlatformStrategies::readBufferFromPasteboard(int index, const String& pasteboardType, const String& pasteboardName)
{
SharedMemory::Handle handle;
uint64_t size = 0;
- WebProcess::shared().parentProcessConnection()->sendSync(Messages::WebContext::ReadBufferFromPasteboard(index, pasteboardType),
- Messages::WebContext::ReadBufferFromPasteboard::Reply(handle, size), 0);
+ WebProcess::singleton().parentProcessConnection()->sendSync(Messages::WebPasteboardProxy::ReadBufferFromPasteboard(index, pasteboardType, pasteboardName), Messages::WebPasteboardProxy::ReadBufferFromPasteboard::Reply(handle, size), 0);
if (handle.isNull())
- return 0;
- RefPtr<SharedMemory> sharedMemoryBuffer = SharedMemory::create(handle, SharedMemory::ReadOnly);
+ return nullptr;
+ RefPtr<SharedMemory> sharedMemoryBuffer = SharedMemory::map(handle, SharedMemory::Protection::ReadOnly);
return SharedBuffer::create(static_cast<unsigned char *>(sharedMemoryBuffer->data()), size);
}
-WebCore::URL WebPlatformStrategies::readURLFromPasteboard(int index, const String& pasteboardType)
+WebCore::URL WebPlatformStrategies::readURLFromPasteboard(int index, const String& pasteboardType, const String& pasteboardName)
{
String urlString;
- WebProcess::shared().parentProcessConnection()->sendSync(Messages::WebContext::ReadURLFromPasteboard(index, pasteboardType),
- Messages::WebContext::ReadURLFromPasteboard::Reply(urlString), 0);
+ WebProcess::singleton().parentProcessConnection()->sendSync(Messages::WebPasteboardProxy::ReadURLFromPasteboard(index, pasteboardType, pasteboardName), Messages::WebPasteboardProxy::ReadURLFromPasteboard::Reply(urlString), 0);
return URL(ParsedURLString, urlString);
}
-String WebPlatformStrategies::readStringFromPasteboard(int index, const String& pasteboardType)
+String WebPlatformStrategies::readStringFromPasteboard(int index, const String& pasteboardType, const String& pasteboardName)
{
String value;
- WebProcess::shared().parentProcessConnection()->sendSync(Messages::WebContext::ReadStringFromPasteboard(index, pasteboardType),
- Messages::WebContext::ReadStringFromPasteboard::Reply(value), 0);
+ WebProcess::singleton().parentProcessConnection()->sendSync(Messages::WebPasteboardProxy::ReadStringFromPasteboard(index, pasteboardType, pasteboardName), Messages::WebPasteboardProxy::ReadStringFromPasteboard::Reply(value), 0);
return value;
}
+#endif // PLATFORM(IOS)
+
+#endif // PLATFORM(COCOA)
-long WebPlatformStrategies::changeCount()
+#if PLATFORM(GTK)
+// PasteboardStrategy
+
+void WebPlatformStrategies::writeToClipboard(const String& pasteboardName, const SelectionData& selection)
{
- uint64_t changeCount;
- WebProcess::shared().parentProcessConnection()->sendSync(Messages::WebContext::GetPasteboardChangeCount(String()),
- Messages::WebContext::GetPasteboardChangeCount::Reply(changeCount), 0);
- return changeCount;
+ WebSelectionData selectionData(selection);
+ WebProcess::singleton().parentProcessConnection()->send(Messages::WebPasteboardProxy::WriteToClipboard(pasteboardName, selectionData), 0);
}
-#endif
+Ref<SelectionData> WebPlatformStrategies::readFromClipboard(const String& pasteboardName)
+{
+ WebSelectionData selection;
+ WebProcess::singleton().parentProcessConnection()->sendSync(Messages::WebPasteboardProxy::ReadFromClipboard(pasteboardName), Messages::WebPasteboardProxy::ReadFromClipboard::Reply(selection), 0);
+ return WTFMove(selection.selectionData);
+}
-#endif
+#endif // PLATFORM(GTK)
} // namespace WebKit
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.h b/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.h
index bfb73c852..c69ea519e 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.h
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010, 2012 Apple Inc. All rights reserved.
+ * Copyright (C) 2010, 2012, 2016 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,19 +27,14 @@
#define WebPlatformStrategies_h
#include <WebCore/CookiesStrategy.h>
-#include <WebCore/DatabaseStrategy.h>
#include <WebCore/LoaderStrategy.h>
#include <WebCore/PasteboardStrategy.h>
#include <WebCore/PlatformStrategies.h>
-#include <WebCore/PluginStrategy.h>
-#include <WebCore/SharedWorkerStrategy.h>
-#include <WebCore/StorageStrategy.h>
-#include <WebCore/VisitedLinkStrategy.h>
#include <wtf/NeverDestroyed.h>
namespace WebKit {
-class WebPlatformStrategies : public WebCore::PlatformStrategies, private WebCore::CookiesStrategy, private WebCore::DatabaseStrategy, private WebCore::LoaderStrategy, private WebCore::PasteboardStrategy, private WebCore::PluginStrategy, private WebCore::SharedWorkerStrategy, private WebCore::StorageStrategy, private WebCore::VisitedLinkStrategy {
+class WebPlatformStrategies : public WebCore::PlatformStrategies, private WebCore::CookiesStrategy, private WebCore::PasteboardStrategy {
friend class NeverDestroyed<WebPlatformStrategies>;
public:
static void initialize();
@@ -48,99 +43,54 @@ private:
WebPlatformStrategies();
// WebCore::PlatformStrategies
- virtual WebCore::CookiesStrategy* createCookiesStrategy() override;
- virtual WebCore::DatabaseStrategy* createDatabaseStrategy() override;
- virtual WebCore::LoaderStrategy* createLoaderStrategy() override;
- virtual WebCore::PasteboardStrategy* createPasteboardStrategy() override;
- virtual WebCore::PluginStrategy* createPluginStrategy() override;
- virtual WebCore::SharedWorkerStrategy* createSharedWorkerStrategy() override;
- virtual WebCore::StorageStrategy* createStorageStrategy() override;
- virtual WebCore::VisitedLinkStrategy* createVisitedLinkStrategy() override;
+ WebCore::CookiesStrategy* createCookiesStrategy() override;
+ WebCore::LoaderStrategy* createLoaderStrategy() override;
+ WebCore::PasteboardStrategy* createPasteboardStrategy() override;
+ WebCore::BlobRegistry* createBlobRegistry() override;
// WebCore::CookiesStrategy
- virtual String cookiesForDOM(const WebCore::NetworkStorageSession&, const WebCore::URL& firstParty, const WebCore::URL&) override;
- virtual void setCookiesFromDOM(const WebCore::NetworkStorageSession&, const WebCore::URL& firstParty, const WebCore::URL&, const String&) override;
- virtual bool cookiesEnabled(const WebCore::NetworkStorageSession&, const WebCore::URL& firstParty, const WebCore::URL&) override;
- virtual String cookieRequestHeaderFieldValue(const WebCore::NetworkStorageSession&, const WebCore::URL& firstParty, const WebCore::URL&) override;
- virtual bool getRawCookies(const WebCore::NetworkStorageSession&, const WebCore::URL& firstParty, const WebCore::URL&, Vector<WebCore::Cookie>&) override;
- virtual void deleteCookie(const WebCore::NetworkStorageSession&, const WebCore::URL&, const String&) override;
-
- // WebCore::DatabaseStrategy
-#if ENABLE(SQL_DATABASE)
- virtual WebCore::AbstractDatabaseServer* getDatabaseServer() override;
-#endif
-#if ENABLE(INDEXED_DATABASE)
- virtual PassRefPtr<WebCore::IDBFactoryBackendInterface> createIDBFactoryBackend(const String& databaseDirectoryIdentifier) override;
-#endif
-
- // WebCore::LoaderStrategy
-#if ENABLE(NETWORK_PROCESS)
- virtual WebCore::ResourceLoadScheduler* resourceLoadScheduler() override;
- virtual void loadResourceSynchronously(WebCore::NetworkingContext*, unsigned long resourceLoadIdentifier, const WebCore::ResourceRequest&, WebCore::StoredCredentials, WebCore::ClientCredentialPolicy, WebCore::ResourceError&, WebCore::ResourceResponse&, Vector<char>& data) override;
-#if ENABLE(BLOB)
- virtual WebCore::BlobRegistry* createBlobRegistry() override;
-#endif
-#endif
-
- // WebCore::PluginStrategy
- virtual void refreshPlugins() override;
- virtual void getPluginInfo(const WebCore::Page*, Vector<WebCore::PluginInfo>&) override;
-
- // WebCore::SharedWorkerStrategy
- virtual bool isAvailable() const override;
-
- // WebCore::StorageStrategy.
- virtual PassRefPtr<WebCore::StorageNamespace> localStorageNamespace(WebCore::PageGroup*) override;
- virtual PassRefPtr<WebCore::StorageNamespace> transientLocalStorageNamespace(WebCore::PageGroup*, WebCore::SecurityOrigin*) override;
- virtual PassRefPtr<WebCore::StorageNamespace> sessionStorageNamespace(WebCore::Page*) override;
-
- // WebCore::VisitedLinkStrategy
- virtual bool isLinkVisited(WebCore::Page*, WebCore::LinkHash, const WebCore::URL& baseURL, const WTF::AtomicString& attributeURL) override;
- virtual void addVisitedLink(WebCore::Page*, WebCore::LinkHash) override;
+ String cookiesForDOM(const WebCore::NetworkStorageSession&, const WebCore::URL& firstParty, const WebCore::URL&) override;
+ void setCookiesFromDOM(const WebCore::NetworkStorageSession&, const WebCore::URL& firstParty, const WebCore::URL&, const String&) override;
+ bool cookiesEnabled(const WebCore::NetworkStorageSession&, const WebCore::URL& firstParty, const WebCore::URL&) override;
+ String cookieRequestHeaderFieldValue(const WebCore::NetworkStorageSession&, const WebCore::URL& firstParty, const WebCore::URL&) override;
+ String cookieRequestHeaderFieldValue(WebCore::SessionID, const WebCore::URL& firstParty, const WebCore::URL&) override;
+ bool getRawCookies(const WebCore::NetworkStorageSession&, const WebCore::URL& firstParty, const WebCore::URL&, Vector<WebCore::Cookie>&) override;
+ void deleteCookie(const WebCore::NetworkStorageSession&, const WebCore::URL&, const String&) override;
+ void addCookie(const WebCore::NetworkStorageSession&, const WebCore::URL&, const WebCore::Cookie&) override;
// WebCore::PasteboardStrategy
#if PLATFORM(IOS)
- virtual void writeToPasteboard(const WebCore::PasteboardWebContent&) override;
- virtual void writeToPasteboard(const WebCore::PasteboardImage&) override;
- virtual void writeToPasteboard(const String& pasteboardType, const String&) override;
- virtual int getPasteboardItemsCount() override;
- virtual String readStringFromPasteboard(int index, const String& pasteboardType) override;
- virtual PassRefPtr<WebCore::SharedBuffer> readBufferFromPasteboard(int index, const String& pasteboardType) override;
- virtual WebCore::URL readURLFromPasteboard(int index, const String& pasteboardType) override;
- virtual long changeCount() override;
+ void writeToPasteboard(const WebCore::PasteboardWebContent&, const String& pasteboardName) override;
+ void writeToPasteboard(const WebCore::PasteboardImage&, const String& pasteboardName) override;
+ void writeToPasteboard(const String& pasteboardType, const String&, const String& pasteboardName) override;
+ int getPasteboardItemsCount(const String& pasteboardName) override;
+ String readStringFromPasteboard(int index, const String& pasteboardType, const String& pasteboardName) override;
+ RefPtr<WebCore::SharedBuffer> readBufferFromPasteboard(int index, const String& pasteboardType, const String& pasteboardName) override;
+ WebCore::URL readURLFromPasteboard(int index, const String& pasteboardType, const String& pasteboardName) override;
#endif
-#if PLATFORM(MAC)
- virtual void getTypes(Vector<String>& types, const String& pasteboardName) override;
- virtual PassRefPtr<WebCore::SharedBuffer> bufferForType(const String& pasteboardType, const String& pasteboardName) override;
- virtual void getPathnamesForType(Vector<String>& pathnames, const String& pasteboardType, const String& pasteboardName) override;
- virtual String stringForType(const String& pasteboardType, const String& pasteboardName) override;
- virtual long changeCount(const String& pasteboardName) override;
- virtual String uniqueName() override;
- virtual WebCore::Color color(const String& pasteboardName) override;
- virtual WebCore::URL url(const String& pasteboardName) override;
-
- virtual long addTypes(const Vector<String>& pasteboardTypes, const String& pasteboardName) override;
- virtual long setTypes(const Vector<String>& pasteboardTypes, const String& pasteboardName) override;
- virtual long copy(const String& fromPasteboard, const String& toPasteboard) override;
- virtual long setBufferForType(PassRefPtr<WebCore::SharedBuffer>, const String& pasteboardType, const String& pasteboardName) override;
- virtual long setPathnamesForType(const Vector<String>&, const String& pasteboardType, const String& pasteboardName) override;
- virtual long setStringForType(const String&, const String& pasteboardType, const String& pasteboardName) override;
+#if PLATFORM(COCOA)
+ void getTypes(Vector<String>& types, const String& pasteboardName) override;
+ RefPtr<WebCore::SharedBuffer> bufferForType(const String& pasteboardType, const String& pasteboardName) override;
+ void getPathnamesForType(Vector<String>& pathnames, const String& pasteboardType, const String& pasteboardName) override;
+ String stringForType(const String& pasteboardType, const String& pasteboardName) override;
+ long changeCount(const String& pasteboardName) override;
+ String uniqueName() override;
+ WebCore::Color color(const String& pasteboardName) override;
+ WebCore::URL url(const String& pasteboardName) override;
+
+ long addTypes(const Vector<String>& pasteboardTypes, const String& pasteboardName) override;
+ long setTypes(const Vector<String>& pasteboardTypes, const String& pasteboardName) override;
+ long copy(const String& fromPasteboard, const String& toPasteboard) override;
+ long setBufferForType(WebCore::SharedBuffer*, const String& pasteboardType, const String& pasteboardName) override;
+ long setPathnamesForType(const Vector<String>&, const String& pasteboardType, const String& pasteboardName) override;
+ long setStringForType(const String&, const String& pasteboardType, const String& pasteboardName) override;
+#endif
+#if PLATFORM(GTK)
+ void writeToClipboard(const String& pasteboardName, const WebCore::SelectionData&) override;
+ Ref<WebCore::SelectionData> readFromClipboard(const String& pasteboardName) override;
#endif
-
-#if ENABLE(NETSCAPE_PLUGIN_API)
- // WebCore::PluginStrategy implementation.
- void populatePluginCache();
- bool m_pluginCacheIsPopulated;
- bool m_shouldRefreshPlugins;
- Vector<WebCore::PluginInfo> m_cachedPlugins;
- Vector<WebCore::PluginInfo> m_cachedApplicationPlugins;
-#endif // ENABLE(NETSCAPE_PLUGIN_API)
};
-#if ENABLE(NETSCAPE_PLUGIN_API)
-void handleDidGetPlugins(uint64_t requestID, const Vector<WebCore::PluginInfo>&, const Vector<WebCore::PluginInfo>& applicationPlugins);
-#endif // ENABLE(NETSCAPE_PLUGIN_API)
-
} // namespace WebKit
#endif // WebPlatformStrategies_h
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebPlugInClient.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebPlugInClient.cpp
index 854d7739f..0ff5fc2c7 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/WebPlugInClient.cpp
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebPlugInClient.cpp
@@ -33,8 +33,9 @@
namespace WebKit {
-WebPlugInClient::WebPlugInClient(WebPage* page)
- : m_page(page)
+WebPlugInClient::WebPlugInClient(WebPage& webPage)
+ : m_webPage(webPage)
+
{
}
@@ -49,12 +50,12 @@ void WebPlugInClient::pageDestroyed()
bool WebPlugInClient::shouldAutoStartFromOrigin(const String& pageOrigin, const String& pluginOrigin, const String& mimeType)
{
- return WebProcess::shared().shouldPlugInAutoStartFromOrigin(m_page, pageOrigin, pluginOrigin, mimeType);
+ return WebProcess::singleton().shouldPlugInAutoStartFromOrigin(m_webPage, pageOrigin, pluginOrigin, mimeType);
}
-void WebPlugInClient::didStartFromOrigin(const String& pageOrigin, const String& pluginOrigin, const String& mimeType)
+void WebPlugInClient::didStartFromOrigin(const String& pageOrigin, const String& pluginOrigin, const String& mimeType, WebCore::SessionID sessionID)
{
- WebProcess::shared().plugInDidStartFromOrigin(pageOrigin, pluginOrigin, mimeType);
+ WebProcess::singleton().plugInDidStartFromOrigin(pageOrigin, pluginOrigin, mimeType, sessionID);
}
} // namespace WebKit
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebPlugInClient.h b/Source/WebKit2/WebProcess/WebCoreSupport/WebPlugInClient.h
index 531028a18..93f9698a9 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/WebPlugInClient.h
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebPlugInClient.h
@@ -27,6 +27,7 @@
#define WebPlugInClient_h
#include <WebCore/PlugInClient.h>
+#include <WebCore/SessionID.h>
namespace WebKit {
@@ -34,14 +35,15 @@ class WebPage;
class WebPlugInClient : public WebCore::PlugInClient {
public:
- WebPlugInClient(WebPage*);
+ explicit WebPlugInClient(WebPage&);
virtual ~WebPlugInClient();
+
private:
- virtual void pageDestroyed();
- virtual bool shouldAutoStartFromOrigin(const String& pageOrigin, const String& pluginOrigin, const String& mimeType);
- virtual void didStartFromOrigin(const String& pageOrigin, const String& pluginOrigin, const String& mimeType);
+ void pageDestroyed() override;
+ bool shouldAutoStartFromOrigin(const String& pageOrigin, const String& pluginOrigin, const String& mimeType) override;
+ void didStartFromOrigin(const String& pageOrigin, const String& pluginOrigin, const String& mimeType, WebCore::SessionID) override;
- WebPage* m_page;
+ WebPage& m_webPage;
};
} // namespace WebKit
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebPopupMenu.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebPopupMenu.cpp
index b62d8d249..a27510893 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/WebPopupMenu.cpp
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebPopupMenu.cpp
@@ -34,9 +34,9 @@ using namespace WebCore;
namespace WebKit {
-PassRefPtr<WebPopupMenu> WebPopupMenu::create(WebPage* page, PopupMenuClient* client)
+Ref<WebPopupMenu> WebPopupMenu::create(WebPage* page, PopupMenuClient* client)
{
- return adoptRef(new WebPopupMenu(page, client));
+ return adoptRef(*new WebPopupMenu(page, client));
}
WebPopupMenu::WebPopupMenu(WebPage* page, PopupMenuClient* client)
@@ -112,7 +112,7 @@ void WebPopupMenu::show(const IntRect& rect, FrameView* view, int index)
PlatformPopupMenuData platformData;
setUpPlatformData(pageCoordinates, platformData);
- WebProcess::shared().parentProcessConnection()->send(Messages::WebPageProxy::ShowPopupMenu(pageCoordinates, m_popupClient->menuStyle().textDirection(), items, index, platformData), m_page->pageID());
+ WebProcess::singleton().parentProcessConnection()->send(Messages::WebPageProxy::ShowPopupMenu(pageCoordinates, m_popupClient->menuStyle().textDirection(), items, index, platformData), m_page->pageID());
}
void WebPopupMenu::hide()
@@ -120,7 +120,7 @@ void WebPopupMenu::hide()
if (!m_page || !m_popupClient)
return;
- WebProcess::shared().parentProcessConnection()->send(Messages::WebPageProxy::HidePopupMenu(), m_page->pageID());
+ WebProcess::singleton().parentProcessConnection()->send(Messages::WebPageProxy::HidePopupMenu(), m_page->pageID());
m_page->setActivePopupMenu(0);
}
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebPopupMenu.h b/Source/WebKit2/WebProcess/WebCoreSupport/WebPopupMenu.h
index ffbfc45cb..0cac029b9 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/WebPopupMenu.h
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebPopupMenu.h
@@ -25,7 +25,6 @@
#include "WebPopupItem.h"
#include <WebCore/PopupMenu.h>
#include <wtf/Forward.h>
-#include <wtf/OwnPtr.h>
#include <wtf/Vector.h>
namespace WebCore {
@@ -40,7 +39,7 @@ struct WebPopupItem;
class WebPopupMenu : public WebCore::PopupMenu {
public:
- static PassRefPtr<WebPopupMenu> create(WebPage*, WebCore::PopupMenuClient*);
+ static Ref<WebPopupMenu> create(WebPage*, WebCore::PopupMenuClient*);
~WebPopupMenu();
WebPage* page() { return m_page; }
@@ -52,10 +51,10 @@ public:
WebCore::PopupMenuClient* client() const { return m_popupClient; }
#endif
- virtual void show(const WebCore::IntRect&, WebCore::FrameView*, int index) override;
- virtual void hide() override;
- virtual void updateFromElement() override;
- virtual void disconnectClient() override;
+ void show(const WebCore::IntRect&, WebCore::FrameView*, int index) override;
+ void hide() override;
+ void updateFromElement() override;
+ void disconnectClient() override;
private:
WebPopupMenu(WebPage*, WebCore::PopupMenuClient*);
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebProgressTrackerClient.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebProgressTrackerClient.cpp
index 6fba9724e..77e96ff7a 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/WebProgressTrackerClient.cpp
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebProgressTrackerClient.cpp
@@ -51,7 +51,8 @@ void WebProgressTrackerClient::progressStarted(Frame& originatingProgressFrame)
{
if (!originatingProgressFrame.isMainFrame())
return;
-
+
+ m_webPage.setMainFrameProgressCompleted(false);
m_webPage.send(Messages::WebPageProxy::DidStartProgress());
}
@@ -68,10 +69,12 @@ void WebProgressTrackerClient::progressFinished(Frame& originatingProgressFrame)
{
if (!originatingProgressFrame.isMainFrame())
return;
-
+
+ m_webPage.setMainFrameProgressCompleted(true);
+
// Notify the bundle client.
m_webPage.injectedBundleLoaderClient().didFinishProgress(&m_webPage);
-
+
m_webPage.send(Messages::WebPageProxy::DidFinishProgress());
}
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebProgressTrackerClient.h b/Source/WebKit2/WebProcess/WebCoreSupport/WebProgressTrackerClient.h
index b9ed23be1..5dd65bfa0 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/WebProgressTrackerClient.h
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebProgressTrackerClient.h
@@ -37,11 +37,11 @@ public:
explicit WebProgressTrackerClient(WebPage&);
private:
- virtual void progressTrackerDestroyed() override;
+ void progressTrackerDestroyed() override;
- virtual void progressStarted(WebCore::Frame& originatingProgressFrame) override;
- virtual void progressEstimateChanged(WebCore::Frame& originatingProgressFrame) override;
- virtual void progressFinished(WebCore::Frame& originatingProgressFrame) override;
+ void progressStarted(WebCore::Frame& originatingProgressFrame) override;
+ void progressEstimateChanged(WebCore::Frame& originatingProgressFrame) override;
+ void progressFinished(WebCore::Frame& originatingProgressFrame) override;
WebPage& m_webPage;
};
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebSearchPopupMenu.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebSearchPopupMenu.cpp
index 1f8f8b304..8e6df3412 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/WebSearchPopupMenu.cpp
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebSearchPopupMenu.cpp
@@ -32,9 +32,9 @@ using namespace WebCore;
namespace WebKit {
-PassRefPtr<WebSearchPopupMenu> WebSearchPopupMenu::create(WebPage* page, PopupMenuClient* client)
+Ref<WebSearchPopupMenu> WebSearchPopupMenu::create(WebPage* page, PopupMenuClient* client)
{
- return adoptRef(new WebSearchPopupMenu(page, client));
+ return adoptRef(*new WebSearchPopupMenu(page, client));
}
WebSearchPopupMenu::WebSearchPopupMenu(WebPage* page, PopupMenuClient* client)
@@ -47,7 +47,7 @@ PopupMenu* WebSearchPopupMenu::popupMenu()
return m_popup.get();
}
-void WebSearchPopupMenu::saveRecentSearches(const AtomicString& name, const Vector<String>& searchItems)
+void WebSearchPopupMenu::saveRecentSearches(const AtomicString& name, const Vector<RecentSearch>& searchItems)
{
if (name.isEmpty())
return;
@@ -56,10 +56,10 @@ void WebSearchPopupMenu::saveRecentSearches(const AtomicString& name, const Vect
if (!page)
return;
- WebProcess::shared().parentProcessConnection()->send(Messages::WebPageProxy::SaveRecentSearches(name, searchItems), page->pageID());
+ WebProcess::singleton().parentProcessConnection()->send(Messages::WebPageProxy::SaveRecentSearches(name, searchItems), page->pageID());
}
-void WebSearchPopupMenu::loadRecentSearches(const AtomicString& name, Vector<String>& resultItems)
+void WebSearchPopupMenu::loadRecentSearches(const AtomicString& name, Vector<RecentSearch>& resultItems)
{
if (name.isEmpty())
return;
@@ -68,7 +68,7 @@ void WebSearchPopupMenu::loadRecentSearches(const AtomicString& name, Vector<Str
if (!page)
return;
- WebProcess::shared().parentProcessConnection()->sendSync(Messages::WebPageProxy::LoadRecentSearches(name), Messages::WebPageProxy::LoadRecentSearches::Reply(resultItems), page->pageID());
+ WebProcess::singleton().parentProcessConnection()->sendSync(Messages::WebPageProxy::LoadRecentSearches(name), Messages::WebPageProxy::LoadRecentSearches::Reply(resultItems), page->pageID());
}
bool WebSearchPopupMenu::enabled()
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebSearchPopupMenu.h b/Source/WebKit2/WebProcess/WebCoreSupport/WebSearchPopupMenu.h
index bd43ed769..4e5b3b66c 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/WebSearchPopupMenu.h
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebSearchPopupMenu.h
@@ -28,12 +28,12 @@ namespace WebKit {
class WebSearchPopupMenu : public WebCore::SearchPopupMenu {
public:
- static PassRefPtr<WebSearchPopupMenu> create(WebPage*, WebCore::PopupMenuClient*);
+ static Ref<WebSearchPopupMenu> create(WebPage*, WebCore::PopupMenuClient*);
- virtual WebCore::PopupMenu* popupMenu() override;
- virtual void saveRecentSearches(const WTF::AtomicString& name, const Vector<String>& searchItems) override;
- virtual void loadRecentSearches(const WTF::AtomicString& name, Vector<String>& searchItems) override;
- virtual bool enabled() override;
+ WebCore::PopupMenu* popupMenu() override;
+ void saveRecentSearches(const WTF::AtomicString& name, const Vector<WebCore::RecentSearch>&) override;
+ void loadRecentSearches(const WTF::AtomicString& name, Vector<WebCore::RecentSearch>&) override;
+ bool enabled() override;
private:
WebSearchPopupMenu(WebPage*, WebCore::PopupMenuClient*);
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebUserMediaClient.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebUserMediaClient.cpp
new file mode 100644
index 000000000..362202e0e
--- /dev/null
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebUserMediaClient.cpp
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2014 Igalia S.L.
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "config.h"
+#include "WebUserMediaClient.h"
+
+#if ENABLE(MEDIA_STREAM)
+
+#include "WebPage.h"
+#include <WebCore/UserMediaController.h>
+#include <WebCore/UserMediaRequest.h>
+
+using namespace WebCore;
+
+namespace WebKit {
+
+WebUserMediaClient::WebUserMediaClient(WebPage& page)
+ : m_page(page)
+{
+}
+
+void WebUserMediaClient::pageDestroyed()
+{
+ delete this;
+}
+
+void WebUserMediaClient::requestUserMediaAccess(UserMediaRequest& request)
+{
+ m_page.userMediaPermissionRequestManager().startUserMediaRequest(request);
+}
+
+void WebUserMediaClient::cancelUserMediaAccessRequest(UserMediaRequest& request)
+{
+ m_page.userMediaPermissionRequestManager().cancelUserMediaRequest(request);
+}
+
+void WebUserMediaClient::enumerateMediaDevices(MediaDevicesEnumerationRequest& request)
+{
+ m_page.userMediaPermissionRequestManager().enumerateMediaDevices(request);
+}
+
+void WebUserMediaClient::cancelMediaDevicesEnumerationRequest(MediaDevicesEnumerationRequest& request)
+{
+ m_page.userMediaPermissionRequestManager().cancelMediaDevicesEnumeration(request);
+}
+
+} // namespace WebKit;
+
+#endif // MEDIA_STREAM
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebUserMediaClient.h b/Source/WebKit2/WebProcess/WebCoreSupport/WebUserMediaClient.h
new file mode 100644
index 000000000..84d426236
--- /dev/null
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebUserMediaClient.h
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2014 Igalia S.L.
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef WebUserMediaClient_h
+#define WebUserMediaClient_h
+
+#if ENABLE(MEDIA_STREAM)
+
+#include <WebCore/UserMediaClient.h>
+
+namespace WebKit {
+
+class WebPage;
+
+class WebUserMediaClient : public WebCore::UserMediaClient {
+public:
+ WebUserMediaClient(WebPage&);
+ ~WebUserMediaClient() { }
+
+private:
+ void pageDestroyed() override;
+
+ void requestUserMediaAccess(WebCore::UserMediaRequest&) override;
+ void cancelUserMediaAccessRequest(WebCore::UserMediaRequest&) override;
+
+ void enumerateMediaDevices(WebCore::MediaDevicesEnumerationRequest&) final;
+ void cancelMediaDevicesEnumerationRequest(WebCore::MediaDevicesEnumerationRequest&) final;
+
+ WebPage& m_page;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(MEDIA_STREAM)
+
+#endif // WebUserMediaClient_h
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebValidationMessageClient.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebValidationMessageClient.cpp
new file mode 100644
index 000000000..dcba2bb9e
--- /dev/null
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebValidationMessageClient.cpp
@@ -0,0 +1,103 @@
+/*
+ * Copyright (C) 2016 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 "WebValidationMessageClient.h"
+
+#include "WebPage.h"
+#include "WebPageProxyMessages.h"
+#include <WebCore/Element.h>
+#include <WebCore/Frame.h>
+
+namespace WebKit {
+
+using namespace WebCore;
+
+WebValidationMessageClient::WebValidationMessageClient(WebPage& page)
+ : m_page(page)
+{
+}
+
+WebValidationMessageClient::~WebValidationMessageClient()
+{
+ if (m_currentAnchor)
+ hideValidationMessage(*m_currentAnchor);
+}
+
+void WebValidationMessageClient::documentDetached(Document& document)
+{
+ if (!m_currentAnchor)
+ return;
+ if (&m_currentAnchor->document() == &document)
+ hideValidationMessage(*m_currentAnchor);
+}
+
+void WebValidationMessageClient::showValidationMessage(const Element& anchor, const String& message)
+{
+ if (m_currentAnchor)
+ hideValidationMessage(*m_currentAnchor);
+
+ m_currentAnchor = &anchor;
+ m_currentAnchorRect = anchor.clientRect();
+ m_page.send(Messages::WebPageProxy::ShowValidationMessage(m_currentAnchorRect, message));
+}
+
+void WebValidationMessageClient::hideValidationMessage(const Element& anchor)
+{
+ if (!isValidationMessageVisible(anchor))
+ return;
+
+ m_currentAnchor = nullptr;
+ m_currentAnchorRect = { };
+ m_page.send(Messages::WebPageProxy::HideValidationMessage());
+}
+
+void WebValidationMessageClient::hideAnyValidationMessage()
+{
+ if (!m_currentAnchor)
+ return;
+
+ m_currentAnchor = nullptr;
+ m_currentAnchorRect = { };
+ m_page.send(Messages::WebPageProxy::HideValidationMessage());
+}
+
+bool WebValidationMessageClient::isValidationMessageVisible(const Element& anchor)
+{
+ return m_currentAnchor == &anchor;
+}
+
+void WebValidationMessageClient::updateValidationBubbleStateIfNeeded()
+{
+ if (!m_currentAnchor)
+ return;
+
+ // We currently hide the validation bubble if its position is outdated instead of trying
+ // to update its position.
+ if (m_currentAnchorRect != m_currentAnchor->clientRect())
+ hideValidationMessage(*m_currentAnchor);
+}
+
+} // namespace WebKit
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebValidationMessageClient.h b/Source/WebKit2/WebProcess/WebCoreSupport/WebValidationMessageClient.h
new file mode 100644
index 000000000..9bc5d90dd
--- /dev/null
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebValidationMessageClient.h
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2016 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 <WebCore/IntRect.h>
+#include <WebCore/ValidationMessageClient.h>
+
+namespace WebKit {
+
+class WebPage;
+
+class WebValidationMessageClient final : public WebCore::ValidationMessageClient {
+public:
+ explicit WebValidationMessageClient(WebPage&);
+ ~WebValidationMessageClient();
+
+ // ValidationMessageClient API.
+ void documentDetached(WebCore::Document&) final;
+ void showValidationMessage(const WebCore::Element& anchor, const String& message) final;
+ void hideValidationMessage(const WebCore::Element& anchor) final;
+ void hideAnyValidationMessage() final;
+ bool isValidationMessageVisible(const WebCore::Element& anchor) final;
+ void updateValidationBubbleStateIfNeeded() final;
+
+private:
+ WebPage& m_page;
+ const WebCore::Element* m_currentAnchor { nullptr };
+ WebCore::IntRect m_currentAnchorRect;
+};
+
+}
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebVibrationClient.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebVibrationClient.cpp
index e41ded285..eeac6eced 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/WebVibrationClient.cpp
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebVibrationClient.cpp
@@ -38,12 +38,12 @@ namespace WebKit {
void WebVibrationClient::vibrate(const unsigned& vibrationTime)
{
- WebProcess::shared().parentProcessConnection()->send(Messages::WebVibrationProxy::Vibrate(vibrationTime), m_page->pageID());
+ WebProcess::singleton().parentProcessConnection()->send(Messages::WebVibrationProxy::Vibrate(vibrationTime), m_page->pageID());
}
void WebVibrationClient::cancelVibration()
{
- WebProcess::shared().parentProcessConnection()->send(Messages::WebVibrationProxy::CancelVibration(), m_page->pageID());
+ WebProcess::singleton().parentProcessConnection()->send(Messages::WebVibrationProxy::CancelVibration(), m_page->pageID());
}
void WebVibrationClient::vibrationDestroyed()
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebVibrationClient.h b/Source/WebKit2/WebProcess/WebCoreSupport/WebVibrationClient.h
index 0cd3b65fd..0f00a5cef 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/WebVibrationClient.h
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebVibrationClient.h
@@ -44,9 +44,9 @@ public:
virtual ~WebVibrationClient() { }
private:
- virtual void vibrate(const unsigned& vibrationTime) override;
- virtual void cancelVibration() override;
- virtual void vibrationDestroyed() override;
+ void vibrate(const unsigned& vibrationTime) override;
+ void cancelVibration() override;
+ void vibrationDestroyed() override;
WebPage* m_page;
};
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebDragClientGtk.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebDragClientGtk.cpp
index 697dd8fe6..0398dca2e 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebDragClientGtk.cpp
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebDragClientGtk.cpp
@@ -32,8 +32,8 @@
#include "ShareableBitmap.h"
#include "WebPage.h"
#include "WebPageProxyMessages.h"
-#include <WebCore/Clipboard.h>
-#include <WebCore/DataObjectGtk.h>
+#include "WebSelectionData.h"
+#include <WebCore/DataTransfer.h>
#include <WebCore/DragData.h>
#include <WebCore/GraphicsContext.h>
#include <WebCore/Pasteboard.h>
@@ -43,31 +43,32 @@ using namespace WebCore;
namespace WebKit {
-static PassRefPtr<ShareableBitmap> convertCairoSurfaceToShareableBitmap(cairo_surface_t* surface)
+static RefPtr<ShareableBitmap> convertCairoSurfaceToShareableBitmap(cairo_surface_t* surface)
{
if (!surface)
- return 0;
+ return nullptr;
IntSize imageSize(cairo_image_surface_get_width(surface), cairo_image_surface_get_height(surface));
RefPtr<ShareableBitmap> bitmap = ShareableBitmap::createShareable(imageSize, ShareableBitmap::SupportsAlpha);
auto graphicsContext = bitmap->createGraphicsContext();
- graphicsContext->platformContext()->drawSurfaceToContext(surface, IntRect(IntPoint(), imageSize), IntRect(IntPoint(), imageSize), graphicsContext.get());
- return bitmap.release();
+ graphicsContext->platformContext()->drawSurfaceToContext(surface, IntRect(IntPoint(), imageSize), IntRect(IntPoint(), imageSize), *graphicsContext);
+ return bitmap;
}
-void WebDragClient::startDrag(DragImageRef dragImage, const IntPoint& clientPosition, const IntPoint& globalPosition, Clipboard& clipboard, Frame&, bool)
+void WebDragClient::startDrag(DragImage dragImage, const IntPoint& clientPosition, const IntPoint& globalPosition, const FloatPoint&, DataTransfer& dataTransfer, Frame&, DragSourceAction)
{
- RefPtr<ShareableBitmap> bitmap = convertCairoSurfaceToShareableBitmap(dragImage);
+ RefPtr<ShareableBitmap> bitmap = convertCairoSurfaceToShareableBitmap(dragImage.get().get());
ShareableBitmap::Handle handle;
// If we have a bitmap, but cannot create a handle to it, we fail early.
if (bitmap && !bitmap->createHandle(handle))
return;
- RefPtr<DataObjectGtk> dataObject = clipboard.pasteboard().dataObject();
- DragData dragData(dataObject.get(), clientPosition, globalPosition, clipboard.sourceOperation());
- m_page->send(Messages::WebPageProxy::StartDrag(dragData, handle));
+ m_page->willStartDrag();
+
+ WebSelectionData selection(dataTransfer.pasteboard().selectionData());
+ m_page->send(Messages::WebPageProxy::StartDrag(selection, dataTransfer.sourceOperation(), handle));
}
}; // namespace WebKit.
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebEditorClientGtk.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebEditorClientGtk.cpp
index 08cf200bd..1505c883f 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebEditorClientGtk.cpp
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebEditorClientGtk.cpp
@@ -20,41 +20,29 @@
#include "config.h"
#include "WebEditorClient.h"
-#include "Frame.h"
-#include "FrameDestructionObserver.h"
#include "PlatformKeyboardEvent.h"
-#include "WebPage.h"
-#include "WebPageProxyMessages.h"
-#include "WebProcess.h"
-#include <WebCore/DataObjectGtk.h>
+#include <WebCore/Document.h>
+#include <WebCore/Editor.h>
+#include <WebCore/EventNames.h>
+#include <WebCore/Frame.h>
#include <WebCore/KeyboardEvent.h>
-#include <WebCore/PasteboardHelper.h>
-#include <WebCore/WindowsKeyboardCodes.h>
+#include <WebCore/Pasteboard.h>
+#include <WebCore/markup.h>
+#include <wtf/glib/GRefPtr.h>
using namespace WebCore;
namespace WebKit {
-void WebEditorClient::getEditorCommandsForKeyEvent(const KeyboardEvent* event, Vector<WTF::String>& pendingEditorCommands)
-{
- ASSERT(event->type() == eventNames().keydownEvent || event->type() == eventNames().keypressEvent);
-
- /* First try to interpret the command in the UI and get the commands.
- UI needs to receive event type because only knows current NativeWebKeyboardEvent.*/
- WebProcess::shared().parentProcessConnection()->sendSync(Messages::WebPageProxy::GetEditorCommandsForKeyEvent(event->type()),
- Messages::WebPageProxy::GetEditorCommandsForKeyEvent::Reply(pendingEditorCommands),
- m_page->pageID(), std::chrono::milliseconds::max());
-}
-
bool WebEditorClient::executePendingEditorCommands(Frame* frame, const Vector<WTF::String>& pendingEditorCommands, bool allowTextInsertion)
{
Vector<Editor::Command> commands;
for (auto& commandString : pendingEditorCommands) {
- Editor::Command command = frame->editor().command(commandString.utf8().data());
+ Editor::Command command = frame->editor().command(commandString);
if (command.isTextInsertion() && !allowTextInsertion)
return false;
- commands.append(std::move(command));
+ commands.append(WTFMove(command));
}
for (auto& command : commands) {
@@ -67,21 +55,20 @@ bool WebEditorClient::executePendingEditorCommands(Frame* frame, const Vector<WT
void WebEditorClient::handleKeyboardEvent(KeyboardEvent* event)
{
- Node* node = event->target()->toNode();
- ASSERT(node);
- Frame* frame = node->document().frame();
- ASSERT(frame);
-
const PlatformKeyboardEvent* platformEvent = event->keyEvent();
if (!platformEvent)
return;
// If this was an IME event don't do anything.
- if (platformEvent->windowsVirtualKeyCode() == VK_PROCESSKEY)
+ if (platformEvent->handledByInputMethod())
return;
- Vector<WTF::String> pendingEditorCommands;
- getEditorCommandsForKeyEvent(event, pendingEditorCommands);
+ Node* node = event->target()->toNode();
+ ASSERT(node);
+ Frame* frame = node->document().frame();
+ ASSERT(frame);
+
+ const Vector<String> pendingEditorCommands = platformEvent->commands();
if (!pendingEditorCommands.isEmpty()) {
// During RawKeyDown events if an editor command will insert text, defer
@@ -126,72 +113,23 @@ void WebEditorClient::handleKeyboardEvent(KeyboardEvent* event)
void WebEditorClient::handleInputMethodKeydown(KeyboardEvent* event)
{
const PlatformKeyboardEvent* platformEvent = event->keyEvent();
- if (platformEvent && platformEvent->windowsVirtualKeyCode() == VK_PROCESSKEY)
- event->preventDefault();
-}
-
-#if PLATFORM(X11)
-class EditorClientFrameDestructionObserver : FrameDestructionObserver {
-public:
- EditorClientFrameDestructionObserver(Frame* frame, GClosure* closure)
- : FrameDestructionObserver(frame)
- , m_closure(closure)
- {
- g_closure_add_finalize_notifier(m_closure, this, destroyOnClosureFinalization);
- }
-
- void frameDestroyed()
- {
- g_closure_invalidate(m_closure);
- FrameDestructionObserver::frameDestroyed();
- }
-private:
- GClosure* m_closure;
-
- static void destroyOnClosureFinalization(gpointer data, GClosure* closure)
- {
- // Calling delete void* will free the memory but won't invoke
- // the destructor, something that is a must for us.
- EditorClientFrameDestructionObserver* observer = static_cast<EditorClientFrameDestructionObserver*>(data);
- delete observer;
- }
-};
-
-static Frame* frameSettingClipboard;
-
-static void collapseSelection(GtkClipboard* clipboard, Frame* frame)
-{
- if (frameSettingClipboard && frameSettingClipboard == frame)
- return;
-
- // Collapse the selection without clearing it.
- ASSERT(frame);
- frame->selection().setBase(frame->selection().extent(), frame->selection().affinity());
+ if (platformEvent && platformEvent->handledByInputMethod())
+ event->setDefaultHandled();
}
-#endif
void WebEditorClient::updateGlobalSelection(Frame* frame)
{
-#if PLATFORM(X11)
- GtkClipboard* clipboard = PasteboardHelper::defaultPasteboardHelper()->getPrimarySelectionClipboard(frame);
- DataObjectGtk* dataObject = DataObjectGtk::forClipboard(clipboard);
-
if (!frame->selection().isRange())
return;
+ RefPtr<Range> range = frame->selection().toNormalizedRange();
+ if (!range)
+ return;
- dataObject->clearAll();
- dataObject->setRange(frame->selection().toNormalizedRange());
-
- frameSettingClipboard = frame;
- GClosure* callback = g_cclosure_new(G_CALLBACK(collapseSelection), frame, 0);
- // This observer will be self-destroyed on closure finalization,
- // that will happen either after closure execution or after
- // closure invalidation.
- new EditorClientFrameDestructionObserver(frame, callback);
- g_closure_set_marshal(callback, g_cclosure_marshal_VOID__VOID);
- PasteboardHelper::defaultPasteboardHelper()->writeClipboardContents(clipboard, PasteboardHelper::DoNotIncludeSmartPaste, callback);
- frameSettingClipboard = 0;
-#endif
+ PasteboardWebContent pasteboardContent;
+ pasteboardContent.canSmartCopyOrDelete = false;
+ pasteboardContent.text = range->text();
+ pasteboardContent.markup = createMarkup(*range, nullptr, AnnotateForInterchange, false, ResolveNonLocalURLs);
+ Pasteboard::createForGlobalSelection()->write(pasteboardContent);
}
bool WebEditorClient::shouldShowUnicodeMenu()
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebErrorsGtk.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebErrorsGtk.cpp
index 7d05108a3..e9d1d4c2b 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebErrorsGtk.cpp
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebErrorsGtk.cpp
@@ -33,7 +33,7 @@
#include <WebCore/ResourceError.h>
#include <WebCore/ResourceRequest.h>
#include <WebCore/ResourceResponse.h>
-#include <WebKit2/WKError.h>
+#include <WebKit/WKErrorRef.h>
#include <glib/gi18n-lib.h>
using namespace WebCore;
@@ -50,6 +50,11 @@ ResourceError blockedError(const ResourceRequest& request)
return WebCore::blockedError(request);
}
+ResourceError blockedByContentBlockerError(const ResourceRequest& request)
+{
+ return WebCore::blockedByContentBlockerError(request);
+}
+
ResourceError cannotShowURLError(const ResourceRequest& request)
{
return WebCore::cannotShowURLError(request);
@@ -77,7 +82,7 @@ ResourceError pluginWillHandleLoadError(const ResourceResponse& response)
WebCore::ResourceError internalError(const WebCore::URL& url)
{
- return ResourceError(API::Error::webKitErrorDomain(), kWKErrorInternal, url.string(), _("Internal error"));
+ return ResourceError(API::Error::webKitErrorDomain(), kWKErrorInternal, url, _("Internal error"));
}
} // namespace WebKit
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/soup/WebFrameNetworkingContext.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/soup/WebFrameNetworkingContext.cpp
index ab482e3b5..a6476f1f1 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/soup/WebFrameNetworkingContext.cpp
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/soup/WebFrameNetworkingContext.cpp
@@ -27,54 +27,29 @@
#include "config.h"
#include "WebFrameNetworkingContext.h"
+#include "NetworkSession.h"
#include "SessionTracker.h"
#include "WebFrame.h"
#include "WebPage.h"
-#include <WebCore/CookieJarSoup.h>
#include <WebCore/NetworkStorageSession.h>
+#include <WebCore/SessionID.h>
#include <WebCore/Settings.h>
#include <WebCore/SoupNetworkSession.h>
-#include <wtf/NeverDestroyed.h>
using namespace WebCore;
namespace WebKit {
-void WebFrameNetworkingContext::ensurePrivateBrowsingSession(uint64_t sessionID)
+void WebFrameNetworkingContext::ensurePrivateBrowsingSession(SessionID sessionID)
{
ASSERT(isMainThread());
+ ASSERT(sessionID.isEphemeral());
- if (SessionTracker::session(sessionID))
+ if (NetworkStorageSession::storageSession(sessionID))
return;
- SessionTracker::setSession(sessionID, NetworkStorageSession::createPrivateBrowsingSession(String::number(sessionID)));
-}
-
-void WebFrameNetworkingContext::setCookieAcceptPolicyForAllContexts(HTTPCookieAcceptPolicy policy)
-{
- SoupCookieJarAcceptPolicy soupPolicy = SOUP_COOKIE_JAR_ACCEPT_ALWAYS;
- switch (policy) {
- case HTTPCookieAcceptPolicyAlways:
- soupPolicy = SOUP_COOKIE_JAR_ACCEPT_ALWAYS;
- break;
- case HTTPCookieAcceptPolicyNever:
- soupPolicy = SOUP_COOKIE_JAR_ACCEPT_NEVER;
- break;
- case HTTPCookieAcceptPolicyOnlyFromMainDocumentDomain:
- soupPolicy = SOUP_COOKIE_JAR_ACCEPT_NO_THIRD_PARTY;
- break;
- }
-
- SoupCookieJar* cookieJar = WebCore::soupCookieJar();
- soup_cookie_jar_set_accept_policy(cookieJar, soupPolicy);
-
- SoupNetworkSession& soupSession = NetworkStorageSession::defaultStorageSession().soupNetworkSession();
- soup_cookie_jar_set_accept_policy(soupSession.cookieJar(), soupPolicy);
-
- for (const auto& session : SessionTracker::sessionMap().values()) {
- if (session)
- soup_cookie_jar_set_accept_policy(session->soupNetworkSession().cookieJar(), soupPolicy);
- }
+ NetworkStorageSession::ensurePrivateBrowsingSession(sessionID, String::number(sessionID.sessionID()));
+ SessionTracker::setSession(sessionID, NetworkSession::create(sessionID));
}
WebFrameNetworkingContext::WebFrameNetworkingContext(WebFrame* frame)
@@ -84,9 +59,10 @@ WebFrameNetworkingContext::WebFrameNetworkingContext(WebFrame* frame)
NetworkStorageSession& WebFrameNetworkingContext::storageSession() const
{
- if (frame() && frame()->settings().privateBrowsingEnabled())
- return *SessionTracker::session(SessionTracker::legacyPrivateSessionID);
-
+ if (frame()) {
+ if (auto* storageSession = NetworkStorageSession::storageSession(frame()->page()->sessionID()))
+ return *storageSession;
+ }
return NetworkStorageSession::defaultStorageSession();
}
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/soup/WebFrameNetworkingContext.h b/Source/WebKit2/WebProcess/WebCoreSupport/soup/WebFrameNetworkingContext.h
index 1ef2a45b9..5dfa8dbb9 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/soup/WebFrameNetworkingContext.h
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/soup/WebFrameNetworkingContext.h
@@ -25,11 +25,10 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef WebFrameNetworkingContext_h
-#define WebFrameNetworkingContext_h
+#pragma once
-#include "HTTPCookieAcceptPolicy.h"
#include <WebCore/FrameNetworkingContext.h>
+#include <WebCore/SessionID.h>
namespace WebKit {
@@ -38,22 +37,19 @@ class WebFrameLoaderClient;
class WebFrameNetworkingContext : public WebCore::FrameNetworkingContext {
public:
- static PassRefPtr<WebFrameNetworkingContext> create(WebFrame* frame)
+ static Ref<WebFrameNetworkingContext> create(WebFrame* frame)
{
- return adoptRef(new WebFrameNetworkingContext(frame));
+ return adoptRef(*new WebFrameNetworkingContext(frame));
}
- static void ensurePrivateBrowsingSession(uint64_t sessionID);
- static void setCookieAcceptPolicyForAllContexts(HTTPCookieAcceptPolicy);
+ static void ensurePrivateBrowsingSession(WebCore::SessionID);
WebFrameLoaderClient* webFrameLoaderClient() const;
private:
WebFrameNetworkingContext(WebFrame*);
- virtual WebCore::NetworkStorageSession& storageSession() const;
+ WebCore::NetworkStorageSession& storageSession() const override;
};
}
-
-#endif // WebFrameNetworkingContext_h