summaryrefslogtreecommitdiff
path: root/Source/WebKit2/UIProcess
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2012-07-11 13:45:28 +0200
committerSimon Hausmann <simon.hausmann@nokia.com>2012-07-11 13:45:28 +0200
commitd6a599dbc9d824a462b2b206316e102bf8136446 (patch)
treeecb257a5e55b2239d74b90fdad62fccd661cf286 /Source/WebKit2/UIProcess
parent3ccc3a85f09a83557b391aae380d3bf5f81a2911 (diff)
downloadqtwebkit-d6a599dbc9d824a462b2b206316e102bf8136446.tar.gz
Imported WebKit commit 8ff1f22783a32de82fee915abd55bd1b298f2644 (http://svn.webkit.org/repository/webkit/trunk@122325)
New snapshot that should work with the latest Qt build system changes
Diffstat (limited to 'Source/WebKit2/UIProcess')
-rw-r--r--Source/WebKit2/UIProcess/API/C/WKAPICast.h10
-rw-r--r--Source/WebKit2/UIProcess/API/C/WKBatteryManager.cpp66
-rw-r--r--Source/WebKit2/UIProcess/API/C/WKBatteryManager.h60
-rw-r--r--Source/WebKit2/UIProcess/API/C/WKBatteryStatus.cpp55
-rw-r--r--Source/WebKit2/UIProcess/API/C/WKBatteryStatus.h43
-rw-r--r--Source/WebKit2/UIProcess/API/C/WKContext.cpp9
-rw-r--r--Source/WebKit2/UIProcess/API/C/WKContext.h9
-rw-r--r--Source/WebKit2/UIProcess/API/C/WKIntentServiceInfo.cpp89
-rw-r--r--Source/WebKit2/UIProcess/API/C/WKIntentServiceInfo.h46
-rw-r--r--Source/WebKit2/UIProcess/API/C/WKNetworkInfoManager.cpp41
-rw-r--r--Source/WebKit2/UIProcess/API/C/WKNetworkInfoManager.h59
-rw-r--r--Source/WebKit2/UIProcess/API/C/WKPage.cpp7
-rw-r--r--Source/WebKit2/UIProcess/API/C/WKPage.h2
-rw-r--r--Source/WebKit2/UIProcess/API/C/WKPreferences.cpp3
-rw-r--r--Source/WebKit2/UIProcess/API/C/WKVibration.cpp51
-rw-r--r--Source/WebKit2/UIProcess/API/C/WKVibration.h57
-rw-r--r--Source/WebKit2/UIProcess/API/efl/BatteryProvider.cpp94
-rw-r--r--Source/WebKit2/UIProcess/API/efl/BatteryProvider.h58
-rw-r--r--Source/WebKit2/UIProcess/API/efl/EWebKit2.h5
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_context.cpp22
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_intent.cpp207
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_intent.h136
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_intent_private.h40
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_intent_service.cpp177
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_intent_service.h128
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_intent_service_private.h39
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_url_request.cpp127
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_url_request.h111
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_url_request_private.h31
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_view.cpp175
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_view.h125
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_view_loader_client.cpp96
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_view_private.h24
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_view_resource_load_client.cpp66
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_view_resource_load_client_private.h34
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_web_error.cpp129
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_web_error.h122
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_web_error_private.h35
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_web_resource.cpp83
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_web_resource.h81
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_web_resource_private.h33
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitSettings.cpp125
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitSettings.h15
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp22
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.h5
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp24
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitWebView.h73
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt5
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/tests/TestContextMenu.cpp67
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitSettings.cpp10
-rw-r--r--Source/WebKit2/UIProcess/API/mac/PageClientImpl.h2
-rw-r--r--Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm5
-rw-r--r--Source/WebKit2/UIProcess/API/mac/WKView.mm2
-rw-r--r--Source/WebKit2/UIProcess/API/qt/qwebkittest.cpp21
-rw-r--r--Source/WebKit2/UIProcess/API/qt/qwebkittest_p.h1
-rw-r--r--Source/WebKit2/UIProcess/API/qt/raw/qrawwebview.cpp384
-rw-r--r--Source/WebKit2/UIProcess/API/qt/raw/qrawwebview_p.h101
-rw-r--r--Source/WebKit2/UIProcess/API/qt/raw/qrawwebview_p_p.h131
-rw-r--r--Source/WebKit2/UIProcess/API/qt/tests/bytearraytestdata.h4
-rw-r--r--Source/WebKit2/UIProcess/API/qt/tests/html/bluesquare.html5
-rw-r--r--Source/WebKit2/UIProcess/API/qt/tests/html/redsquare.html5
-rw-r--r--Source/WebKit2/UIProcess/API/qt/tests/html/resources/qwkview_noBackground1.pngbin0 -> 801 bytes
-rw-r--r--Source/WebKit2/UIProcess/API/qt/tests/html/resources/qwkview_noBackground3.pngbin0 -> 827 bytes
-rw-r--r--Source/WebKit2/UIProcess/API/qt/tests/html/resources/qwkview_paint.pngbin0 -> 728 bytes
-rw-r--r--Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_colorChooser.qml17
-rw-r--r--Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_singleFileUpload.qml21
-rw-r--r--Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_wheelEventHandling.qml46
-rw-r--r--Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/colorChooser.html4
-rw-r--r--Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/test4.html117
-rw-r--r--Source/WebKit2/UIProcess/API/qt/tests/qrawwebview/qrawwebview.pro3
-rw-r--r--Source/WebKit2/UIProcess/API/qt/tests/qrawwebview/tst_qrawwebview.cpp226
-rw-r--r--Source/WebKit2/UIProcess/API/qt/tests/testwindow.h4
-rw-r--r--Source/WebKit2/UIProcess/Launcher/ProcessLauncher.cpp4
-rw-r--r--Source/WebKit2/UIProcess/WebBackForwardList.cpp93
-rw-r--r--Source/WebKit2/UIProcess/WebBackForwardList.h2
-rw-r--r--Source/WebKit2/UIProcess/WebBatteryManagerProxy.cpp102
-rw-r--r--Source/WebKit2/UIProcess/WebBatteryManagerProxy.h84
-rw-r--r--Source/WebKit2/UIProcess/WebBatteryManagerProxy.messages.in30
-rw-r--r--Source/WebKit2/UIProcess/WebBatteryProvider.cpp54
-rw-r--r--Source/WebKit2/UIProcess/WebBatteryProvider.h49
-rw-r--r--Source/WebKit2/UIProcess/WebContext.cpp29
-rw-r--r--Source/WebKit2/UIProcess/WebContext.h10
-rw-r--r--Source/WebKit2/UIProcess/WebContextInjectedBundleClient.cpp8
-rw-r--r--Source/WebKit2/UIProcess/WebContextInjectedBundleClient.h1
-rw-r--r--Source/WebKit2/UIProcess/WebFrameProxy.cpp17
-rw-r--r--Source/WebKit2/UIProcess/WebFrameProxy.h8
-rw-r--r--Source/WebKit2/UIProcess/WebLayerTreeRenderer.cpp4
-rw-r--r--Source/WebKit2/UIProcess/WebNetworkInfoManagerProxy.cpp105
-rw-r--r--Source/WebKit2/UIProcess/WebNetworkInfoManagerProxy.h88
-rw-r--r--Source/WebKit2/UIProcess/WebNetworkInfoManagerProxy.messages.in33
-rw-r--r--Source/WebKit2/UIProcess/WebNetworkInfoProvider.cpp72
-rw-r--r--Source/WebKit2/UIProcess/WebNetworkInfoProvider.h52
-rw-r--r--Source/WebKit2/UIProcess/WebPageProxy.cpp80
-rw-r--r--Source/WebKit2/UIProcess/WebPageProxy.h9
-rw-r--r--Source/WebKit2/UIProcess/WebPageProxy.messages.in1
-rw-r--r--Source/WebKit2/UIProcess/WebProcessProxy.cpp3
-rw-r--r--Source/WebKit2/UIProcess/WebVibrationProvider.cpp54
-rw-r--r--Source/WebKit2/UIProcess/WebVibrationProvider.h49
-rw-r--r--Source/WebKit2/UIProcess/WebVibrationProxy.cpp76
-rw-r--r--Source/WebKit2/UIProcess/WebVibrationProxy.h78
-rw-r--r--Source/WebKit2/UIProcess/WebVibrationProxy.messages.in30
-rw-r--r--Source/WebKit2/UIProcess/cf/WebBackForwardListCF.cpp187
-rw-r--r--Source/WebKit2/UIProcess/gtk/WebContextMenuProxyGtk.h1
-rw-r--r--Source/WebKit2/UIProcess/gtk/WebInspectorProxyGtk.cpp7
-rw-r--r--Source/WebKit2/UIProcess/mac/WebPopupMenuProxyMac.mm3
-rw-r--r--Source/WebKit2/UIProcess/qt/QtDialogRunner.cpp6
-rw-r--r--Source/WebKit2/UIProcess/qt/QtViewportHandler.cpp3
-rw-r--r--Source/WebKit2/UIProcess/texmap/LayerBackingStore.cpp25
-rw-r--r--Source/WebKit2/UIProcess/texmap/LayerBackingStore.h4
109 files changed, 5499 insertions, 192 deletions
diff --git a/Source/WebKit2/UIProcess/API/C/WKAPICast.h b/Source/WebKit2/UIProcess/API/C/WKAPICast.h
index 816f8f1ae..bef294e8a 100644
--- a/Source/WebKit2/UIProcess/API/C/WKAPICast.h
+++ b/Source/WebKit2/UIProcess/API/C/WKAPICast.h
@@ -56,6 +56,8 @@ class NotificationPermissionRequest;
class WebApplicationCacheManagerProxy;
class WebBackForwardList;
class WebBackForwardListItem;
+class WebBatteryManagerProxy;
+class WebBatteryStatus;
class WebResourceCacheManagerProxy;
class WebContext;
class WebCookieManagerProxy;
@@ -75,6 +77,8 @@ class WebIntentServiceInfo;
class WebKeyValueStorageManagerProxy;
class WebMediaCacheManagerProxy;
class WebNavigationData;
+class WebNetworkInfoManagerProxy;
+class WebNetworkInfo;
class WebNotification;
class WebNotificationProvider;
class WebNotificationManagerProxy;
@@ -88,12 +92,15 @@ class WebProtectionSpace;
class WebRenderLayer;
class WebRenderObject;
class WebTextChecker;
+class WebVibrationProxy;
WK_ADD_API_MAPPING(WKApplicationCacheManagerRef, WebApplicationCacheManagerProxy)
WK_ADD_API_MAPPING(WKAuthenticationChallengeRef, AuthenticationChallengeProxy)
WK_ADD_API_MAPPING(WKAuthenticationDecisionListenerRef, AuthenticationDecisionListener)
WK_ADD_API_MAPPING(WKBackForwardListItemRef, WebBackForwardListItem)
WK_ADD_API_MAPPING(WKBackForwardListRef, WebBackForwardList)
+WK_ADD_API_MAPPING(WKBatteryManagerRef, WebBatteryManagerProxy)
+WK_ADD_API_MAPPING(WKBatteryStatusRef, WebBatteryStatus)
WK_ADD_API_MAPPING(WKResourceCacheManagerRef, WebResourceCacheManagerProxy)
WK_ADD_API_MAPPING(WKContextRef, WebContext)
WK_ADD_API_MAPPING(WKCookieManagerRef, WebCookieManagerProxy)
@@ -114,6 +121,8 @@ WK_ADD_API_MAPPING(WKIntentServiceInfoRef, WebIntentServiceInfo)
WK_ADD_API_MAPPING(WKKeyValueStorageManagerRef, WebKeyValueStorageManagerProxy)
WK_ADD_API_MAPPING(WKMediaCacheManagerRef, WebMediaCacheManagerProxy)
WK_ADD_API_MAPPING(WKNavigationDataRef, WebNavigationData)
+WK_ADD_API_MAPPING(WKNetworkInfoManagerRef, WebNetworkInfoManagerProxy)
+WK_ADD_API_MAPPING(WKNetworkInfoRef, WebNetworkInfo)
WK_ADD_API_MAPPING(WKNotificationManagerRef, WebNotificationManagerProxy)
WK_ADD_API_MAPPING(WKNotificationPermissionRequestRef, NotificationPermissionRequest)
WK_ADD_API_MAPPING(WKNotificationProviderRef, WebNotificationProvider)
@@ -128,6 +137,7 @@ WK_ADD_API_MAPPING(WKProtectionSpaceRef, WebProtectionSpace)
WK_ADD_API_MAPPING(WKRenderLayerRef, WebRenderLayer)
WK_ADD_API_MAPPING(WKRenderObjectRef, WebRenderObject)
WK_ADD_API_MAPPING(WKTextCheckerRef, WebTextChecker)
+WK_ADD_API_MAPPING(WKVibrationRef, WebVibrationProxy)
#if ENABLE(INSPECTOR)
WK_ADD_API_MAPPING(WKInspectorRef, WebInspectorProxy)
diff --git a/Source/WebKit2/UIProcess/API/C/WKBatteryManager.cpp b/Source/WebKit2/UIProcess/API/C/WKBatteryManager.cpp
new file mode 100644
index 000000000..950336d56
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/C/WKBatteryManager.cpp
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2012 Intel Corporation. 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 "WKBatteryManager.h"
+
+#include "WKAPICast.h"
+#include <wtf/text/AtomicString.h>
+
+#if ENABLE(BATTERY_STATUS)
+#include "WebBatteryManagerProxy.h"
+#endif
+
+using namespace WebKit;
+
+WKTypeID WKBatteryManagerGetTypeID()
+{
+#if ENABLE(BATTERY_STATUS)
+ return toAPI(WebBatteryManagerProxy::APIType);
+#else
+ return 0;
+#endif
+}
+
+void WKBatteryManagerSetProvider(WKBatteryManagerRef batteryManager, const WKBatteryProvider* provider)
+{
+#if ENABLE(BATTERY_STATUS)
+ toImpl(batteryManager)->initializeProvider(provider);
+#endif
+}
+
+void WKBatteryManagerProviderDidChangeBatteryStatus(WKBatteryManagerRef batteryManager, WKStringRef eventType, WKBatteryStatusRef status)
+{
+#if ENABLE(BATTERY_STATUS)
+ toImpl(batteryManager)->providerDidChangeBatteryStatus(AtomicString(toImpl(eventType)->string()), toImpl(status));
+#endif
+}
+
+void WKBatteryManagerProviderUpdateBatteryStatus(WKBatteryManagerRef batteryManager, WKBatteryStatusRef status)
+{
+#if ENABLE(BATTERY_STATUS)
+ toImpl(batteryManager)->providerUpdateBatteryStatus(toImpl(status));
+#endif
+}
diff --git a/Source/WebKit2/UIProcess/API/C/WKBatteryManager.h b/Source/WebKit2/UIProcess/API/C/WKBatteryManager.h
new file mode 100644
index 000000000..712cbfb4c
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/C/WKBatteryManager.h
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2012 Intel Corporation. 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 WKBatteryManager_h
+#define WKBatteryManager_h
+
+#include <WebKit2/WKBase.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+// Provider.
+typedef void (*WKBatteryProviderStartUpdatingCallback)(WKBatteryManagerRef batteryManager, const void* clientInfo);
+typedef void (*WKBatteryProviderStopUpdatingCallback)(WKBatteryManagerRef batteryManager, const void* clientInfo);
+
+struct WKBatteryProvider {
+ int version;
+ const void * clientInfo;
+ WKBatteryProviderStartUpdatingCallback startUpdating;
+ WKBatteryProviderStopUpdatingCallback stopUpdating;
+};
+typedef struct WKBatteryProvider WKBatteryProvider;
+
+enum { kWKBatteryProviderCurrentVersion = 0 };
+
+WK_EXPORT WKTypeID WKBatteryManagerGetTypeID();
+
+WK_EXPORT void WKBatteryManagerSetProvider(WKBatteryManagerRef batteryManager, const WKBatteryProvider* provider);
+
+WK_EXPORT void WKBatteryManagerProviderDidChangeBatteryStatus(WKBatteryManagerRef batteryManager, WKStringRef eventType, WKBatteryStatusRef status);
+WK_EXPORT void WKBatteryManagerProviderUpdateBatteryStatus(WKBatteryManagerRef batteryManager, WKBatteryStatusRef status);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* WKBatteryManager_h */
diff --git a/Source/WebKit2/UIProcess/API/C/WKBatteryStatus.cpp b/Source/WebKit2/UIProcess/API/C/WKBatteryStatus.cpp
new file mode 100644
index 000000000..0069a6f95
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/C/WKBatteryStatus.cpp
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2012 Intel Corporation. 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 "WKBatteryStatus.h"
+
+#include "WKAPICast.h"
+
+#if ENABLE(BATTERY_STATUS)
+#include "WebBatteryStatus.h"
+#endif
+
+using namespace WebKit;
+
+WKTypeID WKBatteryStatusGetTypeID()
+{
+#if ENABLE(BATTERY_STATUS)
+ return toAPI(WebBatteryStatus::APIType);
+#else
+ return 0;
+#endif
+}
+
+WKBatteryStatusRef WKBatteryStatusCreate(bool isCharging, double chargingTime, double dischargingTime, double level)
+{
+#if ENABLE(BATTERY_STATUS)
+ RefPtr<WebBatteryStatus> status = WebBatteryStatus::create(isCharging, chargingTime, dischargingTime, level);
+ return toAPI(status.release().leakRef());
+#else
+ return 0;
+#endif
+}
+
diff --git a/Source/WebKit2/UIProcess/API/C/WKBatteryStatus.h b/Source/WebKit2/UIProcess/API/C/WKBatteryStatus.h
new file mode 100644
index 000000000..afa1dd931
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/C/WKBatteryStatus.h
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2012 Intel Corporation. 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 WKBatteryStatus_h
+#define WKBatteryStatus_h
+
+#include <WebKit2/WKBase.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+WK_EXPORT WKTypeID WKBatteryStatusGetTypeID();
+
+WK_EXPORT WKBatteryStatusRef WKBatteryStatusCreate(bool isCharging, double chargingTime, double dischargingTime, double level);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // WKBatteryStatus_h
diff --git a/Source/WebKit2/UIProcess/API/C/WKContext.cpp b/Source/WebKit2/UIProcess/API/C/WKContext.cpp
index 9f6dbbc37..7bfc04aed 100644
--- a/Source/WebKit2/UIProcess/API/C/WKContext.cpp
+++ b/Source/WebKit2/UIProcess/API/C/WKContext.cpp
@@ -170,6 +170,15 @@ WKApplicationCacheManagerRef WKContextGetApplicationCacheManager(WKContextRef co
return toAPI(toImpl(contextRef)->applicationCacheManagerProxy());
}
+WKBatteryManagerRef WKContextGetBatteryManager(WKContextRef contextRef)
+{
+#if ENABLE(BATTERY_STATUS)
+ return toAPI(toImpl(contextRef)->batteryManagerProxy());
+#else
+ return 0;
+#endif
+}
+
WKDatabaseManagerRef WKContextGetDatabaseManager(WKContextRef contextRef)
{
return toAPI(toImpl(contextRef)->databaseManagerProxy());
diff --git a/Source/WebKit2/UIProcess/API/C/WKContext.h b/Source/WebKit2/UIProcess/API/C/WKContext.h
index f4299daff..85e4c157c 100644
--- a/Source/WebKit2/UIProcess/API/C/WKContext.h
+++ b/Source/WebKit2/UIProcess/API/C/WKContext.h
@@ -42,16 +42,22 @@ typedef uint32_t WKCacheModel;
// Injected Bundle Client
typedef void (*WKContextDidReceiveMessageFromInjectedBundleCallback)(WKContextRef page, WKStringRef messageName, WKTypeRef messageBody, const void *clientInfo);
typedef void (*WKContextDidReceiveSynchronousMessageFromInjectedBundleCallback)(WKContextRef page, WKStringRef messageName, WKTypeRef messageBody, WKTypeRef* returnData, const void *clientInfo);
+typedef WKTypeRef (*WKContextGetInjectedBundleInitializationUserDataCallback)(WKContextRef context, const void *clientInfo);
struct WKContextInjectedBundleClient {
int version;
const void * clientInfo;
+
+ // Version 0.
WKContextDidReceiveMessageFromInjectedBundleCallback didReceiveMessageFromInjectedBundle;
WKContextDidReceiveSynchronousMessageFromInjectedBundleCallback didReceiveSynchronousMessageFromInjectedBundle;
+
+ // Version 1.
+ WKContextGetInjectedBundleInitializationUserDataCallback getInjectedBundleInitializationUserData;
};
typedef struct WKContextInjectedBundleClient WKContextInjectedBundleClient;
-enum { kWKContextInjectedBundleClientCurrentVersion = 0 };
+enum { kWKContextInjectedBundleClientCurrentVersion = 1 };
// History Client
typedef void (*WKContextDidNavigateWithNavigationDataCallback)(WKContextRef context, WKPageRef page, WKNavigationDataRef navigationData, WKFrameRef frame, const void *clientInfo);
@@ -142,6 +148,7 @@ WK_EXPORT void WKContextStartMemorySampler(WKContextRef context, WKDoubleRef int
WK_EXPORT void WKContextStopMemorySampler(WKContextRef context);
WK_EXPORT WKApplicationCacheManagerRef WKContextGetApplicationCacheManager(WKContextRef context);
+WK_EXPORT WKBatteryManagerRef WKContextGetBatteryManager(WKContextRef context);
WK_EXPORT WKCookieManagerRef WKContextGetCookieManager(WKContextRef context);
WK_EXPORT WKDatabaseManagerRef WKContextGetDatabaseManager(WKContextRef context);
WK_EXPORT WKGeolocationManagerRef WKContextGetGeolocationManager(WKContextRef context);
diff --git a/Source/WebKit2/UIProcess/API/C/WKIntentServiceInfo.cpp b/Source/WebKit2/UIProcess/API/C/WKIntentServiceInfo.cpp
new file mode 100644
index 000000000..5a30fb71a
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/C/WKIntentServiceInfo.cpp
@@ -0,0 +1,89 @@
+/*
+ * Copyright (C) 2012 Intel Corporation. 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 "WKIntentServiceInfo.h"
+
+#include "WKAPICast.h"
+
+#if ENABLE(WEB_INTENTS_TAG)
+#include "WebIntentServiceInfo.h"
+#endif
+
+using namespace WebKit;
+
+WKTypeID WKIntentServiceInfoGetTypeID()
+{
+#if ENABLE(WEB_INTENTS_TAG)
+ return toAPI(WebIntentServiceInfo::APIType);
+#else
+ return 0;
+#endif
+}
+
+WKStringRef WKIntentServiceInfoCopyAction(WKIntentServiceInfoRef serviceRef)
+{
+#if ENABLE(WEB_INTENTS_TAG)
+ return toCopiedAPI(toImpl(serviceRef)->action());
+#else
+ return 0;
+#endif
+}
+
+WKStringRef WKIntentServiceInfoCopyType(WKIntentServiceInfoRef serviceRef)
+{
+#if ENABLE(WEB_INTENTS_TAG)
+ return toCopiedAPI(toImpl(serviceRef)->payloadType());
+#else
+ return 0;
+#endif
+}
+
+WKURLRef WKIntentServiceInfoCopyHref(WKIntentServiceInfoRef serviceRef)
+{
+#if ENABLE(WEB_INTENTS_TAG)
+ return toCopiedURLAPI(toImpl(serviceRef)->href());
+#else
+ return 0;
+#endif
+}
+
+WKStringRef WKIntentServiceInfoCopyTitle(WKIntentServiceInfoRef serviceRef)
+{
+#if ENABLE(WEB_INTENTS_TAG)
+ return toCopiedAPI(toImpl(serviceRef)->title());
+#else
+ return 0;
+#endif
+}
+
+WKStringRef WKIntentServiceInfoCopyDisposition(WKIntentServiceInfoRef serviceRef)
+{
+#if ENABLE(WEB_INTENTS_TAG)
+ return toCopiedAPI(toImpl(serviceRef)->disposition());
+#else
+ return 0;
+#endif
+}
diff --git a/Source/WebKit2/UIProcess/API/C/WKIntentServiceInfo.h b/Source/WebKit2/UIProcess/API/C/WKIntentServiceInfo.h
new file mode 100644
index 000000000..121cffde8
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/C/WKIntentServiceInfo.h
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2012 Intel Corporation. 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 WKIntentServiceInfo_h
+#define WKIntentServiceInfo_h
+
+#include <WebKit2/WKBase.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+WK_EXPORT WKTypeID WKIntentServiceInfoGetTypeID();
+WK_EXPORT WKStringRef WKIntentServiceInfoCopyAction(WKIntentServiceInfoRef serviceRef);
+WK_EXPORT WKStringRef WKIntentServiceInfoCopyType(WKIntentServiceInfoRef serviceRef);
+WK_EXPORT WKURLRef WKIntentServiceInfoCopyHref(WKIntentServiceInfoRef serviceRef);
+WK_EXPORT WKStringRef WKIntentServiceInfoCopyTitle(WKIntentServiceInfoRef serviceRef);
+WK_EXPORT WKStringRef WKIntentServiceInfoCopyDisposition(WKIntentServiceInfoRef serviceRef);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // WKIntentServiceInfo_h
diff --git a/Source/WebKit2/UIProcess/API/C/WKNetworkInfoManager.cpp b/Source/WebKit2/UIProcess/API/C/WKNetworkInfoManager.cpp
new file mode 100644
index 000000000..1e0733ac2
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/C/WKNetworkInfoManager.cpp
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2012 Intel Corporation. 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 "WKNetworkInfoManager.h"
+
+#include "WKAPICast.h"
+#include "WebNetworkInfoManagerProxy.h"
+
+using namespace WebKit;
+
+WKTypeID WKNetworkInfoManagerGetTypeID()
+{
+#if ENABLE(NETWORK_INFO)
+ return toAPI(WebNetworkInfoManagerProxy::APIType);
+#else
+ return 0;
+#endif
+}
diff --git a/Source/WebKit2/UIProcess/API/C/WKNetworkInfoManager.h b/Source/WebKit2/UIProcess/API/C/WKNetworkInfoManager.h
new file mode 100644
index 000000000..efecf4ef8
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/C/WKNetworkInfoManager.h
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2012 Intel Corporation. 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 WKNetworkInfoManager_h
+#define WKNetworkInfoManager_h
+
+#include <WebKit2/WKBase.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+// Provider.
+typedef void (*WKNetworkInfoProviderStartUpdatingCallback)(WKNetworkInfoManagerRef networkInfoManager, const void* clientInfo);
+typedef void (*WKNetworkInfoProviderStopUpdatingCallback)(WKNetworkInfoManagerRef networkInfoManager, const void* clientInfo);
+typedef double (*WKNetworkInfoProviderGetBandwidthCallback)(WKNetworkInfoManagerRef networkInfoManager, const void* clientInfo);
+typedef bool (*WKNetworkInfoProviderIsMeteredCallback)(WKNetworkInfoManagerRef networkInfoManager, const void* clientInfo);
+
+struct WKNetworkInfoProvider {
+ int version;
+ const void * clientInfo;
+ WKNetworkInfoProviderStartUpdatingCallback startUpdating;
+ WKNetworkInfoProviderStopUpdatingCallback stopUpdating;
+ WKNetworkInfoProviderGetBandwidthCallback bandwidth;
+ WKNetworkInfoProviderIsMeteredCallback isMetered;
+};
+typedef struct WKNetworkInfoProvider WKNetworkInfoProvider;
+
+enum { kWKNetworkInfoProviderCurrentVersion = 0 };
+
+WK_EXPORT WKTypeID WKNetworkInfoManagerGetTypeID();
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // WKNetworkInfoManager_h
diff --git a/Source/WebKit2/UIProcess/API/C/WKPage.cpp b/Source/WebKit2/UIProcess/API/C/WKPage.cpp
index c2a21b5bb..5c600350a 100644
--- a/Source/WebKit2/UIProcess/API/C/WKPage.cpp
+++ b/Source/WebKit2/UIProcess/API/C/WKPage.cpp
@@ -684,6 +684,13 @@ void WKPageEndPrinting(WKPageRef page)
}
#endif
+void WKPageDeliverIntentToFrame(WKPageRef page, WKFrameRef frame, WKIntentDataRef intent)
+{
+#if ENABLE(WEB_INTENTS)
+ toImpl(page)->deliverIntentToFrame(toImpl(frame), toImpl(intent));
+#endif
+}
+
WKImageRef WKPageCreateSnapshotOfVisibleContent(WKPageRef)
{
return 0;
diff --git a/Source/WebKit2/UIProcess/API/C/WKPage.h b/Source/WebKit2/UIProcess/API/C/WKPage.h
index 035f51daa..12a7b63e9 100644
--- a/Source/WebKit2/UIProcess/API/C/WKPage.h
+++ b/Source/WebKit2/UIProcess/API/C/WKPage.h
@@ -468,6 +468,8 @@ WK_EXPORT void WKPageGetContentsAsString_b(WKPageRef page, WKPageGetContentsAsSt
typedef void (*WKPageForceRepaintFunction)(WKErrorRef, void*);
WK_EXPORT void WKPageForceRepaint(WKPageRef page, void* context, WKPageForceRepaintFunction function);
+WK_EXPORT void WKPageDeliverIntentToFrame(WKPageRef page, WKFrameRef frame, WKIntentDataRef intent);
+
/*
Some of the more common command name strings include the following, although any WebCore EditorCommand string is supported:
diff --git a/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp b/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp
index 9fe8d6ab9..727781f01 100644
--- a/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp
+++ b/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp
@@ -650,12 +650,11 @@ bool WKPreferencesGetFileAccessFromFileURLsAllowed(WKPreferencesRef preferencesR
void WKPreferencesSetHixie76WebSocketProtocolEnabled(WKPreferencesRef preferencesRef, bool enabled)
{
- toImpl(preferencesRef)->setHixie76WebSocketProtocolEnabled(enabled);
}
bool WKPreferencesGetHixie76WebSocketProtocolEnabled(WKPreferencesRef preferencesRef)
{
- return toImpl(preferencesRef)->hixie76WebSocketProtocolEnabled();
+ return false;
}
void WKPreferencesSetMediaPlaybackRequiresUserGesture(WKPreferencesRef preferencesRef, bool flag)
diff --git a/Source/WebKit2/UIProcess/API/C/WKVibration.cpp b/Source/WebKit2/UIProcess/API/C/WKVibration.cpp
new file mode 100644
index 000000000..e9d933ceb
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/C/WKVibration.cpp
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2012 Intel Corporation. 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 "WKVibration.h"
+
+#include "WKAPICast.h"
+
+#if ENABLE(VIBRATION)
+#include "WebVibrationProxy.h"
+#endif
+
+using namespace WebKit;
+
+WKTypeID WKVibrationGetTypeID()
+{
+#if ENABLE(VIBRATION)
+ return toAPI(WebVibrationProxy::APIType);
+#else
+ return 0;
+#endif
+}
+
+void WKVibrationSetProvider(WKVibrationRef vibrationRef, const WKVibrationProvider* wkProvider)
+{
+#if ENABLE(VIBRATION)
+ toImpl(vibrationRef)->initializeProvider(wkProvider);
+#endif
+}
diff --git a/Source/WebKit2/UIProcess/API/C/WKVibration.h b/Source/WebKit2/UIProcess/API/C/WKVibration.h
new file mode 100644
index 000000000..f300b46e8
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/C/WKVibration.h
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2012 Intel Corporation. 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 WKVibration_h
+#define WKVibration_h
+
+#include <WebKit2/WKBase.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+// Provider.
+typedef void (*WKVibrationProviderVibrateCallback)(WKVibrationRef vibrationRef, uint64_t vibrationTime, const void* clientInfo);
+typedef void (*WKVibrationProviderCancelVibrationCallback)(WKVibrationRef vibrationRef, const void* clientInfo);
+
+struct WKVibrationProvider {
+ int version;
+ const void * clientInfo;
+ WKVibrationProviderVibrateCallback vibrate;
+ WKVibrationProviderCancelVibrationCallback cancelVibration;
+};
+typedef struct WKVibrationProvider WKVibrationProvider;
+
+enum { kWKVibrationProviderCurrentVersion = 0 };
+
+WK_EXPORT WKTypeID WKVibrationGetTypeID();
+
+WK_EXPORT void WKVibrationSetProvider(WKVibrationRef vibrationRef, const WKVibrationProvider* provider);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // WKVibration_h
diff --git a/Source/WebKit2/UIProcess/API/efl/BatteryProvider.cpp b/Source/WebKit2/UIProcess/API/efl/BatteryProvider.cpp
new file mode 100644
index 000000000..2bd55e211
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/efl/BatteryProvider.cpp
@@ -0,0 +1,94 @@
+/*
+ * Copyright (C) 2012 Intel Corporation. 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 "BatteryProvider.h"
+
+#if ENABLE(BATTERY_STATUS)
+
+#include "WKAPICast.h"
+#include "WKBatteryManager.h"
+#include "WKBatteryStatus.h"
+
+using namespace WebCore;
+using namespace WebKit;
+
+static inline BatteryProviderEfl* toBatteryProvider(const void* clientInfo)
+{
+ return static_cast<BatteryProviderEfl*>(const_cast<void*>(clientInfo));
+}
+
+static void startUpdatingCallback(WKBatteryManagerRef batteryManager, const void* clientInfo)
+{
+ toBatteryProvider(clientInfo)->startUpdating();
+}
+
+static void stopUpdatingCallback(WKBatteryManagerRef batteryManager, const void* clientInfo)
+{
+ toBatteryProvider(clientInfo)->stopUpdating();
+}
+
+BatteryProvider::~BatteryProvider()
+{
+ m_provider.stopUpdating();
+}
+
+PassRefPtr<BatteryProvider> BatteryProvider::create(WKBatteryManagerRef wkBatteryManager)
+{
+ return adoptRef(new BatteryProvider(wkBatteryManager));
+}
+
+BatteryProvider::BatteryProvider(WKBatteryManagerRef wkBatteryManager)
+ : m_wkBatteryManager(wkBatteryManager)
+ , m_provider(this)
+{
+ ASSERT(wkBatteryManager);
+
+ WKBatteryProvider wkBatteryProvider = {
+ kWKBatteryProviderCurrentVersion,
+ this, // clientInfo
+ startUpdatingCallback,
+ stopUpdatingCallback
+ };
+ WKBatteryManagerSetProvider(m_wkBatteryManager.get(), &wkBatteryProvider);
+}
+
+void BatteryProvider::startUpdating()
+{
+ m_provider.startUpdating();
+}
+
+void BatteryProvider::stopUpdating()
+{
+ m_provider.stopUpdating();
+}
+
+void BatteryProvider::didChangeBatteryStatus(const AtomicString& eventType, PassRefPtr<BatteryStatus> status)
+{
+ WKRetainPtr<WKBatteryStatusRef> wkBatteryStatus(AdoptWK, WKBatteryStatusCreate(status->charging(), status->chargingTime(), status->dischargingTime(), status->level()));
+ WKBatteryManagerProviderDidChangeBatteryStatus(m_wkBatteryManager.get(), toAPI(eventType.impl()), wkBatteryStatus.get());
+}
+
+#endif // ENABLE(BATTERY_STATUS)
diff --git a/Source/WebKit2/UIProcess/API/efl/BatteryProvider.h b/Source/WebKit2/UIProcess/API/efl/BatteryProvider.h
new file mode 100644
index 000000000..e9e4cf5f0
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/efl/BatteryProvider.h
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2012 Intel Corporation. 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 BatteryProvider_h
+#define BatteryProvider_h
+
+#if ENABLE(BATTERY_STATUS)
+
+#include "BatteryProviderEfl.h"
+#include "BatteryProviderEflClient.h"
+#include "BatteryStatus.h"
+#include "WKRetainPtr.h"
+#include <WebKit2/WKBase.h>
+#include <wtf/PassRefPtr.h>
+
+class BatteryProvider : public RefCounted<BatteryProvider>, public WebCore::BatteryProviderEflClient {
+public:
+ virtual ~BatteryProvider();
+ static PassRefPtr<BatteryProvider> create(WKBatteryManagerRef);
+
+ void startUpdating();
+ void stopUpdating();
+
+private:
+ BatteryProvider(WKBatteryManagerRef);
+
+ // BatteryProviderEflClient interface.
+ virtual void didChangeBatteryStatus(const AtomicString& eventType, PassRefPtr<WebCore::BatteryStatus>);
+
+ WKRetainPtr<WKBatteryManagerRef> m_wkBatteryManager;
+ WebCore::BatteryProviderEfl m_provider;
+};
+
+#endif // ENABLE(BATTERY_STATUS)
+
+#endif // BatteryProvider_h
diff --git a/Source/WebKit2/UIProcess/API/efl/EWebKit2.h b/Source/WebKit2/UIProcess/API/efl/EWebKit2.h
index e143b781b..799d258e0 100644
--- a/Source/WebKit2/UIProcess/API/efl/EWebKit2.h
+++ b/Source/WebKit2/UIProcess/API/efl/EWebKit2.h
@@ -28,6 +28,11 @@
#define EWebKit2_h
#include "ewk_context.h"
+#include "ewk_intent.h"
+#include "ewk_intent_service.h"
+#include "ewk_url_request.h"
#include "ewk_view.h"
+#include "ewk_web_error.h"
+#include "ewk_web_resource.h"
#endif // EWebKit2_h
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_context.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_context.cpp
index 90685cf92..791bc95f4 100644
--- a/Source/WebKit2/UIProcess/API/efl/ewk_context.cpp
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_context.cpp
@@ -21,6 +21,7 @@
#include "config.h"
#include "ewk_context.h"
+#include "BatteryProvider.h"
#include "WKAPICast.h"
#include "WKRetainPtr.h"
#include "ewk_context_private.h"
@@ -29,6 +30,9 @@ using namespace WebKit;
struct _Ewk_Context {
WKRetainPtr<WKContextRef> context;
+#if ENABLE(BATTERY_STATUS)
+ RefPtr<BatteryProvider> batteryProvider;
+#endif
_Ewk_Context(WKContextRef contextRef)
{
@@ -41,8 +45,22 @@ WKContextRef ewk_context_WKContext_get(const Ewk_Context* ewkContext)
return ewkContext->context.get();
}
+static inline Ewk_Context* createDefaultEwkContext()
+{
+ WKContextRef wkContext = WKContextGetSharedProcessContext();
+ Ewk_Context* ewkContext = new Ewk_Context(wkContext);
+
+#if ENABLE(BATTERY_STATUS)
+ WKBatteryManagerRef wkBatteryManager = WKContextGetBatteryManager(wkContext);
+ ewkContext->batteryProvider = BatteryProvider::create(wkBatteryManager);
+#endif
+
+ return ewkContext;
+}
+
Ewk_Context* ewk_context_default_get()
{
- DEFINE_STATIC_LOCAL(Ewk_Context, defaultContext, (WKContextGetSharedProcessContext()));
- return &defaultContext;
+ static Ewk_Context* defaultContext = createDefaultEwkContext();
+
+ return defaultContext;
}
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_intent.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_intent.cpp
new file mode 100644
index 000000000..63b9ee364
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_intent.cpp
@@ -0,0 +1,207 @@
+/*
+ * Copyright (C) 2012 Intel Corporation. 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 "ewk_intent.h"
+
+#include "WKAPICast.h"
+#include "WKArray.h"
+#include "WKDictionary.h"
+#include "WKIntentData.h"
+#include "WKRetainPtr.h"
+#include "WKString.h"
+#include "WKURL.h"
+#include "ewk_intent_private.h"
+#include <wtf/text/CString.h>
+
+using namespace WebKit;
+
+/**
+ * \struct _Ewk_Intent
+ * @brief Contains the intent data.
+ */
+struct _Ewk_Intent {
+ unsigned int __ref; /**< the reference count of the object */
+#if ENABLE(WEB_INTENTS)
+ WKRetainPtr<WKIntentDataRef> wkIntent;
+#endif
+ const char* action;
+ const char* type;
+ const char* service;
+};
+
+#define EWK_INTENT_WK_GET_OR_RETURN(intent, wkIntent_, ...) \
+ if (!(intent)) { \
+ EINA_LOG_CRIT("intent is NULL."); \
+ return __VA_ARGS__; \
+ } \
+ if (!(intent)->wkIntent) { \
+ EINA_LOG_CRIT("intent->wkIntent is NULL."); \
+ return __VA_ARGS__; \
+ } \
+ WKIntentDataRef wkIntent_ = (intent)->wkIntent.get()
+
+void ewk_intent_ref(Ewk_Intent* intent)
+{
+#if ENABLE(WEB_INTENTS)
+ EINA_SAFETY_ON_NULL_RETURN(intent);
+ ++intent->__ref;
+#endif
+}
+
+void ewk_intent_unref(Ewk_Intent* intent)
+{
+#if ENABLE(WEB_INTENTS)
+ EINA_SAFETY_ON_NULL_RETURN(intent);
+
+ if (--intent->__ref)
+ return;
+
+ eina_stringshare_del(intent->action);
+ eina_stringshare_del(intent->type);
+ eina_stringshare_del(intent->service);
+ free(intent);
+#endif
+}
+
+const char* ewk_intent_action_get(const Ewk_Intent* intent)
+{
+#if ENABLE(WEB_INTENTS)
+ EWK_INTENT_WK_GET_OR_RETURN(intent, wkIntent, 0);
+
+ WKRetainPtr<WKStringRef> wkAction(AdoptWK, WKIntentDataCopyAction(wkIntent));
+ Ewk_Intent* ewkIntent = const_cast<Ewk_Intent*>(intent);
+ eina_stringshare_replace(&ewkIntent->action, toImpl(wkAction.get())->string().utf8().data());
+
+ return intent->action;
+#else
+ return 0;
+#endif
+}
+
+const char* ewk_intent_type_get(const Ewk_Intent* intent)
+{
+#if ENABLE(WEB_INTENTS)
+ EWK_INTENT_WK_GET_OR_RETURN(intent, wkIntent, 0);
+
+ WKRetainPtr<WKStringRef> wkType(AdoptWK, WKIntentDataCopyType(wkIntent));
+ Ewk_Intent* ewkIntent = const_cast<Ewk_Intent*>(intent);
+ eina_stringshare_replace(&ewkIntent->type, toImpl(wkType.get())->string().utf8().data());
+
+ return intent->type;
+#else
+ return 0;
+#endif
+}
+
+const char* ewk_intent_service_get(const Ewk_Intent* intent)
+{
+#if ENABLE(WEB_INTENTS)
+ EWK_INTENT_WK_GET_OR_RETURN(intent, wkIntent, 0);
+
+ WKRetainPtr<WKURLRef> wkService(AdoptWK, WKIntentDataCopyService(wkIntent));
+ Ewk_Intent* ewkIntent = const_cast<Ewk_Intent*>(intent);
+ eina_stringshare_replace(&ewkIntent->service, toImpl(wkService.get())->string().utf8().data());
+
+ return intent->service;
+#else
+ return 0;
+#endif
+}
+
+Eina_List* ewk_intent_suggestions_get(const Ewk_Intent* intent)
+{
+#if ENABLE(WEB_INTENTS)
+ EWK_INTENT_WK_GET_OR_RETURN(intent, wkIntent, 0);
+
+ Eina_List* listOfSuggestions = 0;
+ WKRetainPtr<WKArrayRef> wkSuggestions(AdoptWK, WKIntentDataCopySuggestions(wkIntent));
+ const size_t numSuggestions = WKArrayGetSize(wkSuggestions.get());
+ for (size_t i = 0; i < numSuggestions; ++i) {
+ WKURLRef wkSuggestion = static_cast<WKURLRef>(WKArrayGetItemAtIndex(wkSuggestions.get(), i));
+ listOfSuggestions = eina_list_append(listOfSuggestions, strdup(toImpl(wkSuggestion)->string().utf8().data()));
+ }
+
+ return listOfSuggestions;
+#else
+ return 0;
+#endif
+}
+
+char* ewk_intent_extra_get(const Ewk_Intent* intent, const char* key)
+{
+#if ENABLE(WEB_INTENTS)
+ EWK_INTENT_WK_GET_OR_RETURN(intent, wkIntent, 0);
+
+ WKRetainPtr<WKStringRef> keyRef = adoptWK(WKStringCreateWithUTF8CString(key));
+ WKRetainPtr<WKStringRef> wkValue(AdoptWK, WKIntentDataCopyExtra(wkIntent, keyRef.get()));
+ String value = toImpl(wkValue.get())->string();
+ if (value.isEmpty())
+ return 0;
+
+ return strdup(value.utf8().data());
+#else
+ return 0;
+#endif
+}
+
+Eina_List* ewk_intent_extra_names_get(const Ewk_Intent* intent)
+{
+#if ENABLE(WEB_INTENTS)
+ EWK_INTENT_WK_GET_OR_RETURN(intent, wkIntent, 0);
+
+ Eina_List* listOfKeys = 0;
+ WKRetainPtr<WKDictionaryRef> wkExtras(AdoptWK, WKIntentDataCopyExtras(wkIntent));
+ WKRetainPtr<WKArrayRef> wkKeys(AdoptWK, WKDictionaryCopyKeys(wkExtras.get()));
+ const size_t numKeys = WKArrayGetSize(wkKeys.get());
+ for (size_t i = 0; i < numKeys; ++i) {
+ WKStringRef wkKey = static_cast<WKStringRef>(WKArrayGetItemAtIndex(wkKeys.get(), i));
+ listOfKeys = eina_list_append(listOfKeys, strdup(toImpl(wkKey)->string().utf8().data()));
+ }
+
+ return listOfKeys;
+#else
+ return 0;
+#endif
+}
+
+#if ENABLE(WEB_INTENTS)
+Ewk_Intent* ewk_intent_new(WKIntentDataRef intentData)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(intentData, 0);
+
+ Ewk_Intent* ewkIntent = static_cast<Ewk_Intent*>(calloc(1, sizeof(Ewk_Intent)));
+ ewkIntent->__ref = 1;
+ ewkIntent->wkIntent = intentData;
+
+ return ewkIntent;
+}
+
+WKIntentDataRef ewk_intent_WKIntentDataRef_get(const Ewk_Intent* intent)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(intent, 0);
+ return intent->wkIntent.get();
+}
+#endif
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_intent.h b/Source/WebKit2/UIProcess/API/efl/ewk_intent.h
new file mode 100644
index 000000000..fdcfe00d4
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_intent.h
@@ -0,0 +1,136 @@
+/*
+ * Copyright (C) 2012 Intel Corporation. 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.
+ */
+
+/**
+ * @file ewk_intent.h
+ * @brief Describes the Ewk Intent API.
+ */
+
+#ifndef ewk_intent_h
+#define ewk_intent_h
+
+#include <Eina.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** Creates a type name for _Ewk_Intent */
+typedef struct _Ewk_Intent Ewk_Intent;
+
+/**
+ * Increases the reference count of the given object.
+ *
+ * @param intent the intent object to increase the reference count
+ */
+EAPI void ewk_intent_ref(Ewk_Intent *intent);
+
+/**
+ * Decreases the reference count of the given object, possibly freeing it.
+ *
+ * When the reference count it's reached 0, the intent is freed.
+ *
+ * @param intent the intent object to decrease the reference count
+ */
+EAPI void ewk_intent_unref(Ewk_Intent *intent);
+
+/**
+ * Query action for this intent.
+ *
+ * @param intent intent item to query.
+ *
+ * @return the action pointer, that may be @c NULL. This pointer is
+ * guaranteed to be eina_stringshare, so whenever possible
+ * save yourself some cpu cycles and use
+ * eina_stringshare_ref() instead of eina_stringshare_add() or
+ * strdup().
+ */
+EAPI const char *ewk_intent_action_get(const Ewk_Intent *intent);
+
+/**
+ * Query type for this intent.
+ *
+ * @param intent intent item to query.
+ *
+ * @return the type pointer, that may be @c NULL. This pointer is
+ * guaranteed to be eina_stringshare, so whenever possible
+ * save yourself some cpu cycles and use
+ * eina_stringshare_ref() instead of eina_stringshare_add() or
+ * strdup().
+ */
+EAPI const char *ewk_intent_type_get(const Ewk_Intent *intent);
+
+/**
+ * Query service for this intent.
+ *
+ * @param intent intent item to query.
+ *
+ * @return the service pointer, that may be @c NULL. This pointer is
+ * guaranteed to be eina_stringshare, so whenever possible
+ * save yourself some cpu cycles and use
+ * eina_stringshare_ref() instead of eina_stringshare_add() or
+ * strdup().
+ */
+EAPI const char *ewk_intent_service_get(const Ewk_Intent *intent);
+
+/**
+ * Query suggestions for this intent.
+ *
+ * This function provides a list of (absolute) suggested Service URLs of which the Client
+ * is aware and which can handle the intent.
+ *
+ * @param intent intent item to query.
+ *
+ * @return @c Eina_List with suggested service URLs on success, or @c 0 on failure,
+ * the Eina_List and its items should be freed after use. Use free() to free the
+ * items.
+ */
+EAPI Eina_List *ewk_intent_suggestions_get(const Ewk_Intent *intent);
+
+/**
+ * Retrieves the value (if any) from the extra data dictionary this intent was constructed with.
+ *
+ * @param intent intent item to query.
+ * @param key key to query in the dictionary.
+ *
+ * @return a newly allocated string or @c NULL in case of error or if the key does not exist.
+ */
+EAPI char *ewk_intent_extra_get(const Ewk_Intent *intent, const char *key);
+
+/**
+ * Retrieve a list of the names of extra metadata associated with the intent.
+ *
+ * @param intent intent item to query.
+ *
+ * @return @c Eina_List with names of extra metadata on success, or @c 0 on failure,
+ * the Eina_List and its items should be freed after use. Use free() to free the
+ * items.
+ */
+EAPI Eina_List *ewk_intent_extra_names_get(const Ewk_Intent *intent);
+
+#ifdef __cplusplus
+}
+#endif
+#endif // ewk_intent_h
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_intent_private.h b/Source/WebKit2/UIProcess/API/efl/ewk_intent_private.h
new file mode 100644
index 000000000..0f8268930
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_intent_private.h
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2012 Intel Corporation. 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 ewk_intent_private_h
+#define ewk_intent_private_h
+
+#if ENABLE(WEB_INTENTS)
+
+#include <WebKit2/WKBase.h>
+
+typedef struct _Ewk_Intent Ewk_Intent;
+
+Ewk_Intent* ewk_intent_new(WKIntentDataRef intentData);
+WKIntentDataRef ewk_intent_WKIntentDataRef_get(const Ewk_Intent* intent);
+
+#endif // ENABLE(WEB_INTENTS)
+
+#endif // ewk_intent_private_h
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_intent_service.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_intent_service.cpp
new file mode 100644
index 000000000..be9b84499
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_intent_service.cpp
@@ -0,0 +1,177 @@
+/*
+ * Copyright (C) 2012 Intel Corporation. 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 "ewk_intent_service.h"
+
+#include "IntentServiceInfo.h"
+#include "WKAPICast.h"
+#include "WKIntentServiceInfo.h"
+#include "WKRetainPtr.h"
+#include "WKURL.h"
+#include "ewk_intent_service_private.h"
+#include <wtf/text/CString.h>
+
+using namespace WebKit;
+
+/**
+ * \struct _Ewk_Intent_Service
+ * @brief Contains the intent service data.
+ */
+struct _Ewk_Intent_Service {
+ unsigned int __ref; /**< the reference count of the object */
+#if ENABLE(WEB_INTENTS_TAG)
+ WKRetainPtr<WKIntentServiceInfoRef> wkService;
+#endif
+ const char* action;
+ const char* type;
+ const char* href;
+ const char* title;
+ const char* disposition;
+};
+
+#define EWK_INTENT_SERVICE_WK_GET_OR_RETURN(service, wkService_, ...) \
+ if (!(service)) { \
+ EINA_LOG_CRIT("service is NULL."); \
+ return __VA_ARGS__; \
+ } \
+ if (!(service)->wkService) { \
+ EINA_LOG_CRIT("service->wkService is NULL."); \
+ return __VA_ARGS__; \
+ } \
+ WKIntentServiceInfoRef wkService_ = (service)->wkService.get()
+
+void ewk_intent_service_ref(Ewk_Intent_Service* service)
+{
+#if ENABLE(WEB_INTENTS_TAG)
+ EINA_SAFETY_ON_NULL_RETURN(service);
+ ++service->__ref;
+#endif
+}
+
+void ewk_intent_service_unref(Ewk_Intent_Service* service)
+{
+#if ENABLE(WEB_INTENTS_TAG)
+ EINA_SAFETY_ON_NULL_RETURN(service);
+
+ if (--service->__ref)
+ return;
+
+ eina_stringshare_del(service->action);
+ eina_stringshare_del(service->type);
+ eina_stringshare_del(service->href);
+ eina_stringshare_del(service->title);
+ eina_stringshare_del(service->disposition);
+ free(service);
+#endif
+}
+
+const char* ewk_intent_service_action_get(const Ewk_Intent_Service* service)
+{
+#if ENABLE(WEB_INTENTS_TAG)
+ EWK_INTENT_SERVICE_WK_GET_OR_RETURN(service, wkService, 0);
+
+ WKRetainPtr<WKStringRef> wkAction(AdoptWK, WKIntentServiceInfoCopyAction(wkService));
+ Ewk_Intent_Service* ewkIntentService = const_cast<Ewk_Intent_Service*>(service);
+ eina_stringshare_replace(&ewkIntentService->action, toImpl(wkAction.get())->string().utf8().data());
+
+ return service->action;
+#else
+ return 0;
+#endif
+}
+
+const char* ewk_intent_service_type_get(const Ewk_Intent_Service* service)
+{
+#if ENABLE(WEB_INTENTS_TAG)
+ EWK_INTENT_SERVICE_WK_GET_OR_RETURN(service, wkService, 0);
+
+ WKRetainPtr<WKStringRef> wkType(AdoptWK, WKIntentServiceInfoCopyType(wkService));
+ Ewk_Intent_Service* ewkIntentService = const_cast<Ewk_Intent_Service*>(service);
+ eina_stringshare_replace(&ewkIntentService->type, toImpl(wkType.get())->string().utf8().data());
+
+ return service->type;
+#else
+ return 0;
+#endif
+}
+
+const char* ewk_intent_service_href_get(const Ewk_Intent_Service* service)
+{
+#if ENABLE(WEB_INTENTS_TAG)
+ EWK_INTENT_SERVICE_WK_GET_OR_RETURN(service, wkService, 0);
+
+ WKRetainPtr<WKURLRef> wkHref(AdoptWK, WKIntentServiceInfoCopyHref(wkService));
+ Ewk_Intent_Service* ewkIntentService = const_cast<Ewk_Intent_Service*>(service);
+ eina_stringshare_replace(&ewkIntentService->href, toImpl(wkHref.get())->string().utf8().data());
+
+ return service->href;
+#else
+ return 0;
+#endif
+}
+
+const char* ewk_intent_service_title_get(const Ewk_Intent_Service* service)
+{
+#if ENABLE(WEB_INTENTS_TAG)
+ EWK_INTENT_SERVICE_WK_GET_OR_RETURN(service, wkService, 0);
+
+ WKRetainPtr<WKStringRef> wkTitle(AdoptWK, WKIntentServiceInfoCopyTitle(wkService));
+ Ewk_Intent_Service* ewkIntentService = const_cast<Ewk_Intent_Service*>(service);
+ eina_stringshare_replace(&ewkIntentService->title, toImpl(wkTitle.get())->string().utf8().data());
+
+ return service->title;
+#else
+ return 0;
+#endif
+}
+
+const char* ewk_intent_service_disposition_get(const Ewk_Intent_Service* service)
+{
+#if ENABLE(WEB_INTENTS_TAG)
+ EWK_INTENT_SERVICE_WK_GET_OR_RETURN(service, wkService, 0);
+
+ WKRetainPtr<WKStringRef> wkDisposition(AdoptWK, WKIntentServiceInfoCopyDisposition(wkService));
+ Ewk_Intent_Service* ewkIntentService = const_cast<Ewk_Intent_Service*>(service);
+ eina_stringshare_replace(&ewkIntentService->disposition, toImpl(wkDisposition.get())->string().utf8().data());
+
+ return service->disposition;
+#else
+ return 0;
+#endif
+}
+
+#if ENABLE(WEB_INTENTS_TAG)
+Ewk_Intent_Service* ewk_intent_service_new(WKIntentServiceInfoRef wkService)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(wkService, 0);
+
+ Ewk_Intent_Service* ewkIntentService = static_cast<Ewk_Intent_Service*>(calloc(1, sizeof(Ewk_Intent_Service)));
+ ewkIntentService->__ref = 1;
+ ewkIntentService->wkService = wkService;
+
+ return ewkIntentService;
+}
+#endif
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_intent_service.h b/Source/WebKit2/UIProcess/API/efl/ewk_intent_service.h
new file mode 100644
index 000000000..de22f6c4c
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_intent_service.h
@@ -0,0 +1,128 @@
+/*
+ * Copyright (C) 2012 Intel Corporation. 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.
+ */
+
+/**
+ * @file ewk_intent_service.h
+ * @brief Describes the Ewk Intent Service API.
+ */
+
+#ifndef ewk_intent_service_h
+#define ewk_intent_service_h
+
+#include <Evas.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** Creates a type name for _Ewk_Intent_Service */
+typedef struct _Ewk_Intent_Service Ewk_Intent_Service;
+
+/**
+ * Increases the reference count of the given object.
+ *
+ * @param service the intent service object to increase the reference count
+ */
+EAPI void ewk_intent_service_ref(Ewk_Intent_Service *service);
+
+/**
+ * Decreases the reference count of the given object, possibly freeing it.
+ *
+ * When the reference count it's reached 0, the intent service is freed.
+ *
+ * @param service the intent service object to decrease the reference count
+ */
+EAPI void ewk_intent_service_unref(Ewk_Intent_Service *service);
+
+/**
+ * Query action for this intent service.
+ *
+ * @param service service item to query.
+ *
+ * @return the action pointer, that may be @c NULL. This pointer is
+ * guaranteed to be eina_stringshare, so whenever possible
+ * save yourself some cpu cycles and use
+ * eina_stringshare_ref() instead of eina_stringshare_add() or
+ * strdup().
+ */
+EAPI const char *ewk_intent_service_action_get(const Ewk_Intent_Service *service);
+
+/**
+ * Query type for this intent service.
+ *
+ * @param service service item to query.
+ *
+ * @return the type pointer, that may be @c NULL. This pointer is
+ * guaranteed to be eina_stringshare, so whenever possible
+ * save yourself some cpu cycles and use
+ * eina_stringshare_ref() instead of eina_stringshare_add() or
+ * strdup().
+ */
+EAPI const char *ewk_intent_service_type_get(const Ewk_Intent_Service *service);
+
+/**
+ * Query URL for this intent service.
+ *
+ * @param service service item to query.
+ *
+ * @return the URL pointer, that may be @c NULL. This pointer is
+ * guaranteed to be eina_stringshare, so whenever possible
+ * save yourself some cpu cycles and use
+ * eina_stringshare_ref() instead of eina_stringshare_add() or
+ * strdup().
+ */
+EAPI const char *ewk_intent_service_href_get(const Ewk_Intent_Service *service);
+
+/**
+ * Query title for this intent service.
+ *
+ * @param service service item to query.
+ *
+ * @return the title pointer, that may be @c NULL. This pointer is
+ * guaranteed to be eina_stringshare, so whenever possible
+ * save yourself some cpu cycles and use
+ * eina_stringshare_ref() instead of eina_stringshare_add() or
+ * strdup().
+ */
+EAPI const char *ewk_intent_service_title_get(const Ewk_Intent_Service *service);
+
+/**
+ * Query disposition for this intent service.
+ *
+ * @param service service item to query.
+ *
+ * @return the disposition pointer, that may be @c NULL. This pointer is
+ * guaranteed to be eina_stringshare, so whenever possible
+ * save yourself some cpu cycles and use
+ * eina_stringshare_ref() instead of eina_stringshare_add() or
+ * strdup().
+ */
+EAPI const char *ewk_intent_service_disposition_get(const Ewk_Intent_Service *service);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // ewk_intent_service_h
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_intent_service_private.h b/Source/WebKit2/UIProcess/API/efl/ewk_intent_service_private.h
new file mode 100644
index 000000000..7ff4923cc
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_intent_service_private.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2012 Intel Corporation. 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 ewk_intent_service_private_h
+#define ewk_intent_service_private_h
+
+#if ENABLE(WEB_INTENTS_TAG)
+
+#include <WebKit2/WKBase.h>
+
+typedef struct _Ewk_Intent_Service Ewk_Intent_Service;
+
+Ewk_Intent_Service* ewk_intent_service_new(WKIntentServiceInfoRef wkService);
+
+#endif // ENABLE(WEB_INTENTS_TAG)
+
+#endif // ewk_intent_service_private_h
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_url_request.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_url_request.cpp
new file mode 100644
index 000000000..0aa874bf7
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_url_request.cpp
@@ -0,0 +1,127 @@
+/*
+ * Copyright (C) 2012 Intel Corporation. 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 "ewk_url_request.h"
+
+#include "WKAPICast.h"
+#include "WKRetainPtr.h"
+#include "WKURL.h"
+#include "WKURLRequest.h"
+#include "WebURLRequest.h"
+#include "WebURLRequestEfl.h"
+#include "ewk_url_request_private.h"
+#include <wtf/text/CString.h>
+
+using namespace WebKit;
+
+/**
+ * \struct _Ewk_Url_Request
+ * @brief Contains the URL request data.
+ */
+struct _Ewk_Url_Request {
+ unsigned int __ref; /**< the reference count of the object */
+ WKRetainPtr<WKURLRequestRef> wkRequest;
+
+ const char* url;
+ const char* first_party;
+ const char* http_method;
+};
+
+#define EWK_URL_REQUEST_WK_GET_OR_RETURN(request, wkRequest_, ...) \
+ if (!(request)) { \
+ EINA_LOG_CRIT("request is NULL."); \
+ return __VA_ARGS__; \
+ } \
+ if (!(request)->wkRequest) { \
+ EINA_LOG_CRIT("request->wkRequest is NULL."); \
+ return __VA_ARGS__; \
+ } \
+ WKURLRequestRef wkRequest_ = (request)->wkRequest.get()
+
+void ewk_url_request_ref(Ewk_Url_Request* request)
+{
+ EINA_SAFETY_ON_NULL_RETURN(request);
+ ++request->__ref;
+}
+
+void ewk_url_request_unref(Ewk_Url_Request* request)
+{
+ EINA_SAFETY_ON_NULL_RETURN(request);
+
+ if (--request->__ref)
+ return;
+
+ eina_stringshare_del(request->url);
+ eina_stringshare_del(request->first_party);
+ eina_stringshare_del(request->http_method);
+ free(request);
+}
+
+const char* ewk_url_request_url_get(const Ewk_Url_Request* request)
+{
+ EWK_URL_REQUEST_WK_GET_OR_RETURN(request, wkRequest, 0);
+
+ WKRetainPtr<WKURLRef> wkUrl(AdoptWK, WKURLRequestCopyURL(wkRequest));
+ Ewk_Url_Request* ewkRequest = const_cast<Ewk_Url_Request*>(request);
+ eina_stringshare_replace(&ewkRequest->url, toImpl(wkUrl.get())->string().utf8().data());
+
+ return request->url;
+}
+
+const char* ewk_request_cookies_first_party_get(const Ewk_Url_Request* request)
+{
+ EWK_URL_REQUEST_WK_GET_OR_RETURN(request, wkRequest, 0);
+
+ Ewk_Url_Request* ewkRequest = const_cast<Ewk_Url_Request*>(request);
+ eina_stringshare_replace(&ewkRequest->first_party, toImpl(wkRequest)->resourceRequest().firstPartyForCookies().string().utf8().data());
+
+ return request->first_party;
+}
+
+const char* ewk_url_request_http_method_get(const Ewk_Url_Request* request)
+{
+ EWK_URL_REQUEST_WK_GET_OR_RETURN(request, wkRequest, 0);
+
+ Ewk_Url_Request* ewkRequest = const_cast<Ewk_Url_Request*>(request);
+ eina_stringshare_replace(&ewkRequest->http_method, toImpl(wkRequest)->resourceRequest().httpMethod().utf8().data());
+
+ return request->http_method;
+}
+
+/**
+ * @internal
+ * Constructs a Ewk_Url_Request from a WKURLRequest.
+ */
+Ewk_Url_Request* ewk_url_request_new(WKURLRequestRef wkUrlRequest)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(wkUrlRequest, 0);
+
+ Ewk_Url_Request* ewkUrlRequest = static_cast<Ewk_Url_Request*>(calloc(1, sizeof(Ewk_Url_Request)));
+ ewkUrlRequest->__ref = 1;
+ ewkUrlRequest->wkRequest = wkUrlRequest;
+
+ return ewkUrlRequest;
+}
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_url_request.h b/Source/WebKit2/UIProcess/API/efl/ewk_url_request.h
new file mode 100644
index 000000000..0150b8917
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_url_request.h
@@ -0,0 +1,111 @@
+/*
+ * Copyright (C) 2012 Intel Corporation. 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.
+ */
+
+/**
+ * @file ewk_url_request.h
+ * @brief Describes the Ewk URL request API.
+ */
+
+#ifndef ewk_url_request_h
+#define ewk_url_request_h
+
+#include <Eina.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** Creates a type name for _Ewk_Url_Request */
+typedef struct _Ewk_Url_Request Ewk_Url_Request;
+
+/**
+ * Increases the reference count of the given object.
+ *
+ * @param request the URL request object to increase the reference count
+ */
+EAPI void ewk_url_request_ref(Ewk_Url_Request *request);
+
+/**
+ * Decreases the reference count of the given object, possibly freeing it.
+ *
+ * When the reference count it's reached 0, the URL request is freed.
+ *
+ * @param request the URL request object to decrease the reference count
+ */
+EAPI void ewk_url_request_unref(Ewk_Url_Request *request);
+
+/**
+ * Query URL for this request.
+ *
+ * @param request request object to query.
+ *
+ * @return the URL pointer, that may be @c NULL. This pointer is
+ * guaranteed to be eina_stringshare, so whenever possible
+ * save yourself some cpu cycles and use
+ * eina_stringshare_ref() instead of eina_stringshare_add() or
+ * strdup().
+ */
+EAPI const char *ewk_url_request_url_get(const Ewk_Url_Request *request);
+
+/**
+ * Query first party for cookies for this request.
+ *
+ * If set, this first party URL is used to distinguish first party cookies
+ * from third party ones. This is usually set to the URL of the main document.
+ *
+ * @param request request object to query.
+ *
+ * @return the first party pointer, that may be @c NULL. This pointer is
+ * guaranteed to be eina_stringshare, so whenever possible
+ * save yourself some cpu cycles and use
+ * eina_stringshare_ref() instead of eina_stringshare_add() or
+ * strdup().
+ */
+EAPI const char *ewk_request_cookies_first_party_get(const Ewk_Url_Request *request);
+
+/**
+ * Query HTTP method for this request.
+ *
+ * HTTP methods are defined by:
+ * http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html
+ *
+ * Examples of HTTP methods are "GET", "POST".
+ *
+ * @param request request object to query.
+ *
+ * @return the HTTP method pointer, that may be @c NULL. This pointer is
+ * guaranteed to be eina_stringshare, so whenever possible
+ * save yourself some cpu cycles and use
+ * eina_stringshare_ref() instead of eina_stringshare_add() or
+ * strdup().
+ */
+EAPI const char *ewk_url_request_http_method_get(const Ewk_Url_Request *request);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // ewk_url_request_h
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_url_request_private.h b/Source/WebKit2/UIProcess/API/efl/ewk_url_request_private.h
new file mode 100644
index 000000000..548b6e91e
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_url_request_private.h
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2012 Intel Corporation. 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 ewk_url_request_private_h
+#define ewk_url_request_private_h
+
+Ewk_Url_Request* ewk_url_request_new(WKURLRequestRef);
+
+#endif // ewk_url_request_private_h
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp
index fe384e377..eb6b15bb5 100644
--- a/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp
@@ -30,8 +30,10 @@
#include "WKURL.h"
#include "ewk_context.h"
#include "ewk_context_private.h"
+#include "ewk_intent_private.h"
#include "ewk_view_loader_client_private.h"
#include "ewk_view_private.h"
+#include "ewk_view_resource_load_client_private.h"
#include <wtf/text/CString.h>
using namespace WebKit;
@@ -122,7 +124,7 @@ static Eina_Bool _ewk_view_smart_focus_out(Ewk_View_Smart_Data* smartData)
{
EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false)
- priv->pageClient->page()->viewStateDidChange(WebPageProxy::ViewWindowIsActive);
+ priv->pageClient->page()->viewStateDidChange(WebPageProxy::ViewIsFocused | WebPageProxy::ViewWindowIsActive);
return true;
}
@@ -493,6 +495,7 @@ Evas_Object* ewk_view_base_add(Evas* canvas, WKContextRef contextRef, WKPageGrou
priv->pageClient = PageClientImpl::create(toImpl(contextRef), toImpl(pageGroupRef), ewkView);
ewk_view_loader_client_attach(toAPI(priv->pageClient->page()), ewkView);
+ ewk_view_resource_load_client_attach(toAPI(priv->pageClient->page()), ewkView);
return ewkView;
}
@@ -537,6 +540,16 @@ Eina_Bool ewk_view_reload(Evas_Object* ewkView)
return true;
}
+Eina_Bool ewk_view_reload_bypass_cache(Evas_Object* ewkView)
+{
+ EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
+ EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
+
+ WKPageReloadFromOrigin(toAPI(priv->pageClient->page()));
+
+ return true;
+}
+
Eina_Bool ewk_view_stop(Evas_Object* ewkView)
{
EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
@@ -546,6 +559,20 @@ Eina_Bool ewk_view_stop(Evas_Object* ewkView)
return true;
}
+/**
+ * @internal
+ * Load was initiated for a resource in the view.
+ *
+ * Emits signal: "resource,request,new" with pointer to resource request.
+ */
+void ewk_view_resource_load_initiated(Evas_Object* ewkView, uint64_t resourceIdentifier, Ewk_Web_Resource* resource, Ewk_Url_Request* request)
+{
+ Ewk_Web_Resource_Request resourceRequest = {resource, request};
+ // FIXME: We will need to store the resource and its identifier at some point
+ // to get the resource back from the identifier on resource load finish.
+ evas_object_smart_callback_call(ewkView, "resource,request,new", &resourceRequest);
+}
+
const char* ewk_view_title_get(const Evas_Object* ewkView)
{
EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
@@ -568,6 +595,55 @@ void ewk_view_title_changed(Evas_Object* ewkView, const char* title)
evas_object_smart_callback_call(ewkView, "title,changed", const_cast<char*>(title));
}
+double ewk_view_load_progress_get(const Evas_Object* ewkView)
+{
+ EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
+ EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 0);
+
+ return WKPageGetEstimatedProgress(toAPI(priv->pageClient->page()));
+}
+
+Eina_Bool ewk_view_device_pixel_ratio_set(Evas_Object* ewkView, float ratio)
+{
+ EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
+ EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
+
+ priv->pageClient->page()->setCustomDeviceScaleFactor(ratio);
+ return true;
+}
+
+float ewk_view_device_pixel_ratio_get(const Evas_Object* ewkView)
+{
+ EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 1);
+ EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 1);
+
+ return priv->pageClient->page()->deviceScaleFactor();
+}
+
+/**
+ * @internal
+ * Reports load progress changed.
+ *
+ * Emits signal: "load,progress" with pointer to a double from 0.0 to 1.0.
+ */
+void ewk_view_load_progress_changed(Evas_Object* ewkView, double progress)
+{
+ evas_object_smart_callback_call(ewkView, "load,progress", &progress);
+}
+
+/**
+ * @internal
+ * The view received a new intent request.
+ *
+ * Emits signal: "intent,request,new" with pointer to a Ewk_Intent.
+ */
+void ewk_view_intent_request_new(Evas_Object* ewkView, const Ewk_Intent* ewkIntent)
+{
+#if ENABLE(WEB_INTENTS)
+ evas_object_smart_callback_call(ewkView, "intent,request,new", const_cast<Ewk_Intent*>(ewkIntent));
+#endif
+}
+
void ewk_view_display(Evas_Object* ewkView, const IntRect& rect)
{
EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
@@ -603,6 +679,21 @@ Eina_Bool ewk_view_forward(Evas_Object* ewkView)
return false;
}
+Eina_Bool ewk_view_intent_deliver(Evas_Object* ewkView, Ewk_Intent* intent)
+{
+#if ENABLE(WEB_INTENTS)
+ EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
+ EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
+ EINA_SAFETY_ON_NULL_RETURN_VAL(intent, false);
+
+ WKPageRef wkPage = toAPI(priv->pageClient->page());
+ WKPageDeliverIntentToFrame(wkPage, WKPageGetMainFrame(wkPage), ewk_intent_WKIntentDataRef_get(intent));
+ return true;
+#else
+ return false;
+#endif
+}
+
Eina_Bool ewk_view_back_possible(Evas_Object* ewkView)
{
EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
@@ -630,6 +721,88 @@ void ewk_view_image_data_set(Evas_Object* ewkView, void* imageData, const IntSiz
evas_object_image_data_copy_set(smartData->image, imageData);
}
+/**
+ * @internal
+ * Reports load failed with error information.
+ *
+ * Emits signal: "load,error" with pointer to Ewk_Web_Error.
+ */
+void ewk_view_load_error(Evas_Object* ewkView, const Ewk_Web_Error* error)
+{
+ evas_object_smart_callback_call(ewkView, "load,error", const_cast<Ewk_Web_Error*>(error));
+}
+
+/**
+ * @internal
+ * Reports load finished.
+ *
+ * Emits signal: "load,finished".
+ */
+void ewk_view_load_finished(Evas_Object* ewkView)
+{
+ evas_object_smart_callback_call(ewkView, "load,finished", 0);
+}
+
+/**
+ * @internal
+ * Reports view provisional load failed with error information.
+ *
+ * Emits signal: "load,provisional,failed" with pointer to Ewk_Web_Error.
+ */
+void ewk_view_load_provisional_failed(Evas_Object* ewkView, const Ewk_Web_Error* error)
+{
+ evas_object_smart_callback_call(ewkView, "load,provisional,failed", const_cast<Ewk_Web_Error*>(error));
+}
+
+/**
+ * @internal
+ * Reports view received redirect for provisional load.
+ *
+ * Emits signal: "load,provisional,redirect".
+ */
+void ewk_view_load_provisional_redirect(Evas_Object* ewkView)
+{
+ evas_object_smart_callback_call(ewkView, "load,provisional,redirect", 0);
+}
+
+/**
+ * @internal
+ * Reports view provisional load started.
+ *
+ * Emits signal: "load,provisional,started".
+ */
+void ewk_view_load_provisional_started(Evas_Object* ewkView)
+{
+ evas_object_smart_callback_call(ewkView, "load,provisional,started", 0);
+}
+
+Eina_Bool ewk_view_html_string_load(Evas_Object* ewkView, const char* html, const char* baseUrl, const char* unreachableUrl)
+{
+ EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
+ EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
+ EINA_SAFETY_ON_NULL_RETURN_VAL(html, false);
+
+ if (unreachableUrl && *unreachableUrl)
+ priv->pageClient->page()->loadAlternateHTMLString(String::fromUTF8(html), baseUrl ? String::fromUTF8(baseUrl) : "", String::fromUTF8(unreachableUrl));
+ else
+ priv->pageClient->page()->loadHTMLString(String::fromUTF8(html), baseUrl ? String::fromUTF8(baseUrl) : "");
+
+ return true;
+}
+
+#if ENABLE(WEB_INTENTS_TAG)
+/**
+ * @internal
+ * The view received a new intent service registration.
+ *
+ * Emits signal: "intent,service,register" with pointer to a Ewk_Intent_Service.
+ */
+void ewk_view_intent_service_register(Evas_Object* ewkView, const Ewk_Intent_Service* ewkIntentService)
+{
+ evas_object_smart_callback_call(ewkView, "intent,service,register", const_cast<Ewk_Intent_Service*>(ewkIntentService));
+}
+#endif // ENABLE(WEB_INTENTS_TAG)
+
WebPageProxy* ewk_view_page_get(const Evas_Object* ewkView)
{
EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_view.h b/Source/WebKit2/UIProcess/API/efl/ewk_view.h
index cb5b6500a..f6092a64e 100644
--- a/Source/WebKit2/UIProcess/API/efl/ewk_view.h
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_view.h
@@ -26,6 +26,15 @@
*
* The following signals (see evas_object_smart_callback_add()) are emitted:
*
+ * - "intent,request,new", Ewk_Intent_Request*: reports new Web intent request.
+ * - "intent,service,register", Ewk_Intent_Service*: reports new Web intent service registration.
+ * - "load,error", const Ewk_Web_Error*: reports main frame load failed.
+ * - "load,finished", void: reports load finished.
+ * - "load,progress", double*: load progress has changed (value from 0.0 to 1.0).
+ * - "load,provisional,failed", const Ewk_Web_Error*: view provisional load failed.
+ * - "load,provisional,redirect", void: view received redirect for provisional load.
+ * - "load,provisional,started", void: view started provisional load.
+ * - "resource,request,new", const Ewk_Web_Resource_Request*: a resource request was initiated.
* - "title,changed", const char*: title of the main frame was changed.
*/
@@ -33,6 +42,9 @@
#define ewk_view_h
#include "ewk_context.h"
+#include "ewk_intent.h"
+#include "ewk_url_request.h"
+#include "ewk_web_resource.h"
#include <Evas.h>
#ifdef __cplusplus
@@ -128,6 +140,19 @@ struct _Ewk_View_Smart_Data {
} changed;
};
+/// Creates a type name for _Ewk_Web_Resource_Request.
+typedef struct _Ewk_Web_Resource_Request Ewk_Web_Resource_Request;
+
+/**
+ * @brief Structure containing details about a resource request.
+ *
+ * Details given about a resource is loaded.
+ */
+struct _Ewk_Web_Resource_Request {
+ Ewk_Web_Resource *resource; /**< resource being requested */
+ Ewk_Url_Request *request; /**< URL request for the resource */
+};
+
/**
* Creates a new EFL WebKit view object.
*
@@ -176,11 +201,20 @@ EAPI const char *ewk_view_uri_get(const Evas_Object *o);
*
* @return @c EINA_TRUE on success or @c EINA_FALSE otherwise
*
- * @see ewk_view_reload_full()
+ * @see ewk_view_reload_bypass_cache()
*/
EAPI Eina_Bool ewk_view_reload(Evas_Object *o);
/**
+ * Reloads the current page's document without cache.
+ *
+ * @param o view object to reload current document
+ *
+ * @return @c EINA_TRUE on success or @c EINA_FALSE otherwise
+ */
+EAPI Eina_Bool ewk_view_reload_bypass_cache(Evas_Object *o);
+
+/**
* Asks the main frame to stop loading.
*
* @param o view object to stop loading
@@ -189,7 +223,16 @@ EAPI Eina_Bool ewk_view_reload(Evas_Object *o);
*/
EAPI Eina_Bool ewk_view_stop(Evas_Object *o);
-/*
+/**
+ * Delivers a Web intent to the view's main frame.
+ *
+ * @param o view object to deliver the intent to
+ *
+ * @return @c EINA_TRUE on success or @c EINA_FALSE otherwise.
+ */
+EAPI Eina_Bool ewk_view_intent_deliver(Evas_Object *o, Ewk_Intent *intent);
+
+/**
* Asks the main frame to navigate back in the history.
*
* @param o view object to navigate back
@@ -241,6 +284,84 @@ EAPI Eina_Bool ewk_view_forward_possible(Evas_Object *o);
*/
EAPI const char *ewk_view_title_get(const Evas_Object *o);
+/**
+ * Gets the current load progress of page.
+ *
+ * The progress estimation from 0.0 to 1.0.
+ *
+ * @param o view object to get the current progress
+ *
+ * @return the load progres of page, value from 0.0 to 1.0.
+ */
+EAPI double ewk_view_load_progress_get(const Evas_Object *o);
+
+/**
+ * Loads the specified @a html string as the content of the view.
+ *
+ * External objects such as stylesheets or images referenced in the HTML
+ * document are located relative to @a baseUrl.
+ *
+ * If an @a unreachableUrl is passed it is used as the url for the loaded
+ * content. This is typically used to display error pages for a failed
+ * load.
+ *
+ * @param o view object to load the HTML into
+ * @param html HTML data to load
+ * @param baseUrl Base URL used for relative paths to external objects (optional)
+ * @param unreachableUrl URL that could not be reached (optional)
+ *
+ * @return @c EINA_TRUE if it the HTML was successfully loaded, @c EINA_FALSE otherwise
+ */
+EAPI Eina_Bool ewk_view_html_string_load(Evas_Object *o, const char *html, const char *baseUrl, const char *unreachableUrl);
+
+/**
+ * Queries the ratio between the CSS units and device pixels when the content is unscaled.
+ *
+ * When designing touch-friendly contents, knowing the approximated target size on a device
+ * is important for contents providers in order to get the intented layout and element
+ * sizes.
+ *
+ * As most first generation touch devices had a PPI of approximately 160, this became a
+ * de-facto value, when used in conjunction with the viewport meta tag.
+ *
+ * Devices with a higher PPI learning towards 240 or 320, applies a pre-scaling on all
+ * content, of either 1.5 or 2.0, not affecting the CSS scale or pinch zooming.
+ *
+ * This value can be set using this property and it is exposed to CSS media queries using
+ * the -webkit-device-pixel-ratio query.
+ *
+ * For instance, if you want to load an image without having it upscaled on a web view
+ * using a device pixel ratio of 2.0 it can be done by loading an image of say 100x100
+ * pixels but showing it at half the size.
+ *
+ * @media (-webkit-min-device-pixel-ratio: 1.5) {
+ * .icon {
+ * width: 50px;
+ * height: 50px;
+ * url: "/images/icon@2x.png"; // This is actually a 100x100 image
+ * }
+ * }
+ *
+ * If the above is used on a device with device pixel ratio of 1.5, it will be scaled
+ * down but still provide a better looking image.
+ *
+ * @param o view object to get device pixel ratio
+ *
+ * @return the ratio between the CSS units and device pixels.
+ */
+EAPI float ewk_view_device_pixel_ratio_get(const Evas_Object *o);
+
+/**
+ * Sets the ratio between the CSS units and device pixels when the content is unscaled.
+ *
+ * @param o view object to set device pixel ratio
+ *
+ * @return @c EINA_TRUE if the device pixel ratio was set, @c EINA_FALSE otherwise
+ *
+ * @see ewk_view_device_pixel_ratio_get()
+ */
+EAPI Eina_Bool ewk_view_device_pixel_ratio_set(Evas_Object *o, float ratio);
+
#ifdef __cplusplus
}
#endif
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_view_loader_client.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_view_loader_client.cpp
index e98e154c6..3c28f2984 100644
--- a/Source/WebKit2/UIProcess/API/efl/ewk_view_loader_client.cpp
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_view_loader_client.cpp
@@ -26,8 +26,14 @@
#include "config.h"
#include "WKFrame.h"
+#include "ewk_intent.h"
+#include "ewk_intent_private.h"
+#include "ewk_intent_service.h"
+#include "ewk_intent_service_private.h"
#include "ewk_view_loader_client_private.h"
#include "ewk_view_private.h"
+#include "ewk_web_error.h"
+#include "ewk_web_error_private.h"
#include <wtf/text/CString.h>
using namespace WebKit;
@@ -41,6 +47,82 @@ static void didReceiveTitleForFrame(WKPageRef, WKStringRef title, WKFrameRef fra
ewk_view_title_changed(ewkView, toImpl(title)->string().utf8().data());
}
+#if ENABLE(WEB_INTENTS)
+static void didReceiveIntentForFrame(WKPageRef page, WKFrameRef frame, WKIntentDataRef intent, const void* clientInfo)
+{
+ Evas_Object* ewkView = static_cast<Evas_Object*>(const_cast<void*>(clientInfo));
+ Ewk_Intent* ewkIntent = ewk_intent_new(intent);
+ ewk_view_intent_request_new(ewkView, ewkIntent);
+ ewk_intent_unref(ewkIntent);
+}
+#endif
+
+#if ENABLE(WEB_INTENTS_TAG)
+static void registerIntentServiceForFrame(WKPageRef page, WKFrameRef frame, WKIntentServiceInfoRef serviceInfo, const void *clientInfo)
+{
+ Evas_Object* ewkView = static_cast<Evas_Object*>(const_cast<void*>(clientInfo));
+ Ewk_Intent_Service* ewkIntentService = ewk_intent_service_new(serviceInfo);
+ ewk_view_intent_service_register(ewkView, ewkIntentService);
+ ewk_intent_service_unref(ewkIntentService);
+}
+#endif
+
+static void didChangeProgress(WKPageRef page, const void* clientInfo)
+{
+ Evas_Object* ewkView = static_cast<Evas_Object*>(const_cast<void*>(clientInfo));
+ ewk_view_load_progress_changed(ewkView, WKPageGetEstimatedProgress(page));
+}
+
+static void didFinishLoadForFrame(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void *clientInfo)
+{
+ if (!WKFrameIsMainFrame(frame))
+ return;
+
+ Evas_Object* ewkView = static_cast<Evas_Object*>(const_cast<void*>(clientInfo));
+ ewk_view_load_finished(ewkView);
+}
+
+static void didFailLoadWithErrorForFrame(WKPageRef page, WKFrameRef frame, WKErrorRef error, WKTypeRef, const void *clientInfo)
+{
+ if (!WKFrameIsMainFrame(frame))
+ return;
+
+ Evas_Object* ewkView = static_cast<Evas_Object*>(const_cast<void*>(clientInfo));
+ Ewk_Web_Error* ewkError = ewk_web_error_new(error);
+ ewk_view_load_error(ewkView, ewkError);
+ ewk_view_load_finished(ewkView);
+ ewk_web_error_free(ewkError);
+}
+
+static void didStartProvisionalLoadForFrame(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void* clientInfo)
+{
+ if (!WKFrameIsMainFrame(frame))
+ return;
+
+ Evas_Object* ewkView = static_cast<Evas_Object*>(const_cast<void*>(clientInfo));
+ ewk_view_load_provisional_started(ewkView);
+}
+
+static void didReceiveServerRedirectForProvisionalLoadForFrame(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void* clientInfo)
+{
+ if (!WKFrameIsMainFrame(frame))
+ return;
+
+ Evas_Object* ewkView = static_cast<Evas_Object*>(const_cast<void*>(clientInfo));
+ ewk_view_load_provisional_redirect(ewkView);
+}
+
+static void didFailProvisionalLoadWithErrorForFrame(WKPageRef page, WKFrameRef frame, WKErrorRef error, WKTypeRef userData, const void* clientInfo)
+{
+ if (!WKFrameIsMainFrame(frame))
+ return;
+
+ Evas_Object* ewkView = static_cast<Evas_Object*>(const_cast<void*>(clientInfo));
+ Ewk_Web_Error* ewkError = ewk_web_error_new(error);
+ ewk_view_load_provisional_failed(ewkView, ewkError);
+ ewk_web_error_free(ewkError);
+}
+
void ewk_view_loader_client_attach(WKPageRef pageRef, Evas_Object* ewkView)
{
WKPageLoaderClient loadClient;
@@ -48,5 +130,19 @@ void ewk_view_loader_client_attach(WKPageRef pageRef, Evas_Object* ewkView)
loadClient.version = kWKPageLoaderClientCurrentVersion;
loadClient.clientInfo = ewkView;
loadClient.didReceiveTitleForFrame = didReceiveTitleForFrame;
+#if ENABLE(WEB_INTENTS)
+ loadClient.didReceiveIntentForFrame = didReceiveIntentForFrame;
+#endif
+#if ENABLE(WEB_INTENTS_TAG)
+ loadClient.registerIntentServiceForFrame = registerIntentServiceForFrame;
+#endif
+ loadClient.didStartProgress = didChangeProgress;
+ loadClient.didChangeProgress = didChangeProgress;
+ loadClient.didFinishProgress = didChangeProgress;
+ loadClient.didFinishLoadForFrame = didFinishLoadForFrame;
+ loadClient.didFailLoadWithErrorForFrame = didFailLoadWithErrorForFrame;
+ loadClient.didStartProvisionalLoadForFrame = didStartProvisionalLoadForFrame;
+ loadClient.didReceiveServerRedirectForProvisionalLoadForFrame = didReceiveServerRedirectForProvisionalLoadForFrame;
+ loadClient.didFailProvisionalLoadWithErrorForFrame = didFailProvisionalLoadWithErrorForFrame;
WKPageSetPageLoaderClient(pageRef, &loadClient);
}
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_view_private.h b/Source/WebKit2/UIProcess/API/efl/ewk_view_private.h
index 62598e4c0..f9f21136c 100644
--- a/Source/WebKit2/UIProcess/API/efl/ewk_view_private.h
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_view_private.h
@@ -30,12 +30,36 @@ class IntRect;
class IntSize;
}
+typedef struct _Ewk_Url_Request Ewk_Url_Request;
+typedef struct _Ewk_Web_Error Ewk_Web_Error;
+typedef struct _Ewk_Web_Resource Ewk_Web_Resource;
+#if ENABLE(WEB_INTENTS)
+typedef struct _Ewk_Intent Ewk_Intent;
+#endif
+#if ENABLE(WEB_INTENTS_TAG)
+typedef struct _Ewk_Intent_Service Ewk_Intent_Service;
+#endif
+
void ewk_view_display(Evas_Object* ewkView, const WebCore::IntRect& rect);
void ewk_view_image_data_set(Evas_Object* ewkView, void* imageData, const WebCore::IntSize& size);
+void ewk_view_load_error(Evas_Object* ewkView, const Ewk_Web_Error* error);
+void ewk_view_load_finished(Evas_Object* ewkView);
+void ewk_view_load_progress_changed(Evas_Object* ewkView, double progress);
+void ewk_view_load_provisional_failed(Evas_Object* ewkView, const Ewk_Web_Error* error);
+void ewk_view_load_provisional_redirect(Evas_Object* ewkView);
+void ewk_view_load_provisional_started(Evas_Object* ewkView);
void ewk_view_title_changed(Evas_Object* ewkView, const char* title);
+void ewk_view_resource_load_initiated(Evas_Object* ewkView, uint64_t resourceIdentifier, Ewk_Web_Resource* resource, Ewk_Url_Request* request);
Evas_Object* ewk_view_base_add(Evas* canvas, WKContextRef, WKPageGroupRef);
+#if ENABLE(WEB_INTENTS)
+void ewk_view_intent_request_new(Evas_Object* ewkView, const Ewk_Intent* ewkIntent);
+#endif
+#if ENABLE(WEB_INTENTS_TAG)
+void ewk_view_intent_service_register(Evas_Object* ewkView, const Ewk_Intent_Service* ewkIntentService);
+#endif
+
WebKit::WebPageProxy* ewk_view_page_get(const Evas_Object* ewkView);
#endif // ewk_view_private_h
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_view_resource_load_client.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_view_resource_load_client.cpp
new file mode 100644
index 000000000..6be39a208
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_view_resource_load_client.cpp
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2012 Intel Corporation. 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 "WKAPICast.h"
+#include "WKFrame.h"
+#include "WKPage.h"
+#include "WKRetainPtr.h"
+#include "WKURL.h"
+#include "WKURLRequest.h"
+#include "ewk_url_request.h"
+#include "ewk_url_request_private.h"
+#include "ewk_view_private.h"
+#include "ewk_view_resource_load_client_private.h"
+#include "ewk_web_resource.h"
+#include "ewk_web_resource_private.h"
+#include <wtf/text/CString.h>
+
+using namespace WebKit;
+
+static void didInitiateLoadForResource(WKPageRef, WKFrameRef wkFrame, uint64_t resourceIdentifier, WKURLRequestRef wkRequest, bool pageIsProvisionallyLoading, const void* clientInfo)
+{
+ Evas_Object* ewkView = static_cast<Evas_Object*>(const_cast<void*>(clientInfo));
+ bool isMainResource = (WKFrameIsMainFrame(wkFrame) && pageIsProvisionallyLoading);
+ WKRetainPtr<WKURLRef> wkUrl(AdoptWK, WKURLRequestCopyURL(wkRequest));
+
+ Ewk_Web_Resource* resource = ewk_web_resource_new(toImpl(wkUrl.get())->string().utf8().data(), isMainResource);
+ Ewk_Url_Request* request = ewk_url_request_new(wkRequest);
+ ewk_view_resource_load_initiated(ewkView, resourceIdentifier, resource, request);
+ ewk_web_resource_unref(resource);
+ ewk_url_request_unref(request);
+}
+
+void ewk_view_resource_load_client_attach(WKPageRef pageRef, Evas_Object* ewkView)
+{
+ WKPageResourceLoadClient wkResourceLoadClient;
+ memset(&wkResourceLoadClient, 0, sizeof(WKPageResourceLoadClient));
+ wkResourceLoadClient.version = kWKPageResourceLoadClientCurrentVersion;
+ wkResourceLoadClient.clientInfo = ewkView;
+ wkResourceLoadClient.didInitiateLoadForResource = didInitiateLoadForResource;
+
+ WKPageSetPageResourceLoadClient(pageRef, &wkResourceLoadClient);
+}
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_view_resource_load_client_private.h b/Source/WebKit2/UIProcess/API/efl/ewk_view_resource_load_client_private.h
new file mode 100644
index 000000000..1f404b920
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_view_resource_load_client_private.h
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2012 Intel Corporation. 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 ewk_view_resource_load_client_private_h
+#define ewk_view_resource_load_client_private_h
+
+#include <Evas.h>
+#include <WebKit2/WKBase.h>
+
+void ewk_view_resource_load_client_attach(WKPageRef pageRef, Evas_Object* ewkView);
+
+#endif // ewk_view_resource_load_client_private_h
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_web_error.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_web_error.cpp
new file mode 100644
index 000000000..96b08d3e5
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_web_error.cpp
@@ -0,0 +1,129 @@
+/*
+ * Copyright (C) 2012 Intel Corporation. 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 "ewk_web_error.h"
+
+#include "WKString.h"
+#include "WKURL.h"
+#include "ewk_web_error_private.h"
+#include <WKAPICast.h>
+#include <WKError.h>
+#include <WKRetainPtr.h>
+#include <wtf/text/CString.h>
+
+using namespace WebKit;
+
+// Copied from ErrorsGtk.h which is used by DownloadSoup.cpp.
+static const char errorDomainDownload[] = "WebKitDownloadError";
+
+struct _Ewk_Web_Error {
+ WKRetainPtr<WKErrorRef> wkError;
+
+ const char* url;
+ const char* description;
+};
+
+#define EWK_WEB_ERROR_WK_GET_OR_RETURN(error, wkError_, ...) \
+ if (!(error)) { \
+ EINA_LOG_CRIT("error is NULL."); \
+ return __VA_ARGS__; \
+ } \
+ if (!(error)->wkError) { \
+ EINA_LOG_CRIT("error->wkError is NULL."); \
+ return __VA_ARGS__; \
+ } \
+ WKErrorRef wkError_ = (error)->wkError.get()
+
+void ewk_web_error_free(Ewk_Web_Error *error)
+{
+ EINA_SAFETY_ON_NULL_RETURN(error);
+
+ eina_stringshare_del(error->url);
+ eina_stringshare_del(error->description);
+ free(error);
+}
+
+Ewk_Web_Error_Type ewk_web_error_type_get(const Ewk_Web_Error* error)
+{
+ EWK_WEB_ERROR_WK_GET_OR_RETURN(error, wkError, EWK_WEB_ERROR_TYPE_NONE);
+
+ WKRetainPtr<WKStringRef> wkDomain(AdoptWK, WKErrorCopyDomain(wkError));
+ WTF::String errorDomain = toWTFString(wkDomain.get());
+
+ if (errorDomain == String(g_quark_to_string(SOUP_HTTP_ERROR)))
+ return EWK_WEB_ERROR_TYPE_HTTP;
+ if (errorDomain == String(g_quark_to_string(G_IO_ERROR)))
+ return EWK_WEB_ERROR_TYPE_IO;
+ if (errorDomain == errorDomainDownload)
+ return EWK_WEB_ERROR_TYPE_DOWNLOAD;
+ return EWK_WEB_ERROR_TYPE_INTERNAL;
+}
+
+const char* ewk_web_error_url_get(const Ewk_Web_Error* error)
+{
+ EWK_WEB_ERROR_WK_GET_OR_RETURN(error, wkError, 0);
+
+ WKRetainPtr<WKURLRef> wkUrl(AdoptWK, WKErrorCopyFailingURL(wkError));
+ Ewk_Web_Error* ewkError = const_cast<Ewk_Web_Error*>(error);
+ eina_stringshare_replace(&ewkError->url, toImpl(wkUrl.get())->string().utf8().data());
+
+ return error->url;
+}
+
+int ewk_web_error_code_get(const Ewk_Web_Error* error)
+{
+ EWK_WEB_ERROR_WK_GET_OR_RETURN(error, wkError, 0);
+
+ return WKErrorGetErrorCode(wkError);
+}
+
+const char* ewk_web_error_description_get(const Ewk_Web_Error* error)
+{
+ EWK_WEB_ERROR_WK_GET_OR_RETURN(error, wkError, 0);
+
+ WKRetainPtr<WKStringRef> wkDescription(AdoptWK, WKErrorCopyLocalizedDescription(wkError));
+ Ewk_Web_Error* ewkError = const_cast<Ewk_Web_Error*>(error);
+ eina_stringshare_replace(&ewkError->description, toImpl(wkDescription.get())->string().utf8().data());
+
+ return error->description;
+}
+
+Eina_Bool ewk_web_error_cancellation_get(const Ewk_Web_Error* error)
+{
+ EWK_WEB_ERROR_WK_GET_OR_RETURN(error, wkError, false);
+
+ return toImpl(wkError)->platformError().isCancellation();
+}
+
+Ewk_Web_Error* ewk_web_error_new(WKErrorRef error)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(error, 0);
+
+ Ewk_Web_Error* ewkError = static_cast<Ewk_Web_Error*>(calloc(1, sizeof(Ewk_Web_Error)));
+ ewkError->wkError = error;
+
+ return ewkError;
+}
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_web_error.h b/Source/WebKit2/UIProcess/API/efl/ewk_web_error.h
new file mode 100644
index 000000000..2d9666581
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_web_error.h
@@ -0,0 +1,122 @@
+/*
+ * Copyright (C) 2012 Intel Corporation. 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.
+ */
+
+/**
+ * @file ewk_web_error.h
+ * @brief Describes the Web Error API.
+ */
+
+#ifndef ewk_web_error_h
+#define ewk_web_error_h
+
+#include <Eina.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** Creates a type name for @a Ewk_Web_Error. */
+typedef struct _Ewk_Web_Error Ewk_Web_Error;
+
+/// Creates a type name for Ewk_Web_Error_Type.
+typedef enum {
+ EWK_WEB_ERROR_TYPE_NONE,
+ EWK_WEB_ERROR_TYPE_INTERNAL,
+ EWK_WEB_ERROR_TYPE_HTTP,
+ EWK_WEB_ERROR_TYPE_IO,
+ EWK_WEB_ERROR_TYPE_DOWNLOAD
+} Ewk_Web_Error_Type;
+
+/**
+ * Frees the given object.
+ *
+ * @param error the error object to free
+ */
+EAPI void ewk_web_error_free(Ewk_Web_Error *error);
+
+/**
+ * Query type for this error.
+ *
+ * @param error error object to query.
+ *
+ * @return the error type, that may be @c NULL. This pointer is
+ * guaranteed to be eina_stringshare, so whenever possible
+ * save yourself some cpu cycles and use
+ * eina_stringshare_ref() instead of eina_stringshare_add() or
+ * strdup().
+ */
+EAPI Ewk_Web_Error_Type ewk_web_error_type_get(const Ewk_Web_Error *error);
+
+/**
+ * Query failing URL for this error.
+ *
+ * URL that failed loading.
+ *
+ * @param error error object to query.
+ *
+ * @return the URL pointer, that may be @c NULL. This pointer is
+ * guaranteed to be eina_stringshare, so whenever possible
+ * save yourself some cpu cycles and use
+ * eina_stringshare_ref() instead of eina_stringshare_add() or
+ * strdup().
+ */
+EAPI const char *ewk_web_error_url_get(const Ewk_Web_Error *error);
+
+/**
+ * Query HTTP error code.
+ *
+ * @param error error object to query.
+ *
+ * @return the HTTP error code.
+ */
+EAPI int ewk_web_error_code_get(const Ewk_Web_Error *error);
+
+/**
+ * Query description for this error.
+ *
+ * @param error error object to query.
+ *
+ * @return the description pointer, that may be @c NULL. This pointer is
+ * guaranteed to be eina_stringshare, so whenever possible
+ * save yourself some cpu cycles and use
+ * eina_stringshare_ref() instead of eina_stringshare_add() or
+ * strdup().
+ */
+EAPI const char *ewk_web_error_description_get(const Ewk_Web_Error *error);
+
+/**
+ * Query if error should be treated as a cancellation.
+ *
+ * @param error error object to query.
+ *
+ * @return @c EINA_TRUE if this error should be treated as a cancellation, @c EINA_FALSE otherwise
+ */
+EAPI Eina_Bool ewk_web_error_cancellation_get(const Ewk_Web_Error *error);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // ewk_web_error_h
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_web_error_private.h b/Source/WebKit2/UIProcess/API/efl/ewk_web_error_private.h
new file mode 100644
index 000000000..c9a31e50a
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_web_error_private.h
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2012 Intel Corporation. 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 ewk_web_error_private_h
+#define ewk_web_error_private_h
+
+#include <WKError.h>
+
+typedef struct _Ewk_Web_Error Ewk_Web_Error;
+
+Ewk_Web_Error* ewk_web_error_new(WKErrorRef error);
+
+#endif // ewk_web_error_private_h
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_web_resource.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_web_resource.cpp
new file mode 100644
index 000000000..ce1ddde65
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_web_resource.cpp
@@ -0,0 +1,83 @@
+/*
+ * Copyright (C) 2012 Intel Corporation. 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 "ewk_web_resource.h"
+
+#include "ewk_web_resource_private.h"
+#include <wtf/text/CString.h>
+
+struct _Ewk_Web_Resource {
+ unsigned int __ref; /**< the reference count of the object */
+ CString url;
+ bool isMainResource;
+};
+
+void ewk_web_resource_ref(Ewk_Web_Resource* resource)
+{
+ EINA_SAFETY_ON_NULL_RETURN(resource);
+
+ ++resource->__ref;
+}
+
+void ewk_web_resource_unref(Ewk_Web_Resource* resource)
+{
+ EINA_SAFETY_ON_NULL_RETURN(resource);
+
+ if (--resource->__ref)
+ return;
+
+ free(resource);
+}
+
+const char* ewk_web_resource_url_get(const Ewk_Web_Resource* resource)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(resource, 0);
+
+ return resource->url.data();
+}
+
+/**
+ * @internal
+ * Constructs a Ewk_Web_Resource.
+ */
+Ewk_Web_Resource* ewk_web_resource_new(const char* url, bool isMainResource)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(url, 0);
+
+ Ewk_Web_Resource* resource = static_cast<Ewk_Web_Resource*>(calloc(1, sizeof(Ewk_Web_Resource)));
+ resource->url = url;
+ resource->isMainResource = isMainResource;
+ resource->__ref = 1;
+
+ return resource;
+}
+
+Eina_Bool ewk_web_resource_main_resource_get(const Ewk_Web_Resource* resource)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(resource, false);
+
+ return resource->isMainResource;
+}
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_web_resource.h b/Source/WebKit2/UIProcess/API/efl/ewk_web_resource.h
new file mode 100644
index 000000000..6a3b0802b
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_web_resource.h
@@ -0,0 +1,81 @@
+/*
+ * Copyright (C) 2012 Intel Corporation. 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.
+ */
+
+/**
+ * @file ewk_web_resource.h
+ * @brief Describes the Web Resource API.
+ */
+
+#ifndef ewk_web_resource_h
+#define ewk_web_resource_h
+
+#include <Eina.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** Creates a type name for @a Ewk_Web_Resource. */
+typedef struct _Ewk_Web_Resource Ewk_Web_Resource;
+
+/**
+ * Increases the reference count of the given object.
+ *
+ * @param resource the resource object to increase the reference count
+ */
+EAPI void ewk_web_resource_ref(Ewk_Web_Resource *resource);
+
+/**
+ * Decreases the reference count of the given object, possibly freeing it.
+ *
+ * When the reference count it's reached 0, the resource is freed.
+ *
+ * @param resource the resource object to decrease the reference count
+ */
+EAPI void ewk_web_resource_unref(Ewk_Web_Resource *resource);
+
+/**
+ * Query URL for this resource.
+ *
+ * @param resource resource object to query.
+ *
+ * @return the URL pointer, that may be @c NULL.
+ */
+EAPI const char *ewk_web_resource_url_get(const Ewk_Web_Resource *resource);
+
+/**
+ * Query if this is the main resource.
+ *
+ * @param resource resource object to query.
+ *
+ * @return @c EINA_TRUE if this is the main resource, @c EINA_FALSE otherwise
+ */
+EAPI Eina_Bool ewk_web_resource_main_resource_get(const Ewk_Web_Resource *resource);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // ewk_web_resource_h
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_web_resource_private.h b/Source/WebKit2/UIProcess/API/efl/ewk_web_resource_private.h
new file mode 100644
index 000000000..5b44fe19f
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_web_resource_private.h
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2012 Intel Corporation. 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 ewk_web_resource_private_h
+#define ewk_web_resource_private_h
+
+typedef struct _Ewk_Web_Resource Ewk_Web_Resource;
+
+Ewk_Web_Resource* ewk_web_resource_new(const char* uri, bool isMainResource);
+
+#endif // ewk_web_resource_private_h
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitSettings.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitSettings.cpp
index 9e24aabb1..5e0be7d32 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitSettings.cpp
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitSettings.cpp
@@ -112,7 +112,9 @@ enum {
PROP_JAVASCRIPT_CAN_ACCESS_CLIPBOARD,
PROP_MEDIA_PLAYBACK_REQUIRES_USER_GESTURE,
PROP_MEDIA_PLAYBACK_ALLOWS_INLINE,
- PROP_DRAW_COMPOSITING_INDICATORS
+ PROP_DRAW_COMPOSITING_INDICATORS,
+ PROP_ENABLE_SITE_SPECIFIC_QUIRKS,
+ PROP_ENABLE_PAGE_CACHE
};
static void webKitSettingsSetProperty(GObject* object, guint propId, const GValue* value, GParamSpec* paramSpec)
@@ -237,6 +239,12 @@ static void webKitSettingsSetProperty(GObject* object, guint propId, const GValu
case PROP_DRAW_COMPOSITING_INDICATORS:
webkit_settings_set_draw_compositing_indicators(settings, g_value_get_boolean(value));
break;
+ case PROP_ENABLE_SITE_SPECIFIC_QUIRKS:
+ webkit_settings_set_enable_site_specific_quirks(settings, g_value_get_boolean(value));
+ break;
+ case PROP_ENABLE_PAGE_CACHE:
+ webkit_settings_set_enable_page_cache(settings, g_value_get_boolean(value));
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propId, paramSpec);
break;
@@ -365,6 +373,12 @@ static void webKitSettingsGetProperty(GObject* object, guint propId, GValue* val
case PROP_DRAW_COMPOSITING_INDICATORS:
g_value_set_boolean(value, webkit_settings_get_draw_compositing_indicators(settings));
break;
+ case PROP_ENABLE_SITE_SPECIFIC_QUIRKS:
+ g_value_set_boolean(value, webkit_settings_get_enable_site_specific_quirks(settings));
+ break;
+ case PROP_ENABLE_PAGE_CACHE:
+ g_value_set_boolean(value, webkit_settings_get_enable_page_cache(settings));
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propId, paramSpec);
break;
@@ -957,6 +971,45 @@ static void webkit_settings_class_init(WebKitSettingsClass* klass)
FALSE,
readWriteConstructParamFlags));
+ /**
+ * WebKitSettings:enable-site-specific-quirks:
+ *
+ * Whether to turn on site-specific quirks. Turning this on will
+ * tell WebKit to use some site-specific workarounds for
+ * better web compatibility. For example, older versions of
+ * MediaWiki will incorrectly send to WebKit a css file with KHTML
+ * workarounds. By turning on site-specific quirks, WebKit will
+ * special-case this and other cases to make some specific sites work.
+ */
+ g_object_class_install_property(gObjectClass,
+ PROP_ENABLE_SITE_SPECIFIC_QUIRKS,
+ g_param_spec_boolean("enable-site-specific-quirks",
+ _("Enable Site Specific Quirks"),
+ _("Enables the site-specific compatibility workarounds"),
+ FALSE,
+ readWriteConstructParamFlags));
+
+ /**
+ * WebKitSettings:enable-page-cache:
+ *
+ * Enable or disable the page cache. Disabling the page cache is
+ * generally only useful for special circumstances like low-memory
+ * scenarios or special purpose applications like static HTML
+ * viewers. This setting only controls the Page Cache, this cache
+ * is different than the disk-based or memory-based traditional
+ * resource caches, its point is to make going back and forth
+ * between pages much faster. For details about the different types
+ * of caches and their purposes see:
+ * http://webkit.org/blog/427/webkit-page-cache-i-the-basics/
+ */
+ g_object_class_install_property(gObjectClass,
+ PROP_ENABLE_PAGE_CACHE,
+ g_param_spec_boolean("enable-page-cache",
+ _("Enable page cache"),
+ _("Whether the page cache should be used"),
+ TRUE,
+ readWriteConstructParamFlags));
+
g_type_class_add_private(klass, sizeof(WebKitSettingsPrivate));
}
@@ -2432,3 +2485,73 @@ gboolean webkit_settings_get_draw_compositing_indicators(WebKitSettings* setting
return WKPreferencesGetCompositingBordersVisible(settings->priv->preferences.get())
&& WKPreferencesGetCompositingRepaintCountersVisible(settings->priv->preferences.get());
}
+
+/**
+ * webkit_settings_get_enable_site_specific_quirks:
+ * @settings: a #WebKitSettings
+ *
+ * Get the #WebKitSettings:enable-site-specific-quirks property.
+ *
+ * Returns: %TRUE if site specific quirks are enabled or %FALSE otherwise.
+ */
+gboolean webkit_settings_get_enable_site_specific_quirks(WebKitSettings* settings)
+{
+ g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), FALSE);
+
+ return WKPreferencesGetNeedsSiteSpecificQuirks(settings->priv->preferences.get());
+}
+
+/**
+ * webkit_settings_set_enable_site_specific_quirks:
+ * @settings: a #WebKitSettings
+ * @enabled: Value to be set
+ *
+ * Set the #WebKitSettings:enable-site-specific-quirks property.
+ */
+void webkit_settings_set_enable_site_specific_quirks(WebKitSettings* settings, gboolean enabled)
+{
+ g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
+
+ WebKitSettingsPrivate* priv = settings->priv;
+ bool currentValue = WKPreferencesGetNeedsSiteSpecificQuirks(priv->preferences.get());
+ if (currentValue == enabled)
+ return;
+
+ WKPreferencesSetNeedsSiteSpecificQuirks(priv->preferences.get(), enabled);
+ g_object_notify(G_OBJECT(settings), "enable-site-specific-quirks");
+}
+
+/**
+ * webkit_settings_get_enable_page_cache:
+ * @settings: a #WebKitSettings
+ *
+ * Get the #WebKitSettings:enable-page-cache property.
+ *
+ * Returns: %TRUE if page cache enabled or %FALSE otherwise.
+ */
+gboolean webkit_settings_get_enable_page_cache(WebKitSettings* settings)
+{
+ g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), FALSE);
+
+ return WKPreferencesGetPageCacheEnabled(settings->priv->preferences.get());
+}
+
+/**
+ * webkit_settings_set_enable_page_cache:
+ * @settings: a #WebKitSettings
+ * @enabled: Value to be set
+ *
+ * Set the #WebKitSettings:enable-page-cache property.
+ */
+void webkit_settings_set_enable_page_cache(WebKitSettings* settings, gboolean enabled)
+{
+ g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
+
+ WebKitSettingsPrivate* priv = settings->priv;
+ bool currentValue = WKPreferencesGetPageCacheEnabled(priv->preferences.get());
+ if (currentValue == enabled)
+ return;
+
+ WKPreferencesSetPageCacheEnabled(priv->preferences.get(), enabled);
+ g_object_notify(G_OBJECT(settings), "enable-page-cache");
+}
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitSettings.h b/Source/WebKit2/UIProcess/API/gtk/WebKitSettings.h
index a86d6bc1e..0c719cd47 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitSettings.h
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitSettings.h
@@ -347,6 +347,21 @@ webkit_settings_get_draw_compositing_indicators (WebKitSettings *
WEBKIT_API void
webkit_settings_set_draw_compositing_indicators (WebKitSettings *settings,
gboolean enabled);
+
+WEBKIT_API gboolean
+webkit_settings_get_enable_site_specific_quirks (WebKitSettings *settings);
+
+WEBKIT_API void
+webkit_settings_set_enable_site_specific_quirks (WebKitSettings *settings,
+ gboolean enabled);
+
+WEBKIT_API gboolean
+webkit_settings_get_enable_page_cache (WebKitSettings *settings);
+
+WEBKIT_API void
+webkit_settings_set_enable_page_cache (WebKitSettings *settings,
+ gboolean enabled);
+
G_END_DECLS
#endif /* WebKitSettings_h */
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp
index 372f46637..8a0625c07 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp
@@ -162,11 +162,10 @@ WebKitWebContext* webkit_web_context_get_default(void)
* these caches, including various WebCore caches.
*
* Browsers can improve document load speed substantially by
- * specifying WEBKIT_CACHE_MODEL_WEB_BROWSER. Applications without a
+ * specifying %WEBKIT_CACHE_MODEL_WEB_BROWSER. Applications without a
* browsing interface can reduce memory usage substantially by
- * specifying WEBKIT_CACHE_MODEL_DOCUMENT_VIEWER. The default value is
- * WEBKIT_CACHE_MODEL_WEB_BROWSER.
- *
+ * specifying %WEBKIT_CACHE_MODEL_DOCUMENT_VIEWER. The default value is
+ * %WEBKIT_CACHE_MODEL_WEB_BROWSER.
*/
void webkit_web_context_set_cache_model(WebKitWebContext* context, WebKitCacheModel model)
{
@@ -221,6 +220,21 @@ WebKitCacheModel webkit_web_context_get_cache_model(WebKitWebContext* context)
return WEBKIT_CACHE_MODEL_WEB_BROWSER;
}
+/**
+ * webkit_web_context_clear_cache:
+ * @context: a #WebKitWebContext
+ *
+ * Clears all resources currently cached.
+ * See also webkit_web_context_set_cache_model().
+ */
+void webkit_web_context_clear_cache(WebKitWebContext* context)
+{
+ g_return_if_fail(WEBKIT_IS_WEB_CONTEXT(context));
+
+ WebKitWebContextPrivate* priv = context->priv;
+ WKResourceCacheManagerClearCacheForAllOrigins(WKContextGetResourceCacheManager(priv->context.get()), WKResourceCachesToClearAll);
+}
+
typedef HashMap<WKDownloadRef, GRefPtr<WebKitDownload> > DownloadsMap;
static DownloadsMap& downloadsMap()
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.h b/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.h
index 1325017d1..83b601a38 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.h
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.h
@@ -51,7 +51,7 @@ G_BEGIN_DECLS
* @WEBKIT_CACHE_MODEL_WEB_BROWSER: Improve document load speed substantially
* by caching a very large number of resources and previously viewed content.
*
- * Enum values used for determining the webview cache model.
+ * Enum values used for determining the #WebKitWebContext cache model.
*/
typedef enum {
WEBKIT_CACHE_MODEL_DOCUMENT_VIEWER,
@@ -103,6 +103,9 @@ webkit_web_context_set_cache_model (WebKitWebContext
WEBKIT_API WebKitCacheModel
webkit_web_context_get_cache_model (WebKitWebContext *context);
+WEBKIT_API void
+webkit_web_context_clear_cache (WebKitWebContext *context);
+
WEBKIT_API WebKitDownload *
webkit_web_context_download_uri (WebKitWebContext *context,
const gchar *uri);
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp
index 94a94ca09..8bfabeec6 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp
@@ -88,6 +88,7 @@ enum {
RUN_FILE_CHOOSER,
CONTEXT_MENU,
+ CONTEXT_MENU_DISMISSED,
LAST_SIGNAL
};
@@ -1043,6 +1044,22 @@ static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass)
WEBKIT_TYPE_CONTEXT_MENU,
GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE,
WEBKIT_TYPE_HIT_TEST_RESULT);
+
+ /**
+ * WebKitWebView::context-menu-dismissed:
+ * @web_view: the #WebKitWebView on which the signal is emitted
+ *
+ * Emitted after #WebKitWebView::context-menu signal, if the context menu is shown,
+ * to notify that the context menu is dismissed.
+ */
+ signals[CONTEXT_MENU_DISMISSED] =
+ g_signal_new("context-menu-dismissed",
+ G_TYPE_FROM_CLASS(webViewClass),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET(WebKitWebViewClass, context_menu_dismissed),
+ 0, 0,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
}
static bool updateReplaceContentStatus(WebKitWebView* webView, WebKitLoadEvent loadEvent)
@@ -1338,6 +1355,11 @@ static void webkitWebViewCreateAndAppendInputMethodsMenuItem(WebKitWebView* webV
webkit_context_menu_insert(contextMenu, menuItem, unicodeMenuItemPosition);
}
+static void contextMenuDismissed(GtkMenuShell*, WebKitWebView* webView)
+{
+ g_signal_emit(webView, signals[CONTEXT_MENU_DISMISSED], 0, NULL);
+}
+
void webkitWebViewPopulateContextMenu(WebKitWebView* webView, WKArrayRef wkProposedMenu, WKHitTestResultRef wkHitTestResult)
{
WebKitWebViewBase* webViewBase = WEBKIT_WEB_VIEW_BASE(webView);
@@ -1360,6 +1382,8 @@ void webkitWebViewPopulateContextMenu(WebKitWebView* webView, WKArrayRef wkPropo
webkitContextMenuPopulate(contextMenu.get(), contextMenuItems);
contextMenuProxy->populate(contextMenuItems);
+ g_signal_connect(contextMenuProxy->gtkMenu(), "deactivate", G_CALLBACK(contextMenuDismissed), webView);
+
// Clear the menu to make sure it's useless after signal emission.
webkit_context_menu_remove_all(contextMenu.get());
}
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.h b/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.h
index 9328fa12f..bac32a78e 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.h
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.h
@@ -127,42 +127,43 @@ struct _WebKitWebView {
struct _WebKitWebViewClass {
WebKitWebViewBaseClass parent;
- void (* load_changed) (WebKitWebView *web_view,
- WebKitLoadEvent load_event);
- gboolean (* load_failed) (WebKitWebView *web_view,
- WebKitLoadEvent load_event,
- const gchar *failing_uri,
- GError *error);
-
- GtkWidget *(* create) (WebKitWebView *web_view);
- void (* ready_to_show) (WebKitWebView *web_view);
- void (* run_as_modal) (WebKitWebView *web_view);
- void (* close) (WebKitWebView *web_view);
-
- gboolean (* script_dialog) (WebKitWebView *web_view,
- WebKitScriptDialog *dialog);
-
- gboolean (* decide_policy) (WebKitWebView *web_view,
- WebKitPolicyDecision *decision,
- WebKitPolicyDecisionType type);
- gboolean (* permission_request) (WebKitWebView *web_view,
- WebKitPermissionRequest *permission_request);
- void (* mouse_target_changed) (WebKitWebView *web_view,
- WebKitHitTestResult *hit_test_result,
- guint modifiers);
- gboolean (* print_requested) (WebKitWebView *web_view,
- WebKitPrintOperation *print_operation);
- void (* resource_load_started) (WebKitWebView *web_view,
- WebKitWebResource *resource,
- WebKitURIRequest *request);
- gboolean (* enter_fullscreen) (WebKitWebView *web_view);
- gboolean (* leave_fullscreen) (WebKitWebView *web_view);
- gboolean (* run_file_chooser) (WebKitWebView *web_view,
- WebKitFileChooserRequest *request);
- gboolean (* context_menu) (WebKitWebView *web_view,
- WebKitContextMenu *context_menu,
- GdkEvent *event,
- WebKitHitTestResult *hit_test_result);
+ void (* load_changed) (WebKitWebView *web_view,
+ WebKitLoadEvent load_event);
+ gboolean (* load_failed) (WebKitWebView *web_view,
+ WebKitLoadEvent load_event,
+ const gchar *failing_uri,
+ GError *error);
+
+ GtkWidget *(* create) (WebKitWebView *web_view);
+ void (* ready_to_show) (WebKitWebView *web_view);
+ void (* run_as_modal) (WebKitWebView *web_view);
+ void (* close) (WebKitWebView *web_view);
+
+ gboolean (* script_dialog) (WebKitWebView *web_view,
+ WebKitScriptDialog *dialog);
+
+ gboolean (* decide_policy) (WebKitWebView *web_view,
+ WebKitPolicyDecision *decision,
+ WebKitPolicyDecisionType type);
+ gboolean (* permission_request) (WebKitWebView *web_view,
+ WebKitPermissionRequest *permission_request);
+ void (* mouse_target_changed) (WebKitWebView *web_view,
+ WebKitHitTestResult *hit_test_result,
+ guint modifiers);
+ gboolean (* print_requested) (WebKitWebView *web_view,
+ WebKitPrintOperation *print_operation);
+ void (* resource_load_started) (WebKitWebView *web_view,
+ WebKitWebResource *resource,
+ WebKitURIRequest *request);
+ gboolean (* enter_fullscreen) (WebKitWebView *web_view);
+ gboolean (* leave_fullscreen) (WebKitWebView *web_view);
+ gboolean (* run_file_chooser) (WebKitWebView *web_view,
+ WebKitFileChooserRequest *request);
+ gboolean (* context_menu) (WebKitWebView *web_view,
+ WebKitContextMenu *context_menu,
+ GdkEvent *event,
+ WebKitHitTestResult *hit_test_result);
+ void (* context_menu_dismissed) (WebKitWebView *web_view);
/* Padding for future expansion */
void (*_webkit_reserved0) (void);
diff --git a/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt b/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt
index aca34df0b..ed66eb479 100644
--- a/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt
+++ b/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt
@@ -27,6 +27,7 @@ WebKitCacheModel
webkit_web_context_get_default
webkit_web_context_get_cache_model
webkit_web_context_set_cache_model
+webkit_web_context_clear_cache
webkit_web_context_download_uri
webkit_web_context_get_cookie_manager
webkit_web_context_set_additional_plugins_directory
@@ -268,6 +269,10 @@ webkit_settings_get_media_playback_allows_inline
webkit_settings_set_media_playback_allows_inline
webkit_settings_get_draw_compositing_indicators
webkit_settings_set_draw_compositing_indicators
+webkit_settings_get_enable_site_specific_quirks
+webkit_settings_set_enable_site_specific_quirks
+webkit_settings_get_enable_page_cache
+webkit_settings_set_enable_page_cache
<SUBSECTION Standard>
WebKitSettingsClass
diff --git a/Source/WebKit2/UIProcess/API/gtk/tests/TestContextMenu.cpp b/Source/WebKit2/UIProcess/API/gtk/tests/TestContextMenu.cpp
index f74016006..876685712 100644
--- a/Source/WebKit2/UIProcess/API/gtk/tests/TestContextMenu.cpp
+++ b/Source/WebKit2/UIProcess/API/gtk/tests/TestContextMenu.cpp
@@ -49,11 +49,17 @@ public:
return test->contextMenu(contextMenu, event, hitTestResult);
}
+ static void contextMenuDismissedCallback(WebKitWebView*, ContextMenuTest* test)
+ {
+ test->contextMenuDismissed();
+ }
+
ContextMenuTest()
: m_menuPositionX(0)
, m_menuPositionY(0)
{
g_signal_connect(m_webView, "context-menu", G_CALLBACK(contextMenuCallback), this);
+ g_signal_connect(m_webView, "context-menu-dismissed", G_CALLBACK(contextMenuDismissedCallback), this);
}
~ContextMenuTest()
@@ -63,6 +69,11 @@ public:
virtual bool contextMenu(WebKitContextMenu*, GdkEvent*, WebKitHitTestResult*) = 0;
+ virtual void contextMenuDismissed()
+ {
+ quitMainLoop();
+ }
+
bool shouldShowInputMethodsMenu()
{
GtkSettings* settings = gtk_widget_get_settings(GTK_WIDGET(m_webView));
@@ -183,6 +194,18 @@ public:
showContextMenuAtPositionAndWaitUntilFinished(0, 0);
}
+ static gboolean simulateEscKeyIdleCallback(ContextMenuTest* test)
+ {
+ test->keyStroke(GDK_KEY_Escape);
+ return FALSE;
+ }
+
+ void dismissContextMenuAndWaitUntilFinished()
+ {
+ g_idle_add(reinterpret_cast<GSourceFunc>(simulateEscKeyIdleCallback), this);
+ g_main_loop_run(m_mainLoop);
+ }
+
double m_menuPositionX;
double m_menuPositionY;
};
@@ -405,7 +428,6 @@ public:
GtkMenuItem* item = getMenuItem(menu, m_itemToActivateLabel);
gtk_menu_shell_activate_item(GTK_MENU_SHELL(menu), GTK_WIDGET(item), TRUE);
m_itemToActivateLabel = 0;
- quitMainLoop();
}
static gboolean activateMenuItemIdleCallback(gpointer userData)
@@ -657,6 +679,48 @@ static void testContextMenuSubMenu(ContextMenuSubmenuTest* test, gconstpointer)
test->showContextMenuAndWaitUntilFinished();
}
+class ContextMenuDismissedTest: public ContextMenuTest {
+public:
+ MAKE_GLIB_TEST_FIXTURE(ContextMenuDismissedTest);
+
+ ContextMenuDismissedTest()
+ : m_dismissed(false)
+ {
+ }
+
+ bool contextMenu(WebKitContextMenu* contextMenu, GdkEvent*, WebKitHitTestResult*)
+ {
+ quitMainLoop();
+ // Show the default context menu.
+ return false;
+ }
+
+ void contextMenuDismissed()
+ {
+ m_dismissed = true;
+ ContextMenuTest::contextMenuDismissed();
+ }
+
+ void showContextMenuAndWaitUntilDismissed()
+ {
+ showContextMenuAndWaitUntilFinished();
+ dismissContextMenuAndWaitUntilFinished();
+ }
+
+ bool m_dismissed;
+};
+
+static void testContextMenuDismissed(ContextMenuDismissedTest* test, gconstpointer)
+{
+ test->showInWindowAndWaitUntilMapped();
+
+ test->loadHtml("<html><body>WebKitGTK+ Context menu tests</body></html>", "file:///");
+ test->waitUntilLoadFinished();
+
+ test->showContextMenuAndWaitUntilDismissed();
+ g_assert(test->m_dismissed);
+}
+
void beforeAll()
{
ContextMenuDefaultTest::add("WebKitWebView", "default-menu", testContextMenuDefaultMenu);
@@ -664,6 +728,7 @@ void beforeAll()
ContextMenuCustomFullTest::add("WebKitWebView", "custom-menu", testContextMenuCustomMenu);
ContextMenuDisabledTest::add("WebKitWebView", "disable-menu", testContextMenuDisableMenu);
ContextMenuSubmenuTest::add("WebKitWebView", "submenu", testContextMenuSubMenu);
+ ContextMenuDismissedTest::add("WebKitWebView", "menu-dismissed", testContextMenuDismissed);
}
void afterAll()
diff --git a/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitSettings.cpp b/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitSettings.cpp
index 2cebdd995..5e6e91b09 100644
--- a/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitSettings.cpp
+++ b/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitSettings.cpp
@@ -229,6 +229,16 @@ static void testWebKitSettings(Test*, gconstpointer)
webkit_settings_set_draw_compositing_indicators(settings, TRUE);
g_assert(webkit_settings_get_draw_compositing_indicators(settings));
+ // By default, site specific quirks are disabled.
+ g_assert(!webkit_settings_get_enable_site_specific_quirks(settings));
+ webkit_settings_set_enable_site_specific_quirks(settings, TRUE);
+ g_assert(webkit_settings_get_enable_site_specific_quirks(settings));
+
+ // By default, page cache is enabled.
+ g_assert(webkit_settings_get_enable_page_cache(settings));
+ webkit_settings_set_enable_page_cache(settings, FALSE);
+ g_assert(!webkit_settings_get_enable_page_cache(settings));
+
g_object_unref(G_OBJECT(settings));
}
diff --git a/Source/WebKit2/UIProcess/API/mac/PageClientImpl.h b/Source/WebKit2/UIProcess/API/mac/PageClientImpl.h
index 8af6ff40c..98da7eceb 100644
--- a/Source/WebKit2/UIProcess/API/mac/PageClientImpl.h
+++ b/Source/WebKit2/UIProcess/API/mac/PageClientImpl.h
@@ -44,6 +44,8 @@ class PageClientImpl : public PageClient {
public:
static PassOwnPtr<PageClientImpl> create(WKView*);
virtual ~PageClientImpl();
+
+ void viewWillMoveToAnotherWindow();
private:
PageClientImpl(WKView*);
diff --git a/Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm b/Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm
index 3bd702078..457ce921f 100644
--- a/Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm
+++ b/Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm
@@ -201,6 +201,11 @@ bool PageClientImpl::isViewInWindow()
return [m_wkView window];
}
+void PageClientImpl::viewWillMoveToAnotherWindow()
+{
+ clearAllEditCommands();
+}
+
LayerHostingMode PageClientImpl::viewLayerHostingMode()
{
#if HAVE(LAYER_HOSTING_IN_WINDOW_SERVER)
diff --git a/Source/WebKit2/UIProcess/API/mac/WKView.mm b/Source/WebKit2/UIProcess/API/mac/WKView.mm
index aa8dc8521..e883215fd 100644
--- a/Source/WebKit2/UIProcess/API/mac/WKView.mm
+++ b/Source/WebKit2/UIProcess/API/mac/WKView.mm
@@ -1883,6 +1883,8 @@ static NSString * const backingPropertyOldScaleFactorKey = @"NSBackingPropertyOl
if (window == currentWindow)
return;
+ _data->_pageClient->viewWillMoveToAnotherWindow();
+
[self removeWindowObservers];
[self addWindowObserversForWindow:window];
diff --git a/Source/WebKit2/UIProcess/API/qt/qwebkittest.cpp b/Source/WebKit2/UIProcess/API/qt/qwebkittest.cpp
index 0930708d4..1c39a53cd 100644
--- a/Source/WebKit2/UIProcess/API/qt/qwebkittest.cpp
+++ b/Source/WebKit2/UIProcess/API/qt/qwebkittest.cpp
@@ -23,9 +23,10 @@
#include "QtViewportHandler.h"
#include "qquickwebview_p_p.h"
-#include "qwindowsysteminterface_qpa.h"
#include <QMutableListIterator>
#include <QTouchEvent>
+#include <QWheelEvent>
+#include <qpa/qwindowsysteminterface.h>
using namespace WebKit;
@@ -113,6 +114,24 @@ bool QWebKitTest::touchDoubleTap(QObject* item, qreal x, qreal y, int delay)
return true;
}
+bool QWebKitTest::wheelEvent(QObject* item, qreal x, qreal y, int delta, Qt::Orientation orient)
+{
+ QQuickWebView* window = qobject_cast<QQuickWebView*>(item);
+
+ if (!window) {
+ qWarning("Wheel event not accepted by receiving item");
+ return false;
+ }
+
+ QWheelEvent event(QPointF(x, y), delta, Qt::NoButton, Qt::NoModifier, orient);
+ event.setTimestamp(QDateTime::currentMSecsSinceEpoch());
+ event.setAccepted(false);
+
+ window->wheelEvent(&event);
+
+ return event.isAccepted();
+}
+
QSize QWebKitTest::contentsSize() const
{
return QSize(m_webViewPrivate->pageView->contentsSize().toSize());
diff --git a/Source/WebKit2/UIProcess/API/qt/qwebkittest_p.h b/Source/WebKit2/UIProcess/API/qt/qwebkittest_p.h
index 982398d3a..c0d3e1187 100644
--- a/Source/WebKit2/UIProcess/API/qt/qwebkittest_p.h
+++ b/Source/WebKit2/UIProcess/API/qt/qwebkittest_p.h
@@ -56,6 +56,7 @@ signals:
public slots:
bool touchTap(QObject* item, qreal x, qreal y, int delay = -1);
bool touchDoubleTap(QObject* item, qreal x, qreal y, int delay = -1);
+ bool wheelEvent(QObject* item, qreal x, qreal y, int delta, Qt::Orientation orient = Qt::Vertical);
public:
QWebKitTest(QQuickWebViewPrivate* webviewPrivate, QObject* parent = 0);
diff --git a/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview.cpp b/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview.cpp
new file mode 100644
index 000000000..16bb567ba
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview.cpp
@@ -0,0 +1,384 @@
+/*
+ Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies)
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#include "config.h"
+#include "qrawwebview_p.h"
+
+#include "Cursor.h"
+#include "DrawingAreaProxyImpl.h"
+#include "LayerTreeCoordinatorProxy.h"
+#include "NativeWebKeyboardEvent.h"
+#include "NativeWebMouseEvent.h"
+#include "NativeWebTouchEvent.h"
+#include "NativeWebWheelEvent.h"
+#include "NotImplemented.h"
+#include "WebContext.h"
+#include "WebLayerTreeRenderer.h"
+#include "WebPageGroup.h"
+#include "WebPreferences.h"
+#include "qrawwebview_p_p.h"
+#include <WebKit2/qrawwebview_p.h>
+
+void QRawWebViewPrivate::didReceiveMessageFromNavigatorQtObject(const String& message)
+{
+ notImplemented();
+}
+
+void QRawWebViewPrivate::didChangeViewportProperties(const WebCore::ViewportAttributes& attr)
+{
+ notImplemented();
+}
+
+void QRawWebViewPrivate::handleDownloadRequest(WebKit::DownloadProxy* download)
+{
+ notImplemented();
+}
+
+void QRawWebViewPrivate::handleAuthenticationRequiredRequest(const String& hostname, const String& realm, const String& prefilledUsername, String& username, String& password)
+{
+ notImplemented();
+}
+
+void QRawWebViewPrivate::handleCertificateVerificationRequest(const String& hostname, bool& ignoreErrors)
+{
+ notImplemented();
+}
+
+void QRawWebViewPrivate::handleProxyAuthenticationRequiredRequest(const String& hostname, uint16_t port, const String& prefilledUsername, String& username, String& password)
+{
+ notImplemented();
+}
+
+void QRawWebViewPrivate::registerEditCommand(PassRefPtr<WebKit::WebEditCommandProxy>, WebKit::WebPageProxy::UndoOrRedo)
+{
+ notImplemented();
+}
+
+bool QRawWebViewPrivate::canUndoRedo(WebKit::WebPageProxy::UndoOrRedo undoOrRedo)
+{
+ notImplemented();
+ return false;
+}
+
+void QRawWebViewPrivate::executeUndoRedo(WebKit::WebPageProxy::UndoOrRedo undoOrRedo)
+{
+ notImplemented();
+}
+
+WebCore::FloatRect QRawWebViewPrivate::convertToDeviceSpace(const WebCore::FloatRect& rect)
+{
+ notImplemented();
+ return rect;
+}
+
+WebCore::FloatRect QRawWebViewPrivate::convertToUserSpace(const WebCore::FloatRect& rect)
+{
+ notImplemented();
+ return rect;
+}
+
+WebCore::IntPoint QRawWebViewPrivate::screenToWindow(const WebCore::IntPoint& point)
+{
+ notImplemented();
+ return point;
+}
+
+WebCore::IntRect QRawWebViewPrivate::windowToScreen(const WebCore::IntRect& rect)
+{
+ notImplemented();
+ return rect;
+}
+
+#if USE(ACCELERATED_COMPOSITING)
+void QRawWebViewPrivate::enterAcceleratedCompositingMode(const WebKit::LayerTreeContext&)
+{
+ notImplemented();
+}
+
+void QRawWebViewPrivate::exitAcceleratedCompositingMode()
+{
+ notImplemented();
+}
+
+void QRawWebViewPrivate::updateAcceleratedCompositingMode(const WebKit::LayerTreeContext&)
+{
+ notImplemented();
+}
+
+#endif // USE(ACCELERATED_COMPOSITING)
+
+void QRawWebViewPrivate::updateTextInputState()
+{
+ notImplemented();
+}
+
+#if ENABLE(GESTURE_EVENTS)
+void QRawWebViewPrivate::doneWithGestureEvent(const WebKit::WebGestureEvent& event, bool wasEventHandled)
+{
+ notImplemented();
+}
+
+#endif
+void QRawWebViewPrivate::displayView()
+{
+ notImplemented();
+}
+
+void QRawWebViewPrivate::scrollView(const WebCore::IntRect& scrollRect, const WebCore::IntSize& scrollOffset)
+{
+ notImplemented();
+}
+
+void QRawWebViewPrivate::flashBackingStoreUpdates(const Vector<WebCore::IntRect>&)
+{
+ notImplemented();
+}
+
+void QRawWebViewPrivate::didFindZoomableArea(const WebCore::IntPoint& target, const WebCore::IntRect& area)
+{
+ notImplemented();
+}
+
+void QRawWebViewPrivate::setCursorHiddenUntilMouseMoves(bool hiddenUntilMouseMoves)
+{
+ notImplemented();
+}
+
+void QRawWebViewPrivate::toolTipChanged(const String&, const String& newTooltip)
+{
+ notImplemented();
+}
+
+void QRawWebViewPrivate::startDrag(const WebCore::DragData& dragData, PassRefPtr<WebKit::ShareableBitmap> dragImage)
+{
+ notImplemented();
+}
+
+PassRefPtr<WebKit::WebPopupMenuProxy> QRawWebViewPrivate::createPopupMenuProxy(WebKit::WebPageProxy* webPageProxy)
+{
+ notImplemented();
+ return PassRefPtr<WebKit::WebPopupMenuProxy>();
+}
+
+PassRefPtr<WebKit::WebContextMenuProxy> QRawWebViewPrivate::createContextMenuProxy(WebKit::WebPageProxy* webPageProxy)
+{
+ notImplemented();
+ return PassRefPtr<WebKit::WebContextMenuProxy>();
+}
+
+#if ENABLE(INPUT_TYPE_COLOR)
+PassRefPtr<WebKit::WebColorChooserProxy> QRawWebViewPrivate::createColorChooserProxy(WebKit::WebPageProxy*, const WebCore::Color& intialColor)
+{
+ notImplemented();
+ return PassRefPtr<WebKit::WebColorChooserProxy>();
+}
+#endif
+
+void QRawWebViewPrivate::pageDidRequestScroll(const WebCore::IntPoint& pos)
+{
+ m_client->viewRequestedScroll(pos);
+
+}
+void QRawWebViewPrivate::processDidCrash()
+{
+ m_client->viewProcessCrashed();
+}
+
+void QRawWebViewPrivate::didRelaunchProcess()
+{
+ m_client->viewProcessRelaunched();
+}
+
+void QRawWebViewPrivate::setViewNeedsDisplay(const WebCore::IntRect& rect)
+{
+ m_client->viewNeedsDisplay(rect);
+}
+
+void QRawWebViewPrivate::didChangeContentsSize(const WebCore::IntSize& newSize)
+{
+ m_client->viewContentSizeChanged(newSize);
+}
+
+void QRawWebViewPrivate::setCursor(const WebCore::Cursor& cursor)
+{
+ m_client->viewRequestedCursorOverride(*cursor.platformCursor());
+}
+
+#if ENABLE(TOUCH_EVENTS)
+void QRawWebViewPrivate::doneWithTouchEvent(const WebKit::NativeWebTouchEvent& event, bool wasEventHandled)
+{
+ m_client->doneWithTouchEvent(event.nativeEvent(), wasEventHandled);
+}
+#endif
+
+void QRawWebViewPrivate::doneWithKeyEvent(const WebKit::NativeWebKeyboardEvent& event, bool wasEventHandled)
+{
+ m_client->doneWithKeyEvent(event.nativeEvent(), wasEventHandled);
+}
+
+PassOwnPtr<WebKit::DrawingAreaProxy> QRawWebViewPrivate::createDrawingAreaProxy()
+{
+ return WebKit::DrawingAreaProxyImpl::create(m_webPageProxy.get());
+}
+
+QRawWebViewPrivate::QRawWebViewPrivate(WebKit::WebContext* context, WebKit::WebPageGroup* pageGroup, QRawWebViewClient* client)
+ : m_client(client)
+ , m_webPageProxy(context->createWebPage(this, pageGroup))
+{
+ m_webPageProxy->pageGroup()->preferences()->setForceCompositingMode(true);
+}
+
+QRawWebViewPrivate::~QRawWebViewPrivate()
+{
+}
+
+QRawWebView::QRawWebView(WKContextRef contextRef, WKPageGroupRef pageGroupRef, QRawWebViewClient* client)
+ : d(new QRawWebViewPrivate(WebKit::toImpl(contextRef), WebKit::toImpl(pageGroupRef), client))
+{
+}
+
+QRawWebView::~QRawWebView()
+{
+ delete d;
+}
+
+void QRawWebView::create()
+{
+ d->m_webPageProxy->initializeWebPage();
+}
+
+void QRawWebView::setTransparentBackground(bool value)
+{
+ d->m_webPageProxy->setDrawsTransparentBackground(value);
+}
+
+bool QRawWebView::transparentBackground() const
+{
+ return d->m_webPageProxy->drawsTransparentBackground();
+}
+
+void QRawWebView::setDrawBackground(bool value)
+{
+ d->m_webPageProxy->setDrawsBackground(value);
+}
+
+bool QRawWebView::drawBackground() const
+{
+ return d->m_webPageProxy->drawsBackground();
+}
+
+bool QRawWebView::isFocused() const
+{
+ return d->m_focused;
+}
+
+void QRawWebView::setFocused(bool focused)
+{
+ d->m_focused = focused;
+ d->m_webPageProxy->viewStateDidChange(WebKit::WebPageProxy::ViewIsFocused);
+}
+
+bool QRawWebView::isVisible() const
+{
+ return d->m_visible;
+}
+
+void QRawWebView::setVisible(bool visible)
+{
+ d->m_visible = visible;
+ d->m_webPageProxy->viewStateDidChange(WebKit::WebPageProxy::ViewIsVisible);
+}
+
+bool QRawWebView::isActive() const
+{
+ return d->m_active;
+}
+
+void QRawWebView::setActive(bool active)
+{
+ d->m_active = active;
+ d->m_webPageProxy->viewStateDidChange(WebKit::WebPageProxy::ViewWindowIsActive);
+}
+
+QSize QRawWebView::size() const
+{
+ return d->m_size;
+}
+
+void QRawWebView::setSize(const QSize& size)
+{
+ d->m_size = size;
+ d->m_webPageProxy->setViewportSize(size);
+
+
+ WebKit::DrawingAreaProxy* drawingArea = d->m_webPageProxy->drawingArea();
+ if (!drawingArea)
+ return;
+
+
+ drawingArea->setSize(d->m_size, WebCore::IntSize());
+ drawingArea->setVisibleContentsRect(WebCore::IntRect(WebCore::IntPoint(), d->m_size), 1 /*scale*/, WebCore::FloatPoint());
+}
+
+WKPageRef QRawWebView::pageRef()
+{
+ return toAPI(d->m_webPageProxy.get());
+}
+
+void QRawWebView::paint(const QMatrix4x4& transform, float opacity, unsigned paintFlags)
+{
+ WebKit::DrawingAreaProxy* drawingArea = d->m_webPageProxy->drawingArea();
+ if (!drawingArea)
+ return;
+
+ WebKit::LayerTreeCoordinatorProxy* coordinatorProxy = drawingArea->layerTreeCoordinatorProxy();
+ if (!coordinatorProxy)
+ return;
+
+ WebKit::WebLayerTreeRenderer* renderer = coordinatorProxy->layerTreeRenderer();
+ if (!renderer)
+ return;
+
+ renderer->setActive(true);
+ renderer->syncRemoteContent();
+
+ WebCore::FloatRect rect(0, 0, d->m_size.width(), d->m_size.height());
+
+ renderer->paintToCurrentGLContext(transform, opacity, transform.mapRect(rect), paintFlags);
+}
+
+void QRawWebView::sendKeyEvent(QKeyEvent* event)
+{
+ d->m_webPageProxy->handleKeyboardEvent(WebKit::NativeWebKeyboardEvent(event));
+}
+
+void QRawWebView::sendMouseEvent(QMouseEvent* event, int clickCount)
+{
+ d->m_webPageProxy->handleMouseEvent(WebKit::NativeWebMouseEvent(event, QTransform(), clickCount));
+}
+
+void QRawWebView::sendWheelEvent(QWheelEvent* event)
+{
+ d->m_webPageProxy->handleWheelEvent(WebKit::NativeWebWheelEvent(event, QTransform()));
+}
+
+void QRawWebView::sendTouchEvent(QTouchEvent* event)
+{
+ d->m_webPageProxy->handleTouchEvent(WebKit::NativeWebTouchEvent(event, QTransform()));
+}
diff --git a/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview_p.h b/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview_p.h
new file mode 100644
index 000000000..b8cba692d
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview_p.h
@@ -0,0 +1,101 @@
+/*
+ Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies)
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+/*
+ This file is not part of the public Qt Api. It may change without notice at any time in future.
+ We make no commitment regarding source compatibility or binary compatibility.
+*/
+
+#ifndef qrawwebview_p_h
+#define qrawwebview_p_h
+
+#include "qwebkitglobal.h"
+
+#include <WebKit2/WKContext.h>
+#include <WebKit2/WKPage.h>
+#include <WebKit2/WKPageGroup.h>
+
+class QRect;
+class QRectF;
+class QPoint;
+class QSize;
+class QKeyEvent;
+class QMouseEvent;
+class QWheelEvent;
+class QTouchEvent;
+class QUrl;
+class QMatrix4x4;
+class QCursor;
+
+class QRawWebViewPrivate;
+
+class QRawWebViewClient {
+public:
+ virtual ~QRawWebViewClient() { }
+
+ virtual void viewNeedsDisplay(const QRect&) = 0;
+ virtual void viewRequestedScroll(const QPoint&) = 0;
+ virtual void viewProcessCrashed() = 0;
+ virtual void viewProcessRelaunched() = 0;
+ virtual void viewContentSizeChanged(const QSize&) = 0;
+ virtual void viewRequestedCursorOverride(const QCursor&) = 0;
+ virtual void doneWithKeyEvent(const QKeyEvent*, bool wasHandled) = 0;
+ virtual void doneWithTouchEvent(const QTouchEvent*, bool wasHandled) = 0;
+};
+
+class QWEBKIT_EXPORT QRawWebView {
+public:
+ QRawWebView(WKContextRef, WKPageGroupRef, QRawWebViewClient*);
+ ~QRawWebView();
+
+ void create();
+
+ void setSize(const QSize&);
+ QSize size() const;
+
+ void setFocused(bool);
+ bool isFocused() const;
+
+ void setVisible(bool);
+ bool isVisible() const;
+
+ void setActive(bool);
+ bool isActive() const;
+
+ void setTransparentBackground(bool);
+ bool transparentBackground() const;
+
+ void setDrawBackground(bool);
+ bool drawBackground() const;
+
+ // Paints on the current GL context.
+ void paint(const QMatrix4x4& transform, float opacity, unsigned paintFlags);
+
+ WKPageRef pageRef();
+
+ void sendKeyEvent(QKeyEvent*);
+ void sendMouseEvent(QMouseEvent*, int clickCount = 0);
+ void sendWheelEvent(QWheelEvent*);
+ void sendTouchEvent(QTouchEvent*);
+
+private:
+ QRawWebViewPrivate* d;
+};
+
+#endif // qrawwebview_p_h
diff --git a/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview_p_p.h b/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview_p_p.h
new file mode 100644
index 000000000..0a4bf5a9e
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview_p_p.h
@@ -0,0 +1,131 @@
+/*
+ Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies)
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+/*
+ This file is not part of the public Qt Api. It may change without notice at any time in future.
+ We make no commitment regarding source compatibility or binary compatibility.
+*/
+
+#ifndef qrawwebview_p_p_h
+#define qrawwebview_p_p_h
+
+#include "PageClient.h"
+#include "WebContextMenuProxy.h"
+#include "WebPopupMenuProxy.h"
+#include "qrawwebview_p.h"
+
+class QRawWebViewPrivate : public WebKit::PageClient {
+public:
+
+ virtual void pageClosed() { }
+
+ virtual void setFindIndicator(PassRefPtr<WebKit::FindIndicator>, bool fadeOut, bool animate) { }
+ virtual void didCommitLoadForMainFrame(bool useCustomRepresentation) { }
+ virtual void didFinishLoadingDataForCustomRepresentation(const String& suggestedFilename, const CoreIPC::DataReference&) { }
+ virtual double customRepresentationZoomFactor() { return 1; }
+ virtual void setCustomRepresentationZoomFactor(double) { }
+ virtual void didChangeScrollbarsForMainFrame() const { }
+ virtual void findStringInCustomRepresentation(const String&, WebKit::FindOptions, unsigned maxMatchCount) { }
+ virtual void countStringMatchesInCustomRepresentation(const String&, WebKit::FindOptions, unsigned maxMatchCount) { }
+ virtual void clearAllEditCommands() { }
+
+ virtual void didReceiveMessageFromNavigatorQtObject(const String& message);
+ virtual void didChangeViewportProperties(const WebCore::ViewportAttributes& attr);
+ virtual void handleDownloadRequest(WebKit::DownloadProxy* download);
+
+ virtual void handleAuthenticationRequiredRequest(const String& hostname, const String& realm, const String& prefilledUsername, String& username, String& password);
+ virtual void handleCertificateVerificationRequest(const String& hostname, bool& ignoreErrors);
+ virtual void handleProxyAuthenticationRequiredRequest(const String& hostname, uint16_t port, const String& prefilledUsername, String& username, String& password);
+
+ virtual void registerEditCommand(PassRefPtr<WebKit::WebEditCommandProxy>, WebKit::WebPageProxy::UndoOrRedo);
+ virtual bool canUndoRedo(WebKit::WebPageProxy::UndoOrRedo undoOrRedo);
+ virtual void executeUndoRedo(WebKit::WebPageProxy::UndoOrRedo undoOrRedo);
+
+ virtual WebCore::FloatRect convertToDeviceSpace(const WebCore::FloatRect& rect);
+ virtual WebCore::FloatRect convertToUserSpace(const WebCore::FloatRect& rect);
+ virtual WebCore::IntPoint screenToWindow(const WebCore::IntPoint& point);
+ virtual WebCore::IntRect windowToScreen(const WebCore::IntRect& rect);
+
+#if USE(ACCELERATED_COMPOSITING)
+ virtual void enterAcceleratedCompositingMode(const WebKit::LayerTreeContext&);
+ virtual void exitAcceleratedCompositingMode();
+ virtual void updateAcceleratedCompositingMode(const WebKit::LayerTreeContext&);
+#endif // USE(ACCELERATED_COMPOSITING)
+
+ virtual void updateTextInputState();
+#if ENABLE(GESTURE_EVENTS)
+ virtual void doneWithGestureEvent(const WebKit::WebGestureEvent& event, bool wasEventHandled);
+#endif
+ virtual void displayView();
+ virtual void scrollView(const WebCore::IntRect& scrollRect, const WebCore::IntSize& scrollOffset);
+
+ virtual void flashBackingStoreUpdates(const Vector<WebCore::IntRect>&);
+ virtual void didFindZoomableArea(const WebCore::IntPoint& target, const WebCore::IntRect& area);
+
+ virtual void setCursorHiddenUntilMouseMoves(bool hiddenUntilMouseMoves);
+ virtual void toolTipChanged(const String&, const String& newTooltip);
+
+ virtual void startDrag(const WebCore::DragData& dragData, PassRefPtr<WebKit::ShareableBitmap> dragImage);
+
+ virtual PassRefPtr<WebKit::WebPopupMenuProxy> createPopupMenuProxy(WebKit::WebPageProxy* webPageProxy);
+ virtual PassRefPtr<WebKit::WebContextMenuProxy> createContextMenuProxy(WebKit::WebPageProxy* webPageProxy);
+
+#if ENABLE(INPUT_TYPE_COLOR)
+ virtual PassRefPtr<WebKit::WebColorChooserProxy> createColorChooserProxy(WebKit::WebPageProxy*, const WebCore::Color& intialColor);
+#endif
+
+ QRawWebViewPrivate(WebKit::WebContext*, WebKit::WebPageGroup*, QRawWebViewClient*);
+ ~QRawWebViewPrivate();
+
+ // PageClient
+
+ virtual PassOwnPtr<WebKit::DrawingAreaProxy> createDrawingAreaProxy();
+
+ virtual void pageDidRequestScroll(const WebCore::IntPoint& pos);
+ virtual void processDidCrash();
+ virtual void didRelaunchProcess();
+ virtual void setViewNeedsDisplay(const WebCore::IntRect& rect);
+ virtual void didChangeContentsSize(const WebCore::IntSize& newSize);
+ virtual void setCursor(const WebCore::Cursor&);
+
+ virtual bool isViewFocused() { return m_focused; }
+ virtual bool isViewVisible() { return m_visible; }
+ virtual bool isViewWindowActive() { return m_active; }
+ virtual bool isViewInWindow() { return true; } // FIXME
+ virtual WebCore::IntSize viewSize() { return m_size; }
+
+ virtual void doneWithKeyEvent(const WebKit::NativeWebKeyboardEvent&, bool wasEventHandled);
+#if ENABLE(TOUCH_EVENTS)
+ virtual void doneWithTouchEvent(const WebKit::NativeWebTouchEvent&, bool wasEventHandled);
+#endif
+
+
+ bool m_focused;
+ bool m_visible;
+ bool m_active;
+ QSize m_size;
+
+ QRawWebViewClient* m_client;
+ WTF::RefPtr<WebKit::WebPageProxy> m_webPageProxy;
+
+private:
+ QRawWebView* q;
+};
+
+#endif // qrawwebview_p_p_h
diff --git a/Source/WebKit2/UIProcess/API/qt/tests/bytearraytestdata.h b/Source/WebKit2/UIProcess/API/qt/tests/bytearraytestdata.h
index 7f87e72dd..2262a5f1a 100644
--- a/Source/WebKit2/UIProcess/API/qt/tests/bytearraytestdata.h
+++ b/Source/WebKit2/UIProcess/API/qt/tests/bytearraytestdata.h
@@ -21,6 +21,10 @@
#ifndef bytearraytestdata_h
#define bytearraytestdata_h
+#if 0
+#pragma qt_no_master_include
+#endif
+
#include "qwebkitglobal.h"
#include <QByteArray>
#include <QObject>
diff --git a/Source/WebKit2/UIProcess/API/qt/tests/html/bluesquare.html b/Source/WebKit2/UIProcess/API/qt/tests/html/bluesquare.html
new file mode 100644
index 000000000..f4b639621
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/qt/tests/html/bluesquare.html
@@ -0,0 +1,5 @@
+<body style="margin:60px">
+ <table style="border:10px solid blue; width:80px; height:80px">
+ <tr><td>&nbsp;</td></tr>
+ </table>
+</body>
diff --git a/Source/WebKit2/UIProcess/API/qt/tests/html/redsquare.html b/Source/WebKit2/UIProcess/API/qt/tests/html/redsquare.html
new file mode 100644
index 000000000..f70d2918a
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/qt/tests/html/redsquare.html
@@ -0,0 +1,5 @@
+<body style="margin:20px">
+ <table style="border:10px solid red; width:160px; height:160px">
+ <tr><td>&nbsp;</td></tr>
+ </table>
+</body>
diff --git a/Source/WebKit2/UIProcess/API/qt/tests/html/resources/qwkview_noBackground1.png b/Source/WebKit2/UIProcess/API/qt/tests/html/resources/qwkview_noBackground1.png
new file mode 100644
index 000000000..c293f449e
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/qt/tests/html/resources/qwkview_noBackground1.png
Binary files differ
diff --git a/Source/WebKit2/UIProcess/API/qt/tests/html/resources/qwkview_noBackground3.png b/Source/WebKit2/UIProcess/API/qt/tests/html/resources/qwkview_noBackground3.png
new file mode 100644
index 000000000..4fa53b135
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/qt/tests/html/resources/qwkview_noBackground3.png
Binary files differ
diff --git a/Source/WebKit2/UIProcess/API/qt/tests/html/resources/qwkview_paint.png b/Source/WebKit2/UIProcess/API/qt/tests/html/resources/qwkview_paint.png
new file mode 100644
index 000000000..68743ac9e
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/qt/tests/html/resources/qwkview_paint.png
Binary files differ
diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_colorChooser.qml b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_colorChooser.qml
index 366e7c00c..b5152c2bb 100644
--- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_colorChooser.qml
+++ b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_colorChooser.qml
@@ -46,12 +46,21 @@ TestWebView {
webView.url = Qt.resolvedUrl("../common/colorChooser.html")
verify(webView.waitForLoadSucceeded())
+ while (webView.title != "Feature enabled" && webView.title != "Feature disabled")
+ wait(0)
+
webView.featureEnabled = (webView.title == "Feature enabled")
+ if (!webView.featureEnabled)
+ return
titleSpy.clear()
- webView.shouldReject = false;
- webView.shouldAcceptCurrent = false;
+ webView.shouldReject = false
+ webView.shouldAcceptCurrent = false
+ }
+
+ function cleanup() {
+ titleSpy.clear()
}
function test_accept() {
@@ -64,8 +73,8 @@ TestWebView {
// pick a new color with the chooser.
webView.selectedColor = "#020020"
openColorChooser()
- titleSpy.wait()
- compare(titleSpy.count, 2)
+ while (titleSpy.count != 2)
+ wait(0)
compare(webView.title, "#020020")
}
diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_singleFileUpload.qml b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_singleFileUpload.qml
index 6bcd8036b..30514a3b6 100644
--- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_singleFileUpload.qml
+++ b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_singleFileUpload.qml
@@ -11,18 +11,20 @@ TestWebView {
height: 400
property bool selectFile
+ property bool returnEmpty: false
property bool acceptMultiple: false
experimental.filePicker: Item {
Component.onCompleted: {
- var selectedFiles = ["filename1", "filename2"]
- if (selectFile) {
+ if (returnEmpty)
+ model.accept("");
+ else if (selectFile) {
+ var selectedFiles = ["filename1", "filename2"];
if (acceptMultiple)
- model.accept(selectedFiles)
+ model.accept(selectedFiles);
else
model.accept("acceptedfilename");
- }
- else
+ } else
model.reject();
}
}
@@ -57,12 +59,21 @@ TestWebView {
function test_multiple() {
webView.selectFile = true;
+ webView.returnEmpty = false;
webView.acceptMultiple = true;
openItemSelector()
titleSpy.wait()
compare(webView.title, "filename1")
}
+ function test_rejectIfEmptyAccept() {
+ var oldTitle = webView.title
+ webView.selectFile = false;
+ webView.returnEmpty = true;
+ openItemSelector()
+ compare(webView.title, oldTitle)
+ }
+
function test_reject() {
var oldTitle = webView.title
webView.selectFile = false;
diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_wheelEventHandling.qml b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_wheelEventHandling.qml
new file mode 100644
index 000000000..d24312610
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_wheelEventHandling.qml
@@ -0,0 +1,46 @@
+import QtQuick 2.0
+import QtTest 1.0
+import QtWebKit 3.0
+import QtWebKit.experimental 1.0
+import Test 1.0
+import "../common"
+
+Item {
+ TestWebView {
+ id: webView
+ width: 800
+ height: 600
+ url: Qt.resolvedUrl("../common/test4.html")
+ }
+
+ SignalSpy {
+ id: scrollSpy
+ target: webView
+ signalName: "contentYChanged"
+ }
+
+ TestCase {
+ name: "WheelEventHandling"
+
+ property variant test: webView.experimental.test
+
+ function init() {
+ webView.url = Qt.resolvedUrl("../common/test4.html")
+ verify(webView.waitForLoadSucceeded())
+ webView.contentY = 0
+ }
+
+ function test_wheelScrollEvent() {
+ scrollSpy.clear()
+ var centerPoint = Qt.point(webView.width / 2, webView.height / 2)
+ test.wheelEvent(webView, centerPoint.x, centerPoint.y, -500);
+ // The signal spy below will time out if the wheel event did not scroll the content.
+ scrollSpy.wait()
+ var position = webView.contentY
+ webView.reload()
+ verify(webView.waitForLoadSucceeded())
+ // The check below will fail if the previous position was not restored after reload.
+ verify(position == webView.contentY)
+ }
+ }
+}
diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/colorChooser.html b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/colorChooser.html
index b04710ab9..b3254c3b8 100644
--- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/colorChooser.html
+++ b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/colorChooser.html
@@ -1,13 +1,15 @@
<!DOCTYPE html>
<html>
<head>
-<title>Feature disabled</title>
+<title>Title</title>
<script>
function detectInputTypeColorEnabled() {
var element = document.getElementById('test')
element.value = 'should sanitize';
if (element.value != 'should sanitize')
document.title = 'Feature enabled';
+ else
+ document.title = 'Feature disabled';
}
function updateTitle(element) {
document.title = element.value;
diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/test4.html b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/test4.html
new file mode 100644
index 000000000..e31d689d8
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/test4.html
@@ -0,0 +1,117 @@
+<html>
+ <head>
+ <title>Long Page To Scroll</title>
+ <style>
+ #content {
+ margin: auto;
+ width: 100%;
+ background: #eeeeee;
+ font-size: 50px;
+ }
+ </style>
+ </head>
+ <body>
+ <div id="content">
+ bla00<br/>
+ bla01<br/>
+ bla02<br/>
+ bla03<br/>
+ bla04<br/>
+ bla05<br/>
+ bla06<br/>
+ bla07<br/>
+ bla08<br/>
+ bla09<br/>
+ bla10<br/>
+ bla11<br/>
+ bla12<br/>
+ bla13<br/>
+ bla14<br/>
+ bla15<br/>
+ bla16<br/>
+ bla17<br/>
+ bla18<br/>
+ bla19<br/>
+ bla20<br/>
+ bla21<br/>
+ bla22<br/>
+ bla23<br/>
+ bla24<br/>
+ bla25<br/>
+ bla26<br/>
+ bla27<br/>
+ bla28<br/>
+ bla29<br/>
+ bla30<br/>
+ bla31<br/>
+ bla32<br/>
+ bla33<br/>
+ bla34<br/>
+ bla35<br/>
+ bla36<br/>
+ bla37<br/>
+ bla38<br/>
+ bla39<br/>
+ bla40<br/>
+ bla41<br/>
+ bla42<br/>
+ bla43<br/>
+ bla44<br/>
+ bla45<br/>
+ bla46<br/>
+ bla47<br/>
+ bla48<br/>
+ bla49<br/>
+ bla50<br/>
+ bla51<br/>
+ bla52<br/>
+ bla53<br/>
+ bla54<br/>
+ bla55<br/>
+ bla56<br/>
+ bla57<br/>
+ bla58<br/>
+ bla59<br/>
+ bla60<br/>
+ bla61<br/>
+ bla62<br/>
+ bla63<br/>
+ bla64<br/>
+ bla65<br/>
+ bla66<br/>
+ bla67<br/>
+ bla68<br/>
+ bla69<br/>
+ bla70<br/>
+ bla71<br/>
+ bla72<br/>
+ bla73<br/>
+ bla74<br/>
+ bla75<br/>
+ bla76<br/>
+ bla77<br/>
+ bla78<br/>
+ bla79<br/>
+ bla80<br/>
+ bla81<br/>
+ bla82<br/>
+ bla83<br/>
+ bla84<br/>
+ bla85<br/>
+ bla86<br/>
+ bla87<br/>
+ bla88<br/>
+ bla89<br/>
+ bla90<br/>
+ bla91<br/>
+ bla92<br/>
+ bla93<br/>
+ bla94<br/>
+ bla95<br/>
+ bla96<br/>
+ bla97<br/>
+ bla98<br/>
+ bla99<br/>
+ </div>
+ </body>
+</html>
diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qrawwebview/qrawwebview.pro b/Source/WebKit2/UIProcess/API/qt/tests/qrawwebview/qrawwebview.pro
new file mode 100644
index 000000000..02dc197c7
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/qt/tests/qrawwebview/qrawwebview.pro
@@ -0,0 +1,3 @@
+include(../tests.pri)
+SOURCES += $${TARGET}.cpp
+QT += webkit-private
diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qrawwebview/tst_qrawwebview.cpp b/Source/WebKit2/UIProcess/API/qt/tests/qrawwebview/tst_qrawwebview.cpp
new file mode 100644
index 000000000..9f6888180
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/qt/tests/qrawwebview/tst_qrawwebview.cpp
@@ -0,0 +1,226 @@
+/*
+ Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies)
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+#include "../util.h"
+
+#include <QImage>
+#include <QMatrix4x4>
+#include <QOpenGLContext>
+#include <QSize>
+#include <QWindow>
+#include <QtTest/QtTest>
+
+#include <WebKit2/WKContext.h>
+#include <WebKit2/WKPageGroup.h>
+#include <WebKit2/WKPreferences.h>
+#include <WebKit2/WKPreferencesPrivate.h>
+#include <WebKit2/WKStringQt.h>
+#include <WebKit2/WKURL.h>
+#include <WebKit2/qrawwebview_p.h>
+
+static WKContextRef webContext()
+{
+ static WKContextRef result = WKContextCreate();
+ return result;
+}
+
+static WKPageGroupRef createWebPageGroup(const QString& name)
+{
+ WKPageGroupRef pageGroup =WKPageGroupCreateWithIdentifier(WKStringCreateWithQString(name));
+ WKPreferencesRef preferences = WKPageGroupGetPreferences(pageGroup);
+ WKPreferencesSetAcceleratedCompositingEnabled(preferences, true);
+ WKPreferencesSetFrameFlatteningEnabled(preferences, true);
+
+ return pageGroup;
+}
+
+static WKPageGroupRef webPageGroup(const QString& name)
+{
+ static WKPageGroupRef result = createWebPageGroup(name);
+ return result;
+}
+
+class WebView : public QObject, public QRawWebViewClient {
+ Q_OBJECT
+public:
+ WebView(const QSize& size)
+ {
+ WKPageLoaderClient loaderClient;
+ memset(&loaderClient, 0, sizeof(WKPageLoaderClient));
+ loaderClient.clientInfo = this;
+ loaderClient.didFinishLoadForFrame = WebView::finishLoadForFrame;
+
+ m_webView = new QRawWebView(webContext(), webPageGroup(QString()), this);
+ WKPageSetPageLoaderClient(m_webView->pageRef(), &loaderClient);
+ m_webView->create();
+ WKPageSetUseFixedLayout(m_webView->pageRef(), true);
+
+ m_webView->setSize(size);
+ m_webView->setFocused(true);
+ m_webView->setVisible(true);
+ m_webView->setActive(true);
+ }
+
+ ~WebView() { delete m_webView; }
+
+ void load(const QString& html)
+ {
+ m_frameLoaded = false;
+ WKPageLoadURL(m_webView->pageRef(), WKURLCreateWithUTF8CString(html.toAscii().data()));
+ QVERIFY(::waitForSignal(this, SIGNAL(loaded()), 5000));
+ }
+
+ void setDrawBackground(bool value) { m_webView->setDrawBackground(value); }
+ void setTransparentBackground(bool value) { m_webView->setTransparentBackground(value); }
+
+ virtual void viewNeedsDisplay(const QRect&)
+ {
+ m_webView->paint(QMatrix4x4(), 1, 0);
+ if (m_frameLoaded)
+ emit loaded();
+ }
+
+ virtual void viewRequestedScroll(const QPoint&) { }
+ virtual void viewProcessCrashed() { }
+ virtual void viewProcessRelaunched() { }
+ virtual void viewContentSizeChanged(const QSize&) { }
+ virtual void viewRequestedCursorOverride(const QCursor&) { }
+ virtual void doneWithKeyEvent(const QKeyEvent*, bool wasHandled) { }
+ virtual void doneWithTouchEvent(const QTouchEvent*, bool wasHandled) { }
+
+ static void finishLoadForFrame(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void *clientInfo);
+
+signals:
+ void loaded();
+
+private:
+ QRawWebView* m_webView;
+ bool m_frameLoaded;
+};
+
+void WebView::finishLoadForFrame(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void *clientInfo)
+{
+ WebView* obj = static_cast<WebView*>(const_cast<void*>(clientInfo));
+ obj->m_frameLoaded = true;
+}
+
+static bool compareImages(const QImage& i1, const QImage& i2, int count)
+{
+ if (i1.size() != i2.size())
+ return false;
+ for (int x = 0; x < count; ++x) {
+ for (int y = 0; y < count; ++y) {
+ QPoint point(x * i1.width() / count, y * i1.height() / count);
+ if (i1.pixel(point) != i2.pixel(point))
+ return false;
+ }
+ }
+
+ return true;
+}
+
+class tst_qrawwebview : public QObject {
+ Q_OBJECT
+public:
+ tst_qrawwebview()
+ : m_resourceDir(QString::fromAscii(TESTS_SOURCE_DIR "/html/resources"))
+ , m_baseUrl(QUrl::fromLocalFile(TESTS_SOURCE_DIR "/html").toString())
+ { }
+
+private slots:
+ void paint() { run(&tst_qrawwebview::doPaint, m_resourceDir + "/qwkview_paint.png"); }
+ void noBackground1() { run(&tst_qrawwebview::doNoBackground1, m_resourceDir + "/qwkview_noBackground1.png"); }
+ void noBackground2() { run(&tst_qrawwebview::doNoBackground2, m_resourceDir + "/qwkview_noBackground1.png"); }
+ void noBackground3() { run(&tst_qrawwebview::doNoBackground3, m_resourceDir + "/qwkview_noBackground3.png"); }
+
+private:
+ const QString m_resourceDir;
+ const QString m_baseUrl;
+
+ void doPaint(const QSize& size);
+ void doNoBackground1(const QSize& size);
+ void doNoBackground2(const QSize& size);
+ void doNoBackground3(const QSize& size);
+
+ typedef void (tst_qrawwebview::*PaintMethod)(const QSize& size);
+ void run(PaintMethod, const QString& expectation);
+};
+
+void tst_qrawwebview::doPaint(const QSize& size)
+{
+ WebView view(size);
+ view.load(m_baseUrl + "/redsquare.html");
+}
+
+void tst_qrawwebview::doNoBackground1(const QSize& size)
+{
+ WebView view(size);
+ view.setTransparentBackground(true);
+ view.load(m_baseUrl + "/redsquare.html");
+ view.load(m_baseUrl + "/bluesquare.html");
+}
+
+void tst_qrawwebview::doNoBackground2(const QSize& size)
+{
+ WebView view1(size);
+ view1.setTransparentBackground(true);
+ view1.load(m_baseUrl + "/redsquare.html");
+
+ WebView view2(size);
+ view2.setTransparentBackground(true);
+ view2.load(m_baseUrl + "/bluesquare.html");
+}
+
+void tst_qrawwebview::doNoBackground3(const QSize& size)
+{
+ WebView view1(size);
+ view1.setTransparentBackground(false);
+ view1.load(m_baseUrl + "/redsquare.html");
+
+ WebView view2(size);
+ view2.setTransparentBackground(true);
+ view2.load(m_baseUrl + "/bluesquare.html");
+}
+
+void tst_qrawwebview::run(PaintMethod method, const QString& expectation)
+{
+
+ QWindow window;
+ window.setSurfaceType(QSurface::OpenGLSurface);
+ window.setGeometry(0, 0, 200, 200);
+ window.create();
+
+ QOpenGLContext context;
+ context.create();
+ context.makeCurrent(&window);
+
+ glViewport(0, 0, window.size().width(), window.size().height());
+ glClearColor(0, 0, 0, 0);
+ glClear(GL_COLOR_BUFFER_BIT);
+
+ (this->*method)(window.size());
+
+ QImage image(window.size(), QImage::Format_ARGB32_Premultiplied);
+ glReadPixels(0, 0, window.size().width(), window.size().height(), GL_RGBA, GL_UNSIGNED_BYTE, image.bits());
+
+ QVERIFY(compareImages(QImage(expectation), image.rgbSwapped(), 5));
+}
+
+QTEST_MAIN(tst_qrawwebview)
+
+#include "tst_qrawwebview.moc"
diff --git a/Source/WebKit2/UIProcess/API/qt/tests/testwindow.h b/Source/WebKit2/UIProcess/API/qt/tests/testwindow.h
index 1eaa43772..6d855cf97 100644
--- a/Source/WebKit2/UIProcess/API/qt/tests/testwindow.h
+++ b/Source/WebKit2/UIProcess/API/qt/tests/testwindow.h
@@ -20,6 +20,10 @@
#ifndef testwindow_h
#define testwindow_h
+#if 0
+#pragma qt_no_master_include
+#endif
+
#include <QResizeEvent>
#include <QScopedPointer>
#include <QtQuick/qquickitem.h>
diff --git a/Source/WebKit2/UIProcess/Launcher/ProcessLauncher.cpp b/Source/WebKit2/UIProcess/Launcher/ProcessLauncher.cpp
index e53d4156b..ba22dda2d 100644
--- a/Source/WebKit2/UIProcess/Launcher/ProcessLauncher.cpp
+++ b/Source/WebKit2/UIProcess/Launcher/ProcessLauncher.cpp
@@ -33,7 +33,9 @@ namespace WebKit {
static WorkQueue& processLauncherWorkQueue()
{
- DEFINE_STATIC_LOCAL(WorkQueue, processLauncherWorkQueue, ("com.apple.WebKit.ProcessLauncher"));
+ // Give in to VisualStudio and its 31 character thread name limit and shorten the thread name to ProcLauncher instead of class name.
+ // See createThread() in Threading.cpp.
+ DEFINE_STATIC_LOCAL(WorkQueue, processLauncherWorkQueue, ("com.apple.WebKit.ProcLauncher"));
return processLauncherWorkQueue;
}
diff --git a/Source/WebKit2/UIProcess/WebBackForwardList.cpp b/Source/WebKit2/UIProcess/WebBackForwardList.cpp
index 4a81a8765..00e8f4c01 100644
--- a/Source/WebKit2/UIProcess/WebBackForwardList.cpp
+++ b/Source/WebKit2/UIProcess/WebBackForwardList.cpp
@@ -43,17 +43,28 @@ WebBackForwardList::WebBackForwardList(WebPageProxy* page)
WebBackForwardList::~WebBackForwardList()
{
+ // A WebBackForwardList should never be destroyed unless it's associated page has been closed or is invalid.
+ ASSERT((!m_page && !m_hasCurrentIndex) || !m_page->isValid());
}
void WebBackForwardList::pageClosed()
{
+ // We should have always started out with an m_page and we should never close the page twice.
+ ASSERT(m_page);
+
if (m_page) {
size_t size = m_entries.size();
- for (size_t i = 0; i < size; ++i)
+ for (size_t i = 0; i < size; ++i) {
+ ASSERT(m_entries[i]);
+ if (!m_entries[i])
+ continue;
m_page->backForwardRemovedItem(m_entries[i]->itemID());
+ }
}
m_page = 0;
+ m_entries.clear();
+ m_hasCurrentIndex = false;
}
void WebBackForwardList::addItem(WebBackForwardListItem* newItem)
@@ -81,15 +92,22 @@ void WebBackForwardList::addItem(WebBackForwardListItem* newItem)
m_page->backForwardRemovedItem(m_entries[0]->itemID());
removedItems.append(m_entries[0].release());
m_entries.remove(0);
+
if (m_entries.isEmpty())
m_hasCurrentIndex = false;
else
m_currentIndex--;
}
} else {
- // If we have no current item index, we should have no other entries before adding this new item.
+ // If we have no current item index we should also not have any entries.
+ ASSERT(m_entries.isEmpty());
+
+ // But just in case it does happen in practice we'll get back in to a consistent state now before adding the new item.
size_t size = m_entries.size();
for (size_t i = 0; i < size; ++i) {
+ ASSERT(m_entries[i]);
+ if (!m_entries[i])
+ continue;
m_page->backForwardRemovedItem(m_entries[i]->itemID());
removedItems.append(m_entries[i].release());
}
@@ -97,6 +115,7 @@ void WebBackForwardList::addItem(WebBackForwardListItem* newItem)
}
if (!m_hasCurrentIndex) {
+ ASSERT(m_entries.isEmpty());
m_currentIndex = 0;
m_hasCurrentIndex = true;
} else
@@ -115,7 +134,7 @@ void WebBackForwardList::goToItem(WebBackForwardListItem* item)
{
ASSERT(!m_hasCurrentIndex || m_currentIndex < m_entries.size());
- if (!m_entries.size() || !item)
+ if (!m_entries.size() || !item || !m_page || !m_hasCurrentIndex)
return;
unsigned index = 0;
@@ -125,8 +144,7 @@ void WebBackForwardList::goToItem(WebBackForwardListItem* item)
}
if (index < m_entries.size()) {
m_currentIndex = index;
- if (m_page)
- m_page->didChangeBackForwardList(0, 0);
+ m_page->didChangeBackForwardList(0, 0);
}
}
@@ -134,28 +152,28 @@ WebBackForwardListItem* WebBackForwardList::currentItem()
{
ASSERT(!m_hasCurrentIndex || m_currentIndex < m_entries.size());
- return m_hasCurrentIndex ? m_entries[m_currentIndex].get() : 0;
+ return m_page && m_hasCurrentIndex ? m_entries[m_currentIndex].get() : 0;
}
WebBackForwardListItem* WebBackForwardList::backItem()
{
ASSERT(!m_hasCurrentIndex || m_currentIndex < m_entries.size());
- return m_hasCurrentIndex && m_currentIndex ? m_entries[m_currentIndex - 1].get() : 0;
+ return m_page && m_hasCurrentIndex && m_currentIndex ? m_entries[m_currentIndex - 1].get() : 0;
}
WebBackForwardListItem* WebBackForwardList::forwardItem()
{
ASSERT(!m_hasCurrentIndex || m_currentIndex < m_entries.size());
- return m_hasCurrentIndex && m_entries.size() && m_currentIndex < m_entries.size() - 1 ? m_entries[m_currentIndex + 1].get() : 0;
+ return m_page && m_hasCurrentIndex && m_entries.size() && m_currentIndex < m_entries.size() - 1 ? m_entries[m_currentIndex + 1].get() : 0;
}
WebBackForwardListItem* WebBackForwardList::itemAtIndex(int index)
{
ASSERT(!m_hasCurrentIndex || m_currentIndex < m_entries.size());
- if (!m_hasCurrentIndex)
+ if (!m_hasCurrentIndex || !m_page)
return 0;
// Do range checks without doing math on index to avoid overflow.
@@ -172,20 +190,23 @@ int WebBackForwardList::backListCount()
{
ASSERT(!m_hasCurrentIndex || m_currentIndex < m_entries.size());
- return !m_hasCurrentIndex ? 0 : m_currentIndex;
+ return m_page && m_hasCurrentIndex ? m_currentIndex : 0;
}
int WebBackForwardList::forwardListCount()
{
ASSERT(!m_hasCurrentIndex || m_currentIndex < m_entries.size());
- return !m_hasCurrentIndex ? 0 : static_cast<int>(m_entries.size()) - (m_currentIndex + 1);
+ return m_page && m_hasCurrentIndex ? m_entries.size() - (m_currentIndex + 1) : 0;
}
PassRefPtr<ImmutableArray> WebBackForwardList::backListAsImmutableArrayWithLimit(unsigned limit)
{
ASSERT(!m_hasCurrentIndex || m_currentIndex < m_entries.size());
+ if (!m_page || !m_hasCurrentIndex)
+ return ImmutableArray::create();
+
unsigned backListSize = static_cast<unsigned>(backListCount());
unsigned size = std::min(backListSize, limit);
if (!size)
@@ -195,8 +216,10 @@ PassRefPtr<ImmutableArray> WebBackForwardList::backListAsImmutableArrayWithLimit
vector.reserveInitialCapacity(size);
ASSERT(backListSize >= size);
- for (unsigned i = backListSize - size; i < backListSize; ++i)
+ for (unsigned i = backListSize - size; i < backListSize; ++i) {
+ ASSERT(m_entries[i]);
vector.uncheckedAppend(m_entries[i].get());
+ }
return ImmutableArray::adopt(vector);
}
@@ -205,6 +228,9 @@ PassRefPtr<ImmutableArray> WebBackForwardList::forwardListAsImmutableArrayWithLi
{
ASSERT(!m_hasCurrentIndex || m_currentIndex < m_entries.size());
+ if (!m_page || !m_hasCurrentIndex)
+ return ImmutableArray::create();
+
unsigned size = std::min(static_cast<unsigned>(forwardListCount()), limit);
if (!size)
return ImmutableArray::create();
@@ -214,8 +240,10 @@ PassRefPtr<ImmutableArray> WebBackForwardList::forwardListAsImmutableArrayWithLi
unsigned last = m_currentIndex + size;
ASSERT(last < m_entries.size());
- for (unsigned i = m_currentIndex + 1; i <= last; ++i)
+ for (unsigned i = m_currentIndex + 1; i <= last; ++i) {
+ ASSERT(m_entries[i]);
vector.uncheckedAppend(m_entries[i].get());
+ }
return ImmutableArray::adopt(vector);
}
@@ -225,22 +253,42 @@ void WebBackForwardList::clear()
ASSERT(!m_hasCurrentIndex || m_currentIndex < m_entries.size());
size_t size = m_entries.size();
- if (size <= 1)
+ if (!m_page || size <= 1)
return;
RefPtr<WebBackForwardListItem> currentItem = this->currentItem();
+ Vector<RefPtr<APIObject> > removedItems;
- if (m_page) {
+ if (!currentItem) {
+ // We should only ever have no current item if we also have no current item index.
+ ASSERT(!m_hasCurrentIndex);
+
+ // But just in case it does happen in practice we should get back into a consistent state now.
for (size_t i = 0; i < size; ++i) {
- if (m_entries[i] != currentItem)
- m_page->backForwardRemovedItem(m_entries[i]->itemID());
+ ASSERT(m_entries[i]);
+ if (!m_entries[i])
+ continue;
+
+ m_page->backForwardRemovedItem(m_entries[i]->itemID());
+ removedItems.append(m_entries[i].release());
}
+
+ m_entries.clear();
+ m_hasCurrentIndex = false;
+ m_page->didChangeBackForwardList(0, &removedItems);
+
+ return;
}
- Vector<RefPtr<APIObject> > removedItems;
- removedItems.reserveCapacity(m_entries.size() - 1);
- for (size_t i = 0; i < m_entries.size(); ++i) {
- if (i != m_currentIndex)
+ for (size_t i = 0; i < size; ++i) {
+ ASSERT(m_entries[i]);
+ if (m_entries[i] && m_entries[i] != currentItem)
+ m_page->backForwardRemovedItem(m_entries[i]->itemID());
+ }
+
+ removedItems.reserveCapacity(size - 1);
+ for (size_t i = 0; i < size; ++i) {
+ if (i != m_currentIndex && m_hasCurrentIndex && m_entries[i])
removedItems.append(m_entries[i].release());
}
@@ -254,8 +302,7 @@ void WebBackForwardList::clear()
m_hasCurrentIndex = false;
}
- if (m_page)
- m_page->didChangeBackForwardList(0, &removedItems);
+ m_page->didChangeBackForwardList(0, &removedItems);
}
} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/WebBackForwardList.h b/Source/WebKit2/UIProcess/WebBackForwardList.h
index 97bd2a32f..16a562d03 100644
--- a/Source/WebKit2/UIProcess/WebBackForwardList.h
+++ b/Source/WebKit2/UIProcess/WebBackForwardList.h
@@ -80,6 +80,8 @@ public:
#if USE(CF)
CFDictionaryRef createCFDictionaryRepresentation(WebPageProxy::WebPageProxySessionStateFilterCallback, void* context) const;
bool restoreFromCFDictionaryRepresentation(CFDictionaryRef);
+ bool restoreFromV0CFDictionaryRepresentation(CFDictionaryRef);
+ bool restoreFromV1CFDictionaryRepresentation(CFDictionaryRef);
#endif
private:
diff --git a/Source/WebKit2/UIProcess/WebBatteryManagerProxy.cpp b/Source/WebKit2/UIProcess/WebBatteryManagerProxy.cpp
new file mode 100644
index 000000000..c3897e81c
--- /dev/null
+++ b/Source/WebKit2/UIProcess/WebBatteryManagerProxy.cpp
@@ -0,0 +1,102 @@
+/*
+ * Copyright (C) 2012 Intel Corporation. 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 "WebBatteryManagerProxy.h"
+
+#if ENABLE(BATTERY_STATUS)
+
+#include "WebBatteryManagerMessages.h"
+#include "WebContext.h"
+
+namespace WebKit {
+
+PassRefPtr<WebBatteryManagerProxy> WebBatteryManagerProxy::create(WebContext* context)
+{
+ return adoptRef(new WebBatteryManagerProxy(context));
+}
+
+WebBatteryManagerProxy::WebBatteryManagerProxy(WebContext* context)
+ : m_isUpdating(false)
+ , m_context(context)
+{
+}
+
+WebBatteryManagerProxy::~WebBatteryManagerProxy()
+{
+}
+
+void WebBatteryManagerProxy::invalidate()
+{
+ stopUpdating();
+}
+
+void WebBatteryManagerProxy::initializeProvider(const WKBatteryProvider* provider)
+{
+ m_provider.initialize(provider);
+}
+
+void WebBatteryManagerProxy::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments)
+{
+ didReceiveWebBatteryManagerProxyMessage(connection, messageID, arguments);
+}
+
+void WebBatteryManagerProxy::startUpdating()
+{
+ if (m_isUpdating)
+ return;
+
+ m_provider.startUpdating(this);
+ m_isUpdating = true;
+}
+
+void WebBatteryManagerProxy::stopUpdating()
+{
+ if (!m_isUpdating)
+ return;
+
+ m_provider.stopUpdating(this);
+ m_isUpdating = false;
+}
+
+void WebBatteryManagerProxy::providerDidChangeBatteryStatus(const WTF::AtomicString& eventType, WebBatteryStatus* status)
+{
+ if (!m_context)
+ return;
+
+ m_context->sendToAllProcesses(Messages::WebBatteryManager::DidChangeBatteryStatus(eventType, status->data()));
+}
+
+void WebBatteryManagerProxy::providerUpdateBatteryStatus(WebBatteryStatus* status)
+{
+ if (!m_context)
+ return;
+
+ m_context->sendToAllProcesses(Messages::WebBatteryManager::UpdateBatteryStatus(status->data()));
+}
+
+} // namespace WebKit
+
+#endif // ENABLE(BATTERY_STATUS)
diff --git a/Source/WebKit2/UIProcess/WebBatteryManagerProxy.h b/Source/WebKit2/UIProcess/WebBatteryManagerProxy.h
new file mode 100644
index 000000000..9fa5bdc43
--- /dev/null
+++ b/Source/WebKit2/UIProcess/WebBatteryManagerProxy.h
@@ -0,0 +1,84 @@
+/*
+ * Copyright (C) 2012 Intel Corporation. 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 WebBatteryManagerProxy_h
+#define WebBatteryManagerProxy_h
+
+#if ENABLE(BATTERY_STATUS)
+
+#include "APIObject.h"
+#include "MessageID.h"
+#include "WebBatteryProvider.h"
+#include <wtf/Forward.h>
+
+namespace CoreIPC {
+class ArgumentDecoder;
+class Connection;
+}
+
+namespace WebKit {
+
+class WebContext;
+class WebBatteryStatus;
+
+class WebBatteryManagerProxy : public APIObject {
+public:
+ static const Type APIType = TypeBatteryManager;
+
+ static PassRefPtr<WebBatteryManagerProxy> create(WebContext*);
+ virtual ~WebBatteryManagerProxy();
+
+ void invalidate();
+ void clearContext() { m_context = 0; }
+
+ void initializeProvider(const WKBatteryProvider*);
+
+ void providerDidChangeBatteryStatus(const WTF::AtomicString&, WebBatteryStatus*);
+ void providerUpdateBatteryStatus(WebBatteryStatus*);
+
+ void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
+
+private:
+ explicit WebBatteryManagerProxy(WebContext*);
+
+ virtual Type type() const { return APIType; }
+
+ // Implemented in generated WebBatteryManagerProxyMessageReceiver.cpp
+ void didReceiveWebBatteryManagerProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
+
+ void startUpdating();
+ void stopUpdating();
+
+ bool m_isUpdating;
+
+ WebContext* m_context;
+ WebBatteryProvider m_provider;
+};
+
+} // namespace WebKit
+
+#endif // ENABLE(BATTERY_STATUS)
+
+#endif // WebBatteryManagerProxy_h
diff --git a/Source/WebKit2/UIProcess/WebBatteryManagerProxy.messages.in b/Source/WebKit2/UIProcess/WebBatteryManagerProxy.messages.in
new file mode 100644
index 000000000..3faefa1e2
--- /dev/null
+++ b/Source/WebKit2/UIProcess/WebBatteryManagerProxy.messages.in
@@ -0,0 +1,30 @@
+# Copyright (C) 2012 Intel Corporation. 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(BATTERY_STATUS)
+
+messages -> WebBatteryManagerProxy {
+ StartUpdating();
+ StopUpdating();
+}
+
+#endif
diff --git a/Source/WebKit2/UIProcess/WebBatteryProvider.cpp b/Source/WebKit2/UIProcess/WebBatteryProvider.cpp
new file mode 100644
index 000000000..82841601d
--- /dev/null
+++ b/Source/WebKit2/UIProcess/WebBatteryProvider.cpp
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2012 Intel Corporation. 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 "WebBatteryProvider.h"
+
+#if ENABLE(BATTERY_STATUS)
+
+#include "WKAPICast.h"
+#include "WebBatteryManagerProxy.h"
+
+namespace WebKit {
+
+void WebBatteryProvider::startUpdating(WebBatteryManagerProxy* batteryManager)
+{
+ if (!m_client.startUpdating)
+ return;
+
+ m_client.startUpdating(toAPI(batteryManager), m_client.clientInfo);
+}
+
+void WebBatteryProvider::stopUpdating(WebBatteryManagerProxy* batteryManager)
+{
+ if (!m_client.stopUpdating)
+ return;
+
+ m_client.stopUpdating(toAPI(batteryManager), m_client.clientInfo);
+}
+
+} // namespace WebKit
+
+#endif // ENABLE(BATTERY_STATUS)
diff --git a/Source/WebKit2/UIProcess/WebBatteryProvider.h b/Source/WebKit2/UIProcess/WebBatteryProvider.h
new file mode 100644
index 000000000..f599068c9
--- /dev/null
+++ b/Source/WebKit2/UIProcess/WebBatteryProvider.h
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2012 Intel Corporation. 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 WebBatteryProvider_h
+#define WebBatteryProvider_h
+
+#if ENABLE(BATTERY_STATUS)
+
+#include "APIClient.h"
+#include "WKBatteryManager.h"
+#include <wtf/Forward.h>
+
+namespace WebKit {
+
+class WebBatteryManagerProxy;
+
+class WebBatteryProvider : public APIClient<WKBatteryProvider, kWKBatteryProviderCurrentVersion> {
+public:
+ void startUpdating(WebBatteryManagerProxy*);
+ void stopUpdating(WebBatteryManagerProxy*);
+};
+
+} // namespace WebKit
+
+#endif // ENABLE(BATTERY_STATUS)
+
+#endif // WebBatteryProvider_h
diff --git a/Source/WebKit2/UIProcess/WebContext.cpp b/Source/WebKit2/UIProcess/WebContext.cpp
index 742aea62c..5c55636d6 100644
--- a/Source/WebKit2/UIProcess/WebContext.cpp
+++ b/Source/WebKit2/UIProcess/WebContext.cpp
@@ -66,6 +66,10 @@
#include "BuiltInPDFView.h"
#endif
+#if ENABLE(BATTERY_STATUS)
+#include "WebBatteryManagerProxy.h"
+#endif
+
#if USE(SOUP)
#include "WebSoupRequestManagerProxy.h"
#endif
@@ -130,6 +134,9 @@ WebContext::WebContext(ProcessModel processModel, const String& injectedBundlePa
, m_memorySamplerEnabled(false)
, m_memorySamplerInterval(1400.0)
, m_applicationCacheManagerProxy(WebApplicationCacheManagerProxy::create(this))
+#if ENABLE(BATTERY_STATUS)
+ , m_batteryManagerProxy(WebBatteryManagerProxy::create(this))
+#endif
, m_cookieManagerProxy(WebCookieManagerProxy::create(this))
, m_databaseManagerProxy(WebDatabaseManagerProxy::create(this))
, m_geolocationManagerProxy(WebGeolocationManagerProxy::create(this))
@@ -157,7 +164,9 @@ WebContext::WebContext(ProcessModel processModel, const String& injectedBundlePa
addLanguageChangeObserver(this, languageChanged);
+#if !LOG_DISABLED
WebCore::initializeLoggingChannelsIfNecessary();
+#endif // !LOG_DISABLED
#ifndef NDEBUG
webContextCounter.increment();
@@ -179,6 +188,11 @@ WebContext::~WebContext()
m_applicationCacheManagerProxy->invalidate();
m_applicationCacheManagerProxy->clearContext();
+#if ENABLE(BATTERY_STATUS)
+ m_batteryManagerProxy->invalidate();
+ m_batteryManagerProxy->clearContext();
+#endif
+
m_cookieManagerProxy->invalidate();
m_cookieManagerProxy->clearContext();
@@ -304,7 +318,10 @@ void WebContext::ensureWebProcess()
// Add any platform specific parameters
platformInitializeWebProcess(parameters);
- m_process->send(Messages::WebProcess::InitializeWebProcess(parameters, WebContextUserMessageEncoder(m_injectedBundleInitializationUserData.get())), 0);
+ RefPtr<APIObject> injectedBundleInitializationUserData = m_injectedBundleClient.getInjectedBundleInitializationUserData(this);
+ if (!injectedBundleInitializationUserData)
+ injectedBundleInitializationUserData = m_injectedBundleInitializationUserData;
+ m_process->send(Messages::WebProcess::InitializeWebProcess(parameters, WebContextUserMessageEncoder(injectedBundleInitializationUserData.get())), 0);
for (size_t i = 0; i != m_pendingMessagesToPostToInjectedBundle.size(); ++i) {
pair<String, RefPtr<APIObject> >& message = m_pendingMessagesToPostToInjectedBundle[i];
@@ -393,6 +410,9 @@ void WebContext::disconnectProcess(WebProcessProxy* process)
m_downloads.clear();
m_applicationCacheManagerProxy->invalidate();
+#if ENABLE(BATTERY_STATUS)
+ m_batteryManagerProxy->invalidate();
+#endif
m_cookieManagerProxy->invalidate();
m_databaseManagerProxy->invalidate();
m_geolocationManagerProxy->invalidate();
@@ -726,6 +746,13 @@ void WebContext::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::Mes
return;
}
+#if ENABLE(BATTERY_STATUS)
+ if (messageID.is<CoreIPC::MessageClassWebBatteryManagerProxy>()) {
+ m_batteryManagerProxy->didReceiveMessage(connection, messageID, arguments);
+ return;
+ }
+#endif
+
if (messageID.is<CoreIPC::MessageClassWebCookieManagerProxy>()) {
m_cookieManagerProxy->didReceiveMessage(connection, messageID, arguments);
return;
diff --git a/Source/WebKit2/UIProcess/WebContext.h b/Source/WebKit2/UIProcess/WebContext.h
index 9a708c26e..a777dd317 100644
--- a/Source/WebKit2/UIProcess/WebContext.h
+++ b/Source/WebKit2/UIProcess/WebContext.h
@@ -48,6 +48,9 @@ namespace WebKit {
class DownloadProxy;
class WebApplicationCacheManagerProxy;
+#if ENABLE(BATTERY_STATUS)
+class WebBatteryManagerProxy;
+#endif
class WebCookieManagerProxy;
class WebDatabaseManagerProxy;
class WebGeolocationManagerProxy;
@@ -103,7 +106,6 @@ public:
DownloadProxy* download(WebPageProxy* initiatingPage, const WebCore::ResourceRequest&);
void setInjectedBundleInitializationUserData(PassRefPtr<APIObject> userData) { m_injectedBundleInitializationUserData = userData; }
- APIObject* injectedBundleInitializationUserData() const { return m_injectedBundleInitializationUserData.get(); }
void postMessageToInjectedBundle(const String&, APIObject*);
@@ -155,6 +157,9 @@ public:
static HashSet<String, CaseFoldingHash> pdfAndPostScriptMIMETypes();
WebApplicationCacheManagerProxy* applicationCacheManagerProxy() const { return m_applicationCacheManagerProxy.get(); }
+#if ENABLE(BATTERY_STATUS)
+ WebBatteryManagerProxy* batteryManagerProxy() const { return m_batteryManagerProxy.get(); }
+#endif
WebCookieManagerProxy* cookieManagerProxy() const { return m_cookieManagerProxy.get(); }
WebDatabaseManagerProxy* databaseManagerProxy() const { return m_databaseManagerProxy.get(); }
WebGeolocationManagerProxy* geolocationManagerProxy() const { return m_geolocationManagerProxy.get(); }
@@ -300,6 +305,9 @@ private:
double m_memorySamplerInterval;
RefPtr<WebApplicationCacheManagerProxy> m_applicationCacheManagerProxy;
+#if ENABLE(BATTERY_STATUS)
+ RefPtr<WebBatteryManagerProxy> m_batteryManagerProxy;
+#endif
RefPtr<WebCookieManagerProxy> m_cookieManagerProxy;
RefPtr<WebDatabaseManagerProxy> m_databaseManagerProxy;
RefPtr<WebGeolocationManagerProxy> m_geolocationManagerProxy;
diff --git a/Source/WebKit2/UIProcess/WebContextInjectedBundleClient.cpp b/Source/WebKit2/UIProcess/WebContextInjectedBundleClient.cpp
index 24e62714f..825388b09 100644
--- a/Source/WebKit2/UIProcess/WebContextInjectedBundleClient.cpp
+++ b/Source/WebKit2/UIProcess/WebContextInjectedBundleClient.cpp
@@ -51,4 +51,12 @@ void WebContextInjectedBundleClient::didReceiveSynchronousMessageFromInjectedBun
returnData = adoptRef(toImpl(returnDataRef));
}
+PassRefPtr<APIObject> WebContextInjectedBundleClient::getInjectedBundleInitializationUserData(WebContext* context)
+{
+ if (!m_client.getInjectedBundleInitializationUserData)
+ return 0;
+
+ return toImpl(m_client.getInjectedBundleInitializationUserData(toAPI(context), m_client.clientInfo));
+}
+
} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/WebContextInjectedBundleClient.h b/Source/WebKit2/UIProcess/WebContextInjectedBundleClient.h
index 2b6ce8d86..d6b274ece 100644
--- a/Source/WebKit2/UIProcess/WebContextInjectedBundleClient.h
+++ b/Source/WebKit2/UIProcess/WebContextInjectedBundleClient.h
@@ -39,6 +39,7 @@ class WebContextInjectedBundleClient : public APIClient<WKContextInjectedBundleC
public:
void didReceiveMessageFromInjectedBundle(WebContext*, const String&, APIObject*);
void didReceiveSynchronousMessageFromInjectedBundle(WebContext*, const String&, APIObject*, RefPtr<APIObject>& returnData);
+ PassRefPtr<APIObject> getInjectedBundleInitializationUserData(WebContext*);
};
} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/WebFrameProxy.cpp b/Source/WebKit2/UIProcess/WebFrameProxy.cpp
index f97d85bb6..f60fab040 100644
--- a/Source/WebKit2/UIProcess/WebFrameProxy.cpp
+++ b/Source/WebKit2/UIProcess/WebFrameProxy.cpp
@@ -37,10 +37,6 @@
#include <stdio.h>
#include <wtf/text/WTFString.h>
-#if ENABLE(WEB_INTENTS)
-#include "WebIntentData.h"
-#endif
-
using namespace WebCore;
using namespace std;
@@ -98,19 +94,6 @@ void WebFrameProxy::stopLoading() const
m_page->process()->send(Messages::WebPage::StopLoadingFrame(m_frameID), m_page->pageID());
}
-
-#if ENABLE(WEB_INTENTS)
-void WebFrameProxy::deliverIntent(WebIntentData* webIntentData)
-{
- if (!m_page)
- return;
-
- if (!m_page->isValid())
- return;
-
- m_page->process()->send(Messages::WebPage::DeliverIntentToFrame(m_frameID, webIntentData->store()), m_page->pageID());
-}
-#endif
bool WebFrameProxy::canProvideSource() const
{
diff --git a/Source/WebKit2/UIProcess/WebFrameProxy.h b/Source/WebKit2/UIProcess/WebFrameProxy.h
index 1f7329b39..de5a58cb7 100644
--- a/Source/WebKit2/UIProcess/WebFrameProxy.h
+++ b/Source/WebKit2/UIProcess/WebFrameProxy.h
@@ -50,10 +50,6 @@ class WebFormSubmissionListenerProxy;
class WebFramePolicyListenerProxy;
class WebPageProxy;
-#if ENABLE(WEB_INTENTS)
-class WebIntentData;
-#endif
-
typedef GenericCallback<WKDataRef> DataCallback;
class WebFrameProxy : public APIObject {
@@ -90,10 +86,6 @@ public:
bool isFrameSet() const { return m_isFrameSet; }
LoadState loadState() const { return m_loadState; }
-
-#if ENABLE(WEB_INTENTS)
- void deliverIntent(WebIntentData*);
-#endif
void stopLoading() const;
diff --git a/Source/WebKit2/UIProcess/WebLayerTreeRenderer.cpp b/Source/WebKit2/UIProcess/WebLayerTreeRenderer.cpp
index b85e01383..95049a32d 100644
--- a/Source/WebKit2/UIProcess/WebLayerTreeRenderer.cpp
+++ b/Source/WebKit2/UIProcess/WebLayerTreeRenderer.cpp
@@ -414,8 +414,10 @@ void WebLayerTreeRenderer::ensureRootLayer()
{
if (m_rootLayer)
return;
- if (!m_textureMapper)
+ if (!m_textureMapper) {
m_textureMapper = TextureMapper::create(TextureMapper::OpenGLMode);
+ static_cast<TextureMapperGL*>(m_textureMapper.get())->setEnableEdgeDistanceAntialiasing(true);
+ }
m_rootLayer = createLayer(InvalidWebLayerID);
m_rootLayer->setMasksToBounds(false);
diff --git a/Source/WebKit2/UIProcess/WebNetworkInfoManagerProxy.cpp b/Source/WebKit2/UIProcess/WebNetworkInfoManagerProxy.cpp
new file mode 100644
index 000000000..4abe2d68d
--- /dev/null
+++ b/Source/WebKit2/UIProcess/WebNetworkInfoManagerProxy.cpp
@@ -0,0 +1,105 @@
+/*
+ * Copyright (C) 2012 Intel Corporation. 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 "WebNetworkInfoManagerProxy.h"
+
+#if ENABLE(NETWORK_INFO)
+
+#include "WebContext.h"
+#include "WebNetworkInfo.h"
+#include "WebNetworkInfoManagerMessages.h"
+
+namespace WebKit {
+
+PassRefPtr<WebNetworkInfoManagerProxy> WebNetworkInfoManagerProxy::create(WebContext* context)
+{
+ return adoptRef(new WebNetworkInfoManagerProxy(context));
+}
+
+WebNetworkInfoManagerProxy::WebNetworkInfoManagerProxy(WebContext* context)
+ : m_isUpdating(false)
+ , m_context(context)
+{
+}
+
+WebNetworkInfoManagerProxy::~WebNetworkInfoManagerProxy()
+{
+}
+
+void WebNetworkInfoManagerProxy::invalidate()
+{
+ stopUpdating();
+}
+
+void WebNetworkInfoManagerProxy::initializeProvider(const WKNetworkInfoProvider* provider)
+{
+ m_provider.initialize(provider);
+}
+
+void WebNetworkInfoManagerProxy::providerDidChangeNetworkInformation(const AtomicString& eventType, WebNetworkInfo* networkInformation)
+{
+ if (!m_context)
+ return;
+
+ m_context->sendToAllProcesses(Messages::WebNetworkInfoManager::DidChangeNetworkInformation(eventType, networkInformation->data()));
+}
+
+void WebNetworkInfoManagerProxy::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments)
+{
+ didReceiveWebNetworkInfoManagerProxyMessage(connection, messageID, arguments);
+}
+
+void WebNetworkInfoManagerProxy::startUpdating()
+{
+ if (m_isUpdating)
+ return;
+
+ m_provider.startUpdating(this);
+ m_isUpdating = true;
+}
+
+void WebNetworkInfoManagerProxy::stopUpdating()
+{
+ if (!m_isUpdating)
+ return;
+
+ m_provider.stopUpdating(this);
+ m_isUpdating = false;
+}
+
+void WebNetworkInfoManagerProxy::getBandwidth(double& bandwidth)
+{
+ bandwidth = m_provider.bandwidth(this);
+}
+
+void WebNetworkInfoManagerProxy::isMetered(bool& isMetered)
+{
+ isMetered = m_provider.isMetered(this);
+}
+
+} // namespace WebKit
+
+#endif // ENABLE(NETWORK_INFO)
diff --git a/Source/WebKit2/UIProcess/WebNetworkInfoManagerProxy.h b/Source/WebKit2/UIProcess/WebNetworkInfoManagerProxy.h
new file mode 100644
index 000000000..660cba9b7
--- /dev/null
+++ b/Source/WebKit2/UIProcess/WebNetworkInfoManagerProxy.h
@@ -0,0 +1,88 @@
+/*
+ * Copyright (C) 2012 Intel Corporation. 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 WebNetworkInfoManagerProxy_h
+#define WebNetworkInfoManagerProxy_h
+
+#if ENABLE(NETWORK_INFO)
+
+#include "APIObject.h"
+#include "MessageID.h"
+#include "WebNetworkInfoProvider.h"
+#include <wtf/Forward.h>
+
+namespace CoreIPC {
+class ArgumentDecoder;
+class ArgumentEncoder;
+class Connection;
+}
+
+namespace WebKit {
+
+class WebContext;
+class WebNetworkInfo;
+
+class WebNetworkInfoManagerProxy : public APIObject {
+public:
+ static const Type APIType = TypeNetworkInfoManager;
+
+ static PassRefPtr<WebNetworkInfoManagerProxy> create(WebContext*);
+ virtual ~WebNetworkInfoManagerProxy();
+
+ void invalidate();
+ void clearContext() { m_context = 0; }
+
+ void initializeProvider(const WKNetworkInfoProvider*);
+
+ void providerDidChangeNetworkInformation(const WTF::AtomicString& eventType, WebNetworkInfo*);
+
+ void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
+
+private:
+ explicit WebNetworkInfoManagerProxy(WebContext*);
+
+ virtual Type type() const { return APIType; }
+
+ // Implemented in generated WebNetworkInfoManagerProxyMessageReceiver.cpp
+ void didReceiveWebNetworkInfoManagerProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
+ void didReceiveSyncWebNetworkInfoManagerProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*, WTF::OwnPtr<CoreIPC::ArgumentEncoder>&);
+
+ void startUpdating();
+ void stopUpdating();
+
+ void getBandwidth(double&);
+ void isMetered(bool&);
+
+ bool m_isUpdating;
+
+ WebContext* m_context;
+ WebNetworkInfoProvider m_provider;
+};
+
+} // namespace WebKit
+
+#endif // ENABLE(NETWORK_INFO)
+
+#endif // WebNetworkInfoManagerProxy_h
diff --git a/Source/WebKit2/UIProcess/WebNetworkInfoManagerProxy.messages.in b/Source/WebKit2/UIProcess/WebNetworkInfoManagerProxy.messages.in
new file mode 100644
index 000000000..b6acdc26b
--- /dev/null
+++ b/Source/WebKit2/UIProcess/WebNetworkInfoManagerProxy.messages.in
@@ -0,0 +1,33 @@
+# Copyright (C) 2012 Intel Corporation. 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(NETWORK_INFO)
+
+messages -> WebNetworkInfoManagerProxy {
+ StartUpdating();
+ StopUpdating();
+
+ GetBandwidth() -> (double bandwidth);
+ IsMetered() -> (bool metered);
+}
+
+#endif
diff --git a/Source/WebKit2/UIProcess/WebNetworkInfoProvider.cpp b/Source/WebKit2/UIProcess/WebNetworkInfoProvider.cpp
new file mode 100644
index 000000000..47d0cee62
--- /dev/null
+++ b/Source/WebKit2/UIProcess/WebNetworkInfoProvider.cpp
@@ -0,0 +1,72 @@
+/*
+ * Copyright (C) 2012 Intel Corporation. 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 "WebNetworkInfoProvider.h"
+
+#if ENABLE(NETWORK_INFO)
+
+#include "WKAPICast.h"
+#include "WebNetworkInfoManagerProxy.h"
+#include <limits.h>
+
+namespace WebKit {
+
+void WebNetworkInfoProvider::startUpdating(WebNetworkInfoManagerProxy* networkInfoManager)
+{
+ if (!m_client.startUpdating)
+ return;
+
+ m_client.startUpdating(toAPI(networkInfoManager), m_client.clientInfo);
+}
+
+void WebNetworkInfoProvider::stopUpdating(WebNetworkInfoManagerProxy* networkInfoManager)
+{
+ if (!m_client.stopUpdating)
+ return;
+
+ m_client.stopUpdating(toAPI(networkInfoManager), m_client.clientInfo);
+}
+
+double WebNetworkInfoProvider::bandwidth(WebNetworkInfoManagerProxy* networkInfoManager) const
+{
+ // The spec indicates that we should return "infinity" if the bandwidth is unknown.
+ if (!m_client.bandwidth)
+ return std::numeric_limits<double>::infinity();
+
+ return m_client.bandwidth(toAPI(networkInfoManager), m_client.clientInfo);
+}
+
+bool WebNetworkInfoProvider::isMetered(WebNetworkInfoManagerProxy* networkInfoManager) const
+{
+ if (!m_client.isMetered)
+ return false;
+
+ return m_client.isMetered(toAPI(networkInfoManager), m_client.clientInfo);
+}
+
+} // namespace WebKit
+
+#endif // ENABLE(NETWORK_INFO)
diff --git a/Source/WebKit2/UIProcess/WebNetworkInfoProvider.h b/Source/WebKit2/UIProcess/WebNetworkInfoProvider.h
new file mode 100644
index 000000000..f7205d05b
--- /dev/null
+++ b/Source/WebKit2/UIProcess/WebNetworkInfoProvider.h
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2012 Intel Corporation. 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 WebNetworkInfoProvider_h
+#define WebNetworkInfoProvider_h
+
+#if ENABLE(NETWORK_INFO)
+
+#include "APIClient.h"
+#include "WKNetworkInfoManager.h"
+#include <wtf/Forward.h>
+
+namespace WebKit {
+
+class WebNetworkInfoManagerProxy;
+
+class WebNetworkInfoProvider : public APIClient<WKNetworkInfoProvider, kWKNetworkInfoProviderCurrentVersion> {
+public:
+ void startUpdating(WebNetworkInfoManagerProxy*);
+ void stopUpdating(WebNetworkInfoManagerProxy*);
+
+ double bandwidth(WebNetworkInfoManagerProxy*) const;
+ bool isMetered(WebNetworkInfoManagerProxy*) const;
+};
+
+} // namespace WebKit
+
+#endif // ENABLE(NETWORK_INFO)
+
+#endif // WebNetworkInfoProvider_h
diff --git a/Source/WebKit2/UIProcess/WebPageProxy.cpp b/Source/WebKit2/UIProcess/WebPageProxy.cpp
index b5046b299..85709ef20 100644
--- a/Source/WebKit2/UIProcess/WebPageProxy.cpp
+++ b/Source/WebKit2/UIProcess/WebPageProxy.cpp
@@ -1135,7 +1135,7 @@ void WebPageProxy::handleKeyboardEvent(const NativeWebKeyboardEvent& event)
if (m_shouldSendEventsSynchronously) {
bool handled = false;
process()->sendSync(Messages::WebPage::KeyEventSyncForTesting(event), Messages::WebPage::KeyEventSyncForTesting::Reply(handled), m_pageID);
- didReceiveKeyEvent(event.type(), handled);
+ didReceiveEvent(event.type(), handled);
} else
process()->send(Messages::WebPage::KeyEvent(event), m_pageID);
}
@@ -1631,6 +1631,16 @@ void WebPageProxy::getSourceForFrame(WebFrameProxy* frame, PassRefPtr<StringCall
process()->send(Messages::WebPage::GetSourceForFrame(frame->frameID(), callbackID), m_pageID);
}
+#if ENABLE(WEB_INTENTS)
+void WebPageProxy::deliverIntentToFrame(WebFrameProxy* frame, WebIntentData* webIntentData)
+{
+ if (!isValid())
+ return;
+
+ process()->send(Messages::WebPage::DeliverIntentToFrame(frame->frameID(), webIntentData->store()), m_pageID);
+}
+#endif
+
void WebPageProxy::getContentsAsString(PassRefPtr<StringCallback> prpCallback)
{
RefPtr<StringCallback> callback = prpCallback;
@@ -3149,42 +3159,6 @@ void WebPageProxy::setCursorHiddenUntilMouseMoves(bool hiddenUntilMouseMoves)
m_pageClient->setCursorHiddenUntilMouseMoves(hiddenUntilMouseMoves);
}
-void WebPageProxy::didReceiveKeyEvent(uint32_t opaqueType, bool handled)
-{
- process()->responsivenessTimer()->stop();
-
- WebEvent::Type type = static_cast<WebEvent::Type>(opaqueType);
-
- switch (type) {
- case WebEvent::KeyDown:
- case WebEvent::KeyUp:
- case WebEvent::RawKeyDown:
- case WebEvent::Char: {
- LOG(KeyHandling, "WebPageProxy::didReceiveKeyEvent: %s", webKeyboardEventTypeString(type));
-
- NativeWebKeyboardEvent event = m_keyEventQueue.first();
- MESSAGE_CHECK(type == event.type());
-
- m_keyEventQueue.removeFirst();
-
- m_pageClient->doneWithKeyEvent(event, handled);
-
- if (handled)
- break;
-
- if (m_uiClient.implementsDidNotHandleKeyEvent())
- m_uiClient.didNotHandleKeyEvent(this, event);
-#if PLATFORM(WIN)
- else
- ::TranslateMessage(event.nativeEvent());
-#endif
- break;
- }
- default:
- ASSERT_NOT_REACHED();
- }
-}
-
void WebPageProxy::didReceiveEvent(uint32_t opaqueType, bool handled)
{
WebEvent::Type type = static_cast<WebEvent::Type>(opaqueType);
@@ -3197,6 +3171,10 @@ void WebPageProxy::didReceiveEvent(uint32_t opaqueType, bool handled)
case WebEvent::MouseDown:
case WebEvent::MouseUp:
case WebEvent::Wheel:
+ case WebEvent::KeyDown:
+ case WebEvent::KeyUp:
+ case WebEvent::RawKeyDown:
+ case WebEvent::Char:
#if ENABLE(GESTURE_EVENTS)
case WebEvent::GestureScrollBegin:
case WebEvent::GestureScrollEnd:
@@ -3210,8 +3188,6 @@ void WebPageProxy::didReceiveEvent(uint32_t opaqueType, bool handled)
#endif
process()->responsivenessTimer()->stop();
break;
- default:
- ASSERT_NOT_REACHED();
}
switch (type) {
@@ -3256,6 +3232,30 @@ void WebPageProxy::didReceiveEvent(uint32_t opaqueType, bool handled)
break;
}
+ case WebEvent::KeyDown:
+ case WebEvent::KeyUp:
+ case WebEvent::RawKeyDown:
+ case WebEvent::Char: {
+ LOG(KeyHandling, "WebPageProxy::didReceiveEvent: %s", webKeyboardEventTypeString(type));
+
+ NativeWebKeyboardEvent event = m_keyEventQueue.first();
+ MESSAGE_CHECK(type == event.type());
+
+ m_keyEventQueue.removeFirst();
+
+ m_pageClient->doneWithKeyEvent(event, handled);
+
+ if (handled)
+ break;
+
+ if (m_uiClient.implementsDidNotHandleKeyEvent())
+ m_uiClient.didNotHandleKeyEvent(this, event);
+#if PLATFORM(WIN)
+ else
+ ::TranslateMessage(event.nativeEvent());
+#endif
+ break;
+ }
#if ENABLE(TOUCH_EVENTS)
case WebEvent::TouchStart:
case WebEvent::TouchMove:
@@ -3273,8 +3273,6 @@ void WebPageProxy::didReceiveEvent(uint32_t opaqueType, bool handled)
break;
}
#endif
- default:
- ASSERT_NOT_REACHED();
}
}
diff --git a/Source/WebKit2/UIProcess/WebPageProxy.h b/Source/WebKit2/UIProcess/WebPageProxy.h
index ed99d0d80..57ab86c24 100644
--- a/Source/WebKit2/UIProcess/WebPageProxy.h
+++ b/Source/WebKit2/UIProcess/WebPageProxy.h
@@ -124,6 +124,10 @@ typedef GtkWidget* PlatformWidget;
typedef Evas_Object* PlatformWidget;
#endif
+#if ENABLE(WEB_INTENTS)
+class WebIntentData;
+#endif
+
namespace WebKit {
class NativeWebKeyboardEvent;
@@ -530,6 +534,10 @@ public:
void runJavaScriptInMainFrame(const String&, PassRefPtr<ScriptValueCallback>);
void forceRepaint(PassRefPtr<VoidCallback>);
+#if ENABLE(WEB_INTENTS)
+ void deliverIntentToFrame(WebFrameProxy*, WebIntentData*);
+#endif
+
float headerHeight(WebFrameProxy*);
float footerHeight(WebFrameProxy*);
void drawHeader(WebFrameProxy*, const WebCore::FloatRect&);
@@ -909,7 +917,6 @@ private:
void setCursorHiddenUntilMouseMoves(bool);
void didReceiveEvent(uint32_t opaqueType, bool handled);
- void didReceiveKeyEvent(uint32_t opaqueType, bool handled);
void stopResponsivenessTimer();
void voidCallback(uint64_t);
diff --git a/Source/WebKit2/UIProcess/WebPageProxy.messages.in b/Source/WebKit2/UIProcess/WebPageProxy.messages.in
index a098ea66d..03412766d 100644
--- a/Source/WebKit2/UIProcess/WebPageProxy.messages.in
+++ b/Source/WebKit2/UIProcess/WebPageProxy.messages.in
@@ -33,7 +33,6 @@ messages -> WebPageProxy {
UnavailablePluginButtonClicked(uint32_t pluginUnavailabilityReason, WTF::String mimeType, WTF::String url, WTF::String pluginsPageURL)
DidChangeViewportProperties(WebCore::ViewportAttributes attributes)
DidReceiveEvent(uint32_t type, bool handled)
- DidReceiveKeyEvent(uint32_t type, bool handled) -> ()
StopResponsivenessTimer()
SetCursor(WebCore::Cursor cursor)
SetCursorHiddenUntilMouseMoves(bool hiddenUntilMouseMoves)
diff --git a/Source/WebKit2/UIProcess/WebProcessProxy.cpp b/Source/WebKit2/UIProcess/WebProcessProxy.cpp
index 455df4d9b..152a72e6f 100644
--- a/Source/WebKit2/UIProcess/WebProcessProxy.cpp
+++ b/Source/WebKit2/UIProcess/WebProcessProxy.cpp
@@ -307,6 +307,9 @@ void WebProcessProxy::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC
|| messageID.is<CoreIPC::MessageClassWebContextLegacy>()
|| messageID.is<CoreIPC::MessageClassDownloadProxy>()
|| messageID.is<CoreIPC::MessageClassWebApplicationCacheManagerProxy>()
+#if ENABLE(BATTERY_STATUS)
+ || messageID.is<CoreIPC::MessageClassWebBatteryManagerProxy>()
+#endif
|| messageID.is<CoreIPC::MessageClassWebCookieManagerProxy>()
|| messageID.is<CoreIPC::MessageClassWebDatabaseManagerProxy>()
|| messageID.is<CoreIPC::MessageClassWebGeolocationManagerProxy>()
diff --git a/Source/WebKit2/UIProcess/WebVibrationProvider.cpp b/Source/WebKit2/UIProcess/WebVibrationProvider.cpp
new file mode 100644
index 000000000..095bd978b
--- /dev/null
+++ b/Source/WebKit2/UIProcess/WebVibrationProvider.cpp
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2012 Intel Corporation. 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 "WebVibrationProvider.h"
+
+#if ENABLE(VIBRATION)
+
+#include "WKAPICast.h"
+#include "WebVibrationProxy.h"
+
+namespace WebKit {
+
+void WebVibrationProvider::vibrate(WebVibrationProxy* vibration, uint64_t vibrationTime)
+{
+ if (!m_client.vibrate)
+ return;
+
+ m_client.vibrate(toAPI(vibration), vibrationTime, m_client.clientInfo);
+}
+
+void WebVibrationProvider::cancelVibration(WebVibrationProxy* vibration)
+{
+ if (!m_client.cancelVibration)
+ return;
+
+ m_client.cancelVibration(toAPI(vibration), m_client.clientInfo);
+}
+
+} // namespace WebKit
+
+#endif // ENABLE(VIBRATION)
diff --git a/Source/WebKit2/UIProcess/WebVibrationProvider.h b/Source/WebKit2/UIProcess/WebVibrationProvider.h
new file mode 100644
index 000000000..76d98a8d2
--- /dev/null
+++ b/Source/WebKit2/UIProcess/WebVibrationProvider.h
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2012 Intel Corporation. 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 WebVibrationProvider_h
+#define WebVibrationProvider_h
+
+#if ENABLE(VIBRATION)
+
+#include "APIClient.h"
+#include "WKVibration.h"
+#include <wtf/Forward.h>
+
+namespace WebKit {
+
+class WebVibrationProxy;
+
+class WebVibrationProvider : public APIClient<WKVibrationProvider, kWKVibrationProviderCurrentVersion> {
+public:
+ void vibrate(WebVibrationProxy*, uint64_t vibrationTime);
+ void cancelVibration(WebVibrationProxy*);
+};
+
+} // namespace WebKit
+
+#endif // ENABLE(VIBRATION)
+
+#endif // WebVibrationProvider_h
diff --git a/Source/WebKit2/UIProcess/WebVibrationProxy.cpp b/Source/WebKit2/UIProcess/WebVibrationProxy.cpp
new file mode 100644
index 000000000..9a5f7f264
--- /dev/null
+++ b/Source/WebKit2/UIProcess/WebVibrationProxy.cpp
@@ -0,0 +1,76 @@
+/*
+ * Copyright (C) 2012 Intel Corporation. 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 "WebVibrationProxy.h"
+
+#if ENABLE(VIBRATION)
+
+#include "WebContext.h"
+
+namespace WebKit {
+
+PassRefPtr<WebVibrationProxy> WebVibrationProxy::create(WebContext* context)
+{
+ return adoptRef(new WebVibrationProxy(context));
+}
+
+WebVibrationProxy::WebVibrationProxy(WebContext* context)
+ : m_context(context)
+{
+}
+
+WebVibrationProxy::~WebVibrationProxy()
+{
+}
+
+void WebVibrationProxy::invalidate()
+{
+ cancelVibration();
+}
+
+void WebVibrationProxy::initializeProvider(const WKVibrationProvider* provider)
+{
+ m_provider.initialize(provider);
+}
+
+void WebVibrationProxy::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments)
+{
+ didReceiveWebVibrationProxyMessage(connection, messageID, arguments);
+}
+
+void WebVibrationProxy::vibrate(uint64_t vibrationTime)
+{
+ m_provider.vibrate(this, vibrationTime);
+}
+
+void WebVibrationProxy::cancelVibration()
+{
+ m_provider.cancelVibration(this);
+}
+
+} // namespace WebKit
+
+#endif // ENABLE(VIBRATION)
diff --git a/Source/WebKit2/UIProcess/WebVibrationProxy.h b/Source/WebKit2/UIProcess/WebVibrationProxy.h
new file mode 100644
index 000000000..4e69e96fa
--- /dev/null
+++ b/Source/WebKit2/UIProcess/WebVibrationProxy.h
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2012 Intel Corporation. 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 WebVibrationProxy_h
+#define WebVibrationProxy_h
+
+#if ENABLE(VIBRATION)
+
+#include "APIObject.h"
+#include "MessageID.h"
+#include "WebVibrationProvider.h"
+#include <wtf/Forward.h>
+
+namespace CoreIPC {
+class ArgumentDecoder;
+class Connection;
+}
+
+namespace WebKit {
+
+class WebContext;
+
+class WebVibrationProxy : public APIObject {
+public:
+ static const Type APIType = TypeVibration;
+
+ static PassRefPtr<WebVibrationProxy> create(WebContext*);
+ virtual ~WebVibrationProxy();
+
+ void invalidate();
+ void clearContext() { m_context = 0; }
+
+ void initializeProvider(const WKVibrationProvider*);
+
+ void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
+
+private:
+ explicit WebVibrationProxy(WebContext*);
+
+ virtual Type type() const { return APIType; }
+
+ // Implemented in generated WebVibrationProxyMessageReceiver.cpp
+ void didReceiveWebVibrationProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
+
+ void vibrate(uint64_t vibrationTime);
+ void cancelVibration();
+
+ WebContext* m_context;
+ WebVibrationProvider m_provider;
+};
+
+} // namespace WebKit
+
+#endif // ENABLE(VIBRATION)
+
+#endif // WebVibrationProxy_h
diff --git a/Source/WebKit2/UIProcess/WebVibrationProxy.messages.in b/Source/WebKit2/UIProcess/WebVibrationProxy.messages.in
new file mode 100644
index 000000000..ff40b0d9f
--- /dev/null
+++ b/Source/WebKit2/UIProcess/WebVibrationProxy.messages.in
@@ -0,0 +1,30 @@
+# Copyright (C) 2012 Intel Corporation. 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(VIBRATION)
+
+messages -> WebVibrationProxy {
+ Vibrate(uint64_t vibrationTime);
+ CancelVibration();
+}
+
+#endif
diff --git a/Source/WebKit2/UIProcess/cf/WebBackForwardListCF.cpp b/Source/WebKit2/UIProcess/cf/WebBackForwardListCF.cpp
index b4885220f..cdff34469 100644
--- a/Source/WebKit2/UIProcess/cf/WebBackForwardListCF.cpp
+++ b/Source/WebKit2/UIProcess/cf/WebBackForwardListCF.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010, 2011 Apple Inc. All rights reserved.
+ * Copyright (C) 2010, 2011, 2012 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -44,6 +44,10 @@ static uint64_t generateWebBackForwardItemID()
return uniqueHistoryItemID;
}
+static CFIndex currentVersion = 1;
+DEFINE_STATIC_GETTER(CFNumberRef, SessionHistoryCurrentVersion, (CFNumberCreate(0, kCFNumberCFIndexType, &currentVersion)));
+
+DEFINE_STATIC_GETTER(CFStringRef, SessionHistoryVersionKey, (CFSTR("SessionHistoryVersion")));
DEFINE_STATIC_GETTER(CFStringRef, SessionHistoryCurrentIndexKey, (CFSTR("SessionHistoryCurrentIndex")));
DEFINE_STATIC_GETTER(CFStringRef, SessionHistoryEntriesKey, (CFSTR("SessionHistoryEntries")));
DEFINE_STATIC_GETTER(CFStringRef, SessionHistoryEntryTitleKey, (CFSTR("SessionHistoryEntryTitle")));
@@ -51,23 +55,41 @@ DEFINE_STATIC_GETTER(CFStringRef, SessionHistoryEntryURLKey, (CFSTR("SessionHist
DEFINE_STATIC_GETTER(CFStringRef, SessionHistoryEntryOriginalURLKey, (CFSTR("SessionHistoryEntryOriginalURL")));
DEFINE_STATIC_GETTER(CFStringRef, SessionHistoryEntryDataKey, (CFSTR("SessionHistoryEntryData")));
+static bool extractBackForwardListEntriesFromArray(CFArrayRef, BackForwardListItemVector&);
+
+static CFDictionaryRef createEmptySessionHistoryDictionary()
+{
+ static const void* keys[1] = { SessionHistoryVersionKey() };
+ static const void* values[1] = { SessionHistoryCurrentVersion() };
+
+ return CFDictionaryCreate(0, keys, values, 1, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
+}
+
CFDictionaryRef WebBackForwardList::createCFDictionaryRepresentation(WebPageProxy::WebPageProxySessionStateFilterCallback filter, void* context) const
{
ASSERT(!m_hasCurrentIndex || m_currentIndex < m_entries.size());
+ if (!m_hasCurrentIndex) {
+ // We represent having no current index by writing out an empty dictionary (besides the version).
+ return createEmptySessionHistoryDictionary();
+ }
+
RetainPtr<CFMutableArrayRef> entries(AdoptCF, CFArrayCreateMutable(0, m_entries.size(), &kCFTypeArrayCallBacks));
// We may need to update the current index to account for entries that are filtered by the callback.
CFIndex currentIndex = m_currentIndex;
+ bool hasCurrentIndex = true;
for (size_t i = 0; i < m_entries.size(); ++i) {
// If we somehow ended up with a null entry then we should consider the data invalid and not save session history at all.
ASSERT(m_entries[i]);
- if (!m_entries[i])
+ if (!m_entries[i]) {
+ LOG(SessionState, "WebBackForwardList contained a null entry at index %lu", i);
return 0;
+ }
if (filter && !filter(toAPI(m_page), WKPageGetSessionHistoryURLValueType(), toURLRef(m_entries[i]->originalURL().impl()), context)) {
- if (i <= static_cast<size_t>(m_currentIndex))
+ if (i <= m_currentIndex)
currentIndex--;
continue;
}
@@ -87,26 +109,62 @@ CFDictionaryRef WebBackForwardList::createCFDictionaryRepresentation(WebPageProx
CFArrayAppendValue(entries.get(), entryDictionary.get());
}
- // If all items before and including the current item were filtered then currentIndex will be -1.
- // Assuming we didn't start out with NoCurrentItemIndex, we should store "current" to point at the first item.
- if (currentIndex == -1 && m_hasCurrentIndex && CFArrayGetCount(entries.get()))
- currentIndex = 0;
-
- // FIXME: We're relying on currentIndex == -1 to mean the exact same thing as NoCurrentItemIndex (UINT_MAX) in unsigned form.
- // That seems implicit and fragile and we should find a better way of representing the NoCurrentItemIndex case.
- if (!m_hasCurrentIndex || !CFArrayGetCount(entries.get()))
- currentIndex = -1;
+ ASSERT(currentIndex == -1 || (currentIndex > -1 && currentIndex < CFArrayGetCount(entries.get())));
+ if (currentIndex < -1 || currentIndex >= CFArrayGetCount(entries.get())) {
+ LOG(SessionState, "Filtering entries to be saved resulted in an inconsistent state that we cannot represent");
+ return 0;
+ }
- RetainPtr<CFNumberRef> currentIndexNumber(AdoptCF, CFNumberCreate(0, kCFNumberCFIndexType, &currentIndex));
+ // If we have an index and all items before and including the current item were filtered then currentIndex will be -1.
+ // In this case the new current index should point at the first item.
+ // It's also possible that all items were filtered so we should represent not having a current index.
+ if (currentIndex == -1) {
+ if (CFArrayGetCount(entries.get()))
+ currentIndex = 0;
+ else
+ hasCurrentIndex = false;
+ }
- const void* keys[2] = { SessionHistoryCurrentIndexKey(), SessionHistoryEntriesKey() };
- const void* values[2] = { currentIndexNumber.get(), entries.get() };
+ if (hasCurrentIndex) {
+ RetainPtr<CFNumberRef> currentIndexNumber(AdoptCF, CFNumberCreate(0, kCFNumberCFIndexType, &currentIndex));
+ const void* keys[3] = { SessionHistoryVersionKey(), SessionHistoryCurrentIndexKey(), SessionHistoryEntriesKey() };
+ const void* values[3] = { SessionHistoryCurrentVersion(), currentIndexNumber.get(), entries.get() };
+
+ return CFDictionaryCreate(0, keys, values, 3, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
+ }
- return CFDictionaryCreate(0, keys, values, 2, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
+ // We represent having no current index by writing out an empty dictionary (besides the version).
+ return createEmptySessionHistoryDictionary();
}
bool WebBackForwardList::restoreFromCFDictionaryRepresentation(CFDictionaryRef dictionary)
{
+ CFNumberRef cfVersion = (CFNumberRef)CFDictionaryGetValue(dictionary, SessionHistoryVersionKey());
+ if (!cfVersion) {
+ // v0 session history dictionaries did not contain versioning
+ return restoreFromV0CFDictionaryRepresentation(dictionary);
+ }
+
+ if (CFGetTypeID(cfVersion) != CFNumberGetTypeID()) {
+ LOG(SessionState, "WebBackForwardList dictionary representation contains a version that is not a number");
+ return false;
+ }
+
+ CFIndex version;
+ if (!CFNumberGetValue(cfVersion, kCFNumberCFIndexType, &version)) {
+ LOG(SessionState, "WebBackForwardList dictionary representation does not have a correctly typed current version");
+ return false;
+ }
+
+ if (version == 1)
+ return restoreFromV1CFDictionaryRepresentation(dictionary);
+
+ LOG(SessionState, "WebBackForwardList dictionary representation has an invalid current version (%ld)", version);
+ return false;
+}
+
+bool WebBackForwardList::restoreFromV0CFDictionaryRepresentation(CFDictionaryRef dictionary)
+{
CFNumberRef cfIndex = (CFNumberRef)CFDictionaryGetValue(dictionary, SessionHistoryCurrentIndexKey());
if (!cfIndex || CFGetTypeID(cfIndex) != CFNumberGetTypeID()) {
LOG(SessionState, "WebBackForwardList dictionary representation does not have a valid current index");
@@ -115,12 +173,12 @@ bool WebBackForwardList::restoreFromCFDictionaryRepresentation(CFDictionaryRef d
CFIndex currentCFIndex;
if (!CFNumberGetValue(cfIndex, kCFNumberCFIndexType, &currentCFIndex)) {
- LOG(SessionState, "WebBackForwardList dictionary representation does not have a valid integer current index");
+ LOG(SessionState, "WebBackForwardList dictionary representation does not have a correctly typed current index");
return false;
}
if (currentCFIndex < -1) {
- LOG(SessionState, "WebBackForwardList dictionary representation contains a negative current index that is bogus (%ld)", currentCFIndex);
+ LOG(SessionState, "WebBackForwardList dictionary representation contains an unexpected negative current index (%ld)", currentCFIndex);
return false;
}
@@ -131,23 +189,94 @@ bool WebBackForwardList::restoreFromCFDictionaryRepresentation(CFDictionaryRef d
}
CFIndex size = CFArrayGetCount(cfEntries);
- if (currentCFIndex < -1 || currentCFIndex >= size ) {
+ if (size < 0 || currentCFIndex >= size) {
LOG(SessionState, "WebBackForwardList dictionary representation contains an invalid current index (%ld) for the number of entries (%ld)", currentCFIndex, size);
return false;
}
- // FIXME: We're relying on currentIndex == -1 to mean the exact same thing as NoCurrentItemIndex (UINT_MAX) in unsigned form.
- // That seems implicit and fragile and we should find a better way of representing the NoCurrentItemIndex case.
- bool hasCurrentIndex = currentCFIndex > -1;
- unsigned currentIndex = hasCurrentIndex ? static_cast<unsigned>(currentCFIndex) : 0;
+ // Version 0 session history relied on currentIndex == -1 to represent the same thing as not having a current index.
+ bool hasCurrentIndex = currentCFIndex != -1;
if (!hasCurrentIndex && size) {
- LOG(SessionState, "WebBackForwardList dictionary representation says there is no current item index, but there is a list of %ld entries - this is bogus", size);
+ LOG(SessionState, "WebBackForwardList dictionary representation says there is no current index, but there is a list of %ld entries", size);
return false;
}
- BackForwardListItemVector newEntries;
- newEntries.reserveCapacity(size);
+ BackForwardListItemVector entries;
+ if (!extractBackForwardListEntriesFromArray(cfEntries, entries)) {
+ // extractBackForwardListEntriesFromArray has already logged the appropriate error message.
+ return false;
+ }
+
+ ASSERT(entries.size() == static_cast<unsigned>(size));
+
+ m_hasCurrentIndex = hasCurrentIndex;
+ m_currentIndex = m_hasCurrentIndex ? static_cast<uint32_t>(currentCFIndex) : 0;
+ m_entries = entries;
+
+ return true;
+}
+
+bool WebBackForwardList::restoreFromV1CFDictionaryRepresentation(CFDictionaryRef dictionary)
+{
+ CFNumberRef cfIndex = (CFNumberRef)CFDictionaryGetValue(dictionary, SessionHistoryCurrentIndexKey());
+ if (!cfIndex) {
+ // No current index means the dictionary represents an empty session.
+ m_hasCurrentIndex = false;
+ m_currentIndex = 0;
+ m_entries.clear();
+
+ return true;
+ }
+
+ if (CFGetTypeID(cfIndex) != CFNumberGetTypeID()) {
+ LOG(SessionState, "WebBackForwardList dictionary representation does not have a valid current index");
+ return false;
+ }
+
+ CFIndex currentCFIndex;
+ if (!CFNumberGetValue(cfIndex, kCFNumberCFIndexType, &currentCFIndex)) {
+ LOG(SessionState, "WebBackForwardList dictionary representation does not have a correctly typed current index");
+ return false;
+ }
+
+ if (currentCFIndex < 0) {
+ LOG(SessionState, "WebBackForwardList dictionary representation contains an unexpected negative current index (%ld)", currentCFIndex);
+ return false;
+ }
+
+ CFArrayRef cfEntries = (CFArrayRef)CFDictionaryGetValue(dictionary, SessionHistoryEntriesKey());
+ if (!cfEntries || CFGetTypeID(cfEntries) != CFArrayGetTypeID()) {
+ LOG(SessionState, "WebBackForwardList dictionary representation does not have a valid list of entries");
+ return false;
+ }
+
+ CFIndex size = CFArrayGetCount(cfEntries);
+ if (currentCFIndex >= size) {
+ LOG(SessionState, "WebBackForwardList dictionary representation contains an invalid current index (%ld) for the number of entries (%ld)", currentCFIndex, size);
+ return false;
+ }
+
+ BackForwardListItemVector entries;
+ if (!extractBackForwardListEntriesFromArray(cfEntries, entries)) {
+ // extractBackForwardListEntriesFromArray has already logged the appropriate error message.
+ return false;
+ }
+
+ ASSERT(entries.size() == static_cast<unsigned>(size));
+
+ m_hasCurrentIndex = true;
+ m_currentIndex = static_cast<uint32_t>(currentCFIndex);
+ m_entries = entries;
+
+ return true;
+}
+
+static bool extractBackForwardListEntriesFromArray(CFArrayRef cfEntries, BackForwardListItemVector& entries)
+{
+ CFIndex size = CFArrayGetCount(cfEntries);
+
+ entries.reserveCapacity(size);
for (CFIndex i = 0; i < size; ++i) {
CFDictionaryRef entryDictionary = (CFDictionaryRef)CFArrayGetValueAtIndex(cfEntries, i);
if (!entryDictionary || CFGetTypeID(entryDictionary) != CFDictionaryGetTypeID()) {
@@ -179,12 +308,8 @@ bool WebBackForwardList::restoreFromCFDictionaryRepresentation(CFDictionaryRef d
return false;
}
- newEntries.append(WebBackForwardListItem::create(originalURL, entryURL, entryTitle, CFDataGetBytePtr(backForwardData), CFDataGetLength(backForwardData), generateWebBackForwardItemID()));
+ entries.append(WebBackForwardListItem::create(originalURL, entryURL, entryTitle, CFDataGetBytePtr(backForwardData), CFDataGetLength(backForwardData), generateWebBackForwardItemID()));
}
-
- m_entries = newEntries;
- m_hasCurrentIndex = hasCurrentIndex;
- m_currentIndex = currentIndex;
return true;
}
diff --git a/Source/WebKit2/UIProcess/gtk/WebContextMenuProxyGtk.h b/Source/WebKit2/UIProcess/gtk/WebContextMenuProxyGtk.h
index 8e187166e..144655f4d 100644
--- a/Source/WebKit2/UIProcess/gtk/WebContextMenuProxyGtk.h
+++ b/Source/WebKit2/UIProcess/gtk/WebContextMenuProxyGtk.h
@@ -49,6 +49,7 @@ public:
virtual void hideContextMenu();
void populate(Vector<WebCore::ContextMenuItem>&);
+ GtkMenu* gtkMenu() const { return m_menu.platformDescription(); }
private:
WebContextMenuProxyGtk(GtkWidget*, WebPageProxy*);
diff --git a/Source/WebKit2/UIProcess/gtk/WebInspectorProxyGtk.cpp b/Source/WebKit2/UIProcess/gtk/WebInspectorProxyGtk.cpp
index 425d799ac..fac19dc8f 100644
--- a/Source/WebKit2/UIProcess/gtk/WebInspectorProxyGtk.cpp
+++ b/Source/WebKit2/UIProcess/gtk/WebInspectorProxyGtk.cpp
@@ -195,8 +195,11 @@ void WebInspectorProxy::platformDetach()
return;
GRefPtr<GtkWidget> inspectorView = m_inspectorView;
- if (!m_client.detach(this))
- gtk_container_remove(GTK_CONTAINER(m_page->viewWidget()), m_inspectorView);
+ if (!m_client.detach(this)) {
+ GtkWidget* parent = gtk_widget_get_parent(m_inspectorView);
+ ASSERT(parent);
+ gtk_container_remove(GTK_CONTAINER(parent), m_inspectorView);
+ }
if (!m_isVisible)
return;
diff --git a/Source/WebKit2/UIProcess/mac/WebPopupMenuProxyMac.mm b/Source/WebKit2/UIProcess/mac/WebPopupMenuProxyMac.mm
index b76978107..29033e421 100644
--- a/Source/WebKit2/UIProcess/mac/WebPopupMenuProxyMac.mm
+++ b/Source/WebKit2/UIProcess/mac/WebPopupMenuProxyMac.mm
@@ -87,6 +87,9 @@ void WebPopupMenuProxyMac::populate(const Vector<WebPopupItem>& items, NSFont *f
RetainPtr<NSAttributedString> string(AdoptNS, [[NSAttributedString alloc] initWithString:nsStringFromWebCoreString(items[i].m_text) attributes:attributes.get()]);
[menuItem setAttributedTitle:string.get()];
+ // We set the title as well as the attributed title here. The attributed title will be displayed in the menu,
+ // but typeahead will use the non-attributed string that doesn't contain any leading or trailing whitespace.
+ [menuItem setTitle:[[string.get() string] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]]];
[menuItem setEnabled:items[i].m_isEnabled];
[menuItem setToolTip:nsStringFromWebCoreString(items[i].m_toolTip)];
}
diff --git a/Source/WebKit2/UIProcess/qt/QtDialogRunner.cpp b/Source/WebKit2/UIProcess/qt/QtDialogRunner.cpp
index 3ff4f273a..3d4c4e6d6 100644
--- a/Source/WebKit2/UIProcess/qt/QtDialogRunner.cpp
+++ b/Source/WebKit2/UIProcess/qt/QtDialogRunner.cpp
@@ -223,6 +223,12 @@ public slots:
void accept(const QVariant& path)
{
QStringList filesPath = path.toStringList();
+
+ if (filesPath.isEmpty()) {
+ emit rejected();
+ return;
+ }
+
// For single file upload, send only the first element if there are more than one file paths
if (!m_allowMultiple && filesPath.count() > 1)
filesPath = QStringList(filesPath.at(0));
diff --git a/Source/WebKit2/UIProcess/qt/QtViewportHandler.cpp b/Source/WebKit2/UIProcess/qt/QtViewportHandler.cpp
index 548819e13..a1f56d189 100644
--- a/Source/WebKit2/UIProcess/qt/QtViewportHandler.cpp
+++ b/Source/WebKit2/UIProcess/qt/QtViewportHandler.cpp
@@ -238,6 +238,9 @@ void QtViewportHandler::viewportAttributesChanged(const WebCore::ViewportAttribu
void QtViewportHandler::pageContentsSizeChanged(const QSize& newSize, const QSize& viewportSize)
{
+ if (viewportSize.isEmpty())
+ return;
+
float minimumScale = WebCore::computeMinimumScaleFactorForContentContained(m_rawAttributes, viewportSize, newSize);
if (!qFuzzyCompare(minimumScale, m_rawAttributes.minimumScale)) {
diff --git a/Source/WebKit2/UIProcess/texmap/LayerBackingStore.cpp b/Source/WebKit2/UIProcess/texmap/LayerBackingStore.cpp
index caaffe9e5..967f07513 100644
--- a/Source/WebKit2/UIProcess/texmap/LayerBackingStore.cpp
+++ b/Source/WebKit2/UIProcess/texmap/LayerBackingStore.cpp
@@ -80,6 +80,7 @@ void LayerBackingStore::updateTile(int id, const IntRect& sourceRect, const IntR
{
HashMap<int, LayerBackingStoreTile>::iterator it = m_tiles.find(id);
ASSERT(it != m_tiles.end());
+ it->second.incrementRepaintCount();
it->second.setBackBuffer(targetRect, sourceRect, backBuffer, offset);
}
@@ -95,6 +96,14 @@ PassRefPtr<BitmapTexture> LayerBackingStore::texture() const
return PassRefPtr<BitmapTexture>();
}
+static bool shouldShowTileDebugVisuals()
+{
+#if PLATFORM(QT)
+ return (qgetenv("QT_WEBKIT_SHOW_COMPOSITING_DEBUG_VISUALS") == "1");
+#endif
+ return false;
+}
+
void LayerBackingStore::paintToTextureMapper(TextureMapper* textureMapper, const FloatRect& targetRect, const TransformationMatrix& transform, float opacity, BitmapTexture* mask)
{
Vector<TextureMapperTile*> tilesToPaint;
@@ -121,8 +130,20 @@ void LayerBackingStore::paintToTextureMapper(TextureMapper* textureMapper, const
tilesToPaint.prepend(&tile);
}
- for (size_t i = 0; i < tilesToPaint.size(); ++i)
- tilesToPaint[i]->paint(textureMapper, transform, opacity, mask);
+ // TODO: When the TextureMapper makes a distinction between some edges exposed and no edges
+ // exposed, the value passed should be an accurate reflection of the tile subset that we are
+ // passing. For now we just "estimate" since LayerBackingStore doesn't keep information about
+ // the total tiled surface rect at the moment.
+ unsigned edgesExposed = m_tiles.size() > 1 ? TextureMapper::NoEdges : TextureMapper::AllEdges;
+ for (size_t i = 0; i < tilesToPaint.size(); ++i) {
+ TextureMapperTile* tile = tilesToPaint[i];
+ tile->paint(textureMapper, transform, opacity, mask, edgesExposed);
+ static bool shouldDebug = shouldShowTileDebugVisuals();
+ if (!shouldDebug)
+ continue;
+ textureMapper->drawBorder(QColor(Qt::red), 2, tile->rect(), transform);
+ textureMapper->drawRepaintCounter(static_cast<LayerBackingStoreTile*>(tile)->repaintCount(), 8, tilesToPaint[i]->rect().location(), transform);
+ }
}
void LayerBackingStore::commitTileOperations(TextureMapper* textureMapper)
diff --git a/Source/WebKit2/UIProcess/texmap/LayerBackingStore.h b/Source/WebKit2/UIProcess/texmap/LayerBackingStore.h
index a3e219b04..6a4f513a0 100644
--- a/Source/WebKit2/UIProcess/texmap/LayerBackingStore.h
+++ b/Source/WebKit2/UIProcess/texmap/LayerBackingStore.h
@@ -35,10 +35,13 @@ public:
LayerBackingStoreTile(float scale = 1)
: TextureMapperTile(WebCore::FloatRect())
, m_scale(scale)
+ , m_repaintCount(0)
{
}
inline float scale() const { return m_scale; }
+ inline void incrementRepaintCount() { ++m_repaintCount; }
+ inline int repaintCount() const { return m_repaintCount; }
void swapBuffers(WebCore::TextureMapper*);
void setBackBuffer(const WebCore::IntRect&, const WebCore::IntRect&, PassRefPtr<ShareableSurface> buffer, const WebCore::IntPoint&);
@@ -48,6 +51,7 @@ private:
WebCore::IntRect m_targetRect;
WebCore::IntPoint m_surfaceOffset;
float m_scale;
+ int m_repaintCount;
};
class LayerBackingStore : public WebCore::TextureMapperBackingStore {