summaryrefslogtreecommitdiffstats
path: root/Source/WebKit2/UIProcess
diff options
context:
space:
mode:
authorBen Murdoch <benm@google.com>2011-05-24 11:24:40 +0100
committerBen Murdoch <benm@google.com>2011-06-02 09:53:15 +0100
commit81bc750723a18f21cd17d1b173cd2a4dda9cea6e (patch)
tree7a9e5ed86ff429fd347a25153107221543909b19 /Source/WebKit2/UIProcess
parent94088a6d336c1dd80a1e734af51e96abcbb689a7 (diff)
downloadexternal_webkit-81bc750723a18f21cd17d1b173cd2a4dda9cea6e.zip
external_webkit-81bc750723a18f21cd17d1b173cd2a4dda9cea6e.tar.gz
external_webkit-81bc750723a18f21cd17d1b173cd2a4dda9cea6e.tar.bz2
Merge WebKit at r80534: Intial merge by Git
Change-Id: Ia7a83357124c9e1cdb1debf55d9661ec0bd09a61
Diffstat (limited to 'Source/WebKit2/UIProcess')
-rw-r--r--Source/WebKit2/UIProcess/API/C/WKAPICast.h12
-rw-r--r--Source/WebKit2/UIProcess/API/C/WKApplicationCacheManager.cpp52
-rw-r--r--Source/WebKit2/UIProcess/API/C/WKApplicationCacheManager.h47
-rw-r--r--Source/WebKit2/UIProcess/API/C/WKContext.cpp27
-rw-r--r--Source/WebKit2/UIProcess/API/C/WKContext.h9
-rw-r--r--Source/WebKit2/UIProcess/API/C/WKCookieManager.cpp69
-rw-r--r--Source/WebKit2/UIProcess/API/C/WKCookieManager.h62
-rw-r--r--Source/WebKit2/UIProcess/API/C/WKKeyValueStorageManager.cpp52
-rw-r--r--Source/WebKit2/UIProcess/API/C/WKKeyValueStorageManager.h47
-rw-r--r--Source/WebKit2/UIProcess/API/C/WKPage.cpp101
-rw-r--r--Source/WebKit2/UIProcess/API/C/WKPage.h41
-rw-r--r--Source/WebKit2/UIProcess/API/C/WKPagePrivate.h23
-rw-r--r--Source/WebKit2/UIProcess/API/C/WKPluginSiteDataManager.cpp65
-rw-r--r--Source/WebKit2/UIProcess/API/C/WKPluginSiteDataManager.h55
-rw-r--r--Source/WebKit2/UIProcess/API/C/WKPreferences.cpp10
-rw-r--r--Source/WebKit2/UIProcess/API/C/WKPreferencesPrivate.h4
-rw-r--r--Source/WebKit2/UIProcess/API/C/WKResourceCacheManager.cpp52
-rw-r--r--Source/WebKit2/UIProcess/API/C/WKResourceCacheManager.h47
-rw-r--r--Source/WebKit2/UIProcess/API/C/gtk/WKView.cpp4
-rw-r--r--Source/WebKit2/UIProcess/API/C/gtk/WKView.h3
-rw-r--r--Source/WebKit2/UIProcess/API/mac/FindIndicatorWindow.mm1
-rw-r--r--Source/WebKit2/UIProcess/API/mac/PDFViewController.h16
-rw-r--r--Source/WebKit2/UIProcess/API/mac/PDFViewController.mm93
-rw-r--r--Source/WebKit2/UIProcess/API/mac/PageClientImpl.h12
-rw-r--r--Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm55
-rw-r--r--Source/WebKit2/UIProcess/API/mac/WKView.mm193
-rw-r--r--Source/WebKit2/UIProcess/API/mac/WKViewInternal.h9
-rw-r--r--Source/WebKit2/UIProcess/API/mac/WKViewPrivate.h2
-rw-r--r--Source/WebKit2/UIProcess/API/qt/qgraphicswkview.cpp22
-rw-r--r--Source/WebKit2/UIProcess/API/qt/qgraphicswkview.h4
-rw-r--r--Source/WebKit2/UIProcess/API/qt/qwkpage.cpp25
-rw-r--r--Source/WebKit2/UIProcess/API/qt/qwkpage.h3
-rw-r--r--Source/WebKit2/UIProcess/API/qt/qwkpage_p.h7
-rw-r--r--Source/WebKit2/UIProcess/API/qt/qwkpreferences.cpp33
-rw-r--r--Source/WebKit2/UIProcess/API/qt/qwkpreferences.h9
-rw-r--r--Source/WebKit2/UIProcess/API/qt/tests/html/basic_page.html1
-rw-r--r--Source/WebKit2/UIProcess/API/qt/tests/qgraphicswkview/qgraphicswkview.pro1
-rw-r--r--Source/WebKit2/UIProcess/API/qt/tests/qgraphicswkview/tst_qgraphicswkview.cpp93
-rw-r--r--Source/WebKit2/UIProcess/API/qt/tests/tests.pri16
-rw-r--r--Source/WebKit2/UIProcess/API/qt/tests/tests.pro2
-rw-r--r--Source/WebKit2/UIProcess/API/qt/tests/util.h78
-rw-r--r--Source/WebKit2/UIProcess/ChunkedUpdateDrawingAreaProxy.cpp14
-rw-r--r--Source/WebKit2/UIProcess/ChunkedUpdateDrawingAreaProxy.h9
-rw-r--r--Source/WebKit2/UIProcess/DrawingAreaProxy.cpp11
-rw-r--r--Source/WebKit2/UIProcess/DrawingAreaProxy.h35
-rw-r--r--Source/WebKit2/UIProcess/DrawingAreaProxy.messages.in8
-rw-r--r--Source/WebKit2/UIProcess/DrawingAreaProxyImpl.cpp138
-rw-r--r--Source/WebKit2/UIProcess/DrawingAreaProxyImpl.h43
-rw-r--r--Source/WebKit2/UIProcess/GenericCallback.h114
-rw-r--r--Source/WebKit2/UIProcess/Launcher/gtk/ThreadLauncherGtk.cpp2
-rw-r--r--Source/WebKit2/UIProcess/Launcher/mac/ProcessLauncherMac.mm52
-rw-r--r--Source/WebKit2/UIProcess/Launcher/qt/ProcessLauncherQt.cpp2
-rw-r--r--Source/WebKit2/UIProcess/LayerBackedDrawingAreaProxy.cpp168
-rw-r--r--Source/WebKit2/UIProcess/LayerBackedDrawingAreaProxy.h94
-rw-r--r--Source/WebKit2/UIProcess/PageClient.h10
-rw-r--r--Source/WebKit2/UIProcess/Plugins/PluginInfoStore.cpp15
-rw-r--r--Source/WebKit2/UIProcess/Plugins/PluginInfoStore.h7
-rw-r--r--Source/WebKit2/UIProcess/Plugins/PluginProcessManager.cpp41
-rw-r--r--Source/WebKit2/UIProcess/Plugins/PluginProcessManager.h7
-rw-r--r--Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.cpp80
-rw-r--r--Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.h24
-rw-r--r--Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.messages.in3
-rw-r--r--Source/WebKit2/UIProcess/Plugins/WebPluginSiteDataManager.cpp299
-rw-r--r--Source/WebKit2/UIProcess/Plugins/WebPluginSiteDataManager.h88
-rw-r--r--Source/WebKit2/UIProcess/Plugins/gtk/PluginInfoStoreGtk.cpp2
-rw-r--r--Source/WebKit2/UIProcess/Plugins/qt/PluginProcessProxyQt.cpp (renamed from Source/WebKit2/UIProcess/win/LayerBackedDrawingAreaProxyWin.cpp)39
-rw-r--r--Source/WebKit2/UIProcess/TextChecker.h2
-rw-r--r--Source/WebKit2/UIProcess/TiledDrawingAreaProxy.cpp29
-rw-r--r--Source/WebKit2/UIProcess/TiledDrawingAreaProxy.h2
-rw-r--r--Source/WebKit2/UIProcess/WebApplicationCacheManagerProxy.cpp99
-rw-r--r--Source/WebKit2/UIProcess/WebApplicationCacheManagerProxy.h82
-rw-r--r--Source/WebKit2/UIProcess/WebApplicationCacheManagerProxy.messages.in25
-rw-r--r--Source/WebKit2/UIProcess/WebBackForwardList.h4
-rw-r--r--Source/WebKit2/UIProcess/WebContext.cpp122
-rw-r--r--Source/WebKit2/UIProcess/WebContext.h37
-rw-r--r--Source/WebKit2/UIProcess/WebContext.messages.in5
-rw-r--r--Source/WebKit2/UIProcess/WebCookieManagerProxy.cpp134
-rw-r--r--Source/WebKit2/UIProcess/WebCookieManagerProxy.h89
-rw-r--r--Source/WebKit2/UIProcess/WebCookieManagerProxy.messages.in27
-rw-r--r--Source/WebKit2/UIProcess/WebCookieManagerProxyClient.cpp41
-rw-r--r--Source/WebKit2/UIProcess/WebCookieManagerProxyClient.h44
-rw-r--r--Source/WebKit2/UIProcess/WebInspectorProxy.cpp8
-rw-r--r--Source/WebKit2/UIProcess/WebInspectorProxy.h2
-rw-r--r--Source/WebKit2/UIProcess/WebInspectorProxy.messages.in1
-rw-r--r--Source/WebKit2/UIProcess/WebKeyValueStorageManagerProxy.cpp100
-rw-r--r--Source/WebKit2/UIProcess/WebKeyValueStorageManagerProxy.h82
-rw-r--r--Source/WebKit2/UIProcess/WebKeyValueStorageManagerProxy.messages.in25
-rw-r--r--Source/WebKit2/UIProcess/WebLoaderClient.cpp8
-rw-r--r--Source/WebKit2/UIProcess/WebLoaderClient.h1
-rw-r--r--Source/WebKit2/UIProcess/WebPageGroup.cpp2
-rw-r--r--Source/WebKit2/UIProcess/WebPageProxy.cpp232
-rw-r--r--Source/WebKit2/UIProcess/WebPageProxy.h120
-rw-r--r--Source/WebKit2/UIProcess/WebPageProxy.messages.in25
-rw-r--r--Source/WebKit2/UIProcess/WebPolicyClient.cpp16
-rw-r--r--Source/WebKit2/UIProcess/WebPolicyClient.h7
-rw-r--r--Source/WebKit2/UIProcess/WebPopupMenuProxy.h2
-rw-r--r--Source/WebKit2/UIProcess/WebProcessManager.cpp96
-rw-r--r--Source/WebKit2/UIProcess/WebProcessProxy.cpp60
-rw-r--r--Source/WebKit2/UIProcess/WebProcessProxy.h11
-rw-r--r--Source/WebKit2/UIProcess/WebProcessProxy.messages.in1
-rw-r--r--Source/WebKit2/UIProcess/WebResourceCacheManagerProxy.cpp96
-rw-r--r--Source/WebKit2/UIProcess/WebResourceCacheManagerProxy.h79
-rw-r--r--Source/WebKit2/UIProcess/WebResourceCacheManagerProxy.messages.in25
-rw-r--r--Source/WebKit2/UIProcess/WebUIClient.cpp6
-rw-r--r--Source/WebKit2/UIProcess/WebUIClient.h4
-rw-r--r--Source/WebKit2/UIProcess/cf/WebPageProxyCF.cpp93
-rw-r--r--Source/WebKit2/UIProcess/gtk/TextCheckerGtk.cpp7
-rw-r--r--Source/WebKit2/UIProcess/gtk/WebContextGtk.cpp (renamed from Source/WebKit2/UIProcess/WebProcessManager.h)41
-rw-r--r--Source/WebKit2/UIProcess/gtk/WebInspectorGtk.cpp9
-rw-r--r--Source/WebKit2/UIProcess/gtk/WebPageProxyGtk.cpp2
-rw-r--r--Source/WebKit2/UIProcess/gtk/WebPreferencesGtk.cpp2
-rw-r--r--Source/WebKit2/UIProcess/gtk/WebView.cpp297
-rw-r--r--Source/WebKit2/UIProcess/gtk/WebView.h122
-rw-r--r--Source/WebKit2/UIProcess/gtk/WebViewWidget.cpp377
-rw-r--r--Source/WebKit2/UIProcess/gtk/WebViewWidget.h70
-rw-r--r--Source/WebKit2/UIProcess/mac/LayerBackedDrawingAreaProxyMac.mm108
-rw-r--r--Source/WebKit2/UIProcess/mac/TextCheckerMac.mm15
-rw-r--r--Source/WebKit2/UIProcess/mac/WebContextMac.mm13
-rw-r--r--Source/WebKit2/UIProcess/mac/WebInspectorProxyMac.mm9
-rw-r--r--Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm8
-rw-r--r--Source/WebKit2/UIProcess/mac/WebPopupMenuProxyMac.h10
-rw-r--r--Source/WebKit2/UIProcess/mac/WebPopupMenuProxyMac.mm21
-rw-r--r--Source/WebKit2/UIProcess/qt/TextCheckerQt.cpp7
-rw-r--r--Source/WebKit2/UIProcess/qt/WebContextMenuProxyQt.cpp39
-rw-r--r--Source/WebKit2/UIProcess/qt/WebContextMenuProxyQt.h3
-rw-r--r--Source/WebKit2/UIProcess/qt/WebInspectorProxyQt.cpp9
-rw-r--r--Source/WebKit2/UIProcess/qt/WebPageProxyQt.cpp2
-rw-r--r--Source/WebKit2/UIProcess/qt/WebPopupMenuProxyQt.cpp2
-rw-r--r--Source/WebKit2/UIProcess/qt/WebPopupMenuProxyQt.h2
-rw-r--r--Source/WebKit2/UIProcess/win/TextCheckerWin.cpp8
-rw-r--r--Source/WebKit2/UIProcess/win/WebContextMenuProxyWin.cpp2
-rw-r--r--Source/WebKit2/UIProcess/win/WebContextWin.cpp23
-rw-r--r--Source/WebKit2/UIProcess/win/WebInspectorProxyWin.cpp11
-rw-r--r--Source/WebKit2/UIProcess/win/WebPageProxyWin.cpp52
-rw-r--r--Source/WebKit2/UIProcess/win/WebPopupMenuProxyWin.cpp2
-rw-r--r--Source/WebKit2/UIProcess/win/WebPopupMenuProxyWin.h2
-rw-r--r--Source/WebKit2/UIProcess/win/WebView.cpp78
-rw-r--r--Source/WebKit2/UIProcess/win/WebView.h8
138 files changed, 4700 insertions, 1267 deletions
diff --git a/Source/WebKit2/UIProcess/API/C/WKAPICast.h b/Source/WebKit2/UIProcess/API/C/WKAPICast.h
index 5ce3b1f..a2983e9 100644
--- a/Source/WebKit2/UIProcess/API/C/WKAPICast.h
+++ b/Source/WebKit2/UIProcess/API/C/WKAPICast.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2010, 2011 Apple Inc. All rights reserved.
* Portions Copyright (c) 2010 Motorola Mobility, Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -45,9 +45,12 @@ class AuthenticationChallengeProxy;
class AuthenticationDecisionListener;
class DownloadProxy;
class GeolocationPermissionRequestProxy;
+class WebApplicationCacheManagerProxy;
class WebBackForwardList;
class WebBackForwardListItem;
+class WebResourceCacheManagerProxy;
class WebContext;
+class WebCookieManagerProxy;
class WebCredential;
class WebDatabaseManagerProxy;
class WebFormSubmissionListenerProxy;
@@ -56,19 +59,24 @@ class WebFrameProxy;
class WebGeolocationManagerProxy;
class WebGeolocationPosition;
class WebInspectorProxy;
+class WebKeyValueStorageManagerProxy;
class WebNavigationData;
class WebOpenPanelParameters;
class WebOpenPanelResultListenerProxy;
class WebPageGroup;
class WebPageProxy;
+class WebPluginSiteDataManager;
class WebPreferences;
class WebProtectionSpace;
+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(WKResourceCacheManagerRef, WebResourceCacheManagerProxy)
WK_ADD_API_MAPPING(WKContextRef, WebContext)
+WK_ADD_API_MAPPING(WKCookieManagerRef, WebCookieManagerProxy)
WK_ADD_API_MAPPING(WKCredentialRef, WebCredential)
WK_ADD_API_MAPPING(WKDatabaseManagerRef, WebDatabaseManagerProxy)
WK_ADD_API_MAPPING(WKDownloadRef, DownloadProxy)
@@ -78,11 +86,13 @@ WK_ADD_API_MAPPING(WKFrameRef, WebFrameProxy)
WK_ADD_API_MAPPING(WKGeolocationManagerRef, WebGeolocationManagerProxy)
WK_ADD_API_MAPPING(WKGeolocationPermissionRequestRef, GeolocationPermissionRequestProxy)
WK_ADD_API_MAPPING(WKGeolocationPositionRef, WebGeolocationPosition)
+WK_ADD_API_MAPPING(WKKeyValueStorageManagerRef, WebKeyValueStorageManagerProxy)
WK_ADD_API_MAPPING(WKNavigationDataRef, WebNavigationData)
WK_ADD_API_MAPPING(WKOpenPanelParametersRef, WebOpenPanelParameters)
WK_ADD_API_MAPPING(WKOpenPanelResultListenerRef, WebOpenPanelResultListenerProxy)
WK_ADD_API_MAPPING(WKPageGroupRef, WebPageGroup)
WK_ADD_API_MAPPING(WKPageRef, WebPageProxy)
+WK_ADD_API_MAPPING(WKPluginSiteDataManagerRef, WebPluginSiteDataManager)
WK_ADD_API_MAPPING(WKPreferencesRef, WebPreferences)
WK_ADD_API_MAPPING(WKProtectionSpaceRef, WebProtectionSpace)
diff --git a/Source/WebKit2/UIProcess/API/C/WKApplicationCacheManager.cpp b/Source/WebKit2/UIProcess/API/C/WKApplicationCacheManager.cpp
new file mode 100644
index 0000000..2d95c67
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/C/WKApplicationCacheManager.cpp
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2011 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WKApplicationCacheManager.h"
+
+#include "WKAPICast.h"
+#include "WebApplicationCacheManagerProxy.h"
+
+using namespace WebKit;
+
+WKTypeID WKApplicationCacheManagerGetTypeID()
+{
+ return toAPI(WebApplicationCacheManagerProxy::APIType);
+}
+
+void WKApplicationCacheManagerGetApplicationCacheOrigins(WKApplicationCacheManagerRef applicationCacheManagerRef, void* context, WKApplicationCacheManagerGetApplicationCacheOriginsFunction callback)
+{
+ toImpl(applicationCacheManagerRef)->getApplicationCacheOrigins(ArrayCallback::create(context, callback));
+}
+
+void WKApplicationCacheManagerDeleteEntriesForOrigin(WKApplicationCacheManagerRef applicationCacheManagerRef, WKSecurityOriginRef originRef)
+{
+ toImpl(applicationCacheManagerRef)->deleteEntriesForOrigin(toImpl(originRef));
+}
+
+void WKApplicationCacheManagerDeleteAllEntries(WKApplicationCacheManagerRef applicationCacheManagerRef)
+{
+ toImpl(applicationCacheManagerRef)->deleteAllEntries();
+}
diff --git a/Source/WebKit2/UIProcess/API/C/WKApplicationCacheManager.h b/Source/WebKit2/UIProcess/API/C/WKApplicationCacheManager.h
new file mode 100644
index 0000000..c40039e
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/C/WKApplicationCacheManager.h
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2011 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WKApplicationCacheManager_h
+#define WKApplicationCacheManager_h
+
+#include <WebKit2/WKBase.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+WK_EXPORT WKTypeID WKApplicationCacheManagerGetTypeID();
+
+typedef void (*WKApplicationCacheManagerGetApplicationCacheOriginsFunction)(WKArrayRef, WKErrorRef, void*);
+WK_EXPORT void WKApplicationCacheManagerGetApplicationCacheOrigins(WKApplicationCacheManagerRef applicationCacheManager, void* context, WKApplicationCacheManagerGetApplicationCacheOriginsFunction function);
+
+WK_EXPORT void WKApplicationCacheManagerDeleteEntriesForOrigin(WKApplicationCacheManagerRef applicationCacheManager, WKSecurityOriginRef origin);
+WK_EXPORT void WKApplicationCacheManagerDeleteAllEntries(WKApplicationCacheManagerRef applicationCacheManager);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // WKApplicationCacheManager_h
diff --git a/Source/WebKit2/UIProcess/API/C/WKContext.cpp b/Source/WebKit2/UIProcess/API/C/WKContext.cpp
index 82bd13d..6e4e5e0 100644
--- a/Source/WebKit2/UIProcess/API/C/WKContext.cpp
+++ b/Source/WebKit2/UIProcess/API/C/WKContext.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2010, 2011 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -158,6 +158,16 @@ void WKContextClearApplicationCache(WKContextRef contextRef)
toImpl(contextRef)->clearApplicationCache();
}
+WKCookieManagerRef WKContextGetCookieManager(WKContextRef contextRef)
+{
+ return toAPI(toImpl(contextRef)->cookieManagerProxy());
+}
+
+WKApplicationCacheManagerRef WKContextGetApplicationCacheManager(WKContextRef contextRef)
+{
+ return toAPI(toImpl(contextRef)->applicationCacheManagerProxy());
+}
+
WKDatabaseManagerRef WKContextGetDatabaseManager(WKContextRef contextRef)
{
return toAPI(toImpl(contextRef)->databaseManagerProxy());
@@ -168,6 +178,21 @@ WKGeolocationManagerRef WKContextGetGeolocationManager(WKContextRef contextRef)
return toAPI(toImpl(contextRef)->geolocationManagerProxy());
}
+WKKeyValueStorageManagerRef WKContextGetKeyValueStorageManager(WKContextRef contextRef)
+{
+ return toAPI(toImpl(contextRef)->keyValueStorageManagerProxy());
+}
+
+WKPluginSiteDataManagerRef WKContextGetPluginSiteDataManager(WKContextRef contextRef)
+{
+ return toAPI(toImpl(contextRef)->pluginSiteDataManager());
+}
+
+WKResourceCacheManagerRef WKContextGetResourceCacheManager(WKContextRef contextRef)
+{
+ return toAPI(toImpl(contextRef)->resourceCacheManagerProxy());
+}
+
void WKContextStartMemorySampler(WKContextRef contextRef, WKDoubleRef interval)
{
toImpl(contextRef)->startMemorySampler(toImpl(interval)->value());
diff --git a/Source/WebKit2/UIProcess/API/C/WKContext.h b/Source/WebKit2/UIProcess/API/C/WKContext.h
index 810ad20..f8e7cee 100644
--- a/Source/WebKit2/UIProcess/API/C/WKContext.h
+++ b/Source/WebKit2/UIProcess/API/C/WKContext.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2010, 2011 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -119,12 +119,17 @@ WK_EXPORT WKCacheModel WKContextGetCacheModel(WKContextRef context);
WK_EXPORT void WKContextClearResourceCaches(WKContextRef context);
WK_EXPORT void WKContextClearApplicationCache(WKContextRef context);
-
+
WK_EXPORT void WKContextStartMemorySampler(WKContextRef context, WKDoubleRef interval);
WK_EXPORT void WKContextStopMemorySampler(WKContextRef context);
+WK_EXPORT WKApplicationCacheManagerRef WKContextGetApplicationCacheManager(WKContextRef context);
+WK_EXPORT WKCookieManagerRef WKContextGetCookieManager(WKContextRef context);
WK_EXPORT WKDatabaseManagerRef WKContextGetDatabaseManager(WKContextRef context);
WK_EXPORT WKGeolocationManagerRef WKContextGetGeolocationManager(WKContextRef context);
+WK_EXPORT WKKeyValueStorageManagerRef WKContextGetKeyValueStorageManager(WKContextRef context);
+WK_EXPORT WKPluginSiteDataManagerRef WKContextGetPluginSiteDataManager(WKContextRef context);
+WK_EXPORT WKResourceCacheManagerRef WKContextGetResourceCacheManager(WKContextRef context);
#ifdef __cplusplus
}
diff --git a/Source/WebKit2/UIProcess/API/C/WKCookieManager.cpp b/Source/WebKit2/UIProcess/API/C/WKCookieManager.cpp
new file mode 100644
index 0000000..83578f7
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/C/WKCookieManager.cpp
@@ -0,0 +1,69 @@
+/*
+ * Copyright (C) 2011 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WKCookieManager.h"
+
+#include "WKAPICast.h"
+#include "WebCookieManagerProxy.h"
+
+using namespace WebKit;
+
+WKTypeID WKCookieManagerGetTypeID()
+{
+ return toAPI(WebCookieManagerProxy::APIType);
+}
+
+void WKCookieManagerSetClient(WKCookieManagerRef cookieManagerRef, const WKCookieManagerClient* wkClient)
+{
+ if (wkClient && wkClient->version)
+ return;
+ toImpl(cookieManagerRef)->initializeClient(wkClient);
+}
+
+void WKCookieManagerGetHostnamesWithCookies(WKCookieManagerRef cookieManagerRef, void* context, WKCookieManagerGetCookieHostnamesFunction callback)
+{
+ toImpl(cookieManagerRef)->getHostnamesWithCookies(ArrayCallback::create(context, callback));
+}
+
+void WKCookieManagerDeleteCookiesForHostname(WKCookieManagerRef cookieManagerRef, WKStringRef hostname)
+{
+ toImpl(cookieManagerRef)->deleteCookiesForHostname(toImpl(hostname)->string());
+}
+
+void WKCookieManagerDeleteAllCookies(WKCookieManagerRef cookieManagerRef)
+{
+ toImpl(cookieManagerRef)->deleteAllCookies();
+}
+
+void WKCookieManagerStartObservingCookieChanges(WKCookieManagerRef cookieManager)
+{
+ toImpl(cookieManager)->startObservingCookieChanges();
+}
+
+void WKCookieManagerStopObservingCookieChanges(WKCookieManagerRef cookieManager)
+{
+ toImpl(cookieManager)->stopObservingCookieChanges();
+}
diff --git a/Source/WebKit2/UIProcess/API/C/WKCookieManager.h b/Source/WebKit2/UIProcess/API/C/WKCookieManager.h
new file mode 100644
index 0000000..75d8ef5
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/C/WKCookieManager.h
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2011 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WKCookieManager_h
+#define WKCookieManager_h
+
+#include <WebKit2/WKBase.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+// Cookie Manager Client
+typedef void (*WKCookieManagerCookiesDidChangeCallback)(WKCookieManagerRef cookieManager, const void *clientInfo);
+
+struct WKCookieManagerClient {
+ int version;
+ const void * clientInfo;
+ WKCookieManagerCookiesDidChangeCallback cookiesDidChange;
+};
+typedef struct WKCookieManagerClient WKCookieManagerClient;
+
+WK_EXPORT WKTypeID WKCookieManagerGetTypeID();
+
+WK_EXPORT void WKCookieManagerSetClient(WKCookieManagerRef cookieManager, const WKCookieManagerClient* client);
+
+typedef void (*WKCookieManagerGetCookieHostnamesFunction)(WKArrayRef, WKErrorRef, void*);
+WK_EXPORT void WKCookieManagerGetHostnamesWithCookies(WKCookieManagerRef cookieManager, void* context, WKCookieManagerGetCookieHostnamesFunction function);
+
+WK_EXPORT void WKCookieManagerDeleteCookiesForHostname(WKCookieManagerRef cookieManager, WKStringRef hostname);
+WK_EXPORT void WKCookieManagerDeleteAllCookies(WKCookieManagerRef cookieManager);
+
+WK_EXPORT void WKCookieManagerStartObservingCookieChanges(WKCookieManagerRef cookieManager);
+WK_EXPORT void WKCookieManagerStopObservingCookieChanges(WKCookieManagerRef cookieManager);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // WKCookieManager_h
diff --git a/Source/WebKit2/UIProcess/API/C/WKKeyValueStorageManager.cpp b/Source/WebKit2/UIProcess/API/C/WKKeyValueStorageManager.cpp
new file mode 100644
index 0000000..f050692
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/C/WKKeyValueStorageManager.cpp
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2011 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WKKeyValueStorageManager.h"
+
+#include "WKAPICast.h"
+#include "WebKeyValueStorageManagerProxy.h"
+
+using namespace WebKit;
+
+WKTypeID WKKeyValueStorageManagerGetTypeID()
+{
+ return toAPI(WebKeyValueStorageManagerProxy::APIType);
+}
+
+void WKKeyValueStorageManagerGetKeyValueStorageOrigins(WKKeyValueStorageManagerRef keyValueStorageManagerRef, void* context, WKKeyValueStorageManagerGetKeyValueStorageOriginsFunction callback)
+{
+ toImpl(keyValueStorageManagerRef)->getKeyValueStorageOrigins(ArrayCallback::create(context, callback));
+}
+
+void WKKeyValueStorageManagerDeleteEntriesForOrigin(WKKeyValueStorageManagerRef keyValueStorageManagerRef, WKSecurityOriginRef originRef)
+{
+ toImpl(keyValueStorageManagerRef)->deleteEntriesForOrigin(toImpl(originRef));
+}
+
+void WKKeyValueStorageManagerDeleteAllEntries(WKKeyValueStorageManagerRef keyValueStorageManagerRef)
+{
+ toImpl(keyValueStorageManagerRef)->deleteAllEntries();
+}
diff --git a/Source/WebKit2/UIProcess/API/C/WKKeyValueStorageManager.h b/Source/WebKit2/UIProcess/API/C/WKKeyValueStorageManager.h
new file mode 100644
index 0000000..a0ee278
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/C/WKKeyValueStorageManager.h
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2011 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WKKeyValueStorageManager_h
+#define WKKeyValueStorageManager_h
+
+#include <WebKit2/WKBase.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+WK_EXPORT WKTypeID WKKeyValueStorageManagerGetTypeID();
+
+typedef void (*WKKeyValueStorageManagerGetKeyValueStorageOriginsFunction)(WKArrayRef, WKErrorRef, void*);
+WK_EXPORT void WKKeyValueStorageManagerGetKeyValueStorageOrigins(WKKeyValueStorageManagerRef keyValueStorageManager, void* context, WKKeyValueStorageManagerGetKeyValueStorageOriginsFunction function);
+
+WK_EXPORT void WKKeyValueStorageManagerDeleteEntriesForOrigin(WKKeyValueStorageManagerRef keyValueStorageManager, WKSecurityOriginRef origin);
+WK_EXPORT void WKKeyValueStorageManagerDeleteAllEntries(WKKeyValueStorageManagerRef keyValueStorageManager);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // WKKeyValueStorageManager_h
diff --git a/Source/WebKit2/UIProcess/API/C/WKPage.cpp b/Source/WebKit2/UIProcess/API/C/WKPage.cpp
index 1d5763f..c4e8eae 100644
--- a/Source/WebKit2/UIProcess/API/C/WKPage.cpp
+++ b/Source/WebKit2/UIProcess/API/C/WKPage.cpp
@@ -27,6 +27,7 @@
#include "WKPage.h"
#include "WKPagePrivate.h"
+#include "PrintInfo.h"
#include "WKAPICast.h"
#include "WebBackForwardList.h"
#include "WebData.h"
@@ -170,6 +171,11 @@ double WKPageGetEstimatedProgress(WKPageRef pageRef)
return toImpl(pageRef)->estimatedProgress();
}
+void WKPageSetMemoryCacheClientCallsEnabled(WKPageRef pageRef, bool memoryCacheClientCallsEnabled)
+{
+ toImpl(pageRef)->setMemoryCacheClientCallsEnabled(memoryCacheClientCallsEnabled);
+}
+
WKStringRef WKPageCopyUserAgent(WKPageRef pageRef)
{
return toCopiedAPI(toImpl(pageRef)->userAgent());
@@ -301,6 +307,31 @@ bool WKPageHasVerticalScrollbar(WKPageRef pageRef)
return toImpl(pageRef)->hasVerticalScrollbar();
}
+bool WKPageIsPinnedToLeftSide(WKPageRef pageRef)
+{
+ return toImpl(pageRef)->isPinnedToLeftSide();
+}
+
+bool WKPageIsPinnedToRightSide(WKPageRef pageRef)
+{
+ return toImpl(pageRef)->isPinnedToRightSide();
+}
+
+bool WKPageCanDelete(WKPageRef pageRef)
+{
+ return toImpl(pageRef)->canDelete();
+}
+
+bool WKPageHasSelectedRange(WKPageRef pageRef)
+{
+ return toImpl(pageRef)->hasSelectedRange();
+}
+
+bool WKPageIsContentEditable(WKPageRef pageRef)
+{
+ return toImpl(pageRef)->isContentEditable();
+}
+
void WKPageFindString(WKPageRef pageRef, WKStringRef string, WKFindOptions options, unsigned maxMatchCount)
{
toImpl(pageRef)->findString(toImpl(string)->string(), toFindOptions(options), maxMatchCount);
@@ -367,11 +398,11 @@ void WKPageSetPageUIClient(WKPageRef pageRef, const WKPageUIClient* wkClient)
void WKPageRunJavaScriptInMainFrame(WKPageRef pageRef, WKStringRef scriptRef, void* context, WKPageRunJavaScriptFunction callback)
{
- toImpl(pageRef)->runJavaScriptInMainFrame(toImpl(scriptRef)->string(), StringCallback::create(context, callback));
+ toImpl(pageRef)->runJavaScriptInMainFrame(toImpl(scriptRef)->string(), ScriptValueCallback::create(context, callback));
}
#ifdef __BLOCKS__
-static void callRunJavaScriptBlockAndRelease(WKStringRef resultValue, WKErrorRef error, void* context)
+static void callRunJavaScriptBlockAndRelease(WKSerializedScriptValueRef resultValue, WKErrorRef error, void* context)
{
WKPageRunJavaScriptBlock block = (WKPageRunJavaScriptBlock)context;
block(resultValue, error);
@@ -452,3 +483,69 @@ WK_EXPORT WKURLRef WKPageCopyPendingAPIRequestURL(WKPageRef pageRef)
return 0;
return toCopiedURLAPI(toImpl(pageRef)->pendingAPIRequestURL());
}
+
+void WKPageSetDebugPaintFlags(WKPageDebugPaintFlags flags)
+{
+ WebPageProxy::setDebugPaintFlags(flags);
+}
+
+WKPageDebugPaintFlags WKPageGetDebugPaintFlags()
+{
+ return WebPageProxy::debugPaintFlags();
+}
+
+void WKPageValidateCommand(WKPageRef pageRef, WKStringRef command, void* context, WKPageValidateCommandCallback callback)
+{
+ toImpl(pageRef)->validateCommand(toImpl(command)->string(), ValidateCommandCallback::create(context, callback));
+}
+
+void WKPageExecuteCommand(WKPageRef pageRef, WKStringRef command)
+{
+ toImpl(pageRef)->executeEditCommand(toImpl(command)->string());
+}
+
+#if PLATFORM(MAC) || PLATFORM(WIN)
+struct ComputedPagesContext {
+ ComputedPagesContext(WKPageComputePagesForPrintingFunction callback, void* context)
+ : callback(callback)
+ , context(context)
+ {
+ }
+ WKPageComputePagesForPrintingFunction callback;
+ void* context;
+};
+
+static void computedPagesCallback(const Vector<WebCore::IntRect>& rects, double scaleFactor, WKErrorRef error, void* untypedContext)
+{
+ OwnPtr<ComputedPagesContext> context = adoptPtr(static_cast<ComputedPagesContext*>(untypedContext));
+ Vector<WKRect> wkRects(rects.size());
+ for (size_t i = 0; i < rects.size(); ++i)
+ wkRects[i] = toAPI(rects[i]);
+ context->callback(wkRects.data(), wkRects.size(), scaleFactor, error, context->context);
+}
+
+static PrintInfo printInfoFromWKPrintInfo(const WKPrintInfo& printInfo)
+{
+ PrintInfo result;
+ result.pageSetupScaleFactor = printInfo.pageSetupScaleFactor;
+ result.availablePaperWidth = printInfo.availablePaperWidth;
+ result.availablePaperHeight = printInfo.availablePaperHeight;
+ return result;
+}
+
+void WKPageComputePagesForPrinting(WKPageRef page, WKFrameRef frame, WKPrintInfo printInfo, WKPageComputePagesForPrintingFunction callback, void* context)
+{
+ toImpl(page)->computePagesForPrinting(toImpl(frame), printInfoFromWKPrintInfo(printInfo), ComputedPagesCallback::create(new ComputedPagesContext(callback, context), computedPagesCallback));
+}
+
+void WKPageBeginPrinting(WKPageRef page, WKFrameRef frame, WKPrintInfo printInfo)
+{
+ toImpl(page)->beginPrinting(toImpl(frame), printInfoFromWKPrintInfo(printInfo));
+}
+
+void WKPageDrawPagesToPDF(WKPageRef page, WKFrameRef frame, uint32_t first, uint32_t count, WKPageDrawToPDFFunction callback, void* context)
+{
+ toImpl(page)->drawPagesToPDF(toImpl(frame), first, count, DataCallback::create(context, callback));
+}
+#endif
+
diff --git a/Source/WebKit2/UIProcess/API/C/WKPage.h b/Source/WebKit2/UIProcess/API/C/WKPage.h
index e6ebc5c..655e999 100644
--- a/Source/WebKit2/UIProcess/API/C/WKPage.h
+++ b/Source/WebKit2/UIProcess/API/C/WKPage.h
@@ -61,6 +61,7 @@ typedef void (*WKPageDidRunInsecureContentForFrameCallback)(WKPageRef page, WKFr
typedef bool (*WKPageCanAuthenticateAgainstProtectionSpaceInFrameCallback)(WKPageRef page, WKFrameRef frame, WKProtectionSpaceRef protectionSpace, const void *clientInfo);
typedef void (*WKPageDidReceiveAuthenticationChallengeInFrameCallback)(WKPageRef page, WKFrameRef frame, WKAuthenticationChallengeRef authenticationChallenge, const void *clientInfo);
typedef void (*WKPageDidChangeBackForwardListCallback)(WKPageRef page, WKBackForwardListItemRef addedItem, WKArrayRef removedItems, const void *clientInfo);
+typedef bool (*WKPageShouldGoToBackForwardListItemCallback)(WKPageRef page, WKBackForwardListItemRef item, const void *clientInfo);
struct WKPageLoaderClient {
int version;
@@ -93,20 +94,23 @@ struct WKPageLoaderClient {
WKPageCallback processDidCrash;
WKPageDidChangeBackForwardListCallback didChangeBackForwardList;
+ WKPageShouldGoToBackForwardListItemCallback shouldGoToBackForwardListItem;
};
typedef struct WKPageLoaderClient WKPageLoaderClient;
// Policy Client.
typedef void (*WKPageDecidePolicyForNavigationActionCallback)(WKPageRef page, WKFrameRef frame, WKFrameNavigationType navigationType, WKEventModifiers modifiers, WKEventMouseButton mouseButton, WKURLRequestRef request, WKFramePolicyListenerRef listener, WKTypeRef userData, const void* clientInfo);
typedef void (*WKPageDecidePolicyForNewWindowActionCallback)(WKPageRef page, WKFrameRef frame, WKFrameNavigationType navigationType, WKEventModifiers modifiers, WKEventMouseButton mouseButton, WKURLRequestRef request, WKStringRef frameName, WKFramePolicyListenerRef listener, WKTypeRef userData, const void* clientInfo);
-typedef void (*WKPageDecidePolicyForMIMETypeCallback)(WKPageRef page, WKFrameRef frame, WKStringRef MIMEType, WKURLRequestRef request, WKFramePolicyListenerRef listener, WKTypeRef userData, const void* clientInfo);
+typedef void (*WKPageDecidePolicyForResponseCallback)(WKPageRef page, WKFrameRef frame, WKURLResponseRef response, WKURLRequestRef request, WKFramePolicyListenerRef listener, WKTypeRef userData, const void* clientInfo);
+typedef void (*WKPageUnableToImplementPolicyCallback)(WKPageRef page, WKFrameRef frame, WKErrorRef error, WKTypeRef userData, const void* clientInfo);
struct WKPagePolicyClient {
int version;
const void * clientInfo;
WKPageDecidePolicyForNavigationActionCallback decidePolicyForNavigationAction;
WKPageDecidePolicyForNewWindowActionCallback decidePolicyForNewWindowAction;
- WKPageDecidePolicyForMIMETypeCallback decidePolicyForMIMEType;
+ WKPageDecidePolicyForResponseCallback decidePolicyForResponse;
+ WKPageUnableToImplementPolicyCallback unableToImplementPolicy;
};
typedef struct WKPagePolicyClient WKPagePolicyClient;
@@ -147,7 +151,7 @@ typedef bool (*WKPageRunJavaScriptConfirmCallback)(WKPageRef page, WKStringRef m
typedef WKStringRef (*WKPageRunJavaScriptPromptCallback)(WKPageRef page, WKStringRef message, WKStringRef defaultValue, WKFrameRef frame, const void *clientInfo);
typedef void (*WKPageSetStatusTextCallback)(WKPageRef page, WKStringRef text, const void *clientInfo);
typedef void (*WKPageMouseDidMoveOverElementCallback)(WKPageRef page, WKEventModifiers modifiers, WKTypeRef userData, const void *clientInfo);
-typedef void (*WKPageMissingPluginButtonClickedCallback)(WKPageRef page, WKStringRef mimeType, WKStringRef url, const void* clientInfo);
+typedef void (*WKPageMissingPluginButtonClickedCallback)(WKPageRef page, WKStringRef mimeType, WKStringRef url, WKStringRef pluginsPageURL, const void* clientInfo);
typedef void (*WKPageDidNotHandleKeyEventCallback)(WKPageRef page, WKNativeEventPtr event, const void *clientInfo);
typedef bool (*WKPageGetToolbarsAreVisibleCallback)(WKPageRef page, const void *clientInfo);
typedef void (*WKPageSetToolbarsAreVisibleCallback)(WKPageRef page, bool toolbarsVisible, const void *clientInfo);
@@ -267,11 +271,15 @@ WK_EXPORT WKBackForwardListRef WKPageGetBackForwardList(WKPageRef page);
WK_EXPORT WKStringRef WKPageCopyTitle(WKPageRef page);
+WK_EXPORT WKURLRef WKPageCopyPendingAPIRequestURL(WKPageRef page);
+
WK_EXPORT WKFrameRef WKPageGetMainFrame(WKPageRef page);
WK_EXPORT WKFrameRef WKPageGetFocusedFrame(WKPageRef page); // The focused frame may be inactive.
WK_EXPORT WKFrameRef WKPageGetFrameSetLargestFrame(WKPageRef page);
WK_EXPORT double WKPageGetEstimatedProgress(WKPageRef page);
+WK_EXPORT void WKPageSetMemoryCacheClientCallsEnabled(WKPageRef page, bool memoryCacheClientCallsEnabled);
+
#if defined(ENABLE_INSPECTOR) && ENABLE_INSPECTOR
WK_EXPORT WKInspectorRef WKPageGetInspector(WKPageRef page);
#endif
@@ -314,6 +322,13 @@ WK_EXPORT WKSize WKPageFixedLayoutSize(WKPageRef page);
WK_EXPORT bool WKPageHasHorizontalScrollbar(WKPageRef page);
WK_EXPORT bool WKPageHasVerticalScrollbar(WKPageRef page);
+WK_EXPORT bool WKPageIsPinnedToLeftSide(WKPageRef page);
+WK_EXPORT bool WKPageIsPinnedToRightSide(WKPageRef page);
+
+WK_EXPORT bool WKPageCanDelete(WKPageRef page);
+WK_EXPORT bool WKPageHasSelectedRange(WKPageRef page);
+WK_EXPORT bool WKPageIsContentEditable(WKPageRef page);
+
WK_EXPORT void WKPageFindString(WKPageRef page, WKStringRef string, WKFindOptions findOptions, unsigned maxMatchCount);
WK_EXPORT void WKPageHideFindUI(WKPageRef page);
WK_EXPORT void WKPageCountStringMatches(WKPageRef page, WKStringRef string, WKFindOptions findOptions, unsigned maxMatchCount);
@@ -326,10 +341,10 @@ WK_EXPORT void WKPageSetPagePolicyClient(WKPageRef page, const WKPagePolicyClien
WK_EXPORT void WKPageSetPageResourceLoadClient(WKPageRef page, const WKPageResourceLoadClient* client);
WK_EXPORT void WKPageSetPageUIClient(WKPageRef page, const WKPageUIClient* client);
-typedef void (*WKPageRunJavaScriptFunction)(WKStringRef, WKErrorRef, void*);
+typedef void (*WKPageRunJavaScriptFunction)(WKSerializedScriptValueRef, WKErrorRef, void*);
WK_EXPORT void WKPageRunJavaScriptInMainFrame(WKPageRef page, WKStringRef script, void* context, WKPageRunJavaScriptFunction function);
#ifdef __BLOCKS__
-typedef void (^WKPageRunJavaScriptBlock)(WKStringRef, WKErrorRef);
+typedef void (^WKPageRunJavaScriptBlock)(WKSerializedScriptValueRef, WKErrorRef);
WK_EXPORT void WKPageRunJavaScriptInMainFrame_b(WKPageRef page, WKStringRef script, WKPageRunJavaScriptBlock block);
#endif
@@ -350,7 +365,21 @@ 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 WKURLRef WKPageCopyPendingAPIRequestURL(WKPageRef page);
+/*
+ Some of the more common command name strings include the following, although any WebCore EditorCommand string is supported:
+
+ "Cut"
+ "Copy"
+ "Paste"
+ "SelectAll"
+ "Undo"
+ "Redo"
+*/
+
+// state represents the state of the command in a menu (on is 1, off is 0, and mixed is -1), typically used to add a checkmark next to the menu item.
+typedef void (*WKPageValidateCommandCallback)(WKStringRef command, bool isEnabled, int32_t state, WKErrorRef, void* context);
+WK_EXPORT void WKPageValidateCommand(WKPageRef page, WKStringRef command, void* context, WKPageValidateCommandCallback callback);
+WK_EXPORT void WKPageExecuteCommand(WKPageRef page, WKStringRef command);
#ifdef __cplusplus
}
diff --git a/Source/WebKit2/UIProcess/API/C/WKPagePrivate.h b/Source/WebKit2/UIProcess/API/C/WKPagePrivate.h
index 3bf50c3..2c1f985 100644
--- a/Source/WebKit2/UIProcess/API/C/WKPagePrivate.h
+++ b/Source/WebKit2/UIProcess/API/C/WKPagePrivate.h
@@ -41,6 +41,29 @@ typedef void (^WKPageRenderTreeExternalRepresentationBlock)(WKStringRef, WKError
WK_EXPORT void WKPageRenderTreeExternalRepresentation_b(WKPageRef page, WKPageRenderTreeExternalRepresentationBlock block);
#endif
+enum {
+ kWKDebugFlashViewUpdates = 1 << 0,
+ kWKDebugFlashBackingStoreUpdates = 1 << 1
+};
+typedef unsigned WKPageDebugPaintFlags;
+
+WK_EXPORT void WKPageSetDebugPaintFlags(WKPageDebugPaintFlags flags);
+WK_EXPORT WKPageDebugPaintFlags WKPageGetDebugPaintFlags(void);
+
+struct WKPrintInfo {
+ float pageSetupScaleFactor;
+ float availablePaperWidth;
+ float availablePaperHeight;
+};
+typedef struct WKPrintInfo WKPrintInfo;
+
+typedef void (*WKPageComputePagesForPrintingFunction)(WKRect* pageRects, uint32_t pageCount, double resultPageScaleFactor, WKErrorRef error, void* functionContext);
+WK_EXPORT void WKPageComputePagesForPrinting(WKPageRef page, WKFrameRef frame, WKPrintInfo, WKPageComputePagesForPrintingFunction, void* context);
+
+typedef void (*WKPageDrawToPDFFunction)(WKDataRef data, WKErrorRef error, void* functionContext);
+WK_EXPORT void WKPageBeginPrinting(WKPageRef page, WKFrameRef frame, WKPrintInfo);
+WK_EXPORT void WKPageDrawPagesToPDF(WKPageRef page, WKFrameRef frame, uint32_t first, uint32_t count, WKPageDrawToPDFFunction callback, void* context);
+
#ifdef __cplusplus
}
#endif
diff --git a/Source/WebKit2/UIProcess/API/C/WKPluginSiteDataManager.cpp b/Source/WebKit2/UIProcess/API/C/WKPluginSiteDataManager.cpp
new file mode 100644
index 0000000..8cfe143
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/C/WKPluginSiteDataManager.cpp
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2011 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WKPluginSiteDataManager.h"
+
+#include "WKAPICast.h"
+#include "WebPluginSiteDataManager.h"
+#include <WebCore/npapi.h>
+
+using namespace WebKit;
+using namespace std;
+
+WKTypeID WKPluginSiteDataManagerGetTypeID()
+{
+ return toAPI(WebPluginSiteDataManager::APIType);
+}
+
+void WKPluginSiteDataManagerGetSitesWithData(WKPluginSiteDataManagerRef managerRef, void* context, WKPluginSiteDataManagerGetSitesWithDataFunction callback)
+{
+ toImpl(managerRef)->getSitesWithData(ArrayCallback::create(context, callback));
+}
+
+static uint64_t toNPClearSiteDataFlags(WKClearSiteDataFlags flags)
+{
+ if (flags == kWKClearSiteDataFlagsClearAll)
+ return NP_CLEAR_ALL;
+
+ uint64_t result = 0;
+ if (flags & kWKClearSiteDataFlagsClearCache)
+ result |= NP_CLEAR_CACHE;
+ return result;
+}
+
+void WKPluginSiteDataManagerClearSiteData(WKPluginSiteDataManagerRef managerRef, WKArrayRef sitesRef, WKClearSiteDataFlags flags, uint64_t maxAgeInSeconds, void* context, WKPluginSiteDataManagerClearSiteDataFunction function)
+{
+ toImpl(managerRef)->clearSiteData(toImpl(sitesRef), toNPClearSiteDataFlags(flags), maxAgeInSeconds, VoidCallback::create(context, function));
+}
+
+void WKPluginSiteDataManagerClearAllSiteData(WKPluginSiteDataManagerRef managerRef, void* context, WKPluginSiteDataManagerClearSiteDataFunction function)
+{
+ toImpl(managerRef)->clearSiteData(0, NP_CLEAR_ALL, numeric_limits<uint64_t>::max(), VoidCallback::create(context, function));
+}
diff --git a/Source/WebKit2/UIProcess/API/C/WKPluginSiteDataManager.h b/Source/WebKit2/UIProcess/API/C/WKPluginSiteDataManager.h
new file mode 100644
index 0000000..66e76fb
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/C/WKPluginSiteDataManager.h
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2011 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WKPluginSiteDataManager_h
+#define WKPluginSiteDataManager_h
+
+#include <WebKit2/WKBase.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+WK_EXPORT WKTypeID WKPluginSiteDataManagerGetTypeID();
+
+typedef void (*WKPluginSiteDataManagerGetSitesWithDataFunction)(WKArrayRef, WKErrorRef, void*);
+WK_EXPORT void WKPluginSiteDataManagerGetSitesWithData(WKPluginSiteDataManagerRef manager, void* context, WKPluginSiteDataManagerGetSitesWithDataFunction function);
+
+enum {
+ kWKClearSiteDataFlagsClearAll = 0,
+ kWKClearSiteDataFlagsClearCache = 1 << 0,
+};
+typedef uint64_t WKClearSiteDataFlags;
+
+typedef void (*WKPluginSiteDataManagerClearSiteDataFunction)(WKErrorRef, void*);
+
+WK_EXPORT void WKPluginSiteDataManagerClearSiteData(WKPluginSiteDataManagerRef manager, WKArrayRef sites, WKClearSiteDataFlags flags, uint64_t maxAgeInSeconds, void* context, WKPluginSiteDataManagerClearSiteDataFunction function);
+WK_EXPORT void WKPluginSiteDataManagerClearAllSiteData(WKPluginSiteDataManagerRef manager, void* context, WKPluginSiteDataManagerClearSiteDataFunction function);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // WKPluginSiteDataManager_h
diff --git a/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp b/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp
index 97e9403..7ba9ba0 100644
--- a/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp
+++ b/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp
@@ -301,6 +301,16 @@ WKFontSmoothingLevel WKPreferencesGetFontSmoothingLevel(WKPreferencesRef prefere
return toAPI(static_cast<FontSmoothingLevel>(toImpl(preferencesRef)->fontSmoothingLevel()));
}
+void WKPreferencesSetAcceleratedDrawingEnabled(WKPreferencesRef preferencesRef, bool flag)
+{
+ toImpl(preferencesRef)->setAcceleratedDrawingEnabled(flag);
+}
+
+bool WKPreferencesGetAcceleratedDrawingEnabled(WKPreferencesRef preferencesRef)
+{
+ return toImpl(preferencesRef)->acceleratedDrawingEnabled();
+}
+
void WKPreferencesSetAcceleratedCompositingEnabled(WKPreferencesRef preferencesRef, bool flag)
{
toImpl(preferencesRef)->setAcceleratedCompositingEnabled(flag);
diff --git a/Source/WebKit2/UIProcess/API/C/WKPreferencesPrivate.h b/Source/WebKit2/UIProcess/API/C/WKPreferencesPrivate.h
index ff9beec..426119b 100644
--- a/Source/WebKit2/UIProcess/API/C/WKPreferencesPrivate.h
+++ b/Source/WebKit2/UIProcess/API/C/WKPreferencesPrivate.h
@@ -47,6 +47,10 @@ typedef enum WKFontSmoothingLevel WKFontSmoothingLevel;
WK_EXPORT void WKPreferencesSetFontSmoothingLevel(WKPreferencesRef, WKFontSmoothingLevel);
WK_EXPORT WKFontSmoothingLevel WKPreferencesGetFontSmoothingLevel(WKPreferencesRef);
+// Defaults to false.
+WK_EXPORT void WKPreferencesSetAcceleratedDrawingEnabled(WKPreferencesRef, bool);
+WK_EXPORT bool WKPreferencesGetAcceleratedDrawingEnabled(WKPreferencesRef);
+
// Defaults to true.
WK_EXPORT void WKPreferencesSetAcceleratedCompositingEnabled(WKPreferencesRef, bool);
WK_EXPORT bool WKPreferencesGetAcceleratedCompositingEnabled(WKPreferencesRef);
diff --git a/Source/WebKit2/UIProcess/API/C/WKResourceCacheManager.cpp b/Source/WebKit2/UIProcess/API/C/WKResourceCacheManager.cpp
new file mode 100644
index 0000000..483beeb
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/C/WKResourceCacheManager.cpp
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2011 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WKResourceCacheManager.h"
+
+#include "WebResourceCacheManagerProxy.h"
+#include "WKAPICast.h"
+
+using namespace WebKit;
+
+WKTypeID WKResourceCacheManagerGetTypeID()
+{
+ return toAPI(WebResourceCacheManagerProxy::APIType);
+}
+
+void WKResourceCacheManagerGetCacheOrigins(WKResourceCacheManagerRef cacheManagerRef, void* context, WKResourceCacheManagerGetCacheOriginsFunction callback)
+{
+ toImpl(cacheManagerRef)->getCacheOrigins(ArrayCallback::create(context, callback));
+}
+
+void WKResourceCacheManagerClearCacheForOrigin(WKResourceCacheManagerRef cacheManagerRef, WKSecurityOriginRef originRef)
+{
+ toImpl(cacheManagerRef)->clearCacheForOrigin(toImpl(originRef));
+}
+
+void WKResourceCacheManagerClearCacheForAllOrigins(WKResourceCacheManagerRef cacheManagerRef)
+{
+ toImpl(cacheManagerRef)->clearCacheForAllOrigins();
+}
diff --git a/Source/WebKit2/UIProcess/API/C/WKResourceCacheManager.h b/Source/WebKit2/UIProcess/API/C/WKResourceCacheManager.h
new file mode 100644
index 0000000..479169d
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/C/WKResourceCacheManager.h
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2011 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WKResourceCacheManager_h
+#define WKResourceCacheManager_h
+
+#include <WebKit2/WKBase.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+WK_EXPORT WKTypeID WKResourceCacheManagerGetTypeID();
+
+typedef void (*WKResourceCacheManagerGetCacheOriginsFunction)(WKArrayRef, WKErrorRef, void*);
+WK_EXPORT void WKResourceCacheManagerGetCacheOrigins(WKResourceCacheManagerRef contextRef, void* context, WKResourceCacheManagerGetCacheOriginsFunction function);
+
+WK_EXPORT void WKResourceCacheManagerClearCacheForOrigin(WKResourceCacheManagerRef cacheManger, WKSecurityOriginRef origin);
+WK_EXPORT void WKResourceCacheManagerClearCacheForAllOrigins(WKResourceCacheManagerRef cacheManager);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // WKResourceCacheManager_h
diff --git a/Source/WebKit2/UIProcess/API/C/gtk/WKView.cpp b/Source/WebKit2/UIProcess/API/C/gtk/WKView.cpp
index aa88151..e3d6c69 100644
--- a/Source/WebKit2/UIProcess/API/C/gtk/WKView.cpp
+++ b/Source/WebKit2/UIProcess/API/C/gtk/WKView.cpp
@@ -37,9 +37,9 @@
using namespace WebKit;
using namespace WebCore;
-WKViewRef WKViewCreate(GdkRectangle rect, WKContextRef contextRef, WKPageGroupRef pageGroupRef)
+WKViewRef WKViewCreate(WKContextRef contextRef, WKPageGroupRef pageGroupRef)
{
- RefPtr<WebView> view = WebView::create(rect, toImpl(contextRef), toImpl(pageGroupRef));
+ RefPtr<WebView> view = WebView::create(toImpl(contextRef), toImpl(pageGroupRef));
return toAPI(view.release().leakRef());
}
diff --git a/Source/WebKit2/UIProcess/API/C/gtk/WKView.h b/Source/WebKit2/UIProcess/API/C/gtk/WKView.h
index 5415fd3..82e55ab 100644
--- a/Source/WebKit2/UIProcess/API/C/gtk/WKView.h
+++ b/Source/WebKit2/UIProcess/API/C/gtk/WKView.h
@@ -35,13 +35,14 @@
extern "C" {
#endif
-WK_EXPORT WKViewRef WKViewCreate(GdkRectangle rect, WKContextRef context, WKPageGroupRef pageGroup);
+WK_EXPORT WKViewRef WKViewCreate(WKContextRef context, WKPageGroupRef pageGroup);
WK_EXPORT GtkWidget* WKViewGetWindow(WKViewRef view);
WK_EXPORT WKPageRef WKViewGetPage(WKViewRef view);
WK_EXPORT WKURLRef WKURLCreateWithURL(const char*);
+
#ifdef __cplusplus
}
#endif
diff --git a/Source/WebKit2/UIProcess/API/mac/FindIndicatorWindow.mm b/Source/WebKit2/UIProcess/API/mac/FindIndicatorWindow.mm
index e622c9d..715bba7 100644
--- a/Source/WebKit2/UIProcess/API/mac/FindIndicatorWindow.mm
+++ b/Source/WebKit2/UIProcess/API/mac/FindIndicatorWindow.mm
@@ -27,6 +27,7 @@
#import "FindIndicatorWindow.h"
#import "FindIndicator.h"
+#import "WKView.h"
#import <WebCore/GraphicsContext.h>
static const double bounceAnimationDuration = 0.12;
diff --git a/Source/WebKit2/UIProcess/API/mac/PDFViewController.h b/Source/WebKit2/UIProcess/API/mac/PDFViewController.h
index 2c4a235..d22d8b5 100644
--- a/Source/WebKit2/UIProcess/API/mac/PDFViewController.h
+++ b/Source/WebKit2/UIProcess/API/mac/PDFViewController.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2010, 2011 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -49,7 +49,7 @@ public:
~PDFViewController();
WKView* wkView() const { return m_wkView; }
- void setPDFDocumentData(const String& mimeType, const CoreIPC::DataReference&);
+ void setPDFDocumentData(const String& mimeType, const String& suggestedFilename, const CoreIPC::DataReference&);
double zoomFactor() const;
void setZoomFactor(double);
@@ -57,16 +57,26 @@ public:
static Class pdfPreviewViewClass();
NSPrintOperation *makePrintOperation(NSPrintInfo *);
-
+ void openPDFInFinder();
+
private:
explicit PDFViewController(WKView *wkView);
static Class pdfDocumentClass();
static NSBundle* pdfKitBundle();
+ NSString *pathToPDFOnDisk();
+
WKView* m_wkView;
+
RetainPtr<WKPDFView> m_wkPDFView;
PDFView* m_pdfView;
+
+ RetainPtr<NSString> m_suggestedFilename;
+ RetainPtr<CFDataRef> m_pdfData;
+
+ RetainPtr<NSString> m_pathToPDFOnDisk;
+ bool m_hasWrittenPDFToDisk;
};
} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/API/mac/PDFViewController.mm b/Source/WebKit2/UIProcess/API/mac/PDFViewController.mm
index 6ab425d..5d9b860 100644
--- a/Source/WebKit2/UIProcess/API/mac/PDFViewController.mm
+++ b/Source/WebKit2/UIProcess/API/mac/PDFViewController.mm
@@ -87,6 +87,7 @@ extern "C" NSString *_NSPathForSystemFramework(NSString *framework);
[self addSubview:_pdfPreviewView.get()];
_pdfView = [_pdfPreviewView.get() performSelector:@selector(pdfView)];
+ [_pdfView setDelegate:self];
}
return self;
@@ -179,6 +180,13 @@ extern "C" NSString *_NSPathForSystemFramework(NSString *framework);
[notificationCenter removeObserver:self name:_webkit_PDFViewPageChangedNotification object:_pdfView];
}
+// PDFView delegate methods
+
+- (void)PDFViewOpenPDFInNativeApplication:(PDFView *)sender
+{
+ _pdfViewController->openPDFInFinder();
+}
+
@end
namespace WebKit {
@@ -192,6 +200,7 @@ PDFViewController::PDFViewController(WKView *wkView)
: m_wkView(wkView)
, m_wkPDFView(AdoptNS, [[WKPDFView alloc] initWithFrame:[m_wkView bounds] PDFViewController:this])
, m_pdfView([m_wkPDFView.get() pdfView])
+ , m_hasWrittenPDFToDisk(false)
{
[m_wkView addSubview:m_wkPDFView.get()];
}
@@ -231,20 +240,20 @@ static RetainPtr<CFDataRef> convertPostScriptDataSourceToPDF(const CoreIPC::Data
return result;
}
-void PDFViewController::setPDFDocumentData(const String& mimeType, const CoreIPC::DataReference& dataReference)
+void PDFViewController::setPDFDocumentData(const String& mimeType, const String& suggestedFilename, const CoreIPC::DataReference& dataReference)
{
- RetainPtr<CFDataRef> data;
-
if (equalIgnoringCase(mimeType, "application/postscript")) {
- data = convertPostScriptDataSourceToPDF(dataReference);
- if (!data)
+ m_pdfData = convertPostScriptDataSourceToPDF(dataReference);
+ if (!m_pdfData)
return;
} else {
// Make sure to copy the data.
- data.adoptCF(CFDataCreate(0, dataReference.data(), dataReference.size()));
+ m_pdfData.adoptCF(CFDataCreate(0, dataReference.data(), dataReference.size()));
}
- RetainPtr<PDFDocument> pdfDocument(AdoptNS, [[pdfDocumentClass() alloc] initWithData:(NSData *)data.get()]);
+ m_suggestedFilename = suggestedFilename;
+
+ RetainPtr<PDFDocument> pdfDocument(AdoptNS, [[pdfDocumentClass() alloc] initWithData:(NSData *)m_pdfData.get()]);
[m_wkPDFView.get() setDocument:pdfDocument.get()];
}
@@ -295,4 +304,74 @@ NSPrintOperation *PDFViewController::makePrintOperation(NSPrintInfo *printInfo)
return [[m_pdfView document] getPrintOperationForPrintInfo:printInfo autoRotate:YES];
}
+void PDFViewController::openPDFInFinder()
+{
+ // We don't want to open the PDF until we have a document to write. (see 4892525).
+ if (![m_pdfView document]) {
+ NSBeep();
+ return;
+ }
+
+ NSString *path = pathToPDFOnDisk();
+ if (!path)
+ return;
+
+ if (!m_hasWrittenPDFToDisk) {
+ // Create a PDF file with the minimal permissions (only accessible to the current user, see 4145714).
+ RetainPtr<NSNumber> permissions(AdoptNS, [[NSNumber alloc] initWithInt:S_IRUSR]);
+ RetainPtr<NSDictionary> fileAttributes(AdoptNS, [[NSDictionary alloc] initWithObjectsAndKeys:permissions.get(), NSFilePosixPermissions, nil]);
+
+ if (![[NSFileManager defaultManager] createFileAtPath:path contents:(NSData *)m_pdfData.get() attributes:fileAttributes.get()])
+ return;
+
+ m_hasWrittenPDFToDisk = true;
+ }
+
+ [[NSWorkspace sharedWorkspace] openFile:path];
+}
+
+static NSString *temporaryPDFDirectoryPath()
+{
+ static NSString *temporaryPDFDirectoryPath;
+
+ if (!temporaryPDFDirectoryPath) {
+ NSString *temporaryDirectoryTemplate = [NSTemporaryDirectory() stringByAppendingPathComponent:@"WebKitPDFs-XXXXXX"];
+ CString templateRepresentation = [temporaryDirectoryTemplate fileSystemRepresentation];
+
+ if (mkdtemp(templateRepresentation.mutableData()))
+ temporaryPDFDirectoryPath = [[[NSFileManager defaultManager] stringWithFileSystemRepresentation:templateRepresentation.data() length:templateRepresentation.length()] copy];
+ }
+
+ return temporaryPDFDirectoryPath;
+}
+
+NSString *PDFViewController::pathToPDFOnDisk()
+{
+ if (m_pathToPDFOnDisk)
+ return m_pathToPDFOnDisk.get();
+
+ NSString *pdfDirectoryPath = temporaryPDFDirectoryPath();
+ if (!pdfDirectoryPath)
+ return nil;
+
+ NSString *path = [pdfDirectoryPath stringByAppendingPathComponent:m_suggestedFilename.get()];
+
+ NSFileManager *fileManager = [NSFileManager defaultManager];
+ if ([fileManager fileExistsAtPath:path]) {
+ NSString *pathTemplatePrefix = [pdfDirectoryPath stringByAppendingString:@"XXXXXX-"];
+ NSString *pathTemplate = [pathTemplatePrefix stringByAppendingPathComponent:m_suggestedFilename.get()];
+ CString pathTemplateRepresentation = [pathTemplate fileSystemRepresentation];
+
+ int fd = mkstemps(pathTemplateRepresentation.mutableData(), pathTemplateRepresentation.length() - strlen([pathTemplatePrefix fileSystemRepresentation]) + 1);
+ if (fd < 0)
+ return nil;
+
+ close(fd);
+ path = [fileManager stringWithFileSystemRepresentation:pathTemplateRepresentation.data() length:pathTemplateRepresentation.length()];
+ }
+
+ m_pathToPDFOnDisk.adoptNS([path copy]);
+ return path;
+}
+
} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/API/mac/PageClientImpl.h b/Source/WebKit2/UIProcess/API/mac/PageClientImpl.h
index b557c1a..e01cf66 100644
--- a/Source/WebKit2/UIProcess/API/mac/PageClientImpl.h
+++ b/Source/WebKit2/UIProcess/API/mac/PageClientImpl.h
@@ -69,7 +69,6 @@ private:
virtual void registerEditCommand(PassRefPtr<WebEditCommandProxy>, WebPageProxy::UndoOrRedo);
virtual void clearAllEditCommands();
- virtual void setEditCommandState(const String& commandName, bool isEnabled, int state);
virtual void interceptKeyEvent(const NativeWebKeyboardEvent& event, Vector<WebCore::KeypressCommand>& commandName, uint32_t selectionStart, uint32_t selectionEnd, Vector<WebCore::CompositionUnderline>& underlines);
virtual void setDragImage(const WebCore::IntPoint& clientPosition, const WebCore::IntSize& imageSize, PassRefPtr<ShareableBitmap> dragImage, bool isLinkDrag);
@@ -86,11 +85,6 @@ private:
virtual void enterAcceleratedCompositingMode(const LayerTreeContext&);
virtual void exitAcceleratedCompositingMode();
-#if USE(ACCELERATED_COMPOSITING)
- virtual void pageDidEnterAcceleratedCompositing();
- virtual void pageDidLeaveAcceleratedCompositing();
-#endif
-
virtual void accessibilityWebProcessTokenReceived(const CoreIPC::DataReference&);
virtual void setComplexTextInputEnabled(uint64_t pluginComplexTextInputIdentifier, bool complexTextInputEnabled);
virtual void setAutodisplay(bool);
@@ -100,11 +94,15 @@ private:
virtual void didChangeScrollbarsForMainFrame() const;
virtual void didCommitLoadForMainFrame(bool useCustomRepresentation);
- virtual void didFinishLoadingDataForCustomRepresentation(const CoreIPC::DataReference&);
+ virtual void didFinishLoadingDataForCustomRepresentation(const String& suggestedFilename, const CoreIPC::DataReference&);
virtual double customRepresentationZoomFactor();
virtual void setCustomRepresentationZoomFactor(double);
+ virtual void flashBackingStoreUpdates(const Vector<WebCore::IntRect>& updateRects);
+
+ virtual void didPerformDictionaryLookup(const String&, double scaleFactor, const DictionaryPopupInfo&);
+
WKView* m_wkView;
RetainPtr<WebEditorUndoTargetObjC> m_undoTarget;
};
diff --git a/Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm b/Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm
index fd70a67..88bb9a4 100644
--- a/Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm
+++ b/Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm
@@ -27,6 +27,7 @@
#import "PageClientImpl.h"
#import "DataReference.h"
+#import "DictionaryPopupInfo.h"
#import "FindIndicator.h"
#import "NativeWebKeyboardEvent.h"
#import "WKAPICast.h"
@@ -40,6 +41,7 @@
#import <WebCore/FoundationExtras.h>
#import <WebCore/GraphicsContext.h>
#import <WebCore/KeyboardEvent.h>
+#import <WebCore/NotImplemented.h>
#import <wtf/PassOwnPtr.h>
#import <wtf/text/CString.h>
#import <wtf/text/WTFString.h>
@@ -279,11 +281,6 @@ void PageClientImpl::clearAllEditCommands()
[[m_wkView undoManager] removeAllActionsWithTarget:m_undoTarget.get()];
}
-void PageClientImpl::setEditCommandState(const String& commandName, bool isEnabled, int newState)
-{
- [m_wkView _setUserInterfaceItemState:nsStringFromWebCoreString(commandName) enabled:isEnabled state:newState];
-}
-
void PageClientImpl::interceptKeyEvent(const NativeWebKeyboardEvent& event, Vector<WebCore::KeypressCommand>& commandsList, uint32_t selectionStart, uint32_t selectionEnd, Vector<WebCore::CompositionUnderline>& underlines)
{
commandsList = [m_wkView _interceptKeyEvent:event.nativeEvent()];
@@ -294,7 +291,6 @@ void PageClientImpl::setDragImage(const IntPoint& clientPosition, const IntSize&
{
OwnPtr<GraphicsContext> graphicsContext = dragImage->createGraphicsContext();
RetainPtr<NSImage> dragNSImage(AdoptNS, [[NSImage alloc] initWithCGImage:CGBitmapContextCreateImage(graphicsContext->platformContext()) size:imageSize]);
- [dragNSImage.get() setFlipped:YES];
[m_wkView _setDragImage:dragNSImage.get() at:clientPosition linkDrag:isLinkDrag];
}
@@ -352,16 +348,6 @@ void PageClientImpl::exitAcceleratedCompositingMode()
{
[m_wkView _exitAcceleratedCompositingMode];
}
-
-void PageClientImpl::pageDidEnterAcceleratedCompositing()
-{
- [m_wkView _pageDidEnterAcceleratedCompositing];
-}
-
-void PageClientImpl::pageDidLeaveAcceleratedCompositing()
-{
- [m_wkView _pageDidLeaveAcceleratedCompositing];
-}
#endif // USE(ACCELERATED_COMPOSITING)
void PageClientImpl::setComplexTextInputEnabled(uint64_t pluginComplexTextInputIdentifier, bool complexTextInputEnabled)
@@ -375,11 +361,21 @@ void PageClientImpl::setAutodisplay(bool newState)
[m_wkView displayIfNeeded];
[[m_wkView window] setAutodisplay:newState];
+
+ // For some reason, painting doesn't happen for a long time without this call, <rdar://problem/8975229>.
+ if (newState)
+ [m_wkView displayIfNeeded];
}
CGContextRef PageClientImpl::containingWindowGraphicsContext()
{
- return static_cast<CGContextRef>([[[m_wkView window] graphicsContext] graphicsPort]);
+ NSWindow *window = [m_wkView window];
+
+ // Don't try to get the graphics context if the NSWindow doesn't have a window device.
+ if ([window windowNumber] <= 0)
+ return 0;
+
+ return static_cast<CGContextRef>([[window graphicsContext] graphicsPort]);
}
void PageClientImpl::didChangeScrollbarsForMainFrame() const
@@ -392,9 +388,9 @@ void PageClientImpl::didCommitLoadForMainFrame(bool useCustomRepresentation)
[m_wkView _setPageHasCustomRepresentation:useCustomRepresentation];
}
-void PageClientImpl::didFinishLoadingDataForCustomRepresentation(const CoreIPC::DataReference& dataReference)
+void PageClientImpl::didFinishLoadingDataForCustomRepresentation(const String& suggestedFilename, const CoreIPC::DataReference& dataReference)
{
- [m_wkView _didFinishLoadingDataForCustomRepresentation:dataReference];
+ [m_wkView _didFinishLoadingDataForCustomRepresentationWithSuggestedFilename:suggestedFilename dataReference:dataReference];
}
double PageClientImpl::customRepresentationZoomFactor()
@@ -407,4 +403,25 @@ void PageClientImpl::setCustomRepresentationZoomFactor(double zoomFactor)
[m_wkView _setCustomRepresentationZoomFactor:zoomFactor];
}
+void PageClientImpl::flashBackingStoreUpdates(const Vector<IntRect>&)
+{
+ notImplemented();
+}
+
+void PageClientImpl::didPerformDictionaryLookup(const String& text, double scaleFactor, const DictionaryPopupInfo& dictionaryPopupInfo)
+{
+ NSFontDescriptor *fontDescriptor = [NSFontDescriptor fontDescriptorWithFontAttributes:(NSDictionary *)dictionaryPopupInfo.fontInfo.fontAttributeDictionary.get()];
+ NSFont *font = [NSFont fontWithDescriptor:fontDescriptor size:((scaleFactor != 1) ? [fontDescriptor pointSize] * scaleFactor : 0)];
+
+ RetainPtr<NSMutableAttributedString> attributedString(AdoptNS, [[NSMutableAttributedString alloc] initWithString:nsStringFromWebCoreString(text)]);
+ [attributedString.get() addAttribute:NSFontAttributeName value:font range:NSMakeRange(0, [attributedString.get() length])];
+
+ NSPoint textBaselineOrigin = dictionaryPopupInfo.origin;
+ textBaselineOrigin.y += [font ascender];
+
+ // If the dictionary lookup is being triggered by a hot key, force the overlay style.
+ NSDictionary *options = (dictionaryPopupInfo.type == DictionaryPopupInfo::HotKey) ? [NSDictionary dictionaryWithObject:NSDefinitionPresentationTypeOverlay forKey:NSDefinitionPresentationTypeKey] : 0;
+ [m_wkView showDefinitionForAttributedString:attributedString.get() range:NSMakeRange(0, [attributedString.get() length]) options:options baselineOriginProvider:^(NSRange adjustedRange) { return (NSPoint)textBaselineOrigin; }];
+}
+
} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/API/mac/WKView.mm b/Source/WebKit2/UIProcess/API/mac/WKView.mm
index da29e04..e432549 100644
--- a/Source/WebKit2/UIProcess/API/mac/WKView.mm
+++ b/Source/WebKit2/UIProcess/API/mac/WKView.mm
@@ -31,7 +31,6 @@
#import "DrawingAreaProxyImpl.h"
#import "FindIndicator.h"
#import "FindIndicatorWindow.h"
-#import "LayerBackedDrawingAreaProxy.h"
#import "LayerTreeContext.h"
#import "Logging.h"
#import "NativeWebKeyboardEvent.h"
@@ -52,7 +51,6 @@
#import "WebEventFactory.h"
#import "WebPage.h"
#import "WebPageProxy.h"
-#import "WebProcessManager.h"
#import "WebProcessProxy.h"
#import "WebSystemInterface.h"
#import <QuartzCore/QuartzCore.h>
@@ -208,6 +206,8 @@ static bool useNewDrawingArea()
if (!self)
return nil;
+ [NSApp registerServicesMenuSendTypes:PasteboardTypes::forSelection() returnTypes:PasteboardTypes::forEditing()];
+
InitWebCoreSystemInterface();
RunLoop::initializeMainRunLoop();
@@ -496,6 +496,30 @@ WEBCORE_COMMAND(yankAndSelect)
#undef WEBCORE_COMMAND
+- (BOOL)writeSelectionToPasteboard:(NSPasteboard *)pasteboard types:(NSArray *)types
+{
+ Vector<String> pasteboardTypes;
+ size_t numTypes = [types count];
+ for (size_t i = 0; i < numTypes; ++i)
+ pasteboardTypes.append([types objectAtIndex:i]);
+ return _data->_page->writeSelectionToPasteboard([pasteboard name], pasteboardTypes);
+}
+
+- (id)validRequestorForSendType:(NSString *)sendType returnType:(NSString *)returnType
+{
+ BOOL isValidSendType = !sendType || ([PasteboardTypes::forSelection() containsObject:sendType] && !_data->_page->selectionState().isNone);
+ BOOL isValidReturnType = NO;
+ if (!returnType)
+ isValidReturnType = YES;
+ else if ([PasteboardTypes::forEditing() containsObject:returnType] && _data->_page->selectionState().isContentEditable) {
+ // We can insert strings in any editable context. We can insert other types, like images, only in rich edit contexts.
+ isValidReturnType = _data->_page->selectionState().isContentRichlyEditable || [returnType isEqualToString:NSStringPboardType];
+ }
+ if (isValidSendType && isValidReturnType)
+ return self;
+ return [[self nextResponder] validRequestorForSendType:sendType returnType:returnType];
+}
+
/*
When possible, editing-related methods should be implemented in WebCore with the
@@ -548,6 +572,18 @@ static NSToolbarItem *toolbarItem(id <NSValidatedUserInterfaceItem> item)
return (NSToolbarItem *)item;
}
+static void validateCommandCallback(WKStringRef commandName, bool isEnabled, int32_t state, WKErrorRef error, void* context)
+{
+ // If the process exits before the command can be validated, we'll be called back with an error.
+ if (error)
+ return;
+
+ WKView* wkView = static_cast<WKView*>(context);
+ ASSERT(wkView);
+
+ [wkView _setUserInterfaceItemState:nsStringFromWebCoreString(toImpl(commandName)->string()) enabled:isEnabled state:state];
+}
+
- (BOOL)validateUserInterfaceItem:(id <NSValidatedUserInterfaceItem>)item
{
SEL action = [item action];
@@ -643,8 +679,7 @@ static NSToolbarItem *toolbarItem(id <NSValidatedUserInterfaceItem> item)
// If we are not already awaiting validation for this command, start the asynchronous validation process.
// FIXME: Theoretically, there is a race here; when we get the answer it might be old, from a previous time
// we asked for the same command; there is no guarantee the answer is still valid.
- // FIXME: The function called here should be renamed validateCommand because it is not specific to menu items.
- _data->_page->validateMenuItem(commandName);
+ _data->_page->validateCommand(commandName, ValidateCommandCallback::create(self, validateCommandCallback));
}
// Treat as enabled until we get the result back from the web process and _setUserInterfaceItemState is called.
@@ -715,6 +750,23 @@ static void speakString(WKStringRef string, WKErrorRef error, void*)
_data->_page->unmarkAllMisspellings();
}
+- (BOOL)isGrammarCheckingEnabled
+{
+ return TextChecker::state().isGrammarCheckingEnabled;
+}
+
+- (void)setGrammarCheckingEnabled:(BOOL)flag
+{
+ if (static_cast<bool>(flag) == TextChecker::state().isGrammarCheckingEnabled)
+ return;
+
+ TextChecker::setGrammarCheckingEnabled(flag);
+ _data->_page->process()->updateTextCheckerState();
+
+ if (!flag)
+ _data->_page->unmarkAllBadGrammar();
+}
+
- (IBAction)toggleGrammarChecking:(id)sender
{
bool grammarCheckingEnabled = !TextChecker::state().isGrammarCheckingEnabled;
@@ -1496,6 +1548,13 @@ static void drawPageBackground(CGContextRef context, WebPageProxy* page, const I
return _data->_page->drawsBackground();
}
+- (BOOL)mouseDownCanMoveWindow
+{
+ // -[NSView mouseDownCanMoveWindow] returns YES when the NSView is transparent,
+ // but we don't want a drag in the NSView to move the window, even if it's transparent.
+ return NO;
+}
+
- (void)viewDidHide
{
_data->_page->viewStateDidChange(WebPageProxy::ViewIsVisible);
@@ -1506,6 +1565,11 @@ static void drawPageBackground(CGContextRef context, WebPageProxy* page, const I
_data->_page->viewStateDidChange(WebPageProxy::ViewIsVisible);
}
+- (id)accessibilityFocusedUIElement
+{
+ return _data->_remoteAccessibilityChild.get();
+}
+
- (BOOL)accessibilityIsIgnored
{
return NO;
@@ -1802,95 +1866,6 @@ static void drawPageBackground(CGContextRef context, WebPageProxy* page, const I
_data->_findIndicatorWindow->setFindIndicator(findIndicator, fadeOut);
}
-#if USE(ACCELERATED_COMPOSITING)
-- (void)_startAcceleratedCompositing:(CALayer *)rootLayer
-{
- if (!_data->_oldLayerHostingView) {
- NSView *hostingView = [[NSView alloc] initWithFrame:[self bounds]];
-#if !defined(BUILDING_ON_LEOPARD)
- [hostingView setAutoresizingMask:(NSViewWidthSizable | NSViewHeightSizable)];
-#endif
-
- [self addSubview:hostingView];
- [hostingView release];
- _data->_oldLayerHostingView = hostingView;
- }
-
- // Make a container layer, which will get sized/positioned by AppKit and CA.
- CALayer *viewLayer = [CALayer layer];
-
-#ifndef NDEBUG
- [viewLayer setName:@"hosting layer"];
-#endif
-
-#if defined(BUILDING_ON_LEOPARD)
- // Turn off default animations.
- NSNull *nullValue = [NSNull null];
- NSDictionary *actions = [NSDictionary dictionaryWithObjectsAndKeys:
- nullValue, @"anchorPoint",
- nullValue, @"bounds",
- nullValue, @"contents",
- nullValue, @"contentsRect",
- nullValue, @"opacity",
- nullValue, @"position",
- nullValue, @"sublayerTransform",
- nullValue, @"sublayers",
- nullValue, @"transform",
- nil];
- [viewLayer setStyle:[NSDictionary dictionaryWithObject:actions forKey:@"actions"]];
-#endif
-
-#if !defined(BUILDING_ON_LEOPARD)
- // If we aren't in the window yet, we'll use the screen's scale factor now, and reset the scale
- // via -viewDidMoveToWindow.
- CGFloat scaleFactor = [self window] ? [[self window] userSpaceScaleFactor] : [[NSScreen mainScreen] userSpaceScaleFactor];
- [viewLayer setTransform:CATransform3DMakeScale(scaleFactor, scaleFactor, 1)];
-#endif
-
- [_data->_oldLayerHostingView setLayer:viewLayer];
- [_data->_oldLayerHostingView setWantsLayer:YES];
-
- // Parent our root layer in the container layer
- [viewLayer addSublayer:rootLayer];
-}
-
-- (void)_stopAcceleratedCompositing
-{
- if (_data->_oldLayerHostingView) {
- [_data->_oldLayerHostingView setLayer:nil];
- [_data->_oldLayerHostingView setWantsLayer:NO];
- [_data->_oldLayerHostingView removeFromSuperview];
- _data->_oldLayerHostingView = nil;
- }
-}
-
-- (void)_switchToDrawingAreaTypeIfNecessary:(DrawingAreaInfo::Type)type
-{
- DrawingAreaInfo::Type existingDrawingAreaType = _data->_page->drawingArea() ? _data->_page->drawingArea()->info().type : DrawingAreaInfo::None;
- if (existingDrawingAreaType == type)
- return;
-
- OwnPtr<DrawingAreaProxy> newDrawingArea;
- switch (type) {
- case DrawingAreaInfo::Impl:
- case DrawingAreaInfo::None:
- break;
- case DrawingAreaInfo::ChunkedUpdate: {
- newDrawingArea = ChunkedUpdateDrawingAreaProxy::create(self, _data->_page.get());
- break;
- }
- case DrawingAreaInfo::LayerBacked: {
- newDrawingArea = LayerBackedDrawingAreaProxy::create(self, _data->_page.get());
- break;
- }
- }
-
- newDrawingArea->setSize(IntSize([self frame].size), IntSize());
-
- _data->_page->drawingArea()->detachCompositingContext();
- _data->_page->setDrawingArea(newDrawingArea.release());
-}
-
- (void)_enterAcceleratedCompositingMode:(const LayerTreeContext&)layerTreeContext
{
ASSERT(!_data->_layerHostingView);
@@ -1899,6 +1874,9 @@ static void drawPageBackground(CGContextRef context, WebPageProxy* page, const I
// Create an NSView that will host our layer tree.
_data->_layerHostingView.adoptNS([[NSView alloc] initWithFrame:[self bounds]]);
[_data->_layerHostingView.get() setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
+
+ [CATransaction begin];
+ [CATransaction setDisableActions:YES];
[self addSubview:_data->_layerHostingView.get()];
// Create a root layer that will back the NSView.
@@ -1912,31 +1890,21 @@ static void drawPageBackground(CGContextRef context, WebPageProxy* page, const I
[_data->_layerHostingView.get() setLayer:rootLayer.get()];
[_data->_layerHostingView.get() setWantsLayer:YES];
+
+ [CATransaction commit];
}
- (void)_exitAcceleratedCompositingMode
{
ASSERT(_data->_layerHostingView);
+ [_data->_layerHostingView.get() removeFromSuperview];
[_data->_layerHostingView.get() setLayer:nil];
[_data->_layerHostingView.get() setWantsLayer:NO];
- [_data->_layerHostingView.get() removeFromSuperview];
_data->_layerHostingView = nullptr;
}
-- (void)_pageDidEnterAcceleratedCompositing
-{
- [self _switchToDrawingAreaTypeIfNecessary:DrawingAreaInfo::LayerBacked];
-}
-
-- (void)_pageDidLeaveAcceleratedCompositing
-{
- // FIXME: we may want to avoid flipping back to the non-layer-backed drawing area until the next page load, to avoid thrashing.
- [self _switchToDrawingAreaTypeIfNecessary:DrawingAreaInfo::ChunkedUpdate];
-}
-#endif // USE(ACCELERATED_COMPOSITING)
-
- (void)_setAccessibilityWebProcessToken:(NSData *)data
{
#if !defined(BUILDING_ON_SNOW_LEOPARD)
@@ -1978,11 +1946,11 @@ static void drawPageBackground(CGContextRef context, WebPageProxy* page, const I
_data->_pdfViewController = PDFViewController::create(self);
}
-- (void)_didFinishLoadingDataForCustomRepresentation:(const CoreIPC::DataReference&)dataReference
+- (void)_didFinishLoadingDataForCustomRepresentationWithSuggestedFilename:(const String&)suggestedFilename dataReference:(const CoreIPC::DataReference&)dataReference
{
ASSERT(_data->_pdfViewController);
- _data->_pdfViewController->setPDFDocumentData(_data->_page->mainFrame()->mimeType(), dataReference);
+ _data->_pdfViewController->setPDFDocumentData(_data->_page->mainFrame()->mimeType(), suggestedFilename, dataReference);
}
- (double)_customRepresentationZoomFactor
@@ -2056,5 +2024,14 @@ static void drawPageBackground(CGContextRef context, WebPageProxy* page, const I
return _frameSizeUpdatesDisabledCount > 0;
}
+- (void)performDictionaryLookupAtCurrentMouseLocation
+{
+ NSPoint thePoint = [NSEvent mouseLocation];
+ thePoint = [[self window] convertScreenToBase:thePoint];
+ thePoint = [self convertPoint:thePoint fromView:nil];
+
+ _data->_page->performDictionaryLookupAtLocation(FloatPoint(thePoint.x, thePoint.y));
+}
+
@end
diff --git a/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h b/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h
index 9e77e30..4147658 100644
--- a/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h
+++ b/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h
@@ -52,18 +52,11 @@ namespace WebKit {
- (void)_enterAcceleratedCompositingMode:(const WebKit::LayerTreeContext&)layerTreeContext;
- (void)_exitAcceleratedCompositingMode;
-#if USE(ACCELERATED_COMPOSITING)
-- (void)_startAcceleratedCompositing:(CALayer *)rootLayer;
-- (void)_stopAcceleratedCompositing;
-- (void)_pageDidEnterAcceleratedCompositing;
-- (void)_pageDidLeaveAcceleratedCompositing;
-#endif
-
- (void)_setAccessibilityWebProcessToken:(NSData *)data;
- (void)_setComplexTextInputEnabled:(BOOL)complexTextInputEnabled pluginComplexTextInputIdentifier:(uint64_t)pluginComplexTextInputIdentifier;
- (void)_setPageHasCustomRepresentation:(BOOL)pageHasCustomRepresentation;
-- (void)_didFinishLoadingDataForCustomRepresentation:(const CoreIPC::DataReference&)dataReference;
+- (void)_didFinishLoadingDataForCustomRepresentationWithSuggestedFilename:(const String&)suggestedFilename dataReference:(const CoreIPC::DataReference&)dataReference;
- (double)_customRepresentationZoomFactor;
- (void)_setCustomRepresentationZoomFactor:(double)zoomFactor;
- (void)_setDragImage:(NSImage *)image at:(NSPoint)clientPoint linkDrag:(BOOL)linkDrag;
diff --git a/Source/WebKit2/UIProcess/API/mac/WKViewPrivate.h b/Source/WebKit2/UIProcess/API/mac/WKViewPrivate.h
index 5d6125e..cece1c7 100644
--- a/Source/WebKit2/UIProcess/API/mac/WKViewPrivate.h
+++ b/Source/WebKit2/UIProcess/API/mac/WKViewPrivate.h
@@ -33,4 +33,6 @@
- (void)enableFrameSizeUpdates;
- (BOOL)frameSizeUpdatesDisabled;
+- (void)performDictionaryLookupAtCurrentMouseLocation;
+
@end
diff --git a/Source/WebKit2/UIProcess/API/qt/qgraphicswkview.cpp b/Source/WebKit2/UIProcess/API/qt/qgraphicswkview.cpp
index 748b1bd..0381d73 100644
--- a/Source/WebKit2/UIProcess/API/qt/qgraphicswkview.cpp
+++ b/Source/WebKit2/UIProcess/API/qt/qgraphicswkview.cpp
@@ -55,7 +55,7 @@ struct QGraphicsWKViewPrivate {
QGraphicsWKView* q;
QWKPage* page;
- QMenu* activeMenu;
+ QSharedPointer<QMenu> activeMenu;
RunLoop::Timer<QGraphicsWKViewPrivate> m_scaleCommitTimer;
bool m_isChangingScale;
};
@@ -83,7 +83,7 @@ QGraphicsWKView::QGraphicsWKView(QWKContext* context, BackingStoreType backingSt
connect(d->page, SIGNAL(urlChanged(const QUrl&)), this, SIGNAL(urlChanged(const QUrl&)));
connect(d->page, SIGNAL(cursorChanged(const QCursor&)), this, SLOT(updateCursor(const QCursor&)));
connect(d->page, SIGNAL(focusNextPrevChild(bool)), this, SLOT(focusNextPrevChildCallback(bool)));
- connect(d->page, SIGNAL(showContextMenu(QMenu*)), this, SLOT(showContextMenu(QMenu*)));
+ connect(d->page, SIGNAL(showContextMenu(QSharedPointer<QMenu>)), this, SLOT(showContextMenu(QSharedPointer<QMenu>)));
}
QGraphicsWKView::~QGraphicsWKView()
@@ -327,12 +327,22 @@ void QGraphicsWKView::focusOutEvent(QFocusEvent*)
page()->d->page->viewStateDidChange(WebPageProxy::ViewIsFocused | WebPageProxy::ViewWindowIsActive);
}
-void QGraphicsWKView::showContextMenu(QMenu* menu)
+
+/*!
+ This slot is called when the engine require a context sensitive menu to be displayed.
+
+ The \a menu passed as a parameter is the menu to be displayed. It is populated with the
+ actions possible for its current position. The menu is empty if there is no action for the position.
+*/
+void QGraphicsWKView::showContextMenu(QSharedPointer<QMenu> menu)
{
// Remove the active menu in case this function is called twice.
if (d->activeMenu)
d->activeMenu->hide();
+ if (menu->isEmpty())
+ return;
+
d->activeMenu = menu;
QWidget* view = 0;
@@ -351,14 +361,14 @@ void QGraphicsWKView::showContextMenu(QMenu* menu)
menu->setParent(view, menu->windowFlags());
menu->exec(view->mapToGlobal(menu->pos()));
if (d->activeMenu == menu)
- d->activeMenu = 0;
+ d->activeMenu.clear();
}
void QGraphicsWKView::takeSnapshot(const QSize& size, const QRect& contentsRect)
{
#if ENABLE(TILED_BACKING_STORE)
DrawingAreaProxy* drawingArea = page()->d->page->drawingArea();
- if (drawingArea->info().type != DrawingAreaInfo::Tiled)
+ if (drawingArea->type() != DrawingAreaTypeTiled)
return;
TiledDrawingAreaProxy* tiledDrawingArea = static_cast<TiledDrawingAreaProxy*>(drawingArea);
tiledDrawingArea->takeSnapshot(size, contentsRect);
@@ -419,7 +429,7 @@ void QGraphicsWKViewPrivate::commitScale()
#if ENABLE(TILED_BACKING_STORE)
DrawingAreaProxy* drawingArea = page->d->page->drawingArea();
float newScale = q->scale();
- if (drawingArea->info().type == DrawingAreaInfo::Tiled) {
+ if (drawingArea->type() == DrawingAreaTypeTiled) {
TiledDrawingAreaProxy* tiledDrawingArea = static_cast<TiledDrawingAreaProxy*>(drawingArea);
if (tiledDrawingArea->contentsScale() == newScale)
return;
diff --git a/Source/WebKit2/UIProcess/API/qt/qgraphicswkview.h b/Source/WebKit2/UIProcess/API/qt/qgraphicswkview.h
index caf8e0d..03fc722 100644
--- a/Source/WebKit2/UIProcess/API/qt/qgraphicswkview.h
+++ b/Source/WebKit2/UIProcess/API/qt/qgraphicswkview.h
@@ -68,6 +68,7 @@ public Q_SLOTS:
void forward();
void reload();
void stop();
+ void showContextMenu(QSharedPointer<QMenu>);
protected:
virtual void keyPressEvent(QKeyEvent*);
@@ -88,9 +89,6 @@ protected:
virtual void focusInEvent(QFocusEvent*);
virtual void focusOutEvent(QFocusEvent*);
-private Q_SLOTS:
- void showContextMenu(QMenu*);
-
private:
Q_PRIVATE_SLOT(d, void onScaleChanged());
diff --git a/Source/WebKit2/UIProcess/API/qt/qwkpage.cpp b/Source/WebKit2/UIProcess/API/qt/qwkpage.cpp
index 16e1cdd..05c7b8b 100644
--- a/Source/WebKit2/UIProcess/API/qt/qwkpage.cpp
+++ b/Source/WebKit2/UIProcess/API/qt/qwkpage.cpp
@@ -34,6 +34,7 @@
#include "FindIndicator.h"
#include "LocalizedStrings.h"
#include "NativeWebKeyboardEvent.h"
+#include "NotImplemented.h"
#include "TiledDrawingAreaProxy.h"
#include "WebContext.h"
#include "WebContextMenuProxyQt.h"
@@ -50,6 +51,7 @@
#include <QtDebug>
#include <WebCore/Cursor.h>
#include <WebCore/FloatRect.h>
+#include <WebCore/NotImplemented.h>
#include <WebKit2/WKFrame.h>
#include <WebKit2/WKPageGroup.h>
#include <WebKit2/WKRetainPtr.h>
@@ -163,20 +165,17 @@ WebCore::IntSize QWKPagePrivate::viewSize()
bool QWKPagePrivate::isViewWindowActive()
{
- // FIXME: Implement.
- return true;
+ return view && view->isActive();
}
bool QWKPagePrivate::isViewFocused()
{
- // FIXME: Implement.
- return true;
+ return view && view->hasFocus();
}
bool QWKPagePrivate::isViewVisible()
{
- // FIXME: Implement.
- return true;
+ return view && view->isVisible();
}
bool QWKPagePrivate::isViewInWindow()
@@ -254,10 +253,15 @@ void QWKPagePrivate::didCommitLoadForMainFrame(bool useCustomRepresentation)
{
}
-void QWKPagePrivate::didFinishLoadingDataForCustomRepresentation(const CoreIPC::DataReference&)
+void QWKPagePrivate::didFinishLoadingDataForCustomRepresentation(const String& suggestedFilename, const CoreIPC::DataReference&)
{
}
+void QWKPagePrivate::flashBackingStoreUpdates(const Vector<IntRect>&)
+{
+ notImplemented();
+}
+
void QWKPagePrivate::paint(QPainter* painter, QRect area)
{
if (page->isValid() && page->drawingArea())
@@ -325,10 +329,6 @@ void QWKPagePrivate::wheelEvent(QGraphicsSceneWheelEvent* ev)
page->handleWheelEvent(wheelEvent);
}
-void QWKPagePrivate::setEditCommandState(const WTF::String&, bool, int)
-{
-}
-
void QWKPagePrivate::updateAction(QWKPage::WebAction action)
{
#ifdef QT_NO_ACTION
@@ -442,7 +442,8 @@ QWKPage::QWKPage(QWKContext* context)
qt_wk_didBecomeUnresponsive,
qt_wk_didBecomeResponsive,
0, /* processDidCrash */
- 0 /* didChangeBackForwardList */
+ 0, /* didChangeBackForwardList */
+ 0 /* shouldGoToBackForwardListItem */
};
WKPageSetPageLoaderClient(pageRef(), &loadClient);
diff --git a/Source/WebKit2/UIProcess/API/qt/qwkpage.h b/Source/WebKit2/UIProcess/API/qt/qwkpage.h
index cb7933a..48fdd9f 100644
--- a/Source/WebKit2/UIProcess/API/qt/qwkpage.h
+++ b/Source/WebKit2/UIProcess/API/qt/qwkpage.h
@@ -3,6 +3,7 @@
#include "qwebkitglobal.h"
#include <QAction>
+#include <QMenu>
#include <QObject>
#include <QPoint>
#include <QRect>
@@ -134,7 +135,7 @@ public:
Q_SIGNAL void windowCloseRequested();
Q_SIGNAL void zoomableAreaFound(const QRect&);
Q_SIGNAL void focusNextPrevChild(bool);
- Q_SIGNAL void showContextMenu(QMenu*);
+ Q_SIGNAL void showContextMenu(QSharedPointer<QMenu>);
Q_SIGNAL void engineConnectionChanged(bool connected);
protected:
diff --git a/Source/WebKit2/UIProcess/API/qt/qwkpage_p.h b/Source/WebKit2/UIProcess/API/qt/qwkpage_p.h
index 65f64ff..1a626a1 100644
--- a/Source/WebKit2/UIProcess/API/qt/qwkpage_p.h
+++ b/Source/WebKit2/UIProcess/API/qt/qwkpage_p.h
@@ -62,8 +62,6 @@ public:
#if USE(ACCELERATED_COMPOSITING)
virtual void enterAcceleratedCompositingMode(const LayerTreeContext&);
virtual void exitAcceleratedCompositingMode();
- void pageDidEnterAcceleratedCompositing() { }
- void pageDidLeaveAcceleratedCompositing() { }
#endif // USE(ACCELERATED_COMPOSITING)
virtual void pageDidRequestScroll(const WebCore::IntSize&);
virtual void processDidCrash();
@@ -87,11 +85,13 @@ public:
virtual void setFindIndicator(PassRefPtr<WebKit::FindIndicator>, bool fadeOut);
virtual void didCommitLoadForMainFrame(bool useCustomRepresentation);
- virtual void didFinishLoadingDataForCustomRepresentation(const CoreIPC::DataReference&);
+ virtual void didFinishLoadingDataForCustomRepresentation(const String& suggestedFilename, const CoreIPC::DataReference&);
virtual double customRepresentationZoomFactor() { return 1; }
virtual void setCustomRepresentationZoomFactor(double) { }
virtual void didChangeScrollbarsForMainFrame() const { }
+ virtual void flashBackingStoreUpdates(const Vector<WebCore::IntRect>& updateRects);
+
void paint(QPainter* painter, QRect);
void keyPressEvent(QKeyEvent*);
@@ -105,7 +105,6 @@ public:
void updateAction(QWKPage::WebAction action);
void updateNavigationActions();
void updateEditorActions();
- void setEditCommandState(const WTF::String&, bool, int);
void _q_webActionTriggered(bool checked);
diff --git a/Source/WebKit2/UIProcess/API/qt/qwkpreferences.cpp b/Source/WebKit2/UIProcess/API/qt/qwkpreferences.cpp
index 4ba18a3..0f54c00 100644
--- a/Source/WebKit2/UIProcess/API/qt/qwkpreferences.cpp
+++ b/Source/WebKit2/UIProcess/API/qt/qwkpreferences.cpp
@@ -184,3 +184,36 @@ void QWKPreferences::setAttribute(WebAttribute attr, bool on)
ASSERT_NOT_REACHED();
}
}
+
+void QWKPreferences::setFontSize(FontSize type, int size)
+{
+ switch (type) {
+ case MinimumFontSize:
+ WKPreferencesSetMinimumFontSize(d->ref, size);
+ break;
+ case DefaultFontSize:
+ WKPreferencesSetDefaultFontSize(d->ref, size);
+ break;
+ case DefaultFixedFontSize:
+ WKPreferencesSetDefaultFixedFontSize(d->ref, size);
+ break;
+ default:
+ ASSERT_NOT_REACHED();
+ }
+}
+
+int QWKPreferences::fontSize(FontSize type) const
+{
+ switch (type) {
+ case MinimumFontSize:
+ return WKPreferencesGetMinimumFontSize(d->ref);
+ case DefaultFontSize:
+ return WKPreferencesGetDefaultFontSize(d->ref);
+ case DefaultFixedFontSize:
+ return WKPreferencesGetDefaultFixedFontSize(d->ref);
+ default:
+ ASSERT_NOT_REACHED();
+ return false;
+ }
+}
+
diff --git a/Source/WebKit2/UIProcess/API/qt/qwkpreferences.h b/Source/WebKit2/UIProcess/API/qt/qwkpreferences.h
index d9f7bc0..db22906 100644
--- a/Source/WebKit2/UIProcess/API/qt/qwkpreferences.h
+++ b/Source/WebKit2/UIProcess/API/qt/qwkpreferences.h
@@ -49,6 +49,12 @@ public:
DnsPrefetchEnabled
};
+ enum FontSize {
+ MinimumFontSize,
+ DefaultFontSize,
+ DefaultFixedFontSize
+ };
+
static QWKPreferences* sharedPreferences();
void setFontFamily(FontFamily which, const QString& family);
@@ -57,6 +63,9 @@ public:
void setAttribute(WebAttribute attr, bool on);
bool testAttribute(WebAttribute attr) const;
+ void setFontSize(FontSize type, int size);
+ int fontSize(FontSize type) const;
+
private:
Q_DISABLE_COPY(QWKPreferences)
diff --git a/Source/WebKit2/UIProcess/API/qt/tests/html/basic_page.html b/Source/WebKit2/UIProcess/API/qt/tests/html/basic_page.html
new file mode 100644
index 0000000..b4eea41
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/qt/tests/html/basic_page.html
@@ -0,0 +1 @@
+<h1>Basic page</h1>
diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qgraphicswkview/qgraphicswkview.pro b/Source/WebKit2/UIProcess/API/qt/tests/qgraphicswkview/qgraphicswkview.pro
new file mode 100644
index 0000000..e99c7f4
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/qt/tests/qgraphicswkview/qgraphicswkview.pro
@@ -0,0 +1 @@
+include(../tests.pri)
diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qgraphicswkview/tst_qgraphicswkview.cpp b/Source/WebKit2/UIProcess/API/qt/tests/qgraphicswkview/tst_qgraphicswkview.cpp
new file mode 100644
index 0000000..f26c69d
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/qt/tests/qgraphicswkview/tst_qgraphicswkview.cpp
@@ -0,0 +1,93 @@
+/*
+ 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 <QGraphicsScene>
+#include <QGraphicsView>
+#include <QResizeEvent>
+#include <QSignalSpy>
+#include <QtTest/QtTest>
+#include <qgraphicswkview.h>
+#include <qwkcontext.h>
+
+class View;
+
+class tst_QGraphicsWKView : public QObject {
+ Q_OBJECT
+
+private slots:
+ void init();
+ void cleanup();
+
+ void loadEmptyPage();
+
+private:
+ View* m_view;
+};
+
+class View : public QGraphicsView {
+public:
+ View();
+ QGraphicsWKView* m_webView;
+
+protected:
+ void resizeEvent(QResizeEvent*);
+};
+
+View::View()
+{
+ QGraphicsScene* const scene = new QGraphicsScene(this);
+ setScene(scene);
+
+ QWKContext* context = new QWKContext(this);
+ m_webView = new QGraphicsWKView(context);
+ scene->addItem(m_webView);
+}
+
+void View::resizeEvent(QResizeEvent* event)
+{
+ QGraphicsView::resizeEvent(event);
+ QRectF rect(QPoint(0, 0), event->size());
+ m_webView->setGeometry(rect);
+ scene()->setSceneRect(rect);
+}
+
+void tst_QGraphicsWKView::init()
+{
+ m_view = new View;
+}
+
+void tst_QGraphicsWKView::cleanup()
+{
+ delete m_view;
+ m_view = 0;
+}
+
+void tst_QGraphicsWKView::loadEmptyPage()
+{
+ m_view->show();
+
+ m_view->m_webView-> load(QUrl::fromLocalFile(TESTDIR "/html/basic_page.html"));
+ QVERIFY(waitForSignal(m_view->m_webView, SIGNAL(loadFinished(bool))));
+}
+
+QTEST_MAIN(tst_QGraphicsWKView)
+
+#include "tst_qgraphicswkview.moc"
+
diff --git a/Source/WebKit2/UIProcess/API/qt/tests/tests.pri b/Source/WebKit2/UIProcess/API/qt/tests/tests.pri
new file mode 100644
index 0000000..3a2aac1
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/qt/tests/tests.pri
@@ -0,0 +1,16 @@
+TEMPLATE = app
+CONFIG -= app_bundle
+
+VPATH += $$_PRO_FILE_PWD_
+# Add the tst_ prefix, In QTDIR_build it's done by qttest_p4.prf
+CONFIG(QTDIR_build) { load(qttest_p4) }
+ELSE { TARGET = tst_$$TARGET }
+
+SOURCES += $${TARGET}.cpp
+INCLUDEPATH += $$PWD
+
+include(../../../../../WebKit.pri)
+QT += testlib
+
+QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR
+DEFINES += TESTDIR=\\\"$$PWD\\\"
diff --git a/Source/WebKit2/UIProcess/API/qt/tests/tests.pro b/Source/WebKit2/UIProcess/API/qt/tests/tests.pro
new file mode 100644
index 0000000..eb85021
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/qt/tests/tests.pro
@@ -0,0 +1,2 @@
+TEMPLATE = subdirs
+SUBDIRS = qgraphicswkview
diff --git a/Source/WebKit2/UIProcess/API/qt/tests/util.h b/Source/WebKit2/UIProcess/API/qt/tests/util.h
new file mode 100644
index 0000000..08d23a9
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/qt/tests/util.h
@@ -0,0 +1,78 @@
+/*
+ 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.
+*/
+// Functions and macros that really need to be in QTestLib
+
+#include <QEventLoop>
+#include <QSignalSpy>
+#include <QTimer>
+
+#if !defined(TESTS_SOURCE_DIR)
+#define TESTS_SOURCE_DIR ""
+#endif
+
+/**
+ * Starts an event loop that runs until the given signal is received.
+ * Optionally the event loop
+ * can return earlier on a timeout.
+ *
+ * \return \p true if the requested signal was received
+ * \p false on timeout
+ */
+static bool waitForSignal(QObject* obj, const char* signal, int timeout = 10000)
+{
+ QEventLoop loop;
+ QObject::connect(obj, signal, &loop, SLOT(quit()));
+ QTimer timer;
+ QSignalSpy timeoutSpy(&timer, SIGNAL(timeout()));
+ if (timeout > 0) {
+ QObject::connect(&timer, SIGNAL(timeout()), &loop, SLOT(quit()));
+ timer.setSingleShot(true);
+ timer.start(timeout);
+ }
+ loop.exec();
+ return timeoutSpy.isEmpty();
+}
+
+// Will try to wait for the condition while allowing event processing
+#define QTRY_VERIFY(__expr) \
+ do { \
+ const int __step = 50; \
+ const int __timeout = 5000; \
+ if (!(__expr)) { \
+ QTest::qWait(0); \
+ } \
+ for (int __i = 0; __i < __timeout && !(__expr); __i+=__step) { \
+ QTest::qWait(__step); \
+ } \
+ QVERIFY(__expr); \
+ } while(0)
+
+// Will try to wait for the condition while allowing event processing
+#define QTRY_COMPARE(__expr, __expected) \
+ do { \
+ const int __step = 50; \
+ const int __timeout = 5000; \
+ if ((__expr) != (__expected)) { \
+ QTest::qWait(0); \
+ } \
+ for (int __i = 0; __i < __timeout && ((__expr) != (__expected)); __i+=__step) { \
+ QTest::qWait(__step); \
+ } \
+ QCOMPARE(__expr, __expected); \
+ } while(0)
diff --git a/Source/WebKit2/UIProcess/ChunkedUpdateDrawingAreaProxy.cpp b/Source/WebKit2/UIProcess/ChunkedUpdateDrawingAreaProxy.cpp
index 58cac4f..dd5f988 100644
--- a/Source/WebKit2/UIProcess/ChunkedUpdateDrawingAreaProxy.cpp
+++ b/Source/WebKit2/UIProcess/ChunkedUpdateDrawingAreaProxy.cpp
@@ -45,7 +45,7 @@ PassOwnPtr<ChunkedUpdateDrawingAreaProxy> ChunkedUpdateDrawingAreaProxy::create(
}
ChunkedUpdateDrawingAreaProxy::ChunkedUpdateDrawingAreaProxy(PlatformWebView* webView, WebPageProxy* webPageProxy)
- : DrawingAreaProxy(DrawingAreaInfo::ChunkedUpdate, webPageProxy)
+ : DrawingAreaProxy(DrawingAreaTypeChunkedUpdate, webPageProxy)
, m_isWaitingForDidSetFrameNotification(false)
, m_isVisible(true)
, m_forceRepaintWhenResumingPainting(false)
@@ -96,12 +96,12 @@ void ChunkedUpdateDrawingAreaProxy::setPageIsVisible(bool isVisible)
if (!m_isVisible) {
// Tell the web process that it doesn't need to paint anything for now.
- page->process()->deprecatedSend(DrawingAreaLegacyMessage::SuspendPainting, page->pageID(), CoreIPC::In(info().identifier));
+ page->process()->deprecatedSend(DrawingAreaLegacyMessage::SuspendPainting, page->pageID(), CoreIPC::In());
return;
}
// The page is now visible, resume painting.
- page->process()->deprecatedSend(DrawingAreaLegacyMessage::ResumePainting, page->pageID(), CoreIPC::In(info().identifier, m_forceRepaintWhenResumingPainting));
+ page->process()->deprecatedSend(DrawingAreaLegacyMessage::ResumePainting, page->pageID(), CoreIPC::In(m_forceRepaintWhenResumingPainting));
m_forceRepaintWhenResumingPainting = false;
}
@@ -120,7 +120,7 @@ void ChunkedUpdateDrawingAreaProxy::didSetSize(UpdateChunk* updateChunk)
drawUpdateChunkIntoBackingStore(updateChunk);
}
-void ChunkedUpdateDrawingAreaProxy::update(UpdateChunk* updateChunk)
+void ChunkedUpdateDrawingAreaProxy::deprecatedUpdate(UpdateChunk* updateChunk)
{
if (!m_isVisible) {
// We got an update request that must have been sent before we told the web process to suspend painting.
@@ -133,7 +133,7 @@ void ChunkedUpdateDrawingAreaProxy::update(UpdateChunk* updateChunk)
}
WebPageProxy* page = this->page();
- page->process()->deprecatedSend(DrawingAreaLegacyMessage::DidUpdate, page->pageID(), CoreIPC::In(info().identifier));
+ page->process()->deprecatedSend(DrawingAreaLegacyMessage::DidUpdate, page->pageID(), CoreIPC::In());
}
void ChunkedUpdateDrawingAreaProxy::sendSetSize()
@@ -145,7 +145,7 @@ void ChunkedUpdateDrawingAreaProxy::sendSetSize()
return;
m_isWaitingForDidSetFrameNotification = true;
- m_webPageProxy->process()->deprecatedSend(DrawingAreaLegacyMessage::SetSize, m_webPageProxy->pageID(), CoreIPC::In(info().identifier, m_size));
+ m_webPageProxy->process()->deprecatedSend(DrawingAreaLegacyMessage::SetSize, m_webPageProxy->pageID(), CoreIPC::In(m_size));
}
void ChunkedUpdateDrawingAreaProxy::didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments)
@@ -156,7 +156,7 @@ void ChunkedUpdateDrawingAreaProxy::didReceiveMessage(CoreIPC::Connection*, Core
if (!arguments->decode(updateChunk))
return;
- update(&updateChunk);
+ deprecatedUpdate(&updateChunk);
break;
}
case DrawingAreaProxyLegacyMessage::DidSetSize: {
diff --git a/Source/WebKit2/UIProcess/ChunkedUpdateDrawingAreaProxy.h b/Source/WebKit2/UIProcess/ChunkedUpdateDrawingAreaProxy.h
index 7d7a5f4..94e441f 100644
--- a/Source/WebKit2/UIProcess/ChunkedUpdateDrawingAreaProxy.h
+++ b/Source/WebKit2/UIProcess/ChunkedUpdateDrawingAreaProxy.h
@@ -30,6 +30,8 @@
#include "DrawingAreaProxy.h"
#include <WebCore/IntSize.h>
+#include <wtf/PassOwnPtr.h>
+#include <wtf/OwnPtr.h>
#if PLATFORM(MAC)
#include <wtf/RetainPtr.h>
@@ -80,15 +82,10 @@ private:
bool platformPaint(const WebCore::IntRect&, PlatformDrawingContext);
void drawUpdateChunkIntoBackingStore(UpdateChunk*);
void didSetSize(UpdateChunk*);
- void update(UpdateChunk*);
+ void deprecatedUpdate(UpdateChunk*);
void sendSetSize();
-#if USE(ACCELERATED_COMPOSITING)
- virtual void attachCompositingContext(uint32_t) { }
- virtual void detachCompositingContext() { }
-#endif
-
bool m_isWaitingForDidSetFrameNotification;
bool m_isVisible;
bool m_forceRepaintWhenResumingPainting;
diff --git a/Source/WebKit2/UIProcess/DrawingAreaProxy.cpp b/Source/WebKit2/UIProcess/DrawingAreaProxy.cpp
index 3d1f1aa..f852e2f 100644
--- a/Source/WebKit2/UIProcess/DrawingAreaProxy.cpp
+++ b/Source/WebKit2/UIProcess/DrawingAreaProxy.cpp
@@ -32,9 +32,10 @@ using namespace WebCore;
namespace WebKit {
-DrawingAreaProxy::DrawingAreaProxy(DrawingAreaInfo::Type type, WebPageProxy* webPageProxy)
- : m_info(type, nextIdentifier())
+DrawingAreaProxy::DrawingAreaProxy(DrawingAreaType type, WebPageProxy* webPageProxy)
+ : m_type(type)
, m_webPageProxy(webPageProxy)
+ , m_size(webPageProxy->viewSize())
{
}
@@ -42,12 +43,6 @@ DrawingAreaProxy::~DrawingAreaProxy()
{
}
-DrawingAreaInfo::Identifier DrawingAreaProxy::nextIdentifier()
-{
- static DrawingAreaInfo::Identifier nextID = 1;
- return ++nextID;
-}
-
void DrawingAreaProxy::setSize(const IntSize& size, const IntSize& scrollOffset)
{
if (m_size == size && scrollOffset.isZero())
diff --git a/Source/WebKit2/UIProcess/DrawingAreaProxy.h b/Source/WebKit2/UIProcess/DrawingAreaProxy.h
index f802241..4222c3b 100644
--- a/Source/WebKit2/UIProcess/DrawingAreaProxy.h
+++ b/Source/WebKit2/UIProcess/DrawingAreaProxy.h
@@ -29,6 +29,7 @@
#include "DrawingAreaInfo.h"
#include <WebCore/IntSize.h>
+#include <wtf/Noncopyable.h>
#if PLATFORM(QT)
class QPainter;
@@ -36,6 +37,16 @@ class QPainter;
typedef struct _cairo cairo_t;
#endif
+namespace CoreIPC {
+ class ArgumentDecoder;
+ class Connection;
+ class MessageID;
+}
+
+namespace WebCore {
+ class IntRect;
+}
+
namespace WebKit {
class LayerTreeContext;
@@ -56,16 +67,15 @@ class DrawingAreaProxy {
WTF_MAKE_NONCOPYABLE(DrawingAreaProxy);
public:
- static DrawingAreaInfo::Identifier nextIdentifier();
-
virtual ~DrawingAreaProxy();
+ DrawingAreaType type() const { return m_type; }
+
#if PLATFORM(MAC) || PLATFORM(WIN)
void didReceiveDrawingAreaProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
#endif
virtual void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*) = 0;
- virtual void didReceiveSyncMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*, CoreIPC::ArgumentEncoder*) { ASSERT_NOT_REACHED(); }
// Returns true if painting was successful, false otherwise.
virtual bool paint(const WebCore::IntRect&, PlatformDrawingContext) = 0;
@@ -76,21 +86,14 @@ public:
virtual void visibilityDidChange() { }
virtual void setPageIsVisible(bool isVisible) = 0;
-
-#if USE(ACCELERATED_COMPOSITING)
- virtual void attachCompositingContext(uint32_t contextID) = 0;
- virtual void detachCompositingContext() = 0;
-#endif
-
- const DrawingAreaInfo& info() const { return m_info; }
const WebCore::IntSize& size() const { return m_size; }
void setSize(const WebCore::IntSize&, const WebCore::IntSize& scrollOffset);
protected:
- explicit DrawingAreaProxy(DrawingAreaInfo::Type, WebPageProxy*);
+ explicit DrawingAreaProxy(DrawingAreaType, WebPageProxy*);
- DrawingAreaInfo m_info;
+ DrawingAreaType m_type;
WebPageProxy* m_webPageProxy;
WebCore::IntSize m_size;
@@ -99,11 +102,11 @@ protected:
private:
// CoreIPC message handlers.
// FIXME: These should be pure virtual.
- virtual void update(uint64_t sequenceNumber, const UpdateInfo&) { }
- virtual void didSetSize(uint64_t sequenceNumber, const UpdateInfo&, const LayerTreeContext&) { }
+ virtual void update(uint64_t backingStoreStateID, const UpdateInfo&) { }
+ virtual void didUpdateBackingStoreState(uint64_t backingStoreStateID, const UpdateInfo&, const LayerTreeContext&) { }
#if USE(ACCELERATED_COMPOSITING)
- virtual void enterAcceleratedCompositingMode(uint64_t sequenceNumber, const LayerTreeContext&) { }
- virtual void exitAcceleratedCompositingMode(uint64_t sequenceNumber, const UpdateInfo&) { }
+ virtual void enterAcceleratedCompositingMode(uint64_t backingStoreStateID, const LayerTreeContext&) { }
+ virtual void exitAcceleratedCompositingMode(uint64_t backingStoreStateID, const UpdateInfo&) { }
#endif
};
diff --git a/Source/WebKit2/UIProcess/DrawingAreaProxy.messages.in b/Source/WebKit2/UIProcess/DrawingAreaProxy.messages.in
index a2b5e26..217feaf 100644
--- a/Source/WebKit2/UIProcess/DrawingAreaProxy.messages.in
+++ b/Source/WebKit2/UIProcess/DrawingAreaProxy.messages.in
@@ -21,11 +21,11 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
messages -> DrawingAreaProxy {
- Update(uint64_t sequenceNumber, WebKit::UpdateInfo updateInfo)
- DidSetSize(uint64_t sequenceNumber, WebKit::UpdateInfo updateInfo, WebKit::LayerTreeContext context)
+ Update(uint64_t stateID, WebKit::UpdateInfo updateInfo)
+ DidUpdateBackingStoreState(uint64_t backingStoreStateID, WebKit::UpdateInfo updateInfo, WebKit::LayerTreeContext context)
#if USE(ACCELERATED_COMPOSITING)
- EnterAcceleratedCompositingMode(uint64_t sequenceNumber, WebKit::LayerTreeContext context)
- ExitAcceleratedCompositingMode(uint64_t sequenceNumber, WebKit::UpdateInfo updateInfo)
+ EnterAcceleratedCompositingMode(uint64_t backingStoreStateID, WebKit::LayerTreeContext context)
+ ExitAcceleratedCompositingMode(uint64_t backingStoreStateID, WebKit::UpdateInfo updateInfo)
#endif
}
diff --git a/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.cpp b/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.cpp
index 6a65841..4cf4d2e 100644
--- a/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.cpp
+++ b/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.cpp
@@ -48,9 +48,11 @@ PassOwnPtr<DrawingAreaProxyImpl> DrawingAreaProxyImpl::create(WebPageProxy* webP
}
DrawingAreaProxyImpl::DrawingAreaProxyImpl(WebPageProxy* webPageProxy)
- : DrawingAreaProxy(DrawingAreaInfo::Impl, webPageProxy)
- , m_isWaitingForDidSetSize(false)
- , m_lastDidSetSizeSequenceNumber(0)
+ : DrawingAreaProxy(DrawingAreaTypeImpl, webPageProxy)
+ , m_currentBackingStoreStateID(0)
+ , m_nextBackingStoreStateID(0)
+ , m_isWaitingForDidUpdateBackingStoreState(false)
+ , m_discardBackingStoreTimer(RunLoop::current(), this, &DrawingAreaProxyImpl::discardBackingStore)
{
}
@@ -65,23 +67,39 @@ void DrawingAreaProxyImpl::paint(BackingStore::PlatformGraphicsContext context,
{
unpaintedRegion = rect;
- if (!m_backingStore)
+ if (isInAcceleratedCompositingMode())
return;
- ASSERT(!isInAcceleratedCompositingMode());
+ ASSERT(m_currentBackingStoreStateID <= m_nextBackingStoreStateID);
+ if (m_currentBackingStoreStateID < m_nextBackingStoreStateID) {
+ // Tell the web process to do a full backing store update now, in case we previously told
+ // it about our next state but didn't request an immediate update.
+ sendUpdateBackingStoreState(RespondImmediately);
- if (m_isWaitingForDidSetSize) {
- // Wait for a DidSetSize message that contains the new bits before we paint
- // what's currently in the backing store.
- waitForAndDispatchDidSetSize();
+ if (m_isWaitingForDidUpdateBackingStoreState) {
+ // Wait for a DidUpdateBackingStoreState message that contains the new bits before we paint
+ // what's currently in the backing store.
+ waitForAndDispatchDidUpdateBackingStoreState();
+ }
- // Dispatching DidSetSize could destroy our backing store or change the compositing mode.
+ // Dispatching DidUpdateBackingStoreState (either beneath sendUpdateBackingStoreState or
+ // beneath waitForAndDispatchDidUpdateBackingStoreState) could destroy our backing store or
+ // change the compositing mode.
if (!m_backingStore || isInAcceleratedCompositingMode())
return;
+ } else {
+ ASSERT(!m_isWaitingForDidUpdateBackingStoreState);
+ if (!m_backingStore) {
+ // The view has asked us to paint before the web process has painted anything. There's
+ // nothing we can do.
+ return;
+ }
}
m_backingStore->paint(context, rect);
unpaintedRegion.subtract(IntRect(IntPoint(), m_backingStore->size()));
+
+ discardBackingStoreSoon();
}
void DrawingAreaProxyImpl::didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*)
@@ -102,7 +120,7 @@ bool DrawingAreaProxyImpl::paint(const WebCore::IntRect&, PlatformDrawingContext
void DrawingAreaProxyImpl::sizeDidChange()
{
- sendSetSize();
+ backingStoreStateDidChange(RespondImmediately);
}
void DrawingAreaProxyImpl::visibilityDidChange()
@@ -121,19 +139,10 @@ void DrawingAreaProxyImpl::setPageIsVisible(bool)
{
}
-void DrawingAreaProxyImpl::attachCompositingContext(uint32_t contextID)
-{
- ASSERT_NOT_REACHED();
-}
-
-void DrawingAreaProxyImpl::detachCompositingContext()
-{
- ASSERT_NOT_REACHED();
-}
-
-void DrawingAreaProxyImpl::update(uint64_t sequenceNumber, const UpdateInfo& updateInfo)
+void DrawingAreaProxyImpl::update(uint64_t backingStoreStateID, const UpdateInfo& updateInfo)
{
- if (sequenceNumber < m_lastDidSetSizeSequenceNumber)
+ ASSERT_ARG(backingStoreStateID, backingStoreStateID <= m_currentBackingStoreStateID);
+ if (backingStoreStateID < m_currentBackingStoreStateID)
return;
// FIXME: Handle the case where the view is hidden.
@@ -142,16 +151,16 @@ void DrawingAreaProxyImpl::update(uint64_t sequenceNumber, const UpdateInfo& upd
m_webPageProxy->process()->send(Messages::DrawingArea::DidUpdate(), m_webPageProxy->pageID());
}
-void DrawingAreaProxyImpl::didSetSize(uint64_t sequenceNumber, const UpdateInfo& updateInfo, const LayerTreeContext& layerTreeContext)
+void DrawingAreaProxyImpl::didUpdateBackingStoreState(uint64_t backingStoreStateID, const UpdateInfo& updateInfo, const LayerTreeContext& layerTreeContext)
{
- ASSERT(sequenceNumber > m_lastDidSetSizeSequenceNumber);
- m_lastDidSetSizeSequenceNumber = sequenceNumber;
+ ASSERT_ARG(backingStoreStateID, backingStoreStateID <= m_nextBackingStoreStateID);
+ ASSERT_ARG(backingStoreStateID, backingStoreStateID > m_currentBackingStoreStateID);
+ m_currentBackingStoreStateID = backingStoreStateID;
- ASSERT(m_isWaitingForDidSetSize);
- m_isWaitingForDidSetSize = false;
+ m_isWaitingForDidUpdateBackingStoreState = false;
- if (m_size != updateInfo.viewSize)
- sendSetSize();
+ if (m_nextBackingStoreStateID != m_currentBackingStoreStateID)
+ sendUpdateBackingStoreState(RespondImmediately);
if (layerTreeContext != m_layerTreeContext) {
if (!m_layerTreeContext.isEmpty()) {
@@ -170,21 +179,25 @@ void DrawingAreaProxyImpl::didSetSize(uint64_t sequenceNumber, const UpdateInfo&
return;
}
+ // FIXME: We could just reuse our existing backing store if it's the same size as
+ // updateInfo.viewSize.
m_backingStore = nullptr;
incorporateUpdate(updateInfo);
}
-void DrawingAreaProxyImpl::enterAcceleratedCompositingMode(uint64_t sequenceNumber, const LayerTreeContext& layerTreeContext)
+void DrawingAreaProxyImpl::enterAcceleratedCompositingMode(uint64_t backingStoreStateID, const LayerTreeContext& layerTreeContext)
{
- if (sequenceNumber < m_lastDidSetSizeSequenceNumber)
+ ASSERT_ARG(backingStoreStateID, backingStoreStateID <= m_currentBackingStoreStateID);
+ if (backingStoreStateID < m_currentBackingStoreStateID)
return;
enterAcceleratedCompositingMode(layerTreeContext);
}
-void DrawingAreaProxyImpl::exitAcceleratedCompositingMode(uint64_t sequenceNumber, const UpdateInfo& updateInfo)
+void DrawingAreaProxyImpl::exitAcceleratedCompositingMode(uint64_t backingStoreStateID, const UpdateInfo& updateInfo)
{
- if (sequenceNumber < m_lastDidSetSizeSequenceNumber)
+ ASSERT_ARG(backingStoreStateID, backingStoreStateID <= m_currentBackingStoreStateID);
+ if (backingStoreStateID < m_currentBackingStoreStateID)
return;
exitAcceleratedCompositingMode();
@@ -208,45 +221,61 @@ void DrawingAreaProxyImpl::incorporateUpdate(const UpdateInfo& updateInfo)
if (shouldScroll)
m_webPageProxy->scrollView(updateInfo.scrollRect, updateInfo.scrollOffset);
-
+
for (size_t i = 0; i < updateInfo.updateRects.size(); ++i)
m_webPageProxy->setViewNeedsDisplay(updateInfo.updateRects[i]);
+ if (WebPageProxy::debugPaintFlags() & kWKDebugFlashBackingStoreUpdates)
+ m_webPageProxy->flashBackingStoreUpdates(updateInfo.updateRects);
+
if (shouldScroll)
m_webPageProxy->displayView();
}
-void DrawingAreaProxyImpl::sendSetSize()
+void DrawingAreaProxyImpl::backingStoreStateDidChange(RespondImmediatelyOrNot respondImmediatelyOrNot)
+{
+ ++m_nextBackingStoreStateID;
+ sendUpdateBackingStoreState(respondImmediatelyOrNot);
+}
+
+void DrawingAreaProxyImpl::sendUpdateBackingStoreState(RespondImmediatelyOrNot respondImmediatelyOrNot)
{
+ ASSERT(m_currentBackingStoreStateID < m_nextBackingStoreStateID);
+
if (!m_webPageProxy->isValid())
return;
- if (m_isWaitingForDidSetSize)
+ if (m_isWaitingForDidUpdateBackingStoreState)
return;
- m_isWaitingForDidSetSize = true;
- m_webPageProxy->process()->send(Messages::DrawingArea::SetSize(m_size, m_scrollOffset), m_webPageProxy->pageID());
+ m_isWaitingForDidUpdateBackingStoreState = respondImmediatelyOrNot == RespondImmediately;
+ m_webPageProxy->process()->send(Messages::DrawingArea::UpdateBackingStoreState(m_nextBackingStoreStateID, respondImmediatelyOrNot == RespondImmediately, m_size, m_scrollOffset), m_webPageProxy->pageID());
m_scrollOffset = IntSize();
- if (!m_layerTreeContext.isEmpty()) {
- // Wait for the DidSetSize message. Normally we don this in DrawingAreaProxyImpl::paint, but that
+ if (m_isWaitingForDidUpdateBackingStoreState && !m_layerTreeContext.isEmpty()) {
+ // Wait for the DidUpdateBackingStoreState message. Normally we don this in DrawingAreaProxyImpl::paint, but that
// function is never called when in accelerated compositing mode.
- waitForAndDispatchDidSetSize();
+ waitForAndDispatchDidUpdateBackingStoreState();
}
}
-void DrawingAreaProxyImpl::waitForAndDispatchDidSetSize()
+void DrawingAreaProxyImpl::waitForAndDispatchDidUpdateBackingStoreState()
{
- ASSERT(m_isWaitingForDidSetSize);
+ ASSERT(m_isWaitingForDidUpdateBackingStoreState);
if (!m_webPageProxy->isValid())
return;
if (m_webPageProxy->process()->isLaunching())
return;
- // The timeout, in seconds, we use when waiting for a DidSetSize message when we're asked to paint.
- static const double didSetSizeTimeout = 0.5;
- m_webPageProxy->process()->connection()->waitForAndDispatchImmediately<Messages::DrawingAreaProxy::DidSetSize>(m_webPageProxy->pageID(), didSetSizeTimeout);
+ // FIXME: waitForAndDispatchImmediately will always return the oldest DidUpdateBackingStoreState message that
+ // hasn't yet been processed. But it might be better to skip ahead to some other DidUpdateBackingStoreState
+ // message, if multiple DidUpdateBackingStoreState messages are waiting to be processed. For instance, we could
+ // choose the most recent one, or the one that is closest to our current size.
+
+ // The timeout, in seconds, we use when waiting for a DidUpdateBackingStoreState message when we're asked to paint.
+ static const double didUpdateBackingStoreStateTimeout = 0.5;
+ m_webPageProxy->process()->connection()->waitForAndDispatchImmediately<Messages::DrawingAreaProxy::DidUpdateBackingStoreState>(m_webPageProxy->pageID(), didUpdateBackingStoreStateTimeout);
}
void DrawingAreaProxyImpl::enterAcceleratedCompositingMode(const LayerTreeContext& layerTreeContext)
@@ -266,4 +295,19 @@ void DrawingAreaProxyImpl::exitAcceleratedCompositingMode()
m_webPageProxy->exitAcceleratedCompositingMode();
}
+void DrawingAreaProxyImpl::discardBackingStoreSoon()
+{
+ // We'll wait this many seconds after the last paint before throwing away our backing store to save memory.
+ // FIXME: It would be smarter to make this delay based on how expensive painting is. See <http://webkit.org/b/55733>.
+ static const double discardBackingStoreDelay = 5;
+
+ m_discardBackingStoreTimer.startOneShot(discardBackingStoreDelay);
+}
+
+void DrawingAreaProxyImpl::discardBackingStore()
+{
+ m_backingStore = nullptr;
+ backingStoreStateDidChange(DoNotRespondImmediately);
+}
+
} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.h b/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.h
index f776b09..17c7512 100644
--- a/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.h
+++ b/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.h
@@ -29,6 +29,9 @@
#include "BackingStore.h"
#include "DrawingAreaProxy.h"
#include "LayerTreeContext.h"
+#include "RunLoop.h"
+#include <wtf/OwnPtr.h>
+#include <wtf/PassOwnPtr.h>
namespace WebKit {
@@ -51,35 +54,47 @@ private:
virtual void sizeDidChange();
virtual void visibilityDidChange();
virtual void setPageIsVisible(bool);
- virtual void attachCompositingContext(uint32_t contextID);
- virtual void detachCompositingContext();
// CoreIPC message handlers
- virtual void update(uint64_t sequenceNumber, const UpdateInfo&);
- virtual void didSetSize(uint64_t sequenceNumber, const UpdateInfo&, const LayerTreeContext&);
- virtual void enterAcceleratedCompositingMode(uint64_t sequenceNumber, const LayerTreeContext&);
- virtual void exitAcceleratedCompositingMode(uint64_t sequenceNumber, const UpdateInfo&);
+ virtual void update(uint64_t backingStoreStateID, const UpdateInfo&);
+ virtual void didUpdateBackingStoreState(uint64_t backingStoreStateID, const UpdateInfo&, const LayerTreeContext&);
+ virtual void enterAcceleratedCompositingMode(uint64_t backingStoreStateID, const LayerTreeContext&);
+ virtual void exitAcceleratedCompositingMode(uint64_t backingStoreStateID, const UpdateInfo&);
void incorporateUpdate(const UpdateInfo&);
- void sendSetSize();
- void waitForAndDispatchDidSetSize();
+
+ enum RespondImmediatelyOrNot { DoNotRespondImmediately, RespondImmediately };
+ void backingStoreStateDidChange(RespondImmediatelyOrNot);
+ void sendUpdateBackingStoreState(RespondImmediatelyOrNot);
+ void waitForAndDispatchDidUpdateBackingStoreState();
void enterAcceleratedCompositingMode(const LayerTreeContext&);
void exitAcceleratedCompositingMode();
bool isInAcceleratedCompositingMode() const { return !m_layerTreeContext.isEmpty(); }
+ void discardBackingStoreSoon();
+ void discardBackingStore();
+
+ // The state ID corresponding to our current backing store. Updated whenever we allocate
+ // a new backing store. Any messages received that correspond to an earlier state are ignored,
+ // as they don't apply to our current backing store.
+ uint64_t m_currentBackingStoreStateID;
+
+ // The next backing store state ID we will request the web process update to. Incremented
+ // whenever our state changes in a way that will require a new backing store to be allocated.
+ uint64_t m_nextBackingStoreStateID;
+
// The current layer tree context.
LayerTreeContext m_layerTreeContext;
- // Whether we've sent a SetSize message and are now waiting for a DidSetSize message.
- // Used to throttle SetSize messages so we don't send them faster than the Web process can handle.
- bool m_isWaitingForDidSetSize;
-
- // The sequence number of the last DidSetSize message
- uint64_t m_lastDidSetSizeSequenceNumber;
+ // Whether we've sent a UpdateBackingStoreState message and are now waiting for a DidUpdateBackingStoreState message.
+ // Used to throttle UpdateBackingStoreState messages so we don't send them faster than the Web process can handle.
+ bool m_isWaitingForDidUpdateBackingStoreState;
OwnPtr<BackingStore> m_backingStore;
+
+ RunLoop::Timer<DrawingAreaProxyImpl> m_discardBackingStoreTimer;
};
} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/GenericCallback.h b/Source/WebKit2/UIProcess/GenericCallback.h
index c34414a..b0d7b9b 100644
--- a/Source/WebKit2/UIProcess/GenericCallback.h
+++ b/Source/WebKit2/UIProcess/GenericCallback.h
@@ -35,7 +35,35 @@
namespace WebKit {
-class VoidCallback : public RefCounted<VoidCallback> {
+class CallbackBase : public RefCounted<CallbackBase> {
+public:
+ virtual ~CallbackBase()
+ {
+ }
+
+ uint64_t callbackID() const { return m_callbackID; }
+
+protected:
+ CallbackBase(void* context)
+ : m_context(context)
+ , m_callbackID(generateCallbackID())
+ {
+ }
+
+ void* context() const { return m_context; }
+
+private:
+ static uint64_t generateCallbackID()
+ {
+ static uint64_t uniqueCallbackID = 1;
+ return uniqueCallbackID++;
+ }
+
+ void* m_context;
+ uint64_t m_callbackID;
+};
+
+class VoidCallback : public CallbackBase {
public:
typedef void (*CallbackFunction)(WKErrorRef, void*);
@@ -44,7 +72,7 @@ public:
return adoptRef(new VoidCallback(context, callback));
}
- VoidCallback()
+ virtual ~VoidCallback()
{
ASSERT(!m_callback);
}
@@ -53,7 +81,7 @@ public:
{
ASSERT(m_callback);
- m_callback(0, m_context);
+ m_callback(0, context());
m_callback = 0;
}
@@ -63,52 +91,41 @@ public:
ASSERT(m_callback);
RefPtr<WebError> error = WebError::create();
- m_callback(toAPI(error.get()), m_context);
+ m_callback(toAPI(error.get()), context());
m_callback = 0;
}
- uint64_t callbackID() const { return m_callbackID; }
-
private:
- static uint64_t generateCallbackID()
- {
- static uint64_t uniqueCallbackID = 1;
- return uniqueCallbackID++;
- }
-
VoidCallback(void* context, CallbackFunction callback)
- : m_context(context)
+ : CallbackBase(context)
, m_callback(callback)
- , m_callbackID(generateCallbackID())
{
}
- void* m_context;
CallbackFunction m_callback;
- uint64_t m_callbackID;
};
-// FIXME: Make a version of GenericCallback with two arguments, and define ComputedPagesCallback as a specialization.
-class ComputedPagesCallback : public RefCounted<ComputedPagesCallback> {
+template<typename APIReturnValueType, typename InternalReturnValueType = typename APITypeInfo<APIReturnValueType>::ImplType>
+class GenericCallback : public CallbackBase {
public:
- typedef void (*CallbackFunction)(const Vector<WebCore::IntRect>&, double, WKErrorRef, void*);
+ typedef void (*CallbackFunction)(APIReturnValueType, WKErrorRef, void*);
- static PassRefPtr<ComputedPagesCallback> create(void* context, CallbackFunction callback)
+ static PassRefPtr<GenericCallback> create(void* context, CallbackFunction callback)
{
- return adoptRef(new ComputedPagesCallback(context, callback));
+ return adoptRef(new GenericCallback(context, callback));
}
- ~ComputedPagesCallback()
+ virtual ~GenericCallback()
{
ASSERT(!m_callback);
}
- void performCallbackWithReturnValue(const Vector<WebCore::IntRect>& returnValue1, double returnValue2)
+ void performCallbackWithReturnValue(InternalReturnValueType returnValue)
{
ASSERT(m_callback);
- m_callback(returnValue1, returnValue2, 0, m_context);
+ m_callback(toAPI(returnValue), 0, context());
m_callback = 0;
}
@@ -118,52 +135,41 @@ public:
ASSERT(m_callback);
RefPtr<WebError> error = WebError::create();
- m_callback(Vector<WebCore::IntRect>(), 0, toAPI(error.get()), m_context);
+ m_callback(0, toAPI(error.get()), context());
m_callback = 0;
}
- uint64_t callbackID() const { return m_callbackID; }
-
private:
- static uint64_t generateCallbackID()
- {
- static uint64_t uniqueCallbackID = 1;
- return uniqueCallbackID++;
- }
-
- ComputedPagesCallback(void* context, CallbackFunction callback)
- : m_context(context)
+ GenericCallback(void* context, CallbackFunction callback)
+ : CallbackBase(context)
, m_callback(callback)
- , m_callbackID(generateCallbackID())
{
}
- void* m_context;
CallbackFunction m_callback;
- uint64_t m_callbackID;
};
-template<typename APIReturnValueType, typename InternalReturnValueType = typename APITypeInfo<APIReturnValueType>::ImplType>
-class GenericCallback : public RefCounted<GenericCallback<APIReturnValueType, InternalReturnValueType> > {
+// FIXME: Make a version of CallbackBase with two arguments, and define ComputedPagesCallback as a specialization.
+class ComputedPagesCallback : public CallbackBase {
public:
- typedef void (*CallbackFunction)(APIReturnValueType, WKErrorRef, void*);
+ typedef void (*CallbackFunction)(const Vector<WebCore::IntRect>&, double, WKErrorRef, void*);
- static PassRefPtr<GenericCallback> create(void* context, CallbackFunction callback)
+ static PassRefPtr<ComputedPagesCallback> create(void* context, CallbackFunction callback)
{
- return adoptRef(new GenericCallback(context, callback));
+ return adoptRef(new ComputedPagesCallback(context, callback));
}
- ~GenericCallback()
+ virtual ~ComputedPagesCallback()
{
ASSERT(!m_callback);
}
- void performCallbackWithReturnValue(InternalReturnValueType returnValue)
+ void performCallbackWithReturnValue(const Vector<WebCore::IntRect>& returnValue1, double returnValue2)
{
ASSERT(m_callback);
- m_callback(toAPI(returnValue), 0, m_context);
+ m_callback(returnValue1, returnValue2, 0, context());
m_callback = 0;
}
@@ -173,30 +179,20 @@ public:
ASSERT(m_callback);
RefPtr<WebError> error = WebError::create();
- m_callback(0, toAPI(error.get()), m_context);
+ m_callback(Vector<WebCore::IntRect>(), 0, toAPI(error.get()), context());
m_callback = 0;
}
- uint64_t callbackID() const { return m_callbackID; }
-
private:
- static uint64_t generateCallbackID()
- {
- static uint64_t uniqueCallbackID = 1;
- return uniqueCallbackID++;
- }
- GenericCallback(void* context, CallbackFunction callback)
- : m_context(context)
+ ComputedPagesCallback(void* context, CallbackFunction callback)
+ : CallbackBase(context)
, m_callback(callback)
- , m_callbackID(generateCallbackID())
{
}
- void* m_context;
CallbackFunction m_callback;
- uint64_t m_callbackID;
};
template<typename T>
diff --git a/Source/WebKit2/UIProcess/Launcher/gtk/ThreadLauncherGtk.cpp b/Source/WebKit2/UIProcess/Launcher/gtk/ThreadLauncherGtk.cpp
index b5fda40..84f72b5 100644
--- a/Source/WebKit2/UIProcess/Launcher/gtk/ThreadLauncherGtk.cpp
+++ b/Source/WebKit2/UIProcess/Launcher/gtk/ThreadLauncherGtk.cpp
@@ -27,7 +27,7 @@
#include "config.h"
#include "ThreadLauncher.h"
-#include "NotImplemented.h"
+#include <WebCore/NotImplemented.h>
namespace WebKit {
diff --git a/Source/WebKit2/UIProcess/Launcher/mac/ProcessLauncherMac.mm b/Source/WebKit2/UIProcess/Launcher/mac/ProcessLauncherMac.mm
index 92f5ad3..af758d9 100644
--- a/Source/WebKit2/UIProcess/Launcher/mac/ProcessLauncherMac.mm
+++ b/Source/WebKit2/UIProcess/Launcher/mac/ProcessLauncherMac.mm
@@ -77,7 +77,9 @@ public:
~EnvironmentVariables()
{
- deleteAllValues(m_allocatedStrings);
+ size_t size = m_allocatedStrings.size();
+ for (size_t i = 0; i < size; ++i)
+ fastFree(m_allocatedStrings[i]);
}
void set(const char* name, const char* value)
@@ -87,30 +89,28 @@ public:
copyEnvironmentVariables();
// Allocate a string for the name and value.
- char* nameAndValue = createStringForVariable(name, value);
+ const char* nameAndValue = createStringForVariable(name, value);
for (size_t i = 0; i < m_environmentVariables.size() - 1; ++i) {
- char* environmentVariable = m_environmentVariables[i];
-
- if (valueIfVariableHasName(environmentVariable, name)) {
+ if (valueIfVariableHasName(m_environmentVariables[i], name)) {
// Just replace the environment variable.
- m_environmentVariables[i] = nameAndValue;
+ m_environmentVariables[i] = const_cast<char*>(nameAndValue);
return;
}
}
// Append the new string.
ASSERT(!m_environmentVariables.last());
- m_environmentVariables.last() = nameAndValue;
+ m_environmentVariables.last() = const_cast<char*>(nameAndValue);
m_environmentVariables.append(static_cast<char*>(0));
m_environmentPointer = m_environmentVariables.data();
}
- char* get(const char* name) const
+ const char* get(const char* name) const
{
for (size_t i = 0; m_environmentPointer[i]; ++i) {
- if (char* value = valueIfVariableHasName(m_environmentPointer[i], name))
+ if (const char* value = valueIfVariableHasName(m_environmentPointer[i], name))
return value;
}
return 0;
@@ -119,7 +119,7 @@ public:
// Will append the value with the given separator if the environment variable already exists.
void appendValue(const char* name, const char* value, char separator)
{
- char* existingValue = get(name);
+ const char* existingValue = get(name);
if (!existingValue) {
set(name, value);
return;
@@ -136,20 +136,22 @@ public:
char** environmentPointer() const { return m_environmentPointer; }
private:
- char *valueIfVariableHasName(const char* environmentVariable, const char* name) const
+ const char* valueIfVariableHasName(const char* environmentVariable, const char* name) const
{
// Find the environment variable name.
- char* equalsLocation = strchr(environmentVariable, '=');
+ const char* equalsLocation = strchr(environmentVariable, '=');
ASSERT(equalsLocation);
size_t nameLength = equalsLocation - environmentVariable;
- if (strncmp(environmentVariable, name, nameLength))
+ if (strlen(name) != nameLength)
+ return 0;
+ if (memcmp(environmentVariable, name, nameLength))
return 0;
return equalsLocation + 1;
}
- char* createStringForVariable(const char* name, const char* value)
+ const char* createStringForVariable(const char* name, const char* value)
{
int nameLength = strlen(name);
int valueLength = strlen(value);
@@ -173,6 +175,9 @@ private:
// Null-terminate the array.
m_environmentVariables.append(static_cast<char*>(0));
+
+ // Update the environment pointer.
+ m_environmentPointer = m_environmentVariables.data();
}
char** m_environmentPointer;
@@ -192,16 +197,19 @@ void ProcessLauncher::launchProcess()
mach_port_insert_right(mach_task_self(), listeningPort, listeningPort, MACH_MSG_TYPE_MAKE_SEND);
NSBundle *webKit2Bundle = [NSBundle bundleWithIdentifier:@"com.apple.WebKit2"];
- const char* bundlePath = [[webKit2Bundle executablePath] fileSystemRepresentation];
+ NSString *frameworksPath = [[webKit2Bundle bundlePath] stringByDeletingLastPathComponent];
+ const char* frameworkExecutablePath = [[webKit2Bundle executablePath] fileSystemRepresentation];
NSString *webProcessAppPath = [webKit2Bundle pathForAuxiliaryExecutable:@"WebProcess.app"];
NSString *webProcessAppExecutablePath = [[NSBundle bundleWithPath:webProcessAppPath] executablePath];
+ RetainPtr<CFStringRef> cfLocalization(AdoptCF, WKCopyCFLocalizationPreferredName(NULL));
+ CString localization = String(cfLocalization.get()).utf8();
+
// Make a unique, per pid, per process launcher web process service name.
CString serviceName = String::format("com.apple.WebKit.WebProcess-%d-%p", getpid(), this).utf8();
- const char* path = [webProcessAppExecutablePath fileSystemRepresentation];
- const char* args[] = { path, bundlePath, "-type", processTypeAsString(m_launchOptions.processType), "-servicename", serviceName.data(), 0 };
+ const char* args[] = { [webProcessAppExecutablePath fileSystemRepresentation], frameworkExecutablePath, "-type", processTypeAsString(m_launchOptions.processType), "-servicename", serviceName.data(), "-localization", localization.data(), 0 };
// Register ourselves.
kern_return_t kr = bootstrap_register2(bootstrap_port, const_cast<char*>(serviceName.data()), listeningPort, 0);
@@ -243,10 +251,16 @@ void ProcessLauncher::launchProcess()
EnvironmentVariables environmentVariables;
+ // To make engineering builds work, if the path is outside of /System set up
+ // DYLD_FRAMEWORK_PATH to pick up other frameworks, but don't do it for the
+ // production configuration because it involves extra file system access.
+ if (![frameworksPath hasPrefix:@"/System/"])
+ environmentVariables.appendValue("DYLD_FRAMEWORK_PATH", [frameworksPath fileSystemRepresentation], ':');
+
if (m_launchOptions.processType == ProcessLauncher::PluginProcess) {
// We need to insert the plug-in process shim.
NSString *pluginProcessShimPathNSString = [[webProcessAppExecutablePath stringByDeletingLastPathComponent] stringByAppendingPathComponent:@"PluginProcessShim.dylib"];
- const char *pluginProcessShimPath = [pluginProcessShimPathNSString fileSystemRepresentation];
+ const char* pluginProcessShimPath = [pluginProcessShimPathNSString fileSystemRepresentation];
// Make sure that the file exists.
struct stat statBuf;
@@ -254,7 +268,7 @@ void ProcessLauncher::launchProcess()
environmentVariables.appendValue("DYLD_INSERT_LIBRARIES", pluginProcessShimPath, ':');
}
- int result = posix_spawn(&processIdentifier, path, 0, &attr, (char *const*)args, environmentVariables.environmentPointer());
+ int result = posix_spawn(&processIdentifier, args[0], 0, &attr, const_cast<char**>(args), environmentVariables.environmentPointer());
posix_spawnattr_destroy(&attr);
diff --git a/Source/WebKit2/UIProcess/Launcher/qt/ProcessLauncherQt.cpp b/Source/WebKit2/UIProcess/Launcher/qt/ProcessLauncherQt.cpp
index 85c3651..1e7e14a 100644
--- a/Source/WebKit2/UIProcess/Launcher/qt/ProcessLauncherQt.cpp
+++ b/Source/WebKit2/UIProcess/Launcher/qt/ProcessLauncherQt.cpp
@@ -28,7 +28,6 @@
#include "ProcessLauncher.h"
#include "Connection.h"
-#include "NotImplemented.h"
#include "RunLoop.h"
#include "WebProcess.h"
#include <QApplication>
@@ -39,6 +38,7 @@
#include <QProcess>
#include <QString>
#include <QtCore/qglobal.h>
+#include <WebCore/NotImplemented.h>
#include <errno.h>
#include <fcntl.h>
#include <runtime/InitializeThreading.h>
diff --git a/Source/WebKit2/UIProcess/LayerBackedDrawingAreaProxy.cpp b/Source/WebKit2/UIProcess/LayerBackedDrawingAreaProxy.cpp
deleted file mode 100644
index fbbff43..0000000
--- a/Source/WebKit2/UIProcess/LayerBackedDrawingAreaProxy.cpp
+++ /dev/null
@@ -1,168 +0,0 @@
-/*
- * Copyright (C) 2010 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "LayerBackedDrawingAreaProxy.h"
-
-#if USE(ACCELERATED_COMPOSITING)
-
-#include "DrawingAreaMessageKinds.h"
-#include "DrawingAreaProxyMessageKinds.h"
-#include "MessageID.h"
-#include "WebCoreArgumentCoders.h"
-#include "WebPageProxy.h"
-#include "WebProcessProxy.h"
-
-using namespace WebCore;
-
-namespace WebKit {
-
-PassOwnPtr<LayerBackedDrawingAreaProxy> LayerBackedDrawingAreaProxy::create(PlatformWebView* webView, WebPageProxy* webPageProxy)
-{
- return adoptPtr(new LayerBackedDrawingAreaProxy(webView, webPageProxy));
-}
-
-LayerBackedDrawingAreaProxy::LayerBackedDrawingAreaProxy(PlatformWebView* webView, WebPageProxy* webPageProxy)
- : DrawingAreaProxy(DrawingAreaInfo::LayerBacked, webPageProxy)
- , m_isWaitingForDidSetFrameNotification(false)
- , m_isVisible(true)
- , m_webView(webView)
-{
-}
-
-LayerBackedDrawingAreaProxy::~LayerBackedDrawingAreaProxy()
-{
-}
-
-#if !PLATFORM(WIN) && !PLATFORM(MAC)
-bool LayerBackedDrawingAreaProxy::paint(const IntRect& rect, PlatformDrawingContext context)
-{
- return true;
-}
-#endif
-
-void LayerBackedDrawingAreaProxy::sizeDidChange()
-{
- WebPageProxy* page = this->page();
- if (!page->isValid())
- return;
-
- if (m_size.isEmpty())
- return;
-
- m_lastSetViewSize = m_size;
-
- platformSetSize();
-
- if (m_isWaitingForDidSetFrameNotification)
- return;
-
- m_isWaitingForDidSetFrameNotification = true;
-
- page->process()->deprecatedSend(DrawingAreaLegacyMessage::SetSize, page->pageID(), CoreIPC::In(info().identifier, m_size));
-}
-
-#if !PLATFORM(MAC) && !PLATFORM(WIN)
-void LayerBackedDrawingAreaProxy::platformSetSize()
-{
-}
-#endif
-
-void LayerBackedDrawingAreaProxy::setPageIsVisible(bool isVisible)
-{
- WebPageProxy* page = this->page();
-
- if (isVisible == m_isVisible)
- return;
-
- m_isVisible = isVisible;
- if (!page->isValid())
- return;
-
- if (!m_isVisible) {
- // Tell the web process that it doesn't need to paint anything for now.
- page->process()->deprecatedSend(DrawingAreaLegacyMessage::SuspendPainting, page->pageID(), CoreIPC::In(info().identifier));
- return;
- }
-
- // The page is now visible.
- page->process()->deprecatedSend(DrawingAreaLegacyMessage::ResumePainting, page->pageID(), CoreIPC::In(info().identifier));
-
- // FIXME: We should request a full repaint here if needed.
-}
-
-void LayerBackedDrawingAreaProxy::didSetSize(const IntSize& size)
-{
- m_isWaitingForDidSetFrameNotification = false;
-
- if (size != m_lastSetViewSize)
- setSize(m_lastSetViewSize, IntSize());
-}
-
-void LayerBackedDrawingAreaProxy::update()
-{
- WebPageProxy* page = this->page();
- page->process()->deprecatedSend(DrawingAreaLegacyMessage::DidUpdate, page->pageID(), CoreIPC::In(info().identifier));
-}
-
-void LayerBackedDrawingAreaProxy::didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments)
-{
- switch (messageID.get<DrawingAreaProxyLegacyMessage::Kind>()) {
- case DrawingAreaProxyLegacyMessage::Update: {
- update();
- break;
- }
- case DrawingAreaProxyLegacyMessage::DidSetSize: {
- IntSize size;
- if (!arguments->decode(CoreIPC::Out(size)))
- return;
- didSetSize(size);
- break;
- }
- default:
- ASSERT_NOT_REACHED();
- }
-}
-
-void LayerBackedDrawingAreaProxy::didReceiveSyncMessage(CoreIPC::Connection*, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments, CoreIPC::ArgumentEncoder*)
-{
- switch (messageID.get<DrawingAreaProxyLegacyMessage::Kind>()) {
-#if USE(ACCELERATED_COMPOSITING)
- case DrawingAreaProxyLegacyMessage::AttachCompositingContext: {
- uint32_t contextID;
- if (!arguments->decode(CoreIPC::Out(contextID)))
- return;
- attachCompositingContext(contextID);
- break;
- }
-#endif
- default:
- ASSERT_NOT_REACHED();
- }
-}
-
-} // namespace WebKit
-
-#endif // USE(ACCELERATED_COMPOSITING)
diff --git a/Source/WebKit2/UIProcess/LayerBackedDrawingAreaProxy.h b/Source/WebKit2/UIProcess/LayerBackedDrawingAreaProxy.h
deleted file mode 100644
index 31aca5c..0000000
--- a/Source/WebKit2/UIProcess/LayerBackedDrawingAreaProxy.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Copyright (C) 2010 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LayerBackedDrawingAreaProxy_h
-#define LayerBackedDrawingAreaProxy_h
-
-#if USE(ACCELERATED_COMPOSITING)
-
-#include "DrawingAreaProxy.h"
-#include <WebCore/IntSize.h>
-
-#if PLATFORM(MAC)
-#include <wtf/RetainPtr.h>
-
-OBJC_CLASS CALayer;
-OBJC_CLASS WKView;
-#endif
-
-namespace WebKit {
-
-class WebPageProxy;
-
-#if PLATFORM(MAC)
-typedef WKView PlatformWebView;
-#elif PLATFORM(WIN)
-class WebView;
-typedef WebView PlatformWebView;
-#endif
-
-class LayerBackedDrawingAreaProxy : public DrawingAreaProxy {
-public:
- static PassOwnPtr<LayerBackedDrawingAreaProxy> create(PlatformWebView*, WebPageProxy*);
- virtual ~LayerBackedDrawingAreaProxy();
-
-private:
- LayerBackedDrawingAreaProxy(PlatformWebView*, WebPageProxy*);
-
- WebPageProxy* page();
-
- // DrawingAreaProxy
- virtual void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
- virtual void didReceiveSyncMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*, CoreIPC::ArgumentEncoder*);
-
- virtual bool paint(const WebCore::IntRect&, PlatformDrawingContext);
- virtual void sizeDidChange();
- virtual void setPageIsVisible(bool isVisible);
-
- virtual void attachCompositingContext(uint32_t contextID);
- virtual void detachCompositingContext();
-
- void didSetSize(const WebCore::IntSize&);
- void update();
-
- void platformSetSize();
-
- bool m_isWaitingForDidSetFrameNotification;
- bool m_isVisible;
-
- WebCore::IntSize m_lastSetViewSize;
-
-#if PLATFORM(MAC)
- RetainPtr<CALayer> m_compositingRootLayer;
-#endif
-
- PlatformWebView* m_webView;
-};
-
-} // namespace WebKit
-
-#endif // USE(ACCELERATED_COMPOSITING)
-
-#endif // LayerBackedDrawingAreaProxy_h
diff --git a/Source/WebKit2/UIProcess/PageClient.h b/Source/WebKit2/UIProcess/PageClient.h
index 4eb1860..59e02ca 100644
--- a/Source/WebKit2/UIProcess/PageClient.h
+++ b/Source/WebKit2/UIProcess/PageClient.h
@@ -97,7 +97,6 @@ public:
virtual void registerEditCommand(PassRefPtr<WebEditCommandProxy>, WebPageProxy::UndoOrRedo) = 0;
virtual void clearAllEditCommands() = 0;
- virtual void setEditCommandState(const String& commandName, bool isEnabled, int state) = 0;
#if PLATFORM(MAC)
virtual void accessibilityWebProcessTokenReceived(const CoreIPC::DataReference&) = 0;
virtual void interceptKeyEvent(const NativeWebKeyboardEvent&, Vector<WebCore::KeypressCommand>& commandName, uint32_t selectionStart, uint32_t selectionEnd, Vector<WebCore::CompositionUnderline>& underlines) = 0;
@@ -119,9 +118,6 @@ public:
#if USE(ACCELERATED_COMPOSITING)
virtual void enterAcceleratedCompositingMode(const LayerTreeContext&) = 0;
virtual void exitAcceleratedCompositingMode() = 0;
-
- virtual void pageDidEnterAcceleratedCompositing() = 0;
- virtual void pageDidLeaveAcceleratedCompositing() = 0;
#endif
#if PLATFORM(WIN)
@@ -131,17 +127,19 @@ public:
#if PLATFORM(MAC)
virtual void setComplexTextInputEnabled(uint64_t pluginComplexTextInputIdentifier, bool complexTextInputEnabled) = 0;
virtual void setAutodisplay(bool) = 0;
-
virtual CGContextRef containingWindowGraphicsContext() = 0;
+ virtual void didPerformDictionaryLookup(const String&, double scaleFactor, const DictionaryPopupInfo&) = 0;
#endif
virtual void didChangeScrollbarsForMainFrame() const = 0;
// Custom representations.
virtual void didCommitLoadForMainFrame(bool useCustomRepresentation) = 0;
- virtual void didFinishLoadingDataForCustomRepresentation(const CoreIPC::DataReference&) = 0;
+ virtual void didFinishLoadingDataForCustomRepresentation(const String& suggestedFilename, const CoreIPC::DataReference&) = 0;
virtual double customRepresentationZoomFactor() = 0;
virtual void setCustomRepresentationZoomFactor(double) = 0;
+
+ virtual void flashBackingStoreUpdates(const Vector<WebCore::IntRect>& updateRects) = 0;
};
} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/Plugins/PluginInfoStore.cpp b/Source/WebKit2/UIProcess/Plugins/PluginInfoStore.cpp
index b3d9183..0787347 100644
--- a/Source/WebKit2/UIProcess/Plugins/PluginInfoStore.cpp
+++ b/Source/WebKit2/UIProcess/Plugins/PluginInfoStore.cpp
@@ -115,6 +115,21 @@ void PluginInfoStore::getPlugins(Vector<PluginInfo>& plugins)
plugins.append(m_plugins[i].info);
}
+void PluginInfoStore::getPluginPaths(Vector<String>& pluginPaths)
+{
+ loadPluginsIfNecessary();
+
+ for (size_t i = 0; i < m_plugins.size(); ++i)
+ pluginPaths.append(m_plugins[i].path);
+}
+
+const Vector<PluginInfoStore::Plugin>& PluginInfoStore::plugins()
+{
+ loadPluginsIfNecessary();
+
+ return m_plugins;
+}
+
PluginInfoStore::Plugin PluginInfoStore::findPluginForMIMEType(const String& mimeType)
{
ASSERT(!mimeType.isNull());
diff --git a/Source/WebKit2/UIProcess/Plugins/PluginInfoStore.h b/Source/WebKit2/UIProcess/Plugins/PluginInfoStore.h
index b342203..fc49d96 100644
--- a/Source/WebKit2/UIProcess/Plugins/PluginInfoStore.h
+++ b/Source/WebKit2/UIProcess/Plugins/PluginInfoStore.h
@@ -41,8 +41,9 @@ public:
void setAdditionalPluginsDirectories(const Vector<String>&);
void refresh();
- void getPlugins(Vector<WebCore::PluginInfo>& plugins);
-
+ void getPlugins(Vector<WebCore::PluginInfo>&);
+ void getPluginPaths(Vector<String>&);
+
// Represents a single plug-in.
struct Plugin {
String path;
@@ -56,6 +57,8 @@ public:
#endif
};
+ const Vector<Plugin>& plugins();
+
// Returns the info for a plug-in that can handle the given MIME type.
// If the MIME type is null, the file extension of the given url will be used to infer the
// plug-in type. In that case, mimeType will be filled in with the right MIME type.
diff --git a/Source/WebKit2/UIProcess/Plugins/PluginProcessManager.cpp b/Source/WebKit2/UIProcess/Plugins/PluginProcessManager.cpp
index bca9689..c0aa8b3 100644
--- a/Source/WebKit2/UIProcess/Plugins/PluginProcessManager.cpp
+++ b/Source/WebKit2/UIProcess/Plugins/PluginProcessManager.cpp
@@ -28,7 +28,6 @@
#if ENABLE(PLUGIN_PROCESS)
-#include "PluginInfoStore.h"
#include "PluginProcessProxy.h"
#include "WebContext.h"
#include <wtf/StdLibExtras.h>
@@ -51,20 +50,7 @@ void PluginProcessManager::getPluginProcessConnection(const String& pluginPath,
ASSERT(!pluginPath.isNull());
PluginInfoStore::Plugin plugin = webProcessProxy->context()->pluginInfoStore()->infoForPluginWithPath(pluginPath);
-
- PluginProcessProxy* pluginProcess = 0;
-
- for (size_t i = 0; i < m_pluginProcesses.size(); ++i) {
- if (m_pluginProcesses[i]->pluginInfo().path == plugin.path) {
- pluginProcess = m_pluginProcesses[i];
- break;
- }
- }
-
- if (!pluginProcess) {
- pluginProcess = PluginProcessProxy::create(this, plugin).leakPtr();
- m_pluginProcesses.append(pluginProcess);
- }
+ PluginProcessProxy* pluginProcess = getOrCreatePluginProcess(plugin);
pluginProcess->createWebProcessConnection(webProcessProxy, reply);
}
@@ -77,6 +63,31 @@ void PluginProcessManager::removePluginProcessProxy(PluginProcessProxy* pluginPr
m_pluginProcesses.remove(vectorIndex);
}
+void PluginProcessManager::getSitesWithData(const PluginInfoStore::Plugin& plugin, WebPluginSiteDataManager* webPluginSiteDataManager, uint64_t callbackID)
+{
+ PluginProcessProxy* pluginProcess = getOrCreatePluginProcess(plugin);
+ pluginProcess->getSitesWithData(webPluginSiteDataManager, callbackID);
+}
+
+void PluginProcessManager::clearSiteData(const PluginInfoStore::Plugin& plugin, WebPluginSiteDataManager* webPluginSiteDataManager, const Vector<String>& sites, uint64_t flags, uint64_t maxAgeInSeconds, uint64_t callbackID)
+{
+ PluginProcessProxy* pluginProcess = getOrCreatePluginProcess(plugin);
+ pluginProcess->clearSiteData(webPluginSiteDataManager, sites, flags, maxAgeInSeconds, callbackID);
+}
+
+PluginProcessProxy* PluginProcessManager::getOrCreatePluginProcess(const PluginInfoStore::Plugin& plugin)
+{
+ for (size_t i = 0; i < m_pluginProcesses.size(); ++i) {
+ if (m_pluginProcesses[i]->pluginInfo().path == plugin.path)
+ return m_pluginProcesses[i];
+ }
+
+ PluginProcessProxy* pluginProcess = PluginProcessProxy::create(this, plugin).leakPtr();
+ m_pluginProcesses.append(pluginProcess);
+
+ return pluginProcess;
+}
+
} // namespace WebKit
#endif // ENABLE(PLUGIN_PROCESS)
diff --git a/Source/WebKit2/UIProcess/Plugins/PluginProcessManager.h b/Source/WebKit2/UIProcess/Plugins/PluginProcessManager.h
index a150d67..79e5952 100644
--- a/Source/WebKit2/UIProcess/Plugins/PluginProcessManager.h
+++ b/Source/WebKit2/UIProcess/Plugins/PluginProcessManager.h
@@ -28,6 +28,7 @@
#if ENABLE(PLUGIN_PROCESS)
+#include "PluginInfoStore.h"
#include <wtf/Forward.h>
#include <wtf/Noncopyable.h>
#include <wtf/Vector.h>
@@ -40,6 +41,7 @@ namespace WebKit {
class PluginProcessProxy;
class WebProcessProxy;
+class WebPluginSiteDataManager;
class PluginProcessManager {
WTF_MAKE_NONCOPYABLE(PluginProcessManager);
@@ -49,9 +51,14 @@ public:
void getPluginProcessConnection(const String& pluginPath, WebProcessProxy*, CoreIPC::ArgumentEncoder* reply);
void removePluginProcessProxy(PluginProcessProxy*);
+ void getSitesWithData(const PluginInfoStore::Plugin&, WebPluginSiteDataManager*, uint64_t callbackID);
+ void clearSiteData(const PluginInfoStore::Plugin&, WebPluginSiteDataManager*, const Vector<String>& sites, uint64_t flags, uint64_t maxAgeInSeconds, uint64_t callbackID);
+
private:
PluginProcessManager();
+ PluginProcessProxy* getOrCreatePluginProcess(const PluginInfoStore::Plugin&);
+
Vector<PluginProcessProxy*> m_pluginProcesses;
};
diff --git a/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.cpp b/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.cpp
index 4b3b3c0..c63d500 100644
--- a/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.cpp
+++ b/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.cpp
@@ -34,9 +34,20 @@
#include "PluginProcessMessages.h"
#include "RunLoop.h"
#include "WebCoreArgumentCoders.h"
+#include "WebPluginSiteDataManager.h"
#include "WebProcessProxy.h"
namespace WebKit {
+
+#if PLATFORM(MAC)
+static bool pluginNeedsExecutableHeap(const PluginInfoStore::Plugin& pluginInfo)
+{
+ if (pluginInfo.bundleIdentifier == "com.apple.QuickTime Plugin.plugin")
+ return false;
+
+ return true;
+}
+#endif
PassOwnPtr<PluginProcessProxy> PluginProcessProxy::create(PluginProcessManager* PluginProcessManager, const PluginInfoStore::Plugin& pluginInfo)
{
@@ -52,9 +63,7 @@ PluginProcessProxy::PluginProcessProxy(PluginProcessManager* PluginProcessManage
launchOptions.processType = ProcessLauncher::PluginProcess;
#if PLATFORM(MAC)
launchOptions.architecture = pluginInfo.pluginArchitecture;
-
- // FIXME: This shouldn't be true for all plug-ins.
- launchOptions.executableHeap = true;
+ launchOptions.executableHeap = pluginNeedsExecutableHeap(pluginInfo);
#endif
m_processLauncher = ProcessLauncher::create(this, launchOptions);
@@ -80,6 +89,39 @@ void PluginProcessProxy::createWebProcessConnection(WebProcessProxy* webProcessP
m_connection->send(Messages::PluginProcess::CreateWebProcessConnection(), 0, CoreIPC::DispatchMessageEvenWhenWaitingForSyncReply);
}
+void PluginProcessProxy::getSitesWithData(WebPluginSiteDataManager* webPluginSiteDataManager, uint64_t callbackID)
+{
+ ASSERT(!m_pendingGetSitesReplies.contains(callbackID));
+ m_pendingGetSitesReplies.set(callbackID, webPluginSiteDataManager);
+
+ if (m_processLauncher->isLaunching()) {
+ m_pendingGetSitesRequests.append(callbackID);
+ return;
+ }
+
+ // Ask the plug-in process for the sites with data.
+ m_connection->send(Messages::PluginProcess::GetSitesWithData(callbackID), 0);
+}
+
+void PluginProcessProxy::clearSiteData(WebPluginSiteDataManager* webPluginSiteDataManager, const Vector<String>& sites, uint64_t flags, uint64_t maxAgeInSeconds, uint64_t callbackID)
+{
+ ASSERT(!m_pendingClearSiteDataReplies.contains(callbackID));
+ m_pendingClearSiteDataReplies.set(callbackID, webPluginSiteDataManager);
+
+ if (m_processLauncher->isLaunching()) {
+ ClearSiteDataRequest request;
+ request.sites = sites;
+ request.flags = flags;
+ request.maxAgeInSeconds = maxAgeInSeconds;
+ request.callbackID = callbackID;
+ m_pendingClearSiteDataRequests.append(request);
+ return;
+ }
+
+ // Ask the plug-in process to clear the site data.
+ m_connection->send(Messages::PluginProcess::ClearSiteData(sites, flags, maxAgeInSeconds, callbackID), 0);
+}
+
void PluginProcessProxy::pluginProcessCrashedOrFailedToLaunch()
{
// The plug-in process must have crashed or exited, send any pending sync replies we might have.
@@ -93,6 +135,12 @@ void PluginProcessProxy::pluginProcessCrashedOrFailedToLaunch()
replyWebProcessProxy->connection()->sendSyncReply(reply);
}
+ while (!m_pendingGetSitesReplies.isEmpty())
+ didGetSitesWithData(Vector<String>(), m_pendingGetSitesReplies.begin()->first);
+
+ while (!m_pendingClearSiteDataReplies.isEmpty())
+ didClearSiteData(m_pendingClearSiteDataReplies.begin()->first);
+
// Tell the plug-in process manager to forget about this plug-in process proxy.
m_pluginProcessManager->removePluginProcessProxy(this);
delete this;
@@ -134,6 +182,16 @@ void PluginProcessProxy::didFinishLaunching(ProcessLauncher*, CoreIPC::Connectio
m_connection->send(Messages::PluginProcess::InitializePluginProcess(parameters), 0);
// Send all our pending requests.
+ for (size_t i = 0; i < m_pendingGetSitesRequests.size(); ++i)
+ m_connection->send(Messages::PluginProcess::GetSitesWithData(m_pendingGetSitesRequests[i]), 0);
+ m_pendingGetSitesRequests.clear();
+
+ for (size_t i = 0; i < m_pendingClearSiteDataRequests.size(); ++i) {
+ const ClearSiteDataRequest& request = m_pendingClearSiteDataRequests[i];
+ m_connection->send(Messages::PluginProcess::ClearSiteData(request.sites, request.flags, request.maxAgeInSeconds, request.callbackID), 0);
+ }
+ m_pendingClearSiteDataRequests.clear();
+
for (unsigned i = 0; i < m_numPendingConnectionRequests; ++i)
m_connection->send(Messages::PluginProcess::CreateWebProcessConnection(), 0);
@@ -154,6 +212,22 @@ void PluginProcessProxy::didCreateWebProcessConnection(const CoreIPC::MachPort&
replyWebProcessProxy->connection()->sendSyncReply(reply);
}
+void PluginProcessProxy::didGetSitesWithData(const Vector<String>& sites, uint64_t callbackID)
+{
+ RefPtr<WebPluginSiteDataManager> webPluginSiteDataManager = m_pendingGetSitesReplies.take(callbackID);
+ ASSERT(webPluginSiteDataManager);
+
+ webPluginSiteDataManager->didGetSitesWithDataForSinglePlugin(sites, callbackID);
+}
+
+void PluginProcessProxy::didClearSiteData(uint64_t callbackID)
+{
+ RefPtr<WebPluginSiteDataManager> webPluginSiteDataManager = m_pendingClearSiteDataReplies.take(callbackID);
+ ASSERT(webPluginSiteDataManager);
+
+ webPluginSiteDataManager->didClearSiteDataForSinglePlugin(callbackID);
+}
+
} // namespace WebKit
#endif // ENABLE(PLUGIN_PROCESS)
diff --git a/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.h b/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.h
index 23a6df0..2ea2573 100644
--- a/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.h
+++ b/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.h
@@ -41,6 +41,7 @@ namespace CoreIPC {
namespace WebKit {
class PluginProcessManager;
+class WebPluginSiteDataManager;
class WebProcessProxy;
struct PluginProcessCreationParameters;
@@ -54,7 +55,13 @@ public:
// Asks the plug-in process to create a new connection to a web process. The connection identifier will be
// encoded in the given argument encoder and sent back to the connection of the given web process.
void createWebProcessConnection(WebProcessProxy*, CoreIPC::ArgumentEncoder* reply);
-
+
+ // Asks the plug-in process to get a list of domains for which the plug-in has data stored.
+ void getSitesWithData(WebPluginSiteDataManager*, uint64_t callbackID);
+
+ // Asks the plug-in process to clear the data for the given sites.
+ void clearSiteData(WebPluginSiteDataManager*, const Vector<String>& sites, uint64_t flags, uint64_t maxAgeInSeconds, uint64_t callbackID);
+
private:
PluginProcessProxy(PluginProcessManager*, const PluginInfoStore::Plugin&);
@@ -71,6 +78,8 @@ private:
// Message handlers
void didReceivePluginProcessProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
void didCreateWebProcessConnection(const CoreIPC::MachPort&);
+ void didGetSitesWithData(const Vector<String>& sites, uint64_t callbackID);
+ void didClearSiteData(uint64_t callbackID);
void platformInitializePluginProcess(PluginProcessCreationParameters& parameters);
@@ -88,10 +97,21 @@ private:
Deque<std::pair<RefPtr<WebProcessProxy>, CoreIPC::ArgumentEncoder*> > m_pendingConnectionReplies;
+ Vector<uint64_t> m_pendingGetSitesRequests;
+ HashMap<uint64_t, RefPtr<WebPluginSiteDataManager> > m_pendingGetSitesReplies;
+
+ struct ClearSiteDataRequest {
+ Vector<String> sites;
+ uint64_t flags;
+ uint64_t maxAgeInSeconds;
+ uint64_t callbackID;
+ };
+ Vector<ClearSiteDataRequest> m_pendingClearSiteDataRequests;
+ HashMap<uint64_t, RefPtr<WebPluginSiteDataManager> > m_pendingClearSiteDataReplies;
+
// If createPluginConnection is called while the process is still launching we'll keep count of it and send a bunch of requests
// when the process finishes launching.
unsigned m_numPendingConnectionRequests;
-
};
} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.messages.in b/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.messages.in
index cbd5abc..a504f9a 100644
--- a/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.messages.in
+++ b/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.messages.in
@@ -25,6 +25,9 @@
messages -> PluginProcessProxy {
# FIXME: This is platform specific
DidCreateWebProcessConnection(CoreIPC::MachPort connectionIdentifier)
+
+ DidGetSitesWithData(Vector<WTF::String> sites, uint64_t callbackID)
+ DidClearSiteData(uint64_t callbackID)
}
#endif
diff --git a/Source/WebKit2/UIProcess/Plugins/WebPluginSiteDataManager.cpp b/Source/WebKit2/UIProcess/Plugins/WebPluginSiteDataManager.cpp
new file mode 100644
index 0000000..dfa0806
--- /dev/null
+++ b/Source/WebKit2/UIProcess/Plugins/WebPluginSiteDataManager.cpp
@@ -0,0 +1,299 @@
+/*
+ * Copyright (C) 2011 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WebPluginSiteDataManager.h"
+
+#include "ImmutableArray.h"
+#include "PluginProcessManager.h"
+#include "WebContext.h"
+#include "WebProcessMessages.h"
+
+using namespace WebCore;
+
+namespace WebKit {
+
+#if ENABLE(PLUGIN_PROCESS)
+class WebPluginSiteDataManager::GetSitesWithDataState {
+public:
+ explicit GetSitesWithDataState(WebPluginSiteDataManager* webPluginSiteDataManager, uint64_t callbackID)
+ : m_webPluginSiteDataManager(webPluginSiteDataManager)
+ , m_callbackID(callbackID)
+ , m_plugins(webPluginSiteDataManager->m_webContext->pluginInfoStore()->plugins())
+ {
+ }
+
+ void getSitesWithDataForNextPlugin()
+ {
+ if (m_plugins.isEmpty()) {
+ Vector<String> sites;
+ copyToVector(m_sites, sites);
+
+ m_webPluginSiteDataManager->didGetSitesWithDataForAllPlugins(sites, m_callbackID);
+ return;
+ }
+
+ PluginProcessManager::shared().getSitesWithData(m_plugins.last(), m_webPluginSiteDataManager, m_callbackID);
+ m_plugins.removeLast();
+ }
+
+ void didGetSitesWithDataForSinglePlugin(const Vector<String>& sites)
+ {
+ for (size_t i = 0; i < sites.size(); ++i)
+ m_sites.add(sites[i]);
+
+ getSitesWithDataForNextPlugin();
+ }
+
+private:
+ WebPluginSiteDataManager* m_webPluginSiteDataManager;
+ uint64_t m_callbackID;
+ Vector<PluginInfoStore::Plugin> m_plugins;
+ HashSet<String> m_sites;
+};
+
+class WebPluginSiteDataManager::ClearSiteDataState {
+public:
+ explicit ClearSiteDataState(WebPluginSiteDataManager* webPluginSiteDataManager, const Vector<String>& sites, uint64_t flags, uint64_t maxAgeInSeconds, uint64_t callbackID)
+ : m_webPluginSiteDataManager(webPluginSiteDataManager)
+ , m_sites(sites)
+ , m_flags(flags)
+ , m_maxAgeInSeconds(maxAgeInSeconds)
+ , m_callbackID(callbackID)
+ , m_plugins(webPluginSiteDataManager->m_webContext->pluginInfoStore()->plugins())
+ {
+ }
+
+ void clearSiteDataForNextPlugin()
+ {
+ if (m_plugins.isEmpty()) {
+ m_webPluginSiteDataManager->didClearSiteDataForAllPlugins(m_callbackID);
+ return;
+ }
+
+ PluginProcessManager::shared().clearSiteData(m_plugins.last(), m_webPluginSiteDataManager, m_sites, m_flags, m_maxAgeInSeconds, m_callbackID);
+ m_plugins.removeLast();
+ }
+
+ void didClearSiteDataForSinglePlugin()
+ {
+ clearSiteDataForNextPlugin();
+ }
+
+private:
+ WebPluginSiteDataManager* m_webPluginSiteDataManager;
+ Vector<String> m_sites;
+ uint64_t m_flags;
+ uint64_t m_maxAgeInSeconds;
+ uint64_t m_callbackID;
+ Vector<PluginInfoStore::Plugin> m_plugins;
+};
+#endif // ENABLE(PLUGIN_PROCESS)
+
+PassRefPtr<WebPluginSiteDataManager> WebPluginSiteDataManager::create(WebContext* webContext)
+{
+ return adoptRef(new WebPluginSiteDataManager(webContext));
+}
+
+WebPluginSiteDataManager::WebPluginSiteDataManager(WebContext* webContext)
+ : m_webContext(webContext)
+{
+}
+
+WebPluginSiteDataManager::~WebPluginSiteDataManager()
+{
+ ASSERT(m_arrayCallbacks.isEmpty());
+ ASSERT(m_voidCallbacks.isEmpty());
+#if ENABLE(PLUGIN_PROCESS)
+ ASSERT(m_pendingGetSitesWithData.isEmpty());
+ ASSERT(m_pendingClearSiteData.isEmpty());
+#endif
+}
+
+void WebPluginSiteDataManager::invalidate()
+{
+ invalidateCallbackMap(m_arrayCallbacks);
+
+#if ENABLE(PLUGIN_PROCESS)
+ deleteAllValues(m_pendingGetSitesWithData);
+ m_pendingGetSitesWithData.clear();
+ deleteAllValues(m_pendingClearSiteData);
+ m_pendingClearSiteData.clear();
+#endif
+}
+
+void WebPluginSiteDataManager::getSitesWithData(PassRefPtr<ArrayCallback> prpCallback)
+{
+ RefPtr<ArrayCallback> callback = prpCallback;
+
+ if (!m_webContext) {
+ callback->invalidate();
+ return;
+ }
+
+ uint64_t callbackID = callback->callbackID();
+ m_arrayCallbacks.set(callbackID, callback.release());
+
+#if ENABLE(PLUGIN_PROCESS)
+ ASSERT(!m_pendingGetSitesWithData.contains(callbackID));
+
+ GetSitesWithDataState* state = new GetSitesWithDataState(this, callbackID);
+ m_pendingGetSitesWithData.set(callbackID, state);
+ state->getSitesWithDataForNextPlugin();
+#else
+ if (!m_webContext->hasValidProcess()) {
+ RefPtr<ArrayCallback> callback = m_arrayCallbacks.take(callbackID);
+ callback->invalidate();
+ return;
+ }
+
+ Vector<String> pluginPaths;
+ m_webContext->pluginInfoStore()->getPluginPaths(pluginPaths);
+ m_webContext->ensureWebProcess();
+ m_webContext->process()->send(Messages::WebProcess::GetSitesWithPluginData(pluginPaths, callbackID), 0);
+#endif
+}
+
+void WebPluginSiteDataManager::didGetSitesWithData(const Vector<String>& sites, uint64_t callbackID)
+{
+ RefPtr<ArrayCallback> callback = m_arrayCallbacks.take(callbackID);
+ if (!callback) {
+ // FIXME: Log error or assert.
+ return;
+ }
+
+ Vector<RefPtr<APIObject> > sitesWK(sites.size());
+
+ for (size_t i = 0; i < sites.size(); ++i)
+ sitesWK[i] = WebString::create(sites[i]);
+
+ RefPtr<ImmutableArray> resultArray = ImmutableArray::adopt(sitesWK);
+ callback->performCallbackWithReturnValue(resultArray.get());
+}
+
+void WebPluginSiteDataManager::clearSiteData(ImmutableArray* sites, uint64_t flags, uint64_t maxAgeInSeconds, PassRefPtr<VoidCallback> prpCallback)
+{
+ RefPtr<VoidCallback> callback = prpCallback;
+ if (!m_webContext) {
+ callback->invalidate();
+ return;
+ }
+
+ Vector<String> sitesVector;
+
+ // If the array is empty, don't do anything.
+ if (sites) {
+ if (!sites->size()) {
+ callback->performCallback();
+ return;
+ }
+
+ for (size_t i = 0; i < sites->size(); ++i) {
+ if (WebString* site = sites->at<WebString>(i))
+ sitesVector.append(site->string());
+ }
+ }
+
+ uint64_t callbackID = callback->callbackID();
+ m_voidCallbacks.set(callbackID, callback.release());
+
+#if ENABLE(PLUGIN_PROCESS)
+ ASSERT(!m_pendingClearSiteData.contains(callbackID));
+
+ ClearSiteDataState* state = new ClearSiteDataState(this, sitesVector, flags, maxAgeInSeconds, callbackID);
+ m_pendingClearSiteData.set(callbackID, state);
+ state->clearSiteDataForNextPlugin();
+#else
+
+ if (!m_webContext->hasValidProcess()) {
+ RefPtr<VoidCallback> callback = m_voidCallbacks.take(callbackID);
+ callback->invalidate();
+ return;
+ }
+ Vector<String> pluginPaths;
+ m_webContext->pluginInfoStore()->getPluginPaths(pluginPaths);
+ m_webContext->ensureWebProcess();
+ m_webContext->process()->send(Messages::WebProcess::ClearPluginSiteData(pluginPaths, sitesVector, flags, maxAgeInSeconds, callbackID), 0);
+#endif
+}
+
+void WebPluginSiteDataManager::didClearSiteData(uint64_t callbackID)
+{
+ RefPtr<VoidCallback> callback = m_voidCallbacks.take(callbackID);
+ if (!callback) {
+ // FIXME: Log error or assert.
+ return;
+ }
+
+ callback->performCallback();
+}
+
+bool WebPluginSiteDataManager::shouldTerminate(WebProcessProxy*) const
+{
+#if ENABLE(PLUGIN_PROCESS)
+ // When out of process plug-ins are enabled, the web process is not involved in fetching site data.
+ return true;
+#else
+ return m_arrayCallbacks.isEmpty() && m_voidCallbacks.isEmpty();
+#endif
+}
+
+#if ENABLE(PLUGIN_PROCESS)
+void WebPluginSiteDataManager::didGetSitesWithDataForSinglePlugin(const Vector<String>& sites, uint64_t callbackID)
+{
+ GetSitesWithDataState* state = m_pendingGetSitesWithData.get(callbackID);
+ ASSERT(state);
+
+ state->didGetSitesWithDataForSinglePlugin(sites);
+}
+
+void WebPluginSiteDataManager::didGetSitesWithDataForAllPlugins(const Vector<String>& sites, uint64_t callbackID)
+{
+ OwnPtr<GetSitesWithDataState> state = adoptPtr(m_pendingGetSitesWithData.take(callbackID));
+ ASSERT(state);
+
+ didGetSitesWithData(sites, callbackID);
+}
+
+void WebPluginSiteDataManager::didClearSiteDataForSinglePlugin(uint64_t callbackID)
+{
+ ClearSiteDataState* state = m_pendingClearSiteData.get(callbackID);
+ ASSERT(state);
+
+ state->didClearSiteDataForSinglePlugin();
+}
+
+void WebPluginSiteDataManager::didClearSiteDataForAllPlugins(uint64_t callbackID)
+{
+ OwnPtr<ClearSiteDataState> state = adoptPtr(m_pendingClearSiteData.take(callbackID));
+ ASSERT(state);
+
+ didClearSiteData(callbackID);
+}
+
+#endif
+
+} // namespace WebKit
+
diff --git a/Source/WebKit2/UIProcess/Plugins/WebPluginSiteDataManager.h b/Source/WebKit2/UIProcess/Plugins/WebPluginSiteDataManager.h
new file mode 100644
index 0000000..9efa175
--- /dev/null
+++ b/Source/WebKit2/UIProcess/Plugins/WebPluginSiteDataManager.h
@@ -0,0 +1,88 @@
+/*
+ * Copyright (C) 2011 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WebPluginSiteDataManagerh
+#define WebPluginSiteDataManager_h
+
+#include "APIObject.h"
+#include "Arguments.h"
+#include "GenericCallback.h"
+#include <wtf/HashMap.h>
+#include <wtf/PassRefPtr.h>
+
+namespace WebKit {
+
+class WebContext;
+class WebProcessProxy;
+
+typedef GenericCallback<WKArrayRef> ArrayCallback;
+
+class WebPluginSiteDataManager : public APIObject {
+public:
+ static const Type APIType = TypePluginSiteDataManager;
+
+ static PassRefPtr<WebPluginSiteDataManager> create(WebContext*);
+ virtual ~WebPluginSiteDataManager();
+
+ void invalidate();
+ void clearContext() { m_webContext = 0; }
+
+ void getSitesWithData(PassRefPtr<ArrayCallback>);
+ void didGetSitesWithData(const Vector<String>& sites, uint64_t callbackID);
+
+ void clearSiteData(ImmutableArray* sites, uint64_t flags, uint64_t maxAgeInSeconds, PassRefPtr<VoidCallback>);
+ void didClearSiteData(uint64_t callbackID);
+
+#if ENABLE(PLUGIN_PROCESS)
+ void didGetSitesWithDataForSinglePlugin(const Vector<String>& sites, uint64_t callbackID);
+ void didClearSiteDataForSinglePlugin(uint64_t callbackID);
+#endif
+
+ bool shouldTerminate(WebProcessProxy*) const;
+
+private:
+ explicit WebPluginSiteDataManager(WebContext*);
+
+ virtual Type type() const { return APIType; }
+
+ WebContext* m_webContext;
+ HashMap<uint64_t, RefPtr<ArrayCallback> > m_arrayCallbacks;
+ HashMap<uint64_t, RefPtr<VoidCallback> > m_voidCallbacks;
+
+#if ENABLE(PLUGIN_PROCESS)
+ void didGetSitesWithDataForAllPlugins(const Vector<String>& sites, uint64_t callbackID);
+ void didClearSiteDataForAllPlugins(uint64_t callbackID);
+
+ class GetSitesWithDataState;
+ HashMap<uint64_t, GetSitesWithDataState*> m_pendingGetSitesWithData;
+
+ class ClearSiteDataState;
+ HashMap<uint64_t, ClearSiteDataState*> m_pendingClearSiteData;
+#endif
+};
+
+} // namespace WebKit
+
+#endif // WebPluginSiteDataManager_h
diff --git a/Source/WebKit2/UIProcess/Plugins/gtk/PluginInfoStoreGtk.cpp b/Source/WebKit2/UIProcess/Plugins/gtk/PluginInfoStoreGtk.cpp
index f06f0e5..2dcea2f 100644
--- a/Source/WebKit2/UIProcess/Plugins/gtk/PluginInfoStoreGtk.cpp
+++ b/Source/WebKit2/UIProcess/Plugins/gtk/PluginInfoStoreGtk.cpp
@@ -27,9 +27,9 @@
#include "config.h"
#include "PluginInfoStore.h"
-#include "NotImplemented.h"
#include "PluginDatabase.h"
#include "PluginPackage.h"
+#include <WebCore/NotImplemented.h>
using namespace WebCore;
diff --git a/Source/WebKit2/UIProcess/win/LayerBackedDrawingAreaProxyWin.cpp b/Source/WebKit2/UIProcess/Plugins/qt/PluginProcessProxyQt.cpp
index 58dc3b0..cc521e0 100644
--- a/Source/WebKit2/UIProcess/win/LayerBackedDrawingAreaProxyWin.cpp
+++ b/Source/WebKit2/UIProcess/Plugins/qt/PluginProcessProxyQt.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2011 Nokia Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -24,43 +24,20 @@
*/
#include "config.h"
-#include "LayerBackedDrawingAreaProxy.h"
+#include "PluginProcessProxy.h"
-#if USE(ACCELERATED_COMPOSITING)
+#if ENABLE(PLUGIN_PROCESS)
-#include "DrawingAreaMessageKinds.h"
-#include "DrawingAreaProxyMessageKinds.h"
-#include "WebView.h"
-#include "WebPageProxy.h"
-#include "WebProcessProxy.h"
-
-using namespace WebCore;
+#include "PluginProcessCreationParameters.h"
+#include <WebCore/NotImplemented.h>
namespace WebKit {
-WebPageProxy* LayerBackedDrawingAreaProxy::page()
-{
- return m_webView->page();
-}
-
-void LayerBackedDrawingAreaProxy::platformSetSize()
-{
-}
-
-void LayerBackedDrawingAreaProxy::attachCompositingContext(uint32_t contextID)
-{
-
-}
-
-void LayerBackedDrawingAreaProxy::detachCompositingContext()
-{
-}
-
-bool LayerBackedDrawingAreaProxy::paint(const IntRect&, PlatformDrawingContext)
+void PluginProcessProxy::platformInitializePluginProcess(PluginProcessCreationParameters& parameters)
{
- return false;
+ notImplemented();
}
} // namespace WebKit
-#endif // USE(ACCELERATED_COMPOSITING)
+#endif // ENABLE(PLUGIN_PROCESS)
diff --git a/Source/WebKit2/UIProcess/TextChecker.h b/Source/WebKit2/UIProcess/TextChecker.h
index fc347fe..7a5d535 100644
--- a/Source/WebKit2/UIProcess/TextChecker.h
+++ b/Source/WebKit2/UIProcess/TextChecker.h
@@ -27,6 +27,7 @@
#define TextChecker_h
#include <WebCore/EditorClient.h>
+#include <WebCore/TextCheckerClient.h>
namespace WebKit {
@@ -56,6 +57,7 @@ public:
static Vector<WebCore::TextCheckingResult> checkTextOfParagraph(int64_t spellDocumentTag, const UChar* text, int length, uint64_t checkingTypes);
static void updateSpellingUIWithMisspelledWord(const String& misspelledWord);
+ static void updateSpellingUIWithGrammarString(const String& badGrammarPhrase, const WebCore::GrammarDetail&);
static void getGuessesForWord(int64_t spellDocumentTag, const String& word, const String& context, Vector<String>& guesses);
static void learnWord(const String& word);
static void ignoreWord(int64_t spellDocumentTag, const String& word);
diff --git a/Source/WebKit2/UIProcess/TiledDrawingAreaProxy.cpp b/Source/WebKit2/UIProcess/TiledDrawingAreaProxy.cpp
index 3b3334f..985827a 100644
--- a/Source/WebKit2/UIProcess/TiledDrawingAreaProxy.cpp
+++ b/Source/WebKit2/UIProcess/TiledDrawingAreaProxy.cpp
@@ -48,7 +48,7 @@ PassOwnPtr<TiledDrawingAreaProxy> TiledDrawingAreaProxy::create(PlatformWebView*
}
TiledDrawingAreaProxy::TiledDrawingAreaProxy(PlatformWebView* webView, WebPageProxy* webPageProxy)
- : DrawingAreaProxy(DrawingAreaInfo::Tiled, webPageProxy)
+ : DrawingAreaProxy(DrawingAreaTypeTiled, webPageProxy)
, m_isWaitingForDidSetFrameNotification(false)
, m_isVisible(true)
, m_webView(webView)
@@ -171,11 +171,6 @@ void TiledDrawingAreaProxy::didReceiveMessage(CoreIPC::Connection*, CoreIPC::Mes
}
}
-void TiledDrawingAreaProxy::didReceiveSyncMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*, CoreIPC::ArgumentEncoder&)
-{
- ASSERT_NOT_REACHED();
-}
-
void TiledDrawingAreaProxy::requestTileUpdate(int tileID, const IntRect& dirtyRect)
{
page()->process()->connection()->deprecatedSend(DrawingAreaLegacyMessage::RequestTileUpdate, page()->pageID(), CoreIPC::In(tileID, dirtyRect, contentsScale()));
@@ -247,8 +242,8 @@ void TiledDrawingAreaProxy::invalidate(const IntRect& contentsDirtyRect)
Vector<TiledDrawingAreaTile::Coordinate> tilesToRemove;
- for (unsigned yCoordinate = topLeft.y(); yCoordinate < bottomRight.y(); ++yCoordinate) {
- for (unsigned xCoordinate = topLeft.x(); xCoordinate < bottomRight.x(); ++xCoordinate) {
+ for (unsigned yCoordinate = topLeft.y(); yCoordinate <= bottomRight.y(); ++yCoordinate) {
+ for (unsigned xCoordinate = topLeft.x(); xCoordinate <= bottomRight.x(); ++xCoordinate) {
RefPtr<TiledDrawingAreaTile> currentTile = tileAt(TiledDrawingAreaTile::Coordinate(xCoordinate, yCoordinate));
if (!currentTile)
continue;
@@ -341,8 +336,8 @@ bool TiledDrawingAreaProxy::paint(const IntRect& rect, PlatformDrawingContext co
TiledDrawingAreaTile::Coordinate topLeft = tileCoordinateForPoint(dirtyRect.location());
TiledDrawingAreaTile::Coordinate bottomRight = tileCoordinateForPoint(IntPoint(dirtyRect.maxX(), dirtyRect.maxY()));
- for (unsigned yCoordinate = topLeft.y(); yCoordinate < bottomRight.y(); ++yCoordinate) {
- for (unsigned xCoordinate = topLeft.x(); xCoordinate < bottomRight.x(); ++xCoordinate) {
+ for (unsigned yCoordinate = topLeft.y(); yCoordinate <= bottomRight.y(); ++yCoordinate) {
+ for (unsigned xCoordinate = topLeft.x(); xCoordinate <= bottomRight.x(); ++xCoordinate) {
TiledDrawingAreaTile::Coordinate currentCoordinate(xCoordinate, yCoordinate);
RefPtr<TiledDrawingAreaTile> currentTile = tileAt(currentCoordinate);
if (currentTile && currentTile->isReadyToPaint())
@@ -398,8 +393,9 @@ double TiledDrawingAreaProxy::tileDistance(const IntRect& viewport, const TiledD
IntRect TiledDrawingAreaProxy::calculateKeepRect(const IntRect& visibleRect) const
{
IntRect result = visibleRect;
- result.inflateX(visibleRect.width() * (m_keepAreaMultiplier.width() - 1));
- result.inflateY(visibleRect.height() * (m_keepAreaMultiplier.height() - 1));
+ // Inflates to both sides, so divide inflate delta by 2
+ result.inflateX(visibleRect.width() * (m_keepAreaMultiplier.width() - 1) / 2);
+ result.inflateY(visibleRect.height() * (m_keepAreaMultiplier.height() - 1) / 2);
result.intersect(contentsRect());
return result;
}
@@ -407,8 +403,9 @@ IntRect TiledDrawingAreaProxy::calculateKeepRect(const IntRect& visibleRect) con
IntRect TiledDrawingAreaProxy::calculateCoverRect(const IntRect& visibleRect) const
{
IntRect result = visibleRect;
- result.inflateX(visibleRect.width() * (m_coverAreaMultiplier.width() - 1));
- result.inflateY(visibleRect.height() * (m_coverAreaMultiplier.height() - 1));
+ // Inflates to both sides, so divide inflate delta by 2
+ result.inflateX(visibleRect.width() * (m_coverAreaMultiplier.width() - 1) / 2);
+ result.inflateY(visibleRect.height() * (m_coverAreaMultiplier.height() - 1) / 2);
result.intersect(contentsRect());
return result;
}
@@ -438,8 +435,8 @@ void TiledDrawingAreaProxy::createTiles()
bool hasVisibleCheckers = false;
TiledDrawingAreaTile::Coordinate topLeft = tileCoordinateForPoint(visibleRect.location());
TiledDrawingAreaTile::Coordinate bottomRight = tileCoordinateForPoint(IntPoint(visibleRect.maxX(), visibleRect.maxY()));
- for (unsigned yCoordinate = topLeft.y(); yCoordinate < bottomRight.y(); ++yCoordinate) {
- for (unsigned xCoordinate = topLeft.x(); xCoordinate < bottomRight.x(); ++xCoordinate) {
+ for (unsigned yCoordinate = topLeft.y(); yCoordinate <= bottomRight.y(); ++yCoordinate) {
+ for (unsigned xCoordinate = topLeft.x(); xCoordinate <= bottomRight.x(); ++xCoordinate) {
TiledDrawingAreaTile::Coordinate currentCoordinate(xCoordinate, yCoordinate);
// Distance is 0 for all currently visible tiles.
double distance = tileDistance(visibleRect, currentCoordinate);
diff --git a/Source/WebKit2/UIProcess/TiledDrawingAreaProxy.h b/Source/WebKit2/UIProcess/TiledDrawingAreaProxy.h
index 80bc20d..89ad62a 100644
--- a/Source/WebKit2/UIProcess/TiledDrawingAreaProxy.h
+++ b/Source/WebKit2/UIProcess/TiledDrawingAreaProxy.h
@@ -30,7 +30,6 @@
#include "DrawingAreaProxy.h"
#include <WebCore/GraphicsContext.h>
-#include <WebCore/IntSize.h>
#include <WebCore/IntRect.h>
#include <wtf/HashSet.h>
@@ -114,7 +113,6 @@ private:
// DrawingAreaProxy
virtual void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
- virtual void didReceiveSyncMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*, CoreIPC::ArgumentEncoder&);
virtual bool paint(const WebCore::IntRect&, PlatformDrawingContext);
virtual void sizeDidChange();
virtual void setPageIsVisible(bool isVisible);
diff --git a/Source/WebKit2/UIProcess/WebApplicationCacheManagerProxy.cpp b/Source/WebKit2/UIProcess/WebApplicationCacheManagerProxy.cpp
new file mode 100644
index 0000000..1cf4921
--- /dev/null
+++ b/Source/WebKit2/UIProcess/WebApplicationCacheManagerProxy.cpp
@@ -0,0 +1,99 @@
+/*
+ * Copyright (C) 2011 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WebApplicationCacheManagerProxy.h"
+
+#include "SecurityOriginData.h"
+#include "WebApplicationCacheManagerMessages.h"
+#include "WebContext.h"
+#include "WebSecurityOrigin.h"
+
+namespace WebKit {
+
+PassRefPtr<WebApplicationCacheManagerProxy> WebApplicationCacheManagerProxy::create(WebContext* context)
+{
+ return adoptRef(new WebApplicationCacheManagerProxy(context));
+}
+
+WebApplicationCacheManagerProxy::WebApplicationCacheManagerProxy(WebContext* context)
+ : m_webContext(context)
+{
+}
+
+WebApplicationCacheManagerProxy::~WebApplicationCacheManagerProxy()
+{
+}
+
+void WebApplicationCacheManagerProxy::invalidate()
+{
+ invalidateCallbackMap(m_arrayCallbacks);
+}
+
+void WebApplicationCacheManagerProxy::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments)
+{
+ didReceiveWebApplicationCacheManagerProxyMessage(connection, messageID, arguments);
+}
+
+void WebApplicationCacheManagerProxy::getApplicationCacheOrigins(PassRefPtr<ArrayCallback> prpCallback)
+{
+ RefPtr<ArrayCallback> callback = prpCallback;
+ if (!m_webContext->hasValidProcess()) {
+ callback->invalidate();
+ return;
+ }
+
+ uint64_t callbackID = callback->callbackID();
+ m_arrayCallbacks.set(callbackID, callback.release());
+ m_webContext->process()->send(Messages::WebApplicationCacheManager::GetApplicationCacheOrigins(callbackID), 0);
+}
+
+void WebApplicationCacheManagerProxy::didGetApplicationCacheOrigins(const Vector<SecurityOriginData>& originDatas, uint64_t callbackID)
+{
+ RefPtr<ArrayCallback> callback = m_arrayCallbacks.take(callbackID);
+ performAPICallbackWithSecurityOriginDataVector(originDatas, callback.get());
+}
+
+void WebApplicationCacheManagerProxy::deleteEntriesForOrigin(WebSecurityOrigin* origin)
+{
+ if (!m_webContext->hasValidProcess())
+ return;
+
+ SecurityOriginData securityOriginData;
+ securityOriginData.protocol = origin->protocol();
+ securityOriginData.host = origin->host();
+ securityOriginData.port = origin->port();
+
+ m_webContext->process()->send(Messages::WebApplicationCacheManager::DeleteEntriesForOrigin(securityOriginData), 0);
+}
+
+void WebApplicationCacheManagerProxy::deleteAllEntries()
+{
+ if (!m_webContext->hasValidProcess())
+ return;
+ m_webContext->process()->send(Messages::WebApplicationCacheManager::DeleteAllEntries(), 0);
+}
+
+} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/WebApplicationCacheManagerProxy.h b/Source/WebKit2/UIProcess/WebApplicationCacheManagerProxy.h
new file mode 100644
index 0000000..81637e0
--- /dev/null
+++ b/Source/WebKit2/UIProcess/WebApplicationCacheManagerProxy.h
@@ -0,0 +1,82 @@
+/*
+ * Copyright (C) 2011 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WebApplicationCacheManagerProxy_h
+#define WebApplicationCacheManagerProxy_h
+
+#include "APIObject.h"
+#include "GenericCallback.h"
+#include "ImmutableArray.h"
+
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefPtr.h>
+#include <wtf/Vector.h>
+
+namespace CoreIPC {
+ class ArgumentDecoder;
+ class Connection;
+ class MessageID;
+}
+
+namespace WebKit {
+
+struct SecurityOriginData;
+class WebContext;
+class WebSecurityOrigin;
+
+typedef GenericCallback<WKArrayRef> ArrayCallback;
+
+class WebApplicationCacheManagerProxy : public APIObject {
+public:
+ static const Type APIType = TypeApplicationCacheManager;
+
+ static PassRefPtr<WebApplicationCacheManagerProxy> create(WebContext*);
+ virtual ~WebApplicationCacheManagerProxy();
+
+ void invalidate();
+ void clearContext() { m_webContext = 0; }
+
+ void getApplicationCacheOrigins(PassRefPtr<ArrayCallback>);
+ void deleteEntriesForOrigin(WebSecurityOrigin*);
+ void deleteAllEntries();
+
+ void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
+
+private:
+ WebApplicationCacheManagerProxy(WebContext*);
+
+ virtual Type type() const { return APIType; }
+
+ void didGetApplicationCacheOrigins(const Vector<SecurityOriginData>&, uint64_t callbackID);
+
+ void didReceiveWebApplicationCacheManagerProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
+
+ WebContext* m_webContext;
+ HashMap<uint64_t, RefPtr<ArrayCallback> > m_arrayCallbacks;
+};
+
+} // namespace WebKit
+
+#endif // WebApplicationCacheManagerProxy_h
diff --git a/Source/WebKit2/UIProcess/WebApplicationCacheManagerProxy.messages.in b/Source/WebKit2/UIProcess/WebApplicationCacheManagerProxy.messages.in
new file mode 100644
index 0000000..2aa0f67
--- /dev/null
+++ b/Source/WebKit2/UIProcess/WebApplicationCacheManagerProxy.messages.in
@@ -0,0 +1,25 @@
+# Copyright (C) 2011 Apple Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+messages -> WebApplicationCacheManagerProxy {
+ DidGetApplicationCacheOrigins(Vector<WebKit::SecurityOriginData> originIdentifiers, uint64_t callbackID);
+}
diff --git a/Source/WebKit2/UIProcess/WebBackForwardList.h b/Source/WebKit2/UIProcess/WebBackForwardList.h
index 3376771..ead0fca 100644
--- a/Source/WebKit2/UIProcess/WebBackForwardList.h
+++ b/Source/WebKit2/UIProcess/WebBackForwardList.h
@@ -33,7 +33,7 @@
#include <wtf/PassRefPtr.h>
#include <wtf/RefPtr.h>
#include <wtf/Vector.h>
-#if PLATFORM(CF)
+#if USE(CF)
#include <CoreFoundation/CFDictionary.h>
#endif
@@ -77,7 +77,7 @@ public:
PassRefPtr<ImmutableArray> backListAsImmutableArrayWithLimit(unsigned limit);
PassRefPtr<ImmutableArray> forwardListAsImmutableArrayWithLimit(unsigned limit);
-#if PLATFORM(CF)
+#if USE(CF)
CFDictionaryRef createCFDictionaryRepresentation(WebPageProxy::WebPageProxySessionStateFilterCallback, void* context) const;
bool restoreFromCFDictionaryRepresentation(CFDictionaryRef);
#endif
diff --git a/Source/WebKit2/UIProcess/WebContext.cpp b/Source/WebKit2/UIProcess/WebContext.cpp
index 5411a36..01b1e0c 100644
--- a/Source/WebKit2/UIProcess/WebContext.cpp
+++ b/Source/WebKit2/UIProcess/WebContext.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2010, 2011 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -33,19 +33,24 @@
#include "SandboxExtension.h"
#include "TextChecker.h"
#include "WKContextPrivate.h"
+#include "WebApplicationCacheManagerProxy.h"
#include "WebContextMessageKinds.h"
#include "WebContextUserMessageCoders.h"
+#include "WebCookieManagerProxy.h"
#include "WebCoreArgumentCoders.h"
#include "WebDatabaseManagerProxy.h"
#include "WebGeolocationManagerProxy.h"
+#include "WebKeyValueStorageManagerProxy.h"
+#include "WebPluginSiteDataManager.h"
#include "WebPageGroup.h"
#include "WebMemorySampler.h"
#include "WebProcessCreationParameters.h"
-#include "WebProcessManager.h"
#include "WebProcessMessages.h"
#include "WebProcessProxy.h"
+#include "WebResourceCacheManagerProxy.h"
#include <WebCore/Language.h>
#include <WebCore/LinkHash.h>
+#include <WebCore/Logging.h>
#include <wtf/CurrentTime.h>
#ifndef NDEBUG
@@ -83,7 +88,19 @@ PassRefPtr<WebContext> WebContext::create(const String& injectedBundlePath)
RunLoop::initializeMainRunLoop();
return adoptRef(new WebContext(ProcessModelSecondaryProcess, injectedBundlePath));
}
-
+
+static Vector<WebContext*>& contexts()
+{
+ DEFINE_STATIC_LOCAL(Vector<WebContext*>, contexts, ());
+
+ return contexts;
+}
+
+const Vector<WebContext*>& WebContext::allContexts()
+{
+ return contexts();
+}
+
WebContext::WebContext(ProcessModel processModel, const String& injectedBundlePath)
: m_processModel(processModel)
, m_defaultPageGroup(WebPageGroup::create())
@@ -95,14 +112,23 @@ WebContext::WebContext(ProcessModel processModel, const String& injectedBundlePa
, m_clearApplicationCacheForNewWebProcess(false)
, m_memorySamplerEnabled(false)
, m_memorySamplerInterval(1400.0)
+ , m_applicationCacheManagerProxy(WebApplicationCacheManagerProxy::create(this))
+ , m_cookieManagerProxy(WebCookieManagerProxy::create(this))
, m_databaseManagerProxy(WebDatabaseManagerProxy::create(this))
, m_geolocationManagerProxy(WebGeolocationManagerProxy::create(this))
+ , m_keyValueStorageManagerProxy(WebKeyValueStorageManagerProxy::create(this))
+ , m_pluginSiteDataManager(WebPluginSiteDataManager::create(this))
+ , m_resourceCacheManagerProxy(WebResourceCacheManagerProxy::create(this))
#if PLATFORM(WIN)
, m_shouldPaintNativeControls(true)
#endif
{
+ contexts().append(this);
+
addLanguageChangeObserver(this, languageChanged);
+ WebCore::InitializeLoggingChannelsIfNecessary();
+
#ifndef NDEBUG
webContextCounter.increment();
#endif
@@ -110,15 +136,31 @@ WebContext::WebContext(ProcessModel processModel, const String& injectedBundlePa
WebContext::~WebContext()
{
+ ASSERT(contexts().find(this) != notFound);
+ contexts().remove(contexts().find(this));
+
removeLanguageChangeObserver(this);
- WebProcessManager::shared().contextWasDestroyed(this);
+ m_applicationCacheManagerProxy->invalidate();
+ m_applicationCacheManagerProxy->clearContext();
+
+ m_cookieManagerProxy->invalidate();
+ m_cookieManagerProxy->clearContext();
m_geolocationManagerProxy->invalidate();
m_geolocationManagerProxy->clearContext();
m_databaseManagerProxy->invalidate();
m_databaseManagerProxy->clearContext();
+
+ m_keyValueStorageManagerProxy->invalidate();
+ m_keyValueStorageManagerProxy->clearContext();
+
+ m_pluginSiteDataManager->invalidate();
+ m_pluginSiteDataManager->clearContext();
+
+ m_resourceCacheManagerProxy->invalidate();
+ m_resourceCacheManagerProxy->clearContext();
#ifndef NDEBUG
webContextCounter.decrement();
@@ -163,7 +205,7 @@ void WebContext::ensureWebProcess()
if (m_process)
return;
- m_process = WebProcessManager::shared().getWebProcess(this);
+ m_process = WebProcessProxy::create(this);
WebProcessCreationParameters parameters;
@@ -197,6 +239,8 @@ void WebContext::ensureWebProcess()
parameters.textCheckerState = TextChecker::state();
+ parameters.defaultRequestTimeoutInterval = WebURLRequest::defaultTimeoutInterval();
+
// Add any platform specific parameters
platformInitializeWebProcess(parameters);
@@ -209,6 +253,20 @@ void WebContext::ensureWebProcess()
m_pendingMessagesToPostToInjectedBundle.clear();
}
+bool WebContext::shouldTerminate(WebProcessProxy* process)
+{
+ // FIXME: Once we support multiple processes per context, this assertion won't hold.
+ ASSERT(process == m_process);
+
+ if (!m_downloads.isEmpty())
+ return false;
+
+ if (!m_pluginSiteDataManager->shouldTerminate(process))
+ return false;
+
+ return true;
+}
+
void WebContext::processDidFinishLaunching(WebProcessProxy* process)
{
// FIXME: Once we support multiple processes per context, this assertion won't hold.
@@ -218,7 +276,7 @@ void WebContext::processDidFinishLaunching(WebProcessProxy* process)
// Sometimes the memorySampler gets initialized after process initialization has happened but before the process has finished launching
// so check if it needs to be started here
- if(m_memorySamplerEnabled) {
+ if (m_memorySamplerEnabled) {
SandboxExtension::Handle sampleLogSandboxHandle;
double now = WTF::currentTime();
String sampleLogFilePath = String::format("WebProcess%llu", static_cast<uint64_t>(now));
@@ -228,7 +286,7 @@ void WebContext::processDidFinishLaunching(WebProcessProxy* process)
}
}
-void WebContext::processDidClose(WebProcessProxy* process)
+void WebContext::disconnectProcess(WebProcessProxy* process)
{
// FIXME: Once we support multiple processes per context, this assertion won't hold.
ASSERT_UNUSED(process, process == m_process);
@@ -243,8 +301,18 @@ void WebContext::processDidClose(WebProcessProxy* process)
m_downloads.clear();
+ m_applicationCacheManagerProxy->invalidate();
+ m_cookieManagerProxy->invalidate();
m_databaseManagerProxy->invalidate();
m_geolocationManagerProxy->invalidate();
+ m_keyValueStorageManagerProxy->invalidate();
+ m_resourceCacheManagerProxy->invalidate();
+
+ // When out of process plug-ins are enabled, we don't want to invalidate the plug-in site data
+ // manager just because the web process crashes since it's not involved.
+#if !ENABLE(PLUGIN_PROCESS)
+ m_pluginSiteDataManager->invalidate();
+#endif
m_process = 0;
}
@@ -407,6 +475,14 @@ void WebContext::setCacheModel(CacheModel cacheModel)
m_process->send(Messages::WebProcess::SetCacheModel(static_cast<uint32_t>(m_cacheModel)), 0);
}
+void WebContext::setDefaultRequestTimeoutInterval(double timeoutInterval)
+{
+ if (!hasValidProcess())
+ return;
+
+ m_process->send(Messages::WebProcess::SetDefaultRequestTimeoutInterval(timeoutInterval), 0);
+}
+
void WebContext::addVisitedLink(const String& visitedURL)
{
if (visitedURL.isEmpty())
@@ -439,6 +515,18 @@ void WebContext::getPluginPath(const String& mimeType, const String& urlString,
pluginPath = plugin.path;
}
+#if !ENABLE(PLUGIN_PROCESS)
+void WebContext::didGetSitesWithPluginData(const Vector<String>& sites, uint64_t callbackID)
+{
+ m_pluginSiteDataManager->didGetSitesWithData(sites, callbackID);
+}
+
+void WebContext::didClearPluginSiteData(uint64_t callbackID)
+{
+ m_pluginSiteDataManager->didClearSiteData(callbackID);
+}
+#endif
+
uint64_t WebContext::createDownloadProxy()
{
RefPtr<DownloadProxy> downloadProxy = DownloadProxy::create(this);
@@ -483,6 +571,16 @@ void WebContext::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::Mes
return;
}
+ if (messageID.is<CoreIPC::MessageClassWebApplicationCacheManagerProxy>()) {
+ m_applicationCacheManagerProxy->didReceiveMessage(connection, messageID, arguments);
+ return;
+ }
+
+ if (messageID.is<CoreIPC::MessageClassWebCookieManagerProxy>()) {
+ m_cookieManagerProxy->didReceiveMessage(connection, messageID, arguments);
+ return;
+ }
+
if (messageID.is<CoreIPC::MessageClassWebDatabaseManagerProxy>()) {
m_databaseManagerProxy->didReceiveWebDatabaseManagerProxyMessage(connection, messageID, arguments);
return;
@@ -493,6 +591,16 @@ void WebContext::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::Mes
return;
}
+ if (messageID.is<CoreIPC::MessageClassWebKeyValueStorageManagerProxy>()) {
+ m_keyValueStorageManagerProxy->didReceiveMessage(connection, messageID, arguments);
+ return;
+ }
+
+ if (messageID.is<CoreIPC::MessageClassWebResourceCacheManagerProxy>()) {
+ m_resourceCacheManagerProxy->didReceiveWebResourceCacheManagerProxyMessage(connection, messageID, arguments);
+ return;
+ }
+
switch (messageID.get<WebContextLegacyMessage::Kind>()) {
case WebContextLegacyMessage::PostMessage: {
String messageName;
diff --git a/Source/WebKit2/UIProcess/WebContext.h b/Source/WebKit2/UIProcess/WebContext.h
index ebf1914..72cd5dc 100644
--- a/Source/WebKit2/UIProcess/WebContext.h
+++ b/Source/WebKit2/UIProcess/WebContext.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2010, 2011 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -45,10 +45,14 @@
namespace WebKit {
class DownloadProxy;
+class WebApplicationCacheManagerProxy;
+class WebCookieManagerProxy;
class WebDatabaseManagerProxy;
class WebGeolocationManagerProxy;
+class WebKeyValueStorageManagerProxy;
class WebPageGroup;
class WebPageProxy;
+class WebResourceCacheManagerProxy;
struct WebProcessCreationParameters;
class WebContext : public APIObject {
@@ -61,6 +65,8 @@ public:
static PassRefPtr<WebContext> create(const String& injectedBundlePath);
virtual ~WebContext();
+ static const Vector<WebContext*>& allContexts();
+
void initializeInjectedBundleClient(const WKContextInjectedBundleClient*);
void initializeHistoryClient(const WKContextHistoryClient*);
void initializeDownloadClient(const WKContextDownloadClient*);
@@ -70,7 +76,9 @@ public:
bool hasValidProcess() const { return m_process && m_process->isValid(); }
void processDidFinishLaunching(WebProcessProxy*);
- void processDidClose(WebProcessProxy*);
+
+ // Disconnect the process from the context.
+ void disconnectProcess(WebProcessProxy*);
WebPageProxy* createWebPage(PageClient*, WebPageGroup*);
@@ -112,7 +120,9 @@ public:
CacheModel cacheModel() const { return m_cacheModel; }
void clearResourceCaches();
void clearApplicationCache();
-
+
+ void setDefaultRequestTimeoutInterval(double);
+
void startMemorySampler(const double interval);
void stopMemorySampler();
@@ -127,8 +137,13 @@ public:
static HashSet<String, CaseFoldingHash> pdfAndPostScriptMIMETypes();
+ WebApplicationCacheManagerProxy* applicationCacheManagerProxy() const { return m_applicationCacheManagerProxy.get(); }
+ WebCookieManagerProxy* cookieManagerProxy() const { return m_cookieManagerProxy.get(); }
WebDatabaseManagerProxy* databaseManagerProxy() const { return m_databaseManagerProxy.get(); }
WebGeolocationManagerProxy* geolocationManagerProxy() const { return m_geolocationManagerProxy.get(); }
+ WebKeyValueStorageManagerProxy* keyValueStorageManagerProxy() const { return m_keyValueStorageManagerProxy.get(); }
+ WebPluginSiteDataManager* pluginSiteDataManager() const { return m_pluginSiteDataManager.get(); }
+ WebResourceCacheManagerProxy* resourceCacheManagerProxy() const { return m_resourceCacheManagerProxy.get(); }
struct Statistics {
unsigned wkViewCount;
@@ -139,12 +154,15 @@ public:
void setDatabaseDirectory(const String& dir) { m_overrideDatabaseDirectory = dir; }
+ void ensureWebProcess();
+
+ bool shouldTerminate(WebProcessProxy*);
+
private:
WebContext(ProcessModel, const String& injectedBundlePath);
virtual Type type() const { return APIType; }
- void ensureWebProcess();
void platformInitializeWebProcess(WebProcessCreationParameters&);
// History client
@@ -156,7 +174,11 @@ private:
// Plugins
void getPlugins(bool refresh, Vector<WebCore::PluginInfo>& plugins);
void getPluginPath(const String& mimeType, const String& urlString, String& pluginPath);
-
+#if !ENABLE(PLUGIN_PROCESS)
+ void didGetSitesWithPluginData(const Vector<String>& sites, uint64_t callbackID);
+ void didClearPluginSiteData(uint64_t callbackID);
+#endif
+
// Implemented in generated WebContextMessageReceiver.cpp
void didReceiveWebContextMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
CoreIPC::SyncReplyMode didReceiveSyncWebContextMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*, CoreIPC::ArgumentEncoder*);
@@ -202,8 +224,13 @@ private:
bool m_memorySamplerEnabled;
double m_memorySamplerInterval;
+ RefPtr<WebApplicationCacheManagerProxy> m_applicationCacheManagerProxy;
+ RefPtr<WebCookieManagerProxy> m_cookieManagerProxy;
RefPtr<WebDatabaseManagerProxy> m_databaseManagerProxy;
RefPtr<WebGeolocationManagerProxy> m_geolocationManagerProxy;
+ RefPtr<WebKeyValueStorageManagerProxy> m_keyValueStorageManagerProxy;
+ RefPtr<WebPluginSiteDataManager> m_pluginSiteDataManager;
+ RefPtr<WebResourceCacheManagerProxy> m_resourceCacheManagerProxy;
#if PLATFORM(WIN)
bool m_shouldPaintNativeControls;
diff --git a/Source/WebKit2/UIProcess/WebContext.messages.in b/Source/WebKit2/UIProcess/WebContext.messages.in
index dc15de2..a086813 100644
--- a/Source/WebKit2/UIProcess/WebContext.messages.in
+++ b/Source/WebKit2/UIProcess/WebContext.messages.in
@@ -35,4 +35,9 @@ messages -> WebContext {
GetPlugins(bool refresh) -> (Vector<WebCore::PluginInfo> plugins)
GetPluginPath(WTF::String mimeType, WTF::String urlString) -> (WTF::String pluginPath)
+#if !ENABLE(PLUGIN_PROCESS)
+ void DidGetSitesWithPluginData(Vector<WTF::String> sites, uint64_t callbackID)
+ void DidClearPluginSiteData(uint64_t callbackID)
+#endif
+
}
diff --git a/Source/WebKit2/UIProcess/WebCookieManagerProxy.cpp b/Source/WebKit2/UIProcess/WebCookieManagerProxy.cpp
new file mode 100644
index 0000000..c56374c
--- /dev/null
+++ b/Source/WebKit2/UIProcess/WebCookieManagerProxy.cpp
@@ -0,0 +1,134 @@
+/*
+ * Copyright (C) 2011 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WebCookieManagerProxy.h"
+
+#include "SecurityOriginData.h"
+#include "WebCookieManagerMessages.h"
+#include "WebContext.h"
+#include "WebSecurityOrigin.h"
+
+namespace WebKit {
+
+PassRefPtr<WebCookieManagerProxy> WebCookieManagerProxy::create(WebContext* context)
+{
+ return adoptRef(new WebCookieManagerProxy(context));
+}
+
+WebCookieManagerProxy::WebCookieManagerProxy(WebContext* context)
+ : m_webContext(context)
+{
+}
+
+WebCookieManagerProxy::~WebCookieManagerProxy()
+{
+}
+
+void WebCookieManagerProxy::invalidate()
+{
+ invalidateCallbackMap(m_arrayCallbacks);
+}
+
+void WebCookieManagerProxy::initializeClient(const WKCookieManagerClient* client)
+{
+ m_client.initialize(client);
+}
+
+void WebCookieManagerProxy::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments)
+{
+ didReceiveWebCookieManagerProxyMessage(connection, messageID, arguments);
+}
+
+void WebCookieManagerProxy::getHostnamesWithCookies(PassRefPtr<ArrayCallback> prpCallback)
+{
+ ASSERT(m_webContext);
+
+ RefPtr<ArrayCallback> callback = prpCallback;
+ if (!m_webContext->hasValidProcess()) {
+ callback->invalidate();
+ return;
+ }
+
+ uint64_t callbackID = callback->callbackID();
+ m_arrayCallbacks.set(callbackID, callback.release());
+ m_webContext->process()->send(Messages::WebCookieManager::GetHostnamesWithCookies(callbackID), 0);
+}
+
+void WebCookieManagerProxy::didGetHostnamesWithCookies(const Vector<String>& hostnameList, uint64_t callbackID)
+{
+ RefPtr<ArrayCallback> callback = m_arrayCallbacks.take(callbackID);
+ if (!callback) {
+ // FIXME: Log error or assert.
+ return;
+ }
+
+ size_t hostnameCount = hostnameList.size();
+ Vector<RefPtr<APIObject> > hostnames(hostnameCount);
+
+ for (size_t i = 0; i < hostnameCount; ++i)
+ hostnames[i] = WebString::create(hostnameList[i]);
+
+ callback->performCallbackWithReturnValue(ImmutableArray::adopt(hostnames).get());
+}
+
+void WebCookieManagerProxy::deleteCookiesForHostname(const String& hostname)
+{
+ ASSERT(m_webContext);
+ if (!m_webContext->hasValidProcess())
+ return;
+ m_webContext->process()->send(Messages::WebCookieManager::DeleteCookiesForHostname(hostname), 0);
+}
+
+void WebCookieManagerProxy::deleteAllCookies()
+{
+ ASSERT(m_webContext);
+ if (!m_webContext->hasValidProcess())
+ return;
+ m_webContext->process()->send(Messages::WebCookieManager::DeleteAllCookies(), 0);
+}
+
+void WebCookieManagerProxy::startObservingCookieChanges()
+{
+ ASSERT(m_webContext);
+ if (!m_webContext->hasValidProcess())
+ return;
+ m_webContext->process()->send(Messages::WebCookieManager::StartObservingCookieChanges(), 0);
+}
+
+void WebCookieManagerProxy::stopObservingCookieChanges()
+{
+ ASSERT(m_webContext);
+ if (!m_webContext->hasValidProcess())
+ return;
+ m_webContext->process()->send(Messages::WebCookieManager::StopObservingCookieChanges(), 0);
+}
+
+void WebCookieManagerProxy::cookiesDidChange()
+{
+ m_client.cookiesDidChange(this);
+}
+
+} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/WebCookieManagerProxy.h b/Source/WebKit2/UIProcess/WebCookieManagerProxy.h
new file mode 100644
index 0000000..9d63265
--- /dev/null
+++ b/Source/WebKit2/UIProcess/WebCookieManagerProxy.h
@@ -0,0 +1,89 @@
+/*
+ * Copyright (C) 2011 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WebCookieManagerProxy_h
+#define WebCookieManagerProxy_h
+
+#include "APIObject.h"
+#include "GenericCallback.h"
+#include "ImmutableArray.h"
+#include "WebCookieManagerProxyClient.h"
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefPtr.h>
+#include <wtf/Vector.h>
+
+namespace CoreIPC {
+ class ArgumentDecoder;
+ class Connection;
+ class MessageID;
+}
+
+namespace WebKit {
+
+class WebContext;
+
+typedef GenericCallback<WKArrayRef> ArrayCallback;
+
+class WebCookieManagerProxy : public APIObject {
+public:
+ static const Type APIType = TypeCookieManager;
+
+ static PassRefPtr<WebCookieManagerProxy> create(WebContext*);
+ virtual ~WebCookieManagerProxy();
+
+ void invalidate();
+ void clearContext() { m_webContext = 0; }
+
+ void initializeClient(const WKCookieManagerClient*);
+
+ void getHostnamesWithCookies(PassRefPtr<ArrayCallback>);
+ void deleteCookiesForHostname(const String& hostname);
+ void deleteAllCookies();
+
+ void startObservingCookieChanges();
+ void stopObservingCookieChanges();
+
+ void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
+
+private:
+ WebCookieManagerProxy(WebContext*);
+
+ virtual Type type() const { return APIType; }
+
+ void didGetHostnamesWithCookies(const Vector<String>&, uint64_t callbackID);
+
+ void cookiesDidChange();
+
+ void didReceiveWebCookieManagerProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
+
+ WebContext* m_webContext;
+ HashMap<uint64_t, RefPtr<ArrayCallback> > m_arrayCallbacks;
+
+ WebCookieManagerProxyClient m_client;
+};
+
+} // namespace WebKit
+
+#endif // WebCookieManagerProxy_h
diff --git a/Source/WebKit2/UIProcess/WebCookieManagerProxy.messages.in b/Source/WebKit2/UIProcess/WebCookieManagerProxy.messages.in
new file mode 100644
index 0000000..808b4c7
--- /dev/null
+++ b/Source/WebKit2/UIProcess/WebCookieManagerProxy.messages.in
@@ -0,0 +1,27 @@
+# Copyright (C) 2011 Apple Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+messages -> WebCookieManagerProxy {
+ DidGetHostnamesWithCookies(Vector<WTF::String> hostnames, uint64_t callbackID);
+
+ CookiesDidChange()
+}
diff --git a/Source/WebKit2/UIProcess/WebCookieManagerProxyClient.cpp b/Source/WebKit2/UIProcess/WebCookieManagerProxyClient.cpp
new file mode 100644
index 0000000..da5512d
--- /dev/null
+++ b/Source/WebKit2/UIProcess/WebCookieManagerProxyClient.cpp
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2011 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WebCookieManagerProxyClient.h"
+
+#include "WKAPICast.h"
+
+namespace WebKit {
+
+void WebCookieManagerProxyClient::cookiesDidChange(WebCookieManagerProxy* cookieManager)
+{
+ if (!m_client.cookiesDidChange)
+ return;
+
+ m_client.cookiesDidChange(toAPI(cookieManager), m_client.clientInfo);
+}
+
+} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/WebCookieManagerProxyClient.h b/Source/WebKit2/UIProcess/WebCookieManagerProxyClient.h
new file mode 100644
index 0000000..aea6bf9
--- /dev/null
+++ b/Source/WebKit2/UIProcess/WebCookieManagerProxyClient.h
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2011 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WebCookieManagerProxyClient_h
+#define WebCookieManagerProxyClient_h
+
+#include "APIClient.h"
+#include "WKCookieManager.h"
+#include <wtf/Forward.h>
+
+namespace WebKit {
+
+class WebCookieManagerProxy;
+
+class WebCookieManagerProxyClient : public APIClient<WKCookieManagerClient> {
+public:
+ void cookiesDidChange(WebCookieManagerProxy*);
+};
+
+} // namespace WebKit
+
+#endif // WebCookieManagerProxyClient_h
diff --git a/Source/WebKit2/UIProcess/WebInspectorProxy.cpp b/Source/WebKit2/UIProcess/WebInspectorProxy.cpp
index 2b282a1..b971315 100644
--- a/Source/WebKit2/UIProcess/WebInspectorProxy.cpp
+++ b/Source/WebKit2/UIProcess/WebInspectorProxy.cpp
@@ -38,8 +38,7 @@
#include "WebView.h"
#endif
-#define DISABLE_NOT_IMPLEMENTED_WARNINGS 1
-#include "NotImplemented.h"
+#include <WebCore/NotImplemented.h>
using namespace WebCore;
@@ -196,6 +195,11 @@ void WebInspectorProxy::didClose()
m_isVisible = false;
}
+void WebInspectorProxy::inspectedURLChanged(const String& urlString)
+{
+ platformInspectedURLChanged(urlString);
+}
+
} // namespace WebKit
#endif // ENABLE(INSPECTOR)
diff --git a/Source/WebKit2/UIProcess/WebInspectorProxy.h b/Source/WebKit2/UIProcess/WebInspectorProxy.h
index ac618c6..715b27d 100644
--- a/Source/WebKit2/UIProcess/WebInspectorProxy.h
+++ b/Source/WebKit2/UIProcess/WebInspectorProxy.h
@@ -103,6 +103,7 @@ private:
WebPageProxy* platformCreateInspectorPage();
void platformOpen();
void platformClose();
+ void platformInspectedURLChanged(const String&);
// Implemented the platform WebInspectorProxy file
String inspectorPageURL() const;
@@ -111,6 +112,7 @@ private:
void createInspectorPage(uint64_t& inspectorPageID, WebPageCreationParameters&);
void didLoadInspectorPage();
void didClose();
+ void inspectedURLChanged(const String&);
static WebPageGroup* inspectorPageGroup();
diff --git a/Source/WebKit2/UIProcess/WebInspectorProxy.messages.in b/Source/WebKit2/UIProcess/WebInspectorProxy.messages.in
index cc10248..5f452b4 100644
--- a/Source/WebKit2/UIProcess/WebInspectorProxy.messages.in
+++ b/Source/WebKit2/UIProcess/WebInspectorProxy.messages.in
@@ -26,6 +26,7 @@ messages -> WebInspectorProxy {
CreateInspectorPage() -> (uint64_t inspectorPageID, WebKit::WebPageCreationParameters inspectorPageParameters)
DidLoadInspectorPage()
DidClose()
+ InspectedURLChanged(WTF::String urlString)
}
#endif
diff --git a/Source/WebKit2/UIProcess/WebKeyValueStorageManagerProxy.cpp b/Source/WebKit2/UIProcess/WebKeyValueStorageManagerProxy.cpp
new file mode 100644
index 0000000..dafa613
--- /dev/null
+++ b/Source/WebKit2/UIProcess/WebKeyValueStorageManagerProxy.cpp
@@ -0,0 +1,100 @@
+/*
+ * Copyright (C) 2011 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WebKeyValueStorageManagerProxy.h"
+
+#include "SecurityOriginData.h"
+#include "WebKeyValueStorageManagerMessages.h"
+#include "WebContext.h"
+#include "WebSecurityOrigin.h"
+
+namespace WebKit {
+
+PassRefPtr<WebKeyValueStorageManagerProxy> WebKeyValueStorageManagerProxy::create(WebContext* context)
+{
+ return adoptRef(new WebKeyValueStorageManagerProxy(context));
+}
+
+WebKeyValueStorageManagerProxy::WebKeyValueStorageManagerProxy(WebContext* context)
+ : m_webContext(context)
+{
+}
+
+WebKeyValueStorageManagerProxy::~WebKeyValueStorageManagerProxy()
+{
+}
+
+void WebKeyValueStorageManagerProxy::invalidate()
+{
+ invalidateCallbackMap(m_arrayCallbacks);
+}
+
+void WebKeyValueStorageManagerProxy::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments)
+{
+ didReceiveWebKeyValueStorageManagerProxyMessage(connection, messageID, arguments);
+}
+
+void WebKeyValueStorageManagerProxy::getKeyValueStorageOrigins(PassRefPtr<ArrayCallback> prpCallback)
+{
+ RefPtr<ArrayCallback> callback = prpCallback;
+ if (!m_webContext->hasValidProcess()) {
+ callback->invalidate();
+ return;
+ }
+
+ uint64_t callbackID = callback->callbackID();
+ m_arrayCallbacks.set(callbackID, callback.release());
+ m_webContext->process()->send(Messages::WebKeyValueStorageManager::GetKeyValueStorageOrigins(callbackID), 0);
+}
+
+void WebKeyValueStorageManagerProxy::didGetKeyValueStorageOrigins(const Vector<SecurityOriginData>& originDatas, uint64_t callbackID)
+{
+ RefPtr<ArrayCallback> callback = m_arrayCallbacks.take(callbackID);
+ performAPICallbackWithSecurityOriginDataVector(originDatas, callback.get());
+}
+
+void WebKeyValueStorageManagerProxy::deleteEntriesForOrigin(WebSecurityOrigin* origin)
+{
+ if (!m_webContext->hasValidProcess())
+ return;
+
+ SecurityOriginData securityOriginData;
+ securityOriginData.protocol = origin->protocol();
+ securityOriginData.host = origin->host();
+ securityOriginData.port = origin->port();
+
+ m_webContext->process()->send(Messages::WebKeyValueStorageManager::DeleteEntriesForOrigin(securityOriginData), 0);
+}
+
+void WebKeyValueStorageManagerProxy::deleteAllEntries()
+{
+ if (!m_webContext->hasValidProcess())
+ return;
+
+ m_webContext->process()->send(Messages::WebKeyValueStorageManager::DeleteAllEntries(), 0);
+}
+
+} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/WebKeyValueStorageManagerProxy.h b/Source/WebKit2/UIProcess/WebKeyValueStorageManagerProxy.h
new file mode 100644
index 0000000..1c5ea3a
--- /dev/null
+++ b/Source/WebKit2/UIProcess/WebKeyValueStorageManagerProxy.h
@@ -0,0 +1,82 @@
+/*
+ * Copyright (C) 2011 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WebKeyValueStorageManagerProxy_h
+#define WebKeyValueStorageManagerProxy_h
+
+#include "APIObject.h"
+#include "GenericCallback.h"
+#include "ImmutableArray.h"
+
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefPtr.h>
+#include <wtf/Vector.h>
+
+namespace CoreIPC {
+ class ArgumentDecoder;
+ class Connection;
+ class MessageID;
+}
+
+namespace WebKit {
+
+struct SecurityOriginData;
+class WebContext;
+class WebSecurityOrigin;
+
+typedef GenericCallback<WKArrayRef> ArrayCallback;
+
+class WebKeyValueStorageManagerProxy : public APIObject {
+public:
+ static const Type APIType = TypeKeyValueStorageManager;
+
+ static PassRefPtr<WebKeyValueStorageManagerProxy> create(WebContext*);
+ virtual ~WebKeyValueStorageManagerProxy();
+
+ void invalidate();
+ void clearContext() { m_webContext = 0; }
+
+ void getKeyValueStorageOrigins(PassRefPtr<ArrayCallback>);
+ void deleteEntriesForOrigin(WebSecurityOrigin*);
+ void deleteAllEntries();
+
+ void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
+
+private:
+ WebKeyValueStorageManagerProxy(WebContext*);
+
+ virtual Type type() const { return APIType; }
+
+ void didGetKeyValueStorageOrigins(const Vector<SecurityOriginData>&, uint64_t callbackID);
+
+ void didReceiveWebKeyValueStorageManagerProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
+
+ WebContext* m_webContext;
+ HashMap<uint64_t, RefPtr<ArrayCallback> > m_arrayCallbacks;
+};
+
+} // namespace WebKit
+
+#endif // WebKeyValueStorageManagerProxy_h
diff --git a/Source/WebKit2/UIProcess/WebKeyValueStorageManagerProxy.messages.in b/Source/WebKit2/UIProcess/WebKeyValueStorageManagerProxy.messages.in
new file mode 100644
index 0000000..b76389a
--- /dev/null
+++ b/Source/WebKit2/UIProcess/WebKeyValueStorageManagerProxy.messages.in
@@ -0,0 +1,25 @@
+# Copyright (C) 2011 Apple Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+messages -> WebKeyValueStorageManagerProxy {
+ DidGetKeyValueStorageOrigins(Vector<WebKit::SecurityOriginData> originIdentifiers, uint64_t callbackID);
+}
diff --git a/Source/WebKit2/UIProcess/WebLoaderClient.cpp b/Source/WebKit2/UIProcess/WebLoaderClient.cpp
index 96adb85..8d7d6f8 100644
--- a/Source/WebKit2/UIProcess/WebLoaderClient.cpp
+++ b/Source/WebKit2/UIProcess/WebLoaderClient.cpp
@@ -223,4 +223,12 @@ void WebLoaderClient::didChangeBackForwardList(WebPageProxy* page, WebBackForwar
m_client.didChangeBackForwardList(toAPI(page), toAPI(addedItem), toAPI(removedItemsArray.get()), m_client.clientInfo);
}
+bool WebLoaderClient::shouldGoToBackForwardListItem(WebPageProxy* page, WebBackForwardListItem* item)
+{
+ if (!m_client.shouldGoToBackForwardListItem)
+ return true;
+
+ return m_client.shouldGoToBackForwardListItem(toAPI(page), toAPI(item), m_client.clientInfo);
+}
+
} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/WebLoaderClient.h b/Source/WebKit2/UIProcess/WebLoaderClient.h
index 6600876..eb5d568 100644
--- a/Source/WebKit2/UIProcess/WebLoaderClient.h
+++ b/Source/WebKit2/UIProcess/WebLoaderClient.h
@@ -77,6 +77,7 @@ public:
void processDidCrash(WebPageProxy*);
void didChangeBackForwardList(WebPageProxy*, WebBackForwardListItem* addedItem, Vector<RefPtr<APIObject> >* removedItems);
+ bool shouldGoToBackForwardListItem(WebPageProxy*, WebBackForwardListItem*);
};
} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/WebPageGroup.cpp b/Source/WebKit2/UIProcess/WebPageGroup.cpp
index aa4cfb7..f64dd2c 100644
--- a/Source/WebKit2/UIProcess/WebPageGroup.cpp
+++ b/Source/WebKit2/UIProcess/WebPageGroup.cpp
@@ -43,7 +43,7 @@ typedef HashMap<uint64_t, WebPageGroup*> WebPageGroupMap;
static WebPageGroupMap& webPageGroupMap()
{
- static WebPageGroupMap map;
+ DEFINE_STATIC_LOCAL(WebPageGroupMap, map, ());
return map;
}
diff --git a/Source/WebKit2/UIProcess/WebPageProxy.cpp b/Source/WebKit2/UIProcess/WebPageProxy.cpp
index 2582547..3813a39 100644
--- a/Source/WebKit2/UIProcess/WebPageProxy.cpp
+++ b/Source/WebKit2/UIProcess/WebPageProxy.cpp
@@ -60,12 +60,21 @@
#include "WebPopupItem.h"
#include "WebPopupMenuProxy.h"
#include "WebPreferences.h"
-#include "WebProcessManager.h"
#include "WebProcessMessages.h"
#include "WebProcessProxy.h"
#include "WebProtectionSpace.h"
#include "WebSecurityOrigin.h"
#include "WebURLRequest.h"
+#include <WebCore/DragData.h>
+#include <WebCore/FloatRect.h>
+#include <WebCore/MIMETypeRegistry.h>
+#include <WebCore/WindowFeatures.h>
+#include <stdio.h>
+
+#if PLATFORM(MAC)
+#include "DictionaryPopupInfo.h"
+#endif
+
#if PLATFORM(WIN)
#include "WebDragSource.h"
#include <WebCore/BitmapInfo.h>
@@ -73,11 +82,6 @@
#include <WebCore/WCDataObject.h>
#include <shlobj.h>
#endif
-#include <WebCore/DragData.h>
-#include <WebCore/FloatRect.h>
-#include <WebCore/MIMETypeRegistry.h>
-#include <WebCore/WindowFeatures.h>
-#include <stdio.h>
#ifndef NDEBUG
#include <wtf/RefCountedLeakCounter.h>
@@ -92,6 +96,8 @@ using namespace WebCore;
namespace WebKit {
+WKPageDebugPaintFlags WebPageProxy::s_debugPaintFlags = 0;
+
#ifndef NDEBUG
static WTF::RefCountedLeakCounter webPageProxyCounter("WebPageProxy");
#endif
@@ -117,6 +123,7 @@ WebPageProxy::WebPageProxy(PageClient* pageClient, WebContext* context, WebPageG
, m_viewScaleFactor(1)
, m_drawsBackground(true)
, m_drawsTransparentBackground(false)
+ , m_areMemoryCacheClientCallsEnabled(true)
, m_useFixedLayout(false)
, m_isValid(true)
, m_isClosed(false)
@@ -129,6 +136,7 @@ WebPageProxy::WebPageProxy(PageClient* pageClient, WebContext* context, WebPageG
, m_inDecidePolicyForNavigationAction(false)
, m_syncNavigationActionPolicyActionIsValid(false)
, m_syncNavigationActionPolicyAction(PolicyUse)
+ , m_syncNavigationActionPolicyDownloadID(0)
, m_processingWheelEvent(false)
, m_processingMouseMoveEvent(false)
, m_pageID(pageID)
@@ -142,6 +150,8 @@ WebPageProxy::WebPageProxy(PageClient* pageClient, WebContext* context, WebPageG
, m_currentDragOperation(DragOperationNone)
, m_mainFrameHasHorizontalScrollbar(false)
, m_mainFrameHasVerticalScrollbar(false)
+ , m_mainFrameIsPinnedToLeftSide(false)
+ , m_mainFrameIsPinnedToRightSide(false)
{
#ifndef NDEBUG
webPageProxyCounter.increment();
@@ -211,6 +221,9 @@ void WebPageProxy::initializeResourceLoadClient(const WKPageResourceLoadClient*
void WebPageProxy::initializeUIClient(const WKPageUIClient* client)
{
m_uiClient.initialize(client);
+
+ process()->send(Messages::WebPage::SetCanRunBeforeUnloadConfirmPanel(m_uiClient.canRunBeforeUnloadConfirmPanel()), m_pageID);
+ process()->send(Messages::WebPage::SetCanRunModal(m_uiClient.canRunModal()), m_pageID);
}
void WebPageProxy::initializeFindClient(const WKPageFindClient* client)
@@ -296,9 +309,13 @@ void WebPageProxy::close()
m_mainFrameHasHorizontalScrollbar = false;
m_mainFrameHasVerticalScrollbar = false;
+ m_mainFrameIsPinnedToLeftSide = false;
+ m_mainFrameIsPinnedToRightSide = false;
+
invalidateCallbackMap(m_voidCallbacks);
invalidateCallbackMap(m_dataCallbacks);
invalidateCallbackMap(m_stringCallbacks);
+ invalidateCallbackMap(m_scriptValueCallbacks);
invalidateCallbackMap(m_computedPagesCallbacks);
Vector<WebEditCommandProxy*> editCommandVector;
@@ -466,6 +483,8 @@ void WebPageProxy::goToBackForwardItem(WebBackForwardListItem* item)
reattachToWebProcessWithItem(item);
return;
}
+
+ setPendingAPIRequestURL(item->url());
SandboxExtension::Handle sandboxExtensionHandle;
initializeSandboxExtensionHandle(KURL(KURL(), item->url()), sandboxExtensionHandle);
@@ -477,6 +496,11 @@ void WebPageProxy::didChangeBackForwardList(WebBackForwardListItem* added, Vecto
m_loaderClient.didChangeBackForwardList(this, added, removed);
}
+void WebPageProxy::shouldGoToBackForwardListItem(uint64_t itemID, bool& shouldGoToBackForwardItem)
+{
+ WebBackForwardListItem* item = process()->webBackForwardItem(itemID);
+ shouldGoToBackForwardItem = item && m_loaderClient.shouldGoToBackForwardListItem(this, item);
+}
bool WebPageProxy::canShowMIMEType(const String& mimeType) const
{
@@ -589,11 +613,16 @@ void WebPageProxy::setWindowResizerSize(const IntSize& windowResizerSize)
process()->send(Messages::WebPage::SetWindowResizerSize(windowResizerSize), m_pageID);
}
-void WebPageProxy::validateMenuItem(const String& commandName)
+void WebPageProxy::validateCommand(const String& commandName, PassRefPtr<ValidateCommandCallback> callback)
{
- if (!isValid())
+ if (!isValid()) {
+ callback->invalidate();
return;
- process()->send(Messages::WebPage::ValidateMenuItem(commandName), m_pageID);
+ }
+
+ uint64_t callbackID = callback->callbackID();
+ m_validateCommandCallbacks.set(callbackID, callback.get());
+ process()->send(Messages::WebPage::ValidateCommand(commandName, callbackID), m_pageID);
}
void WebPageProxy::executeEditCommand(const String& commandName)
@@ -638,6 +667,14 @@ WebCore::IntRect WebPageProxy::firstRectForCharacterRange(uint64_t location, uin
process()->sendSync(Messages::WebPage::FirstRectForCharacterRange(location, length), Messages::WebPage::FirstRectForCharacterRange::Reply(resultRect), m_pageID);
return resultRect;
}
+
+bool WebPageProxy::writeSelectionToPasteboard(const String& pasteboardName, const Vector<String>& pasteboardTypes)
+{
+ bool result;
+ const double MessageTimeout = 20;
+ process()->sendSync(Messages::WebPage::WriteSelectionToPasteboard(pasteboardName, pasteboardTypes), Messages::WebPage::WriteSelectionToPasteboard::Reply(result), m_pageID, MessageTimeout);
+ return result;
+}
#elif PLATFORM(WIN)
WebCore::IntRect WebPageProxy::firstRectForCharacterInSelectedRange(int characterPosition)
{
@@ -868,6 +905,7 @@ void WebPageProxy::receivedPolicyDecision(PolicyAction action, WebFrameProxy* fr
if (m_inDecidePolicyForNavigationAction) {
m_syncNavigationActionPolicyActionIsValid = true;
m_syncNavigationActionPolicyAction = action;
+ m_syncNavigationActionPolicyDownloadID = downloadID;
return;
}
@@ -946,7 +984,7 @@ void WebPageProxy::terminateProcess()
process()->terminate();
}
-#if !PLATFORM(CF) || defined(BUILDING_QT__)
+#if !USE(CF) || defined(BUILDING_QT__)
PassRefPtr<WebData> WebPageProxy::sessionStateData(WebPageProxySessionStateFilterCallback, void* context) const
{
// FIXME: Return session state data for saving Page state.
@@ -1065,6 +1103,15 @@ void WebPageProxy::viewScaleFactorDidChange(double scaleFactor)
m_viewScaleFactor = scaleFactor;
}
+void WebPageProxy::setMemoryCacheClientCallsEnabled(bool memoryCacheClientCallsEnabled)
+{
+ if (m_areMemoryCacheClientCallsEnabled == memoryCacheClientCallsEnabled)
+ return;
+
+ m_areMemoryCacheClientCallsEnabled = memoryCacheClientCallsEnabled;
+ process()->send(Messages::WebPage::SetMemoryCacheMessagesEnabled(memoryCacheClientCallsEnabled), m_pageID);
+}
+
void WebPageProxy::findString(const String& string, FindOptions options, unsigned maxMatchCount)
{
process()->send(Messages::WebPage::FindString(string, options, maxMatchCount), m_pageID);
@@ -1079,12 +1126,12 @@ void WebPageProxy::countStringMatches(const String& string, FindOptions options,
{
process()->send(Messages::WebPage::CountStringMatches(string, options, maxMatchCount), m_pageID);
}
-
-void WebPageProxy::runJavaScriptInMainFrame(const String& script, PassRefPtr<StringCallback> prpCallback)
+
+void WebPageProxy::runJavaScriptInMainFrame(const String& script, PassRefPtr<ScriptValueCallback> prpCallback)
{
- RefPtr<StringCallback> callback = prpCallback;
+ RefPtr<ScriptValueCallback> callback = prpCallback;
uint64_t callbackID = callback->callbackID();
- m_stringCallbacks.set(callbackID, callback.get());
+ m_scriptValueCallbacks.set(callbackID, callback.get());
process()->send(Messages::WebPage::RunJavaScriptInMainFrame(script, callbackID), m_pageID);
}
@@ -1158,6 +1205,16 @@ void WebPageProxy::forceRepaint(PassRefPtr<VoidCallback> prpCallback)
process()->send(Messages::WebPage::ForceRepaint(callbackID), m_pageID);
}
+#if PLATFORM(MAC)
+void WebPageProxy::performDictionaryLookupAtLocation(const WebCore::FloatPoint& point)
+{
+ if (!isValid())
+ return;
+
+ process()->send(Messages::WebPage::PerformDictionaryLookupAtLocation(point), m_pageID);
+}
+#endif
+
void WebPageProxy::preferencesDidChange()
{
if (!isValid())
@@ -1166,7 +1223,9 @@ void WebPageProxy::preferencesDidChange()
// FIXME: It probably makes more sense to send individual preference changes.
// However, WebKitTestRunner depends on getting a preference change notification
// even if nothing changed in UI process, so that overrides get removed.
- process()->send(Messages::WebPage::PreferencesDidChange(pageGroup()->preferences()->store()), m_pageID);
+
+ // Preferences need to be updated during synchronous printing to make "print backgrounds" preference work when toggled from a print dialog checkbox.
+ process()->send(Messages::WebPage::PreferencesDidChange(pageGroup()->preferences()->store()), m_pageID, m_isPerformingDOMPrintOperation ? CoreIPC::DispatchMessageEvenWhenWaitingForSyncReply : 0);
}
#if ENABLE(TILED_BACKING_STORE)
@@ -1203,11 +1262,6 @@ void WebPageProxy::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::M
void WebPageProxy::didReceiveSyncMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments, CoreIPC::ArgumentEncoder* reply)
{
- if (messageID.is<CoreIPC::MessageClassDrawingAreaProxyLegacy>()) {
- m_drawingArea->didReceiveSyncMessage(connection, messageID, arguments, reply);
- return;
- }
-
#if ENABLE(INSPECTOR)
if (messageID.is<CoreIPC::MessageClassWebInspectorProxy>()) {
if (WebInspectorProxy* inspector = this->inspector())
@@ -1548,7 +1602,7 @@ void WebPageProxy::frameDidBecomeFrameSet(uint64_t frameID, bool value)
}
// PolicyClient
-void WebPageProxy::decidePolicyForNavigationAction(uint64_t frameID, uint32_t opaqueNavigationType, uint32_t opaqueModifiers, int32_t opaqueMouseButton, const ResourceRequest& request, uint64_t listenerID, CoreIPC::ArgumentDecoder* arguments, bool& receivedPolicyAction, uint64_t& policyAction)
+void WebPageProxy::decidePolicyForNavigationAction(uint64_t frameID, uint32_t opaqueNavigationType, uint32_t opaqueModifiers, int32_t opaqueMouseButton, const ResourceRequest& request, uint64_t listenerID, CoreIPC::ArgumentDecoder* arguments, bool& receivedPolicyAction, uint64_t& policyAction, uint64_t& downloadID)
{
RefPtr<APIObject> userData;
WebContextUserMessageDecoder messageDecoder(userData, context());
@@ -1578,9 +1632,10 @@ void WebPageProxy::decidePolicyForNavigationAction(uint64_t frameID, uint32_t op
m_inDecidePolicyForNavigationAction = false;
// Check if we received a policy decision already. If we did, we can just pass it back.
+ receivedPolicyAction = m_syncNavigationActionPolicyActionIsValid;
if (m_syncNavigationActionPolicyActionIsValid) {
- receivedPolicyAction = true;
policyAction = m_syncNavigationActionPolicyAction;
+ downloadID = m_syncNavigationActionPolicyDownloadID;
}
}
@@ -1603,7 +1658,7 @@ void WebPageProxy::decidePolicyForNewWindowAction(uint64_t frameID, uint32_t opa
listener->use();
}
-void WebPageProxy::decidePolicyForMIMEType(uint64_t frameID, const String& MIMEType, const ResourceRequest& request, uint64_t listenerID, CoreIPC::ArgumentDecoder* arguments, bool& receivedPolicyAction, uint64_t& policyAction, uint64_t& downloadID)
+void WebPageProxy::decidePolicyForResponse(uint64_t frameID, const ResourceResponse& response, const ResourceRequest& request, uint64_t listenerID, CoreIPC::ArgumentDecoder* arguments, bool& receivedPolicyAction, uint64_t& policyAction, uint64_t& downloadID)
{
RefPtr<APIObject> userData;
WebContextUserMessageDecoder messageDecoder(userData, context());
@@ -1620,19 +1675,32 @@ void WebPageProxy::decidePolicyForMIMEType(uint64_t frameID, const String& MIMET
m_inDecidePolicyForMIMEType = true;
m_syncMimeTypePolicyActionIsValid = false;
- if (!m_policyClient.decidePolicyForMIMEType(this, frame, MIMEType, request, listener.get(), 0 /*userData*/))
+ if (!m_policyClient.decidePolicyForResponse(this, frame, response, request, listener.get(), userData.get()))
listener->use();
m_inDecidePolicyForMIMEType = false;
// Check if we received a policy decision already. If we did, we can just pass it back.
+ receivedPolicyAction = m_syncMimeTypePolicyActionIsValid;
if (m_syncMimeTypePolicyActionIsValid) {
- receivedPolicyAction = true;
policyAction = m_syncMimeTypePolicyAction;
downloadID = m_syncMimeTypePolicyDownloadID;
}
}
+void WebPageProxy::unableToImplementPolicy(uint64_t frameID, const WebCore::ResourceError& error, CoreIPC::ArgumentDecoder* arguments)
+{
+ RefPtr<APIObject> userData;
+ WebContextUserMessageDecoder messageDecoder(userData, context());
+ if (!arguments->decode(messageDecoder))
+ return;
+
+ WebFrameProxy* frame = process()->webFrame(frameID);
+ MESSAGE_CHECK(frame);
+
+ m_policyClient.unableToImplementPolicy(this, frame, error, userData.get());
+}
+
// FormClient
void WebPageProxy::willSubmitForm(uint64_t frameID, uint64_t sourceFrameID, const StringPairVector& textFieldValues, uint64_t listenerID, CoreIPC::ArgumentDecoder* arguments)
@@ -1766,9 +1834,9 @@ void WebPageProxy::mouseDidMoveOverElement(uint32_t opaqueModifiers, CoreIPC::Ar
m_uiClient.mouseDidMoveOverElement(this, modifiers, userData.get());
}
-void WebPageProxy::missingPluginButtonClicked(const String& mimeType, const String& url)
+void WebPageProxy::missingPluginButtonClicked(const String& mimeType, const String& url, const String& pluginsPageURL)
{
- m_uiClient.missingPluginButtonClicked(this, mimeType, url);
+ m_uiClient.missingPluginButtonClicked(this, mimeType, url, pluginsPageURL);
}
void WebPageProxy::setToolbarsAreVisible(bool toolbarsAreVisible)
@@ -1821,11 +1889,6 @@ void WebPageProxy::getWindowFrame(FloatRect& newWindowFrame)
newWindowFrame = m_pageClient->convertToUserSpace(m_uiClient.windowFrame(this));
}
-void WebPageProxy::canRunBeforeUnloadConfirmPanel(bool& canRun)
-{
- canRun = m_uiClient.canRunBeforeUnloadConfirmPanel();
-}
-
void WebPageProxy::runBeforeUnloadConfirmPanel(const String& message, uint64_t frameID, bool& shouldClose)
{
WebFrameProxy* frame = process()->webFrame(frameID);
@@ -2034,14 +2097,12 @@ void WebPageProxy::showPopupMenu(const IntRect& rect, uint64_t textDirection, co
m_activePopupMenu = m_pageClient->createPopupMenuProxy(this);
-#if PLATFORM(WIN)
- // On Windows, we're about to run our own message pump in showPopupMenu(), so turn off the responsiveness timer.
+ // Since showPopupMenu() can spin a nested run loop we need to turn off the responsiveness timer.
process()->responsivenessTimer()->stop();
-#endif
RefPtr<WebPopupMenuProxy> protectedActivePopupMenu = m_activePopupMenu;
- protectedActivePopupMenu->showPopupMenu(rect, static_cast<TextDirection>(textDirection), items, data, selectedIndex);
+ protectedActivePopupMenu->showPopupMenu(rect, static_cast<TextDirection>(textDirection), m_viewScaleFactor, items, data, selectedIndex);
protectedActivePopupMenu->invalidate();
protectedActivePopupMenu = 0;
}
@@ -2252,6 +2313,11 @@ void WebPageProxy::updateSpellingUIWithMisspelledWord(const String& misspelledWo
TextChecker::updateSpellingUIWithMisspelledWord(misspelledWord);
}
+void WebPageProxy::updateSpellingUIWithGrammarString(const String& badGrammarPhrase, const GrammarDetail& grammarDetail)
+{
+ TextChecker::updateSpellingUIWithGrammarString(badGrammarPhrase, grammarDetail);
+}
+
void WebPageProxy::getGuessesForWord(const String& word, const String& context, Vector<String>& guesses)
{
TextChecker::getGuessesForWord(spellDocumentTag(), word, context, guesses);
@@ -2292,11 +2358,6 @@ void WebPageProxy::setCursor(const WebCore::Cursor& cursor)
m_pageClient->setCursor(cursor);
}
-void WebPageProxy::didValidateMenuItem(const String& commandName, bool isEnabled, int32_t state)
-{
- m_pageClient->setEditCommandState(commandName, isEnabled, state);
-}
-
void WebPageProxy::didReceiveEvent(uint32_t opaqueType, bool handled)
{
WebEvent::Type type = static_cast<WebEvent::Type>(opaqueType);
@@ -2398,6 +2459,21 @@ void WebPageProxy::stringCallback(const String& resultString, uint64_t callbackI
callback->performCallbackWithReturnValue(resultString.impl());
}
+void WebPageProxy::scriptValueCallback(const CoreIPC::DataReference& dataReference, uint64_t callbackID)
+{
+ RefPtr<ScriptValueCallback> callback = m_scriptValueCallbacks.take(callbackID);
+ if (!callback) {
+ // FIXME: Log error or assert.
+ return;
+ }
+
+ Vector<uint8_t> data;
+ data.reserveInitialCapacity(dataReference.size());
+ data.append(dataReference.data(), dataReference.size());
+
+ callback->performCallbackWithReturnValue(data.size() ? WebSerializedScriptValue::adopt(data).get() : 0);
+}
+
void WebPageProxy::computedPagesCallback(const Vector<WebCore::IntRect>& pageRects, double totalScaleFactorForPrinting, uint64_t callbackID)
{
RefPtr<ComputedPagesCallback> callback = m_computedPagesCallbacks.take(callbackID);
@@ -2409,7 +2485,22 @@ void WebPageProxy::computedPagesCallback(const Vector<WebCore::IntRect>& pageRec
callback->performCallbackWithReturnValue(pageRects, totalScaleFactorForPrinting);
}
+void WebPageProxy::validateCommandCallback(const String& commandName, bool isEnabled, int state, uint64_t callbackID)
+{
+ RefPtr<ValidateCommandCallback> callback = m_validateCommandCallbacks.take(callbackID);
+ if (!callback) {
+ // FIXME: Log error or assert.
+ return;
+ }
+
+ callback->performCallbackWithReturnValue(commandName.impl(), isEnabled, state);
+}
+
#if PLATFORM(MAC)
+void WebPageProxy::didPerformDictionaryLookup(const String& text, const DictionaryPopupInfo& dictionaryPopupInfo)
+{
+ m_pageClient->didPerformDictionaryLookup(text, m_viewScaleFactor, dictionaryPopupInfo);
+}
void WebPageProxy::registerWebProcessAccessibilityToken(const CoreIPC::DataReference& data)
{
@@ -2451,18 +2542,6 @@ void WebPageProxy::frameSetLargestFrameChanged(uint64_t frameID)
m_frameSetLargestFrame = frame;
}
-#if USE(ACCELERATED_COMPOSITING)
-void WebPageProxy::didChangeAcceleratedCompositing(bool compositing, DrawingAreaInfo& drawingAreaInfo)
-{
- if (compositing)
- didEnterAcceleratedCompositing();
- else
- didLeaveAcceleratedCompositing();
-
- drawingAreaInfo = drawingArea()->info();
-}
-#endif
-
void WebPageProxy::processDidBecomeUnresponsive()
{
m_loaderClient.processDidBecomeUnresponsive(this);
@@ -2505,10 +2584,15 @@ void WebPageProxy::processDidCrash()
m_mainFrameHasHorizontalScrollbar = false;
m_mainFrameHasVerticalScrollbar = false;
+ m_mainFrameIsPinnedToLeftSide = false;
+ m_mainFrameIsPinnedToRightSide = false;
+
invalidateCallbackMap(m_voidCallbacks);
invalidateCallbackMap(m_dataCallbacks);
invalidateCallbackMap(m_stringCallbacks);
+ invalidateCallbackMap(m_scriptValueCallbacks);
invalidateCallbackMap(m_computedPagesCallbacks);
+ invalidateCallbackMap(m_validateCommandCallbacks);
Vector<WebEditCommandProxy*> editCommandVector;
copyToVector(m_editCommandSet, editCommandVector);
@@ -2536,16 +2620,18 @@ WebPageCreationParameters WebPageProxy::creationParameters() const
parameters.isFocused = m_pageClient->isViewFocused();
parameters.isVisible = m_pageClient->isViewVisible();
parameters.isInWindow = m_pageClient->isViewInWindow();
- parameters.drawingAreaInfo = m_drawingArea->info();
+ parameters.drawingAreaType = m_drawingArea->type();
parameters.store = m_pageGroup->preferences()->store();
parameters.pageGroupData = m_pageGroup->data();
parameters.drawsBackground = m_drawsBackground;
parameters.drawsTransparentBackground = m_drawsTransparentBackground;
+ parameters.areMemoryCacheClientCallsEnabled = m_areMemoryCacheClientCallsEnabled;
parameters.useFixedLayout = m_useFixedLayout;
parameters.fixedLayoutSize = m_fixedLayoutSize;
parameters.userAgent = userAgent();
parameters.sessionState = SessionState(m_backForwardList->entries(), m_backForwardList->currentIndex());
parameters.highestUsedBackForwardItemID = WebBackForwardListItem::highedUsedItemID();
+ parameters.canRunBeforeUnloadConfirmPanel = m_uiClient.canRunBeforeUnloadConfirmPanel();
parameters.canRunModal = m_uiClient.canRunModal();
#if PLATFORM(MAC)
@@ -2569,17 +2655,6 @@ void WebPageProxy::exitAcceleratedCompositingMode()
{
m_pageClient->exitAcceleratedCompositingMode();
}
-
-void WebPageProxy::didEnterAcceleratedCompositing()
-{
- m_pageClient->pageDidEnterAcceleratedCompositing();
-}
-
-void WebPageProxy::didLeaveAcceleratedCompositing()
-{
- m_pageClient->pageDidLeaveAcceleratedCompositing();
-}
-
#endif // USE(ACCELERATED_COMPOSITING)
void WebPageProxy::backForwardClear()
@@ -2662,9 +2737,15 @@ void WebPageProxy::didChangeScrollbarsForMainFrame(bool hasHorizontalScrollbar,
m_pageClient->didChangeScrollbarsForMainFrame();
}
-void WebPageProxy::didFinishLoadingDataForCustomRepresentation(const CoreIPC::DataReference& dataReference)
+void WebPageProxy::didChangeScrollOffsetPinningForMainFrame(bool pinnedToLeftSide, bool pinnedToRightSide)
+{
+ m_mainFrameIsPinnedToLeftSide = pinnedToLeftSide;
+ m_mainFrameIsPinnedToRightSide = pinnedToRightSide;
+}
+
+void WebPageProxy::didFinishLoadingDataForCustomRepresentation(const String& suggestedFilename, const CoreIPC::DataReference& dataReference)
{
- m_pageClient->didFinishLoadingDataForCustomRepresentation(dataReference);
+ m_pageClient->didFinishLoadingDataForCustomRepresentation(suggestedFilename, dataReference);
}
#if PLATFORM(MAC)
@@ -2710,7 +2791,7 @@ void WebPageProxy::computePagesForPrinting(WebFrameProxy* frame, const PrintInfo
process()->send(Messages::WebPage::ComputePagesForPrinting(frame->frameID(), printInfo, callbackID), m_pageID, m_isPerformingDOMPrintOperation ? CoreIPC::DispatchMessageEvenWhenWaitingForSyncReply : 0);
}
-#if PLATFORM(MAC)
+#if PLATFORM(MAC) || PLATFORM(WIN)
void WebPageProxy::drawRectToPDF(WebFrameProxy* frame, const IntRect& rect, PassRefPtr<DataCallback> callback)
{
uint64_t callbackID = callback->callbackID();
@@ -2726,4 +2807,19 @@ void WebPageProxy::drawPagesToPDF(WebFrameProxy* frame, uint32_t first, uint32_t
}
#endif
+void WebPageProxy::flashBackingStoreUpdates(const Vector<IntRect>& updateRects)
+{
+ m_pageClient->flashBackingStoreUpdates(updateRects);
+}
+
+Color WebPageProxy::viewUpdatesFlashColor()
+{
+ return Color(0, 200, 255);
+}
+
+Color WebPageProxy::backingStoreUpdatesFlashColor()
+{
+ return Color(200, 0, 255);
+}
+
} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/WebPageProxy.h b/Source/WebKit2/UIProcess/WebPageProxy.h
index 46aa240..ce56cea 100644
--- a/Source/WebKit2/UIProcess/WebPageProxy.h
+++ b/Source/WebKit2/UIProcess/WebPageProxy.h
@@ -35,6 +35,7 @@
#include "SelectionState.h"
#include "SharedMemory.h"
#include "WKBase.h"
+#include "WKPagePrivate.h"
#include "WebContextMenuItemData.h"
#include "WebEvent.h"
#include "WebFindClient.h"
@@ -101,6 +102,7 @@ class WebProcessProxy;
class WebURLRequest;
class WebWheelEvent;
struct ContextMenuState;
+struct DictionaryPopupInfo;
struct PlatformPopupMenuData;
struct PrintInfo;
struct WebPageCreationParameters;
@@ -111,6 +113,52 @@ class WebGestureEvent;
#endif
typedef GenericCallback<WKStringRef, StringImpl*> StringCallback;
+typedef GenericCallback<WKSerializedScriptValueRef, WebSerializedScriptValue*> ScriptValueCallback;
+
+// FIXME: Make a version of CallbackBase with three arguments, and define ValidateCommandCallback as a specialization.
+class ValidateCommandCallback : public CallbackBase {
+public:
+ typedef void (*CallbackFunction)(WKStringRef, bool, int32_t, WKErrorRef, void*);
+
+ static PassRefPtr<ValidateCommandCallback> create(void* context, CallbackFunction callback)
+ {
+ return adoptRef(new ValidateCommandCallback(context, callback));
+ }
+
+ virtual ~ValidateCommandCallback()
+ {
+ ASSERT(!m_callback);
+ }
+
+ void performCallbackWithReturnValue(StringImpl* returnValue1, bool returnValue2, int returnValue3)
+ {
+ ASSERT(m_callback);
+
+ m_callback(toAPI(returnValue1), returnValue2, returnValue3, 0, context());
+
+ m_callback = 0;
+ }
+
+ void invalidate()
+ {
+ ASSERT(m_callback);
+
+ RefPtr<WebError> error = WebError::create();
+ m_callback(0, 0, 0, toAPI(error.get()), context());
+
+ m_callback = 0;
+ }
+
+private:
+
+ ValidateCommandCallback(void* context, CallbackFunction callback)
+ : CallbackBase(context)
+ , m_callback(callback)
+ {
+ }
+
+ CallbackFunction m_callback;
+};
class WebPageProxy : public APIObject, public WebPopupMenuProxy::Client {
public:
@@ -164,6 +212,7 @@ public:
void goToBackForwardItem(WebBackForwardListItem*);
void didChangeBackForwardList(WebBackForwardListItem* addedItem, Vector<RefPtr<APIObject> >* removedItems);
+ void shouldGoToBackForwardListItem(uint64_t itemID, bool& shouldGoToBackForwardListItem);
bool canShowMIMEType(const String& mimeType) const;
@@ -196,9 +245,12 @@ public:
bool isViewVisible() const { return m_isVisible; }
void executeEditCommand(const String& commandName);
- void validateMenuItem(const String& commandName);
+ void validateCommand(const String& commandName, PassRefPtr<ValidateCommandCallback>);
const SelectionState& selectionState() const { return m_selectionState; }
+ bool canDelete() const { return hasSelectedRange() && isContentEditable(); }
+ bool hasSelectedRange() const { return m_selectionState.selectedRangeLength; }
+ bool isContentEditable() const { return m_selectionState.isContentEditable; }
#if PLATFORM(MAC)
void updateWindowIsVisible(bool windowIsVisible);
@@ -270,15 +322,21 @@ public:
bool hasHorizontalScrollbar() const { return m_mainFrameHasHorizontalScrollbar; }
bool hasVerticalScrollbar() const { return m_mainFrameHasVerticalScrollbar; }
+ bool isPinnedToLeftSide() const { return m_mainFrameIsPinnedToLeftSide; }
+ bool isPinnedToRightSide() const { return m_mainFrameIsPinnedToRightSide; }
+
#if PLATFORM(MAC)
// Called by the web process through a message.
void registerWebProcessAccessibilityToken(const CoreIPC::DataReference&);
// Called by the UI process when it is ready to send its tokens to the web process.
void registerUIProcessAccessibilityTokens(const CoreIPC::DataReference& elemenToken, const CoreIPC::DataReference& windowToken);
+ bool writeSelectionToPasteboard(const String& pasteboardName, const Vector<String>& pasteboardTypes);
#endif
void viewScaleFactorDidChange(double);
+ void setMemoryCacheClientCallsEnabled(bool);
+
// Find.
void findString(const String&, FindOptions, unsigned maxMatchCount);
void hideFindUI();
@@ -291,9 +349,9 @@ public:
void getSelectionOrContentsAsString(PassRefPtr<StringCallback>);
void getSourceForFrame(WebFrameProxy*, PassRefPtr<StringCallback>);
void getWebArchiveOfFrame(WebFrameProxy*, PassRefPtr<DataCallback>);
- void runJavaScriptInMainFrame(const String&, PassRefPtr<StringCallback>);
+ void runJavaScriptInMainFrame(const String&, PassRefPtr<ScriptValueCallback>);
void forceRepaint(PassRefPtr<VoidCallback>);
-
+
float headerHeight(WebFrameProxy*);
float footerHeight(WebFrameProxy*);
void drawHeader(WebFrameProxy*, const WebCore::FloatRect&);
@@ -301,6 +359,9 @@ public:
#if PLATFORM(MAC)
void setAutodisplay(bool);
+
+ // Dictionary.
+ void performDictionaryLookupAtLocation(const WebCore::FloatPoint&);
#endif
void receivedPolicyDecision(WebCore::PolicyAction, WebFrameProxy*, uint64_t listenerID);
@@ -329,11 +390,6 @@ public:
virtual void exitAcceleratedCompositingMode();
#endif
-#if USE(ACCELERATED_COMPOSITING)
- void didEnterAcceleratedCompositing();
- void didLeaveAcceleratedCompositing();
-#endif
-
void didDraw();
enum UndoOrRedo { Undo, Redo };
@@ -389,13 +445,23 @@ public:
void beginPrinting(WebFrameProxy*, const PrintInfo&);
void endPrinting();
void computePagesForPrinting(WebFrameProxy*, const PrintInfo&, PassRefPtr<ComputedPagesCallback>);
-#if PLATFORM(MAC)
+#if PLATFORM(MAC) || PLATFORM(WIN)
void drawRectToPDF(WebFrameProxy*, const WebCore::IntRect&, PassRefPtr<DataCallback>);
void drawPagesToPDF(WebFrameProxy*, uint32_t first, uint32_t count, PassRefPtr<DataCallback>);
#endif
const String& pendingAPIRequestURL() const { return m_pendingAPIRequestURL; }
+ void flashBackingStoreUpdates(const Vector<WebCore::IntRect>& updateRects);
+
+ static void setDebugPaintFlags(WKPageDebugPaintFlags flags) { s_debugPaintFlags = flags; }
+ static WKPageDebugPaintFlags debugPaintFlags() { return s_debugPaintFlags; }
+
+ // Color to be used with kWKDebugFlashViewUpdates.
+ static WebCore::Color viewUpdatesFlashColor();
+ // Color to be used with kWKDebugFlashBackingStoreUpdates.
+ static WebCore::Color backingStoreUpdatesFlashColor();
+
private:
WebPageProxy(PageClient*, WebContext*, WebPageGroup*, uint64_t pageID);
@@ -433,9 +499,10 @@ private:
void didChangeProgress(double);
void didFinishProgress();
- void decidePolicyForNavigationAction(uint64_t frameID, uint32_t navigationType, uint32_t modifiers, int32_t mouseButton, const WebCore::ResourceRequest&, uint64_t listenerID, CoreIPC::ArgumentDecoder*, bool& receivedPolicyAction, uint64_t& policyAction);
+ void decidePolicyForNavigationAction(uint64_t frameID, uint32_t navigationType, uint32_t modifiers, int32_t mouseButton, const WebCore::ResourceRequest&, uint64_t listenerID, CoreIPC::ArgumentDecoder*, bool& receivedPolicyAction, uint64_t& policyAction, uint64_t& downloadID);
void decidePolicyForNewWindowAction(uint64_t frameID, uint32_t navigationType, uint32_t modifiers, int32_t mouseButton, const WebCore::ResourceRequest&, const String& frameName, uint64_t listenerID, CoreIPC::ArgumentDecoder*);
- void decidePolicyForMIMEType(uint64_t frameID, const String& MIMEType, const WebCore::ResourceRequest&, uint64_t listenerID, CoreIPC::ArgumentDecoder* arguments, bool& receivedPolicyAction, uint64_t& policyAction, uint64_t& downloadID);
+ void decidePolicyForResponse(uint64_t frameID, const WebCore::ResourceResponse&, const WebCore::ResourceRequest&, uint64_t listenerID, CoreIPC::ArgumentDecoder* arguments, bool& receivedPolicyAction, uint64_t& policyAction, uint64_t& downloadID);
+ void unableToImplementPolicy(uint64_t frameID, const WebCore::ResourceError&, CoreIPC::ArgumentDecoder* arguments);
void willSubmitForm(uint64_t frameID, uint64_t sourceFrameID, const StringPairVector& textFieldValues, uint64_t listenerID, CoreIPC::ArgumentDecoder*);
@@ -456,7 +523,7 @@ private:
void runJavaScriptPrompt(uint64_t frameID, const String&, const String&, String& result);
void setStatusText(const String&);
void mouseDidMoveOverElement(uint32_t modifiers, CoreIPC::ArgumentDecoder*);
- void missingPluginButtonClicked(const String& mimeType, const String& url);
+ void missingPluginButtonClicked(const String& mimeType, const String& url, const String& pluginsPageURL);
void setToolbarsAreVisible(bool toolbarsAreVisible);
void getToolbarsAreVisible(bool& toolbarsAreVisible);
void setMenuBarIsVisible(bool menuBarIsVisible);
@@ -467,7 +534,6 @@ private:
void getIsResizable(bool& isResizable);
void setWindowFrame(const WebCore::FloatRect&);
void getWindowFrame(WebCore::FloatRect&);
- void canRunBeforeUnloadConfirmPanel(bool& canRun);
void runBeforeUnloadConfirmPanel(const String& message, uint64_t frameID, bool& shouldClose);
void didChangeViewportData(const WebCore::ViewportArguments&);
void pageDidScroll();
@@ -478,6 +544,7 @@ private:
void runModal() { m_uiClient.runModal(this); }
void didCompleteRubberBandForMainFrame(const WebCore::IntSize&);
void didChangeScrollbarsForMainFrame(bool hasHorizontalScrollbar, bool hasVerticalScrollbar);
+ void didChangeScrollOffsetPinningForMainFrame(bool pinnedToLeftSide, bool pinnedToRightSide);
void reattachToWebProcess();
void reattachToWebProcessWithItem(WebBackForwardListItem*);
@@ -524,17 +591,21 @@ private:
// Context Menu.
void showContextMenu(const WebCore::IntPoint& menuLocation, const ContextMenuState&, const Vector<WebContextMenuItemData>&, CoreIPC::ArgumentDecoder*);
- // Speech.
#if PLATFORM(MAC)
+ // Speech.
void getIsSpeaking(bool&);
void speak(const String&);
void stopSpeaking();
+
+ // Dictionary.
+ void didPerformDictionaryLookup(const String&, const DictionaryPopupInfo&);
#endif
// Spelling and grammar.
int64_t spellDocumentTag();
void checkTextOfParagraph(const String& text, uint64_t checkingTypes, Vector<WebCore::TextCheckingResult>& results);
void updateSpellingUIWithMisspelledWord(const String& misspelledWord);
+ void updateSpellingUIWithGrammarString(const String& badGrammarPhrase, const WebCore::GrammarDetail&);
void getGuessesForWord(const String& word, const String& context, Vector<String>& guesses);
void learnWord(const String& word);
void ignoreWord(const String& word);
@@ -542,26 +613,23 @@ private:
void takeFocus(bool direction);
void setToolTip(const String&);
void setCursor(const WebCore::Cursor&);
- void didValidateMenuItem(const String& commandName, bool isEnabled, int32_t state);
void didReceiveEvent(uint32_t opaqueType, bool handled);
void voidCallback(uint64_t);
void dataCallback(const CoreIPC::DataReference&, uint64_t);
void stringCallback(const String&, uint64_t);
+ void scriptValueCallback(const CoreIPC::DataReference&, uint64_t);
void computedPagesCallback(const Vector<WebCore::IntRect>&, double totalScaleFactorForPrinting, uint64_t);
+ void validateCommandCallback(const String&, bool, int, uint64_t);
void focusedFrameChanged(uint64_t frameID);
void frameSetLargestFrameChanged(uint64_t frameID);
-#if USE(ACCELERATED_COMPOSITING)
- void didChangeAcceleratedCompositing(bool compositing, DrawingAreaInfo&);
-#endif
-
void canAuthenticateAgainstProtectionSpaceInFrame(uint64_t frameID, const WebCore::ProtectionSpace&, bool& canAuthenticate);
void didReceiveAuthenticationChallenge(uint64_t frameID, const WebCore::AuthenticationChallenge&, uint64_t challengeID);
- void didFinishLoadingDataForCustomRepresentation(const CoreIPC::DataReference& data);
+ void didFinishLoadingDataForCustomRepresentation(const String& suggestedFilename, const CoreIPC::DataReference&);
#if PLATFORM(MAC)
void setComplexTextInputEnabled(uint64_t pluginComplexTextInputIdentifier, bool complexTextInputEnabled);
@@ -602,7 +670,9 @@ private:
HashMap<uint64_t, RefPtr<VoidCallback> > m_voidCallbacks;
HashMap<uint64_t, RefPtr<DataCallback> > m_dataCallbacks;
HashMap<uint64_t, RefPtr<StringCallback> > m_stringCallbacks;
+ HashMap<uint64_t, RefPtr<ScriptValueCallback> > m_scriptValueCallbacks;
HashMap<uint64_t, RefPtr<ComputedPagesCallback> > m_computedPagesCallbacks;
+ HashMap<uint64_t, RefPtr<ValidateCommandCallback> > m_validateCommandCallbacks;
HashSet<WebEditCommandProxy*> m_editCommandSet;
@@ -638,6 +708,8 @@ private:
bool m_drawsBackground;
bool m_drawsTransparentBackground;
+ bool m_areMemoryCacheClientCallsEnabled;
+
bool m_useFixedLayout;
WebCore::IntSize m_fixedLayoutSize;
@@ -658,7 +730,8 @@ private:
bool m_inDecidePolicyForNavigationAction;
bool m_syncNavigationActionPolicyActionIsValid;
WebCore::PolicyAction m_syncNavigationActionPolicyAction;
-
+ uint64_t m_syncNavigationActionPolicyDownloadID;
+
Deque<NativeWebKeyboardEvent> m_keyEventQueue;
bool m_processingWheelEvent;
OwnPtr<WebWheelEvent> m_nextWheelEvent;
@@ -683,6 +756,11 @@ private:
bool m_mainFrameHasHorizontalScrollbar;
bool m_mainFrameHasVerticalScrollbar;
+
+ bool m_mainFrameIsPinnedToLeftSide;
+ bool m_mainFrameIsPinnedToRightSide;
+
+ static WKPageDebugPaintFlags s_debugPaintFlags;
};
} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/WebPageProxy.messages.in b/Source/WebKit2/UIProcess/WebPageProxy.messages.in
index e566d02..8692f14 100644
--- a/Source/WebKit2/UIProcess/WebPageProxy.messages.in
+++ b/Source/WebKit2/UIProcess/WebPageProxy.messages.in
@@ -29,10 +29,9 @@ messages -> WebPageProxy {
RunJavaScriptConfirm(uint64_t frameID, WTF::String message) -> (bool result)
RunJavaScriptPrompt(uint64_t frameID, WTF::String message, WTF::String defaultValue) -> (WTF::String result)
MouseDidMoveOverElement(uint32_t modifiers, WebKit::InjectedBundleUserMessageEncoder userData);
- MissingPluginButtonClicked(WTF::String mimeType, WTF::String url)
+ MissingPluginButtonClicked(WTF::String mimeType, WTF::String url, WTF::String pluginsPageURL)
DidChangeViewportData(WebCore::ViewportArguments arguments)
DidReceiveEvent(uint32_t type, bool handled)
- DidValidateMenuItem(WTF::String commandName, bool isEnabled, int32_t state)
SetCursor(WebCore::Cursor cursor)
SetStatusText(WTF::String statusText)
SetToolTip(WTF::String toolTip)
@@ -49,7 +48,6 @@ messages -> WebPageProxy {
GetIsResizable() -> (bool isResizable)
SetWindowFrame(WebCore::FloatRect windowFrame)
GetWindowFrame() -> (WebCore::FloatRect windowFrame)
- CanRunBeforeUnloadConfirmPanel() -> (bool canRun)
RunBeforeUnloadConfirmPanel(WTF::String message, uint64_t frameID) -> (bool shouldClose)
PageDidScroll()
RunOpenPanel(uint64_t frameID, WebKit::WebOpenPanelParameters::Data parameters)
@@ -57,6 +55,7 @@ messages -> WebPageProxy {
RunModal()
DidCompleteRubberBandForMainFrame(WebCore::IntSize initialOverhang)
DidChangeScrollbarsForMainFrame(bool hasHorizontalScrollbar, bool hasVerticalScrollbar)
+ DidChangeScrollOffsetPinningForMainFrame(bool hasHorizontalScrollbar, bool hasVerticalScrollbar)
#if ENABLE(TILED_BACKING_STORE)
PageDidRequestScroll(WebCore::IntSize delta)
@@ -67,9 +66,10 @@ messages -> WebPageProxy {
#endif
# Policy messages
- DecidePolicyForMIMEType(uint64_t frameID, WTF::String MIMEType, WebCore::ResourceRequest request, uint64_t listenerID, WebKit::InjectedBundleUserMessageEncoder userData) -> (bool receivedPolicyAction, uint64_t policyAction, uint64_t downloadID)
- DecidePolicyForNavigationAction(uint64_t frameID, uint32_t navigationType, uint32_t modifiers, int32_t mouseButton, WebCore::ResourceRequest request, uint64_t listenerID, WebKit::InjectedBundleUserMessageEncoder userData) -> (bool receivedPolicyAction, uint64_t policyAction)
+ DecidePolicyForResponse(uint64_t frameID, WebCore::ResourceResponse response, WebCore::ResourceRequest request, uint64_t listenerID, WebKit::InjectedBundleUserMessageEncoder userData) -> (bool receivedPolicyAction, uint64_t policyAction, uint64_t downloadID)
+ DecidePolicyForNavigationAction(uint64_t frameID, uint32_t navigationType, uint32_t modifiers, int32_t mouseButton, WebCore::ResourceRequest request, uint64_t listenerID, WebKit::InjectedBundleUserMessageEncoder userData) -> (bool receivedPolicyAction, uint64_t policyAction, uint64_t downloadID)
DecidePolicyForNewWindowAction(uint64_t frameID, uint32_t navigationType, uint32_t modifiers, int32_t mouseButton, WebCore::ResourceRequest request, WTF::String frameName, uint64_t listenerID, WebKit::InjectedBundleUserMessageEncoder userData)
+ UnableToImplementPolicy(uint64_t frameID, WebCore::ResourceError error, WebKit::InjectedBundleUserMessageEncoder userData)
# Progress messages
DidChangeProgress(double value)
@@ -109,7 +109,7 @@ messages -> WebPageProxy {
DidFailLoadForResource(uint64_t frameID, uint64_t resourceIdentifier, WebCore::ResourceError error)
# Custom representations
- DidFinishLoadingDataForCustomRepresentation(CoreIPC::DataReference data)
+ DidFinishLoadingDataForCustomRepresentation(WTF::String suggestedFilename, CoreIPC::DataReference data)
# Forms messages
WillSubmitForm(uint64_t frameID, uint64_t sourceFrameID, WebKit::StringPairVector textFieldValues, uint64_t listenerID, WebKit::InjectedBundleUserMessageEncoder userData)
@@ -118,12 +118,16 @@ messages -> WebPageProxy {
VoidCallback(uint64_t callbackID)
DataCallback(CoreIPC::DataReference resultData, uint64_t callbackID)
StringCallback(WTF::String resultString, uint64_t callbackID)
+ ScriptValueCallback(CoreIPC::DataReference resultData, uint64_t callbackID)
ComputedPagesCallback(Vector<WebCore::IntRect> pageRects, double totalScaleFactorForPrinting, uint64_t callbackID)
-
+ ValidateCommandCallback(WTF::String command, bool isEnabled, int32_t state, uint64_t callbackID)
ViewScaleFactorDidChange(double scaleFactor)
#if PLATFORM(MAC)
+ # Dictionary support.
+ DidPerformDictionaryLookup(WTF::String text, WebKit::DictionaryPopupInfo dictionaryPopupInfo)
+
# Keyboard support messages
InterpretKeyEvent(uint32_t type) -> (Vector<WebCore::KeypressCommand> commandName, uint32_t selectionStart, uint32_t selectionEnd, Vector<WebCore::CompositionUnderline> underlines)
@@ -138,6 +142,7 @@ messages -> WebPageProxy {
BackForwardBackListCount() -> (int32_t count)
BackForwardForwardListCount() -> (int32_t count)
BackForwardClear()
+ ShouldGoToBackForwardListItem(uint64_t itemID) -> (bool shouldGoToBackForwardListItem)
# Undo/Redo messages
RegisterEditCommandForUndo(uint64_t commandID, uint32_t editAction)
@@ -163,11 +168,6 @@ messages -> WebPageProxy {
# ContextMenu messages
ShowContextMenu(WebCore::IntPoint menuLocation, WebKit::ContextMenuState state, Vector<WebKit::WebContextMenuItemData> items, WebKit::InjectedBundleUserMessageEncoder userData)
-#if USE(ACCELERATED_COMPOSITING)
- # Accelerated compositing messages
- DidChangeAcceleratedCompositing(bool compositing) -> (WebKit::DrawingAreaInfo newDrawingArea)
-#endif
-
# Authentication messages
CanAuthenticateAgainstProtectionSpaceInFrame(uint64_t frameID, WebCore::ProtectionSpace protectionSpace) -> (bool canAuthenticate)
DidReceiveAuthenticationChallenge(uint64_t frameID, WebCore::AuthenticationChallenge challenge, uint64_t challengeID)
@@ -193,6 +193,7 @@ messages -> WebPageProxy {
# Spelling and grammar messages
CheckTextOfParagraph(WTF::String text, uint64_t checkingTypes) -> (Vector<WebCore::TextCheckingResult> results)
UpdateSpellingUIWithMisspelledWord(WTF::String misspelledWord)
+ UpdateSpellingUIWithGrammarString(WTF::String badGrammarPhrase, WebCore::GrammarDetail grammarDetail)
GetGuessesForWord(WTF::String word, WTF::String context) -> (Vector<WTF::String> guesses)
LearnWord(WTF::String word);
IgnoreWord(WTF::String word);
diff --git a/Source/WebKit2/UIProcess/WebPolicyClient.cpp b/Source/WebKit2/UIProcess/WebPolicyClient.cpp
index 6296664..c57c896 100644
--- a/Source/WebKit2/UIProcess/WebPolicyClient.cpp
+++ b/Source/WebKit2/UIProcess/WebPolicyClient.cpp
@@ -26,6 +26,7 @@
#include "config.h"
#include "WebPolicyClient.h"
+#include "APIObject.h"
#include "WKAPICast.h"
#include "WebURLRequest.h"
@@ -55,15 +56,24 @@ bool WebPolicyClient::decidePolicyForNewWindowAction(WebPageProxy* page, WebFram
return true;
}
-bool WebPolicyClient::decidePolicyForMIMEType(WebPageProxy* page, WebFrameProxy* frame, const String& MIMEType, const ResourceRequest& resourceRequest, WebFramePolicyListenerProxy* listener, APIObject* userData)
+bool WebPolicyClient::decidePolicyForResponse(WebPageProxy* page, WebFrameProxy* frame, const ResourceResponse& resourceResponse, const ResourceRequest& resourceRequest, WebFramePolicyListenerProxy* listener, APIObject* userData)
{
- if (!m_client.decidePolicyForMIMEType)
+ if (!m_client.decidePolicyForResponse)
return false;
+ RefPtr<WebURLResponse> response = WebURLResponse::create(resourceResponse);
RefPtr<WebURLRequest> request = WebURLRequest::create(resourceRequest);
- m_client.decidePolicyForMIMEType(toAPI(page), toAPI(frame), toAPI(MIMEType.impl()), toAPI(request.get()), toAPI(listener), toAPI(userData), m_client.clientInfo);
+ m_client.decidePolicyForResponse(toAPI(page), toAPI(frame), toAPI(response.get()), toAPI(request.get()), toAPI(listener), toAPI(userData), m_client.clientInfo);
return true;
}
+void WebPolicyClient::unableToImplementPolicy(WebPageProxy* page, WebFrameProxy* frame, const ResourceError& error, APIObject* userData)
+{
+ if (!m_client.unableToImplementPolicy)
+ return;
+
+ m_client.unableToImplementPolicy(toAPI(page), toAPI(frame), toAPI(error), toAPI(userData), m_client.clientInfo);
+}
+
} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/WebPolicyClient.h b/Source/WebKit2/UIProcess/WebPolicyClient.h
index c624c58..23e0ffd 100644
--- a/Source/WebKit2/UIProcess/WebPolicyClient.h
+++ b/Source/WebKit2/UIProcess/WebPolicyClient.h
@@ -27,18 +27,20 @@
#define WebPolicyClient_h
#include "APIClient.h"
-#include "APIObject.h"
#include "WKPage.h"
#include "WebEvent.h"
#include <WebCore/FrameLoaderTypes.h>
#include <wtf/Forward.h>
namespace WebCore {
+ class ResourceError;
class ResourceRequest;
+ class ResourceResponse;
}
namespace WebKit {
+class APIObject;
class WebPageProxy;
class WebFrameProxy;
class WebFramePolicyListenerProxy;
@@ -47,7 +49,8 @@ class WebPolicyClient : public APIClient<WKPagePolicyClient> {
public:
bool decidePolicyForNavigationAction(WebPageProxy*, WebFrameProxy*, WebCore::NavigationType, WebEvent::Modifiers, WebMouseEvent::Button, const WebCore::ResourceRequest&, WebFramePolicyListenerProxy*, APIObject* userData);
bool decidePolicyForNewWindowAction(WebPageProxy*, WebFrameProxy*, WebCore::NavigationType, WebEvent::Modifiers, WebMouseEvent::Button, const WebCore::ResourceRequest&, const String& frameName, WebFramePolicyListenerProxy*, APIObject* userData);
- bool decidePolicyForMIMEType(WebPageProxy*, WebFrameProxy*, const String& MIMEType, const WebCore::ResourceRequest&, WebFramePolicyListenerProxy*, APIObject* userData);
+ bool decidePolicyForResponse(WebPageProxy*, WebFrameProxy*, const WebCore::ResourceResponse&, const WebCore::ResourceRequest&, WebFramePolicyListenerProxy*, APIObject* userData);
+ void unableToImplementPolicy(WebPageProxy*, WebFrameProxy*, const WebCore::ResourceError&, APIObject* userData);
};
} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/WebPopupMenuProxy.h b/Source/WebKit2/UIProcess/WebPopupMenuProxy.h
index 78dad64..96901fb 100644
--- a/Source/WebKit2/UIProcess/WebPopupMenuProxy.h
+++ b/Source/WebKit2/UIProcess/WebPopupMenuProxy.h
@@ -57,7 +57,7 @@ public:
{
}
- virtual void showPopupMenu(const WebCore::IntRect& rect, WebCore::TextDirection, const Vector<WebPopupItem>& items, const PlatformPopupMenuData&, int32_t selectedIndex) = 0;
+ virtual void showPopupMenu(const WebCore::IntRect& rect, WebCore::TextDirection, double scaleFactor, const Vector<WebPopupItem>& items, const PlatformPopupMenuData&, int32_t selectedIndex) = 0;
virtual void hidePopupMenu() = 0;
void invalidate() { m_client = 0; }
diff --git a/Source/WebKit2/UIProcess/WebProcessManager.cpp b/Source/WebKit2/UIProcess/WebProcessManager.cpp
deleted file mode 100644
index 80e3c2d..0000000
--- a/Source/WebKit2/UIProcess/WebProcessManager.cpp
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Copyright (C) 2010 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "WebProcessManager.h"
-
-#include "WebContext.h"
-
-namespace WebKit {
-
-WebProcessManager& WebProcessManager::shared()
-{
- static WebProcessManager& manager = *new WebProcessManager;
- return manager;
-}
-
-WebProcessManager::WebProcessManager()
-{
-}
-
-WebProcessProxy* WebProcessManager::getWebProcess(WebContext* context)
-{
- switch (context->processModel()) {
- case ProcessModelSharedSecondaryProcess: {
- if (!m_sharedProcess)
- m_sharedProcess = WebProcessProxy::create(context);
- return m_sharedProcess.get();
- }
- case ProcessModelSharedSecondaryThread: {
- if (!m_sharedThread)
- m_sharedThread = WebProcessProxy::create(context);
- return m_sharedThread.get();
- }
- case ProcessModelSecondaryProcess: {
- std::pair<ProcessMap::iterator, bool> result = m_processMap.add(context, 0);
- if (result.second) {
- ASSERT(!result.first->second);
- result.first->second = WebProcessProxy::create(context);
- }
-
- ASSERT(result.first->second);
- return result.first->second.get();
- }
- }
-
- ASSERT_NOT_REACHED();
- return 0;
-}
-
-void WebProcessManager::processDidClose(WebProcessProxy* process, WebContext* context)
-{
- if (process == m_sharedProcess) {
- ASSERT(context->processModel() == ProcessModelSharedSecondaryProcess);
- m_sharedProcess = 0;
- return;
- }
-
- ProcessMap::iterator it = m_processMap.find(context);
- if (it != m_processMap.end()) {
- ASSERT(it->second == process);
- m_processMap.remove(it);
- return;
- }
-
- // The shared thread connection should never be closed.
- ASSERT_NOT_REACHED();
-}
-
-void WebProcessManager::contextWasDestroyed(WebContext* context)
-{
- m_processMap.remove(context);
-}
-
-} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/WebProcessProxy.cpp b/Source/WebKit2/UIProcess/WebProcessProxy.cpp
index 67dc46b..42e3408 100644
--- a/Source/WebKit2/UIProcess/WebProcessProxy.cpp
+++ b/Source/WebKit2/UIProcess/WebProcessProxy.cpp
@@ -35,7 +35,6 @@
#include "WebContext.h"
#include "WebNavigationDataStore.h"
#include "WebPageProxy.h"
-#include "WebProcessManager.h"
#include "WebProcessMessages.h"
#include "WebProcessProxyMessages.h"
#include "WebProcessProxyMessageKinds.h"
@@ -111,6 +110,25 @@ void WebProcessProxy::connect()
}
}
+void WebProcessProxy::disconnect()
+{
+ if (m_connection) {
+ m_connection->invalidate();
+ m_connection = nullptr;
+ }
+
+ m_responsivenessTimer.stop();
+
+ Vector<RefPtr<WebFrameProxy> > frames;
+ copyValuesToVector(m_frameMap, frames);
+
+ for (size_t i = 0, size = frames.size(); i < size; ++i)
+ frames[i]->disconnect();
+ m_frameMap.clear();
+
+ m_context->disconnectProcess(this);
+}
+
bool WebProcessProxy::sendMessage(CoreIPC::MessageID messageID, PassOwnPtr<CoreIPC::ArgumentEncoder> arguments, unsigned messageSendFlags)
{
// If we're waiting for the web process to launch, we need to stash away the messages so we can send them once we have
@@ -230,8 +248,12 @@ void WebProcessProxy::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC
if (messageID.is<CoreIPC::MessageClassWebContext>()
|| messageID.is<CoreIPC::MessageClassWebContextLegacy>()
|| messageID.is<CoreIPC::MessageClassDownloadProxy>()
+ || messageID.is<CoreIPC::MessageClassWebApplicationCacheManagerProxy>()
+ || messageID.is<CoreIPC::MessageClassWebCookieManagerProxy>()
|| messageID.is<CoreIPC::MessageClassWebDatabaseManagerProxy>()
- || messageID.is<CoreIPC::MessageClassWebGeolocationManagerProxy>()) {
+ || messageID.is<CoreIPC::MessageClassWebGeolocationManagerProxy>()
+ || messageID.is<CoreIPC::MessageClassWebKeyValueStorageManagerProxy>()
+ || messageID.is<CoreIPC::MessageClassWebResourceCacheManagerProxy>()) {
m_context->didReceiveMessage(connection, messageID, arguments);
return;
}
@@ -249,6 +271,9 @@ void WebProcessProxy::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC
CoreIPC::SyncReplyMode WebProcessProxy::didReceiveSyncMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments, CoreIPC::ArgumentEncoder* reply)
{
+ if (messageID.is<CoreIPC::MessageClassWebProcessProxy>())
+ return didReceiveSyncWebProcessProxyMessage(connection, messageID, arguments, reply);
+
#if ENABLE(PLUGIN_PROCESS)
if (messageID.is<CoreIPC::MessageClassWebProcessProxyLegacy>()) {
switch (messageID.get<WebProcessProxyLegacyMessage::Kind>()) {
@@ -282,26 +307,14 @@ CoreIPC::SyncReplyMode WebProcessProxy::didReceiveSyncMessage(CoreIPC::Connectio
void WebProcessProxy::didClose(CoreIPC::Connection*)
{
- // Protect ourselves, as the call to the shared WebProcessManager's processDidClose()
- // below may otherwise cause us to be deleted before we can finish our work.
+ // Protect ourselves, as the call to disconnect() below may otherwise cause us
+ // to be deleted before we can finish our work.
RefPtr<WebProcessProxy> protect(this);
-
- m_connection = nullptr;
- m_responsivenessTimer.stop();
-
- Vector<RefPtr<WebFrameProxy> > frames;
- copyValuesToVector(m_frameMap, frames);
-
- for (size_t i = 0, size = frames.size(); i < size; ++i)
- frames[i]->disconnect();
- m_frameMap.clear();
Vector<RefPtr<WebPageProxy> > pages;
copyValuesToVector(m_pageMap, pages);
- m_context->processDidClose(this);
-
- WebProcessManager::shared().processDidClose(this, m_context);
+ disconnect();
for (size_t i = 0, size = pages.size(); i < size; ++i)
pages[i]->processDidCrash();
@@ -411,6 +424,19 @@ size_t WebProcessProxy::frameCountInPage(WebPageProxy* page) const
return result;
}
+void WebProcessProxy::shouldTerminate(bool& shouldTerminate)
+{
+ if (!m_pageMap.isEmpty() || !m_context->shouldTerminate(this)) {
+ shouldTerminate = false;
+ return;
+ }
+
+ shouldTerminate = true;
+
+ // We know that the web process is going to terminate so disconnect it from the context.
+ disconnect();
+}
+
void WebProcessProxy::updateTextCheckerState()
{
if (!isValid())
diff --git a/Source/WebKit2/UIProcess/WebProcessProxy.h b/Source/WebKit2/UIProcess/WebProcessProxy.h
index e4221fe..04dbd98 100644
--- a/Source/WebKit2/UIProcess/WebProcessProxy.h
+++ b/Source/WebKit2/UIProcess/WebProcessProxy.h
@@ -97,7 +97,6 @@ public:
WebFrameProxy* webFrame(uint64_t) const;
bool canCreateFrame(uint64_t frameID) const;
void frameCreated(uint64_t, WebFrameProxy*);
- void didDestroyFrame(uint64_t);
void disconnectFramesFromPage(WebPageProxy*); // Including main frame.
size_t frameCountInPage(WebPageProxy*) const; // Including main frame.
@@ -111,11 +110,20 @@ public:
private:
explicit WebProcessProxy(WebContext*);
+ // Initializes the process or thread launcher which will begin launching the process.
void connect();
+ // Called when the web process has crashed or we know that it will terminate soon.
+ // Will potentially cause the WebProcessProxy object to be freed.
+ void disconnect();
+
bool sendMessage(CoreIPC::MessageID, PassOwnPtr<CoreIPC::ArgumentEncoder>, unsigned messageSendFlags);
+ // CoreIPC message handlers.
void addBackForwardItem(uint64_t itemID, const String& originalURLString, const String& urlString, const String& title, const CoreIPC::DataReference& backForwardData);
+ void didDestroyFrame(uint64_t);
+
+ void shouldTerminate(bool& shouldTerminate);
#if ENABLE(PLUGIN_PROCESS)
void getPluginProcessConnection(const String& pluginPath, CoreIPC::ArgumentEncoder* reply);
@@ -141,6 +149,7 @@ private:
// Implemented in generated WebProcessProxyMessageReceiver.cpp
void didReceiveWebProcessProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
+ CoreIPC::SyncReplyMode didReceiveSyncWebProcessProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder* arguments, CoreIPC::ArgumentEncoder* reply);
ResponsivenessTimer m_responsivenessTimer;
RefPtr<CoreIPC::Connection> m_connection;
diff --git a/Source/WebKit2/UIProcess/WebProcessProxy.messages.in b/Source/WebKit2/UIProcess/WebProcessProxy.messages.in
index 86bc9e2..99014d4 100644
--- a/Source/WebKit2/UIProcess/WebProcessProxy.messages.in
+++ b/Source/WebKit2/UIProcess/WebProcessProxy.messages.in
@@ -25,4 +25,5 @@ messages -> WebProcessProxy {
AddBackForwardItem(uint64_t itemID, WTF::String originalURL, WTF::String url, WTF::String title, CoreIPC::DataReference backForwardData)
DidDestroyFrame(uint64_t frameID)
+ ShouldTerminate() -> (bool shouldTerminate)
}
diff --git a/Source/WebKit2/UIProcess/WebResourceCacheManagerProxy.cpp b/Source/WebKit2/UIProcess/WebResourceCacheManagerProxy.cpp
new file mode 100644
index 0000000..aa65113
--- /dev/null
+++ b/Source/WebKit2/UIProcess/WebResourceCacheManagerProxy.cpp
@@ -0,0 +1,96 @@
+/*
+ * Copyright (C) 2011 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WebResourceCacheManagerProxy.h"
+
+#include "ImmutableArray.h"
+#include "ImmutableDictionary.h"
+#include "SecurityOriginData.h"
+#include "WebContext.h"
+#include "WebResourceCacheManagerMessages.h"
+#include "WebSecurityOrigin.h"
+
+using namespace WebCore;
+
+namespace WebKit {
+
+PassRefPtr<WebResourceCacheManagerProxy> WebResourceCacheManagerProxy::create(WebContext* webContext)
+{
+ return adoptRef(new WebResourceCacheManagerProxy(webContext));
+}
+
+WebResourceCacheManagerProxy::WebResourceCacheManagerProxy(WebContext* webContext)
+ : m_webContext(webContext)
+{
+}
+
+WebResourceCacheManagerProxy::~WebResourceCacheManagerProxy()
+{
+}
+
+void WebResourceCacheManagerProxy::invalidate()
+{
+ invalidateCallbackMap(m_arrayCallbacks);
+}
+
+void WebResourceCacheManagerProxy::getCacheOrigins(PassRefPtr<ArrayCallback> prpCallback)
+{
+ RefPtr<ArrayCallback> callback = prpCallback;
+ if (!m_webContext->hasValidProcess()) {
+ callback->invalidate();
+ return;
+ }
+ uint64_t callbackID = callback->callbackID();
+ m_arrayCallbacks.set(callbackID, callback.release());
+ m_webContext->process()->send(Messages::WebResourceCacheManager::GetCacheOrigins(callbackID), 0);
+}
+
+void WebResourceCacheManagerProxy::didGetCacheOrigins(const Vector<SecurityOriginData>& origins, uint64_t callbackID)
+{
+ RefPtr<ArrayCallback> callback = m_arrayCallbacks.take(callbackID);
+ performAPICallbackWithSecurityOriginDataVector(origins, callback.get());
+}
+
+void WebResourceCacheManagerProxy::clearCacheForOrigin(WebSecurityOrigin* origin)
+{
+ if (!m_webContext->hasValidProcess())
+ return;
+
+ SecurityOriginData securityOrigin;
+ securityOrigin.protocol = origin->protocol();
+ securityOrigin.host = origin->host();
+ securityOrigin.port = origin->port();
+ m_webContext->process()->send(Messages::WebResourceCacheManager::ClearCacheForOrigin(securityOrigin), 0);
+}
+
+void WebResourceCacheManagerProxy::clearCacheForAllOrigins()
+{
+ if (!m_webContext->hasValidProcess())
+ return;
+ m_webContext->process()->send(Messages::WebResourceCacheManager::ClearCacheForAllOrigins(), 0);
+}
+
+} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/WebResourceCacheManagerProxy.h b/Source/WebKit2/UIProcess/WebResourceCacheManagerProxy.h
new file mode 100644
index 0000000..0a2c3c8
--- /dev/null
+++ b/Source/WebKit2/UIProcess/WebResourceCacheManagerProxy.h
@@ -0,0 +1,79 @@
+/*
+ * Copyright (C) 2011 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WebResourceCacheManagerProxy_h
+#define WebResourceCacheManagerProxy_h
+
+#include "APIObject.h"
+#include "Arguments.h"
+#include "GenericCallback.h"
+#include <wtf/HashMap.h>
+#include <wtf/PassRefPtr.h>
+
+namespace CoreIPC {
+class ArgumentDecoder;
+class Connection;
+class MessageID;
+}
+
+namespace WebKit {
+
+struct SecurityOriginData;
+class WebContext;
+class WebSecurityOrigin;
+
+typedef GenericCallback<WKArrayRef> ArrayCallback;
+
+class WebResourceCacheManagerProxy : public APIObject {
+public:
+ static const Type APIType = TypeCacheManager;
+
+ static PassRefPtr<WebResourceCacheManagerProxy> create(WebContext*);
+ virtual ~WebResourceCacheManagerProxy();
+
+ void invalidate();
+ void clearContext() { m_webContext = 0; }
+
+ void getCacheOrigins(PassRefPtr<ArrayCallback>);
+ void clearCacheForOrigin(WebSecurityOrigin*);
+ void clearCacheForAllOrigins();
+
+ void didReceiveWebResourceCacheManagerProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
+
+private:
+ explicit WebResourceCacheManagerProxy(WebContext*);
+
+ virtual Type type() const { return APIType; }
+
+ // Message handlers.
+ void didGetCacheOrigins(const Vector<SecurityOriginData>& originIdentifiers, uint64_t callbackID);
+
+ WebContext* m_webContext;
+ HashMap<uint64_t, RefPtr<ArrayCallback> > m_arrayCallbacks;
+};
+
+} // namespace WebKit
+
+#endif // DatabaseManagerProxy_h
diff --git a/Source/WebKit2/UIProcess/WebResourceCacheManagerProxy.messages.in b/Source/WebKit2/UIProcess/WebResourceCacheManagerProxy.messages.in
new file mode 100644
index 0000000..c1e73a9
--- /dev/null
+++ b/Source/WebKit2/UIProcess/WebResourceCacheManagerProxy.messages.in
@@ -0,0 +1,25 @@
+# Copyright (C) 2011 Apple Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+messages -> WebResourceCacheManagerProxy {
+ DidGetCacheOrigins(Vector<WebKit::SecurityOriginData> originIdentifiers, uint64_t callbackID)
+}
diff --git a/Source/WebKit2/UIProcess/WebUIClient.cpp b/Source/WebKit2/UIProcess/WebUIClient.cpp
index 076b331..31dd458 100644
--- a/Source/WebKit2/UIProcess/WebUIClient.cpp
+++ b/Source/WebKit2/UIProcess/WebUIClient.cpp
@@ -131,12 +131,12 @@ void WebUIClient::mouseDidMoveOverElement(WebPageProxy* page, WebEvent::Modifier
m_client.mouseDidMoveOverElement(toAPI(page), toAPI(modifiers), toAPI(userData), m_client.clientInfo);
}
-void WebUIClient::missingPluginButtonClicked(WebPageProxy* page, const String& mimeType, const String& url)
+void WebUIClient::missingPluginButtonClicked(WebPageProxy* page, const String& mimeType, const String& url, const String& pluginsPageURL)
{
if (!m_client.missingPluginButtonClicked)
return;
- m_client.missingPluginButtonClicked(toAPI(page), toAPI(mimeType.impl()), toAPI(url.impl()), m_client.clientInfo);
+ m_client.missingPluginButtonClicked(toAPI(page), toAPI(mimeType.impl()), toAPI(url.impl()), toAPI(pluginsPageURL.impl()), m_client.clientInfo);
}
void WebUIClient::didNotHandleKeyEvent(WebPageProxy* page, const NativeWebKeyboardEvent& event)
@@ -218,7 +218,7 @@ FloatRect WebUIClient::windowFrame(WebPageProxy* page)
return toFloatRect(m_client.getWindowFrame(toAPI(page), m_client.clientInfo));
}
-bool WebUIClient::canRunBeforeUnloadConfirmPanel()
+bool WebUIClient::canRunBeforeUnloadConfirmPanel() const
{
return m_client.runBeforeUnloadConfirmPanel;
}
diff --git a/Source/WebKit2/UIProcess/WebUIClient.h b/Source/WebKit2/UIProcess/WebUIClient.h
index d8e0bff..ed47f8f 100644
--- a/Source/WebKit2/UIProcess/WebUIClient.h
+++ b/Source/WebKit2/UIProcess/WebUIClient.h
@@ -61,7 +61,7 @@ public:
void setStatusText(WebPageProxy*, const String&);
void mouseDidMoveOverElement(WebPageProxy*, WebEvent::Modifiers, APIObject*);
- void missingPluginButtonClicked(WebPageProxy*, const String& mimeType, const String& url);
+ void missingPluginButtonClicked(WebPageProxy*, const String& mimeType, const String& url, const String& pluginsPageURL);
void didNotHandleKeyEvent(WebPageProxy*, const NativeWebKeyboardEvent&);
bool toolbarsAreVisible(WebPageProxy*);
@@ -76,7 +76,7 @@ public:
void setWindowFrame(WebPageProxy*, const WebCore::FloatRect&);
WebCore::FloatRect windowFrame(WebPageProxy*);
- bool canRunBeforeUnloadConfirmPanel();
+ bool canRunBeforeUnloadConfirmPanel() const;
bool runBeforeUnloadConfirmPanel(WebPageProxy*, const String&, WebFrameProxy*);
void didDraw(WebPageProxy*);
diff --git a/Source/WebKit2/UIProcess/cf/WebPageProxyCF.cpp b/Source/WebKit2/UIProcess/cf/WebPageProxyCF.cpp
index 2065799..dc26899 100644
--- a/Source/WebKit2/UIProcess/cf/WebPageProxyCF.cpp
+++ b/Source/WebKit2/UIProcess/cf/WebPageProxyCF.cpp
@@ -42,21 +42,40 @@ using namespace WebCore;
namespace WebKit {
DEFINE_STATIC_GETTER(CFStringRef, SessionHistoryKey, (CFSTR("SessionHistory")));
+DEFINE_STATIC_GETTER(CFStringRef, ProvisionalURLKey, (CFSTR("ProvisionalURL")));
static const UInt32 CurrentSessionStateDataVersion = 2;
PassRefPtr<WebData> WebPageProxy::sessionStateData(WebPageProxySessionStateFilterCallback filter, void* context) const
{
+ const void* keys[2];
+ const void* values[2];
+ CFIndex numValues = 0;
+
RetainPtr<CFDictionaryRef> sessionHistoryDictionary(AdoptCF, m_backForwardList->createCFDictionaryRepresentation(filter, context));
-
- // For now we're only serializing the back/forward list. If that object is null, then the entire sessionState can be null.
- if (!sessionHistoryDictionary)
+ if (sessionHistoryDictionary) {
+ keys[numValues] = SessionHistoryKey();
+ values[numValues] = sessionHistoryDictionary.get();
+ ++numValues;
+ }
+
+ RetainPtr<CFStringRef> provisionalURLString;
+ if (m_mainFrame) {
+ String provisionalURL = pendingAPIRequestURL();
+ if (provisionalURL.isEmpty())
+ provisionalURL = m_mainFrame->provisionalURL();
+ if (!provisionalURL.isEmpty()) {
+ provisionalURLString.adoptCF(provisionalURL.createCFString());
+ keys[numValues] = ProvisionalURLKey();
+ values[numValues] = provisionalURLString.get();
+ ++numValues;
+ }
+ }
+
+ if (!numValues)
return 0;
-
- const void* keys[1] = { SessionHistoryKey() };
- const void* values[1] = { sessionHistoryDictionary.get() };
-
- RetainPtr<CFDictionaryRef> stateDictionary(AdoptCF, CFDictionaryCreate(0, keys, values, 1, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
+
+ RetainPtr<CFDictionaryRef> stateDictionary(AdoptCF, CFDictionaryCreate(0, keys, values, numValues, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
RetainPtr<CFWriteStreamRef> writeStream(AdoptCF, CFWriteStreamCreateWithAllocatedBuffers(0, 0));
if (!writeStream)
@@ -115,29 +134,49 @@ void WebPageProxy::restoreFromSessionStateData(WebData* webData)
LOG(SessionState, "SessionState property list is not a CFDictionaryRef (%i) - its CFTypeID is %i", (int)CFDictionaryGetTypeID(), (int)CFGetTypeID(propertyList.get()));
return;
}
-
- CFTypeRef sessionHistoryRef = CFDictionaryGetValue(static_cast<CFDictionaryRef>(propertyList.get()), SessionHistoryKey());
- if (!sessionHistoryRef || CFGetTypeID(sessionHistoryRef) != CFDictionaryGetTypeID()) {
- LOG(SessionState, "SessionState dictionary does not contain a SessionHistoryDictionary key, it is of the wrong type");
- return;
+
+ CFDictionaryRef backForwardListDictionary = 0;
+ if (CFTypeRef value = CFDictionaryGetValue(static_cast<CFDictionaryRef>(propertyList.get()), SessionHistoryKey())) {
+ if (CFGetTypeID(value) != CFDictionaryGetTypeID())
+ LOG(SessionState, "SessionState dictionary has a SessionHistory key, but the value is not a dictionary");
+ else
+ backForwardListDictionary = static_cast<CFDictionaryRef>(value);
}
-
- CFDictionaryRef sessionHistoryDictionary = static_cast<CFDictionaryRef>(sessionHistoryRef);
- if (!m_backForwardList->restoreFromCFDictionaryRepresentation(sessionHistoryDictionary)) {
- LOG(SessionState, "Failed to restore back/forward list from SessionHistoryDictionary");
- return;
+
+ CFStringRef provisionalURL = 0;
+ if (CFTypeRef value = CFDictionaryGetValue(static_cast<CFDictionaryRef>(propertyList.get()), ProvisionalURLKey())) {
+ if (CFGetTypeID(value) != CFStringGetTypeID())
+ LOG(SessionState, "SessionState dictionary has a ProvisionalValue key, but the value is not a string");
+ else
+ provisionalURL = static_cast<CFStringRef>(value);
}
-
- const BackForwardListItemVector& entries = m_backForwardList->entries();
- size_t size = entries.size();
- for (size_t i = 0; i < size; ++i)
- process()->registerNewWebBackForwardListItem(entries[i].get());
- SandboxExtension::Handle sandboxExtensionHandle;
- if (WebBackForwardListItem* item = m_backForwardList->currentItem())
- initializeSandboxExtensionHandle(KURL(KURL(), item->url()), sandboxExtensionHandle);
+ bool restoredFromBackForwardList = false;
+ if (backForwardListDictionary) {
+ if (!m_backForwardList->restoreFromCFDictionaryRepresentation(backForwardListDictionary))
+ LOG(SessionState, "Failed to restore back/forward list from SessionHistory dictionary");
+ else {
+ const BackForwardListItemVector& entries = m_backForwardList->entries();
+ if (size_t size = entries.size()) {
+ for (size_t i = 0; i < size; ++i)
+ process()->registerNewWebBackForwardListItem(entries[i].get());
+
+ SandboxExtension::Handle sandboxExtensionHandle;
+ if (WebBackForwardListItem* item = m_backForwardList->currentItem())
+ initializeSandboxExtensionHandle(KURL(KURL(), item->url()), sandboxExtensionHandle);
+
+ process()->send(Messages::WebPage::RestoreSessionAndNavigateToCurrentItem(SessionState(m_backForwardList->entries(), m_backForwardList->currentIndex()), sandboxExtensionHandle), m_pageID);
+
+ restoredFromBackForwardList = true;
+ }
+ }
+ }
- process()->send(Messages::WebPage::RestoreSessionAndNavigateToCurrentItem(SessionState(m_backForwardList->entries(), m_backForwardList->currentIndex()), sandboxExtensionHandle), m_pageID);
+ // FIXME: It would be better to load the provisional URL even if the back/forward list is also present.
+ // But when we tried it, it overwrote the current item in the back/forward list instead of pushing a
+ // new item on. For now, just throw away the provisional URL if there is also a back/forward list.
+ if (provisionalURL && !restoredFromBackForwardList)
+ loadURL(provisionalURL);
}
} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/gtk/TextCheckerGtk.cpp b/Source/WebKit2/UIProcess/gtk/TextCheckerGtk.cpp
index 711783a..6a6715a 100644
--- a/Source/WebKit2/UIProcess/gtk/TextCheckerGtk.cpp
+++ b/Source/WebKit2/UIProcess/gtk/TextCheckerGtk.cpp
@@ -27,8 +27,8 @@
#include "config.h"
#include "TextChecker.h"
-#include "NotImplemented.h"
#include "TextCheckerState.h"
+#include <WebCore/NotImplemented.h>
using namespace WebCore;
@@ -80,6 +80,11 @@ void TextChecker::updateSpellingUIWithMisspelledWord(const String& misspelledWor
notImplemented();
}
+void TextChecker::updateSpellingUIWithGrammarString(const String& badGrammarPhrase, const GrammarDetail& grammarDetail)
+{
+ notImplemented();
+}
+
void TextChecker::getGuessesForWord(int64_t spellDocumentTag, const String& word, const String& context, Vector<String>& guesses)
{
notImplemented();
diff --git a/Source/WebKit2/UIProcess/WebProcessManager.h b/Source/WebKit2/UIProcess/gtk/WebContextGtk.cpp
index 320829e..d67726c 100644
--- a/Source/WebKit2/UIProcess/WebProcessManager.h
+++ b/Source/WebKit2/UIProcess/gtk/WebContextGtk.cpp
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Portions Copyright (c) 2010 Motorola Mobility, Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -10,7 +11,7 @@
* 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''
+ * 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
@@ -23,34 +24,26 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef WebProcessManager_h
-#define WebProcessManager_h
+#include "config.h"
+#include "WebContext.h"
-#include "WebProcessProxy.h"
-#include <wtf/HashMap.h>
-#include <wtf/RefPtr.h>
+#include "ApplicationCacheStorage.h"
+#include "NotImplemented.h"
namespace WebKit {
-class WebProcessManager {
-public:
- static WebProcessManager& shared();
+WTF::String WebContext::applicationCacheDirectory()
+{
+ return WebCore::cacheStorage().cacheDirectory();
+}
- WebProcessProxy* getWebProcess(WebContext*);
- void processDidClose(WebProcessProxy*, WebContext*);
+void WebContext::platformInitializeWebProcess(WebProcessCreationParameters&)
+{
+}
- void contextWasDestroyed(WebContext*);
-
-private:
- WebProcessManager();
-
- RefPtr<WebProcessProxy> m_sharedThread;
- RefPtr<WebProcessProxy> m_sharedProcess;
-
- typedef HashMap<WebContext*, RefPtr<WebProcessProxy> > ProcessMap;
- ProcessMap m_processMap;
-};
+String WebContext::platformDefaultDatabaseDirectory() const
+{
+ return WTF::String::fromUTF8(g_build_filename(g_get_user_data_dir(), "webkit", "databases", NULL));
+}
} // namespace WebKit
-
-#endif // WebProcessManager_h
diff --git a/Source/WebKit2/UIProcess/gtk/WebInspectorGtk.cpp b/Source/WebKit2/UIProcess/gtk/WebInspectorGtk.cpp
index 8d6b515..ee12bac 100644
--- a/Source/WebKit2/UIProcess/gtk/WebInspectorGtk.cpp
+++ b/Source/WebKit2/UIProcess/gtk/WebInspectorGtk.cpp
@@ -29,11 +29,9 @@
#if ENABLE(INSPECTOR)
+#include <WebCore/NotImplemented.h>
#include <wtf/text/WTFString.h>
-#define DISABLE_NOT_IMPLEMENTED_WARNINGS 1
-#include "NotImplemented.h"
-
namespace WebKit {
WebPageProxy* WebInspectorProxy::platformCreateInspectorPage()
@@ -52,6 +50,11 @@ void WebInspectorProxy::platformClose()
notImplemented();
}
+void WebInspectorProxy::platformInspectedURLChanged(const String&)
+{
+ notImplemented();
+}
+
String WebInspectorProxy::inspectorPageURL() const
{
notImplemented();
diff --git a/Source/WebKit2/UIProcess/gtk/WebPageProxyGtk.cpp b/Source/WebKit2/UIProcess/gtk/WebPageProxyGtk.cpp
index a36bd0c..838de97 100644
--- a/Source/WebKit2/UIProcess/gtk/WebPageProxyGtk.cpp
+++ b/Source/WebKit2/UIProcess/gtk/WebPageProxyGtk.cpp
@@ -32,7 +32,7 @@ namespace WebKit {
String WebPageProxy::standardUserAgent(const String& applicationNameForUserAgent)
{
// FIXME: This should not be hard coded.
- return "Mozilla/5.0 (X11; U; Linux i686; en-us) AppleWebKit/534.7 (KHTML, like Gecko) Version/5.0 Safari/534.7";
+ return "Mozilla/5.0 (X11; Linux i686) AppleWebKit/534.7 (KHTML, like Gecko) Version/5.0 Safari/534.7";
}
} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/gtk/WebPreferencesGtk.cpp b/Source/WebKit2/UIProcess/gtk/WebPreferencesGtk.cpp
index f7caee8..c698204 100644
--- a/Source/WebKit2/UIProcess/gtk/WebPreferencesGtk.cpp
+++ b/Source/WebKit2/UIProcess/gtk/WebPreferencesGtk.cpp
@@ -27,7 +27,7 @@
#include "config.h"
#include "WebPreferences.h"
-#include "NotImplemented.h"
+#include <WebCore/NotImplemented.h>
namespace WebKit {
diff --git a/Source/WebKit2/UIProcess/gtk/WebView.cpp b/Source/WebKit2/UIProcess/gtk/WebView.cpp
new file mode 100644
index 0000000..5063922
--- /dev/null
+++ b/Source/WebKit2/UIProcess/gtk/WebView.cpp
@@ -0,0 +1,297 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Portions Copyright (c) 2010 Motorola Mobility, Inc. All rights reserved.
+ * Copyright (C) 2011 Igalia S.L.
+ *
+ * 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 "WebView.h"
+
+#include "ChunkedUpdateDrawingAreaProxy.h"
+#include "NativeWebKeyboardEvent.h"
+#include "NotImplemented.h"
+#include "WebContext.h"
+#include "WebContextMenuProxy.h"
+#include "WebEventFactory.h"
+#include "WebViewWidget.h"
+#include "WebPageProxy.h"
+#include <wtf/text/WTFString.h>
+
+using namespace WebCore;
+
+namespace WebKit {
+
+
+void WebView::handleFocusInEvent(GtkWidget* widget)
+{
+ if (!(m_isPageActive)) {
+ m_isPageActive = true;
+ m_page->viewStateDidChange(WebPageProxy::ViewWindowIsActive);
+ }
+
+ m_page->viewStateDidChange(WebPageProxy::ViewIsFocused);
+}
+
+void WebView::handleFocusOutEvent(GtkWidget* widget)
+{
+ m_isPageActive = false;
+ m_page->viewStateDidChange(WebPageProxy::ViewWindowIsActive);
+}
+
+WebView::WebView(WebContext* context, WebPageGroup* pageGroup)
+ : m_isPageActive(true)
+{
+ m_page = context->createWebPage(this, pageGroup);
+
+ m_viewWidget = static_cast<GtkWidget*>(g_object_new(WEB_VIEW_TYPE_WIDGET, NULL));
+ ASSERT(m_viewWidget);
+
+ m_page->initializeWebPage();
+
+ WebViewWidget* webViewWidget = WEB_VIEW_WIDGET(m_viewWidget);
+ webViewWidgetSetWebViewInstance(webViewWidget, this);
+}
+
+WebView::~WebView()
+{
+}
+
+GdkWindow* WebView::getWebViewWindow()
+{
+ return gtk_widget_get_window(m_viewWidget);
+}
+
+void WebView::paint(GtkWidget* widget, GdkRectangle rect, cairo_t* cr)
+{
+ m_page->drawingArea()->paint(IntRect(rect), cr);
+}
+
+void WebView::setSize(GtkWidget*, IntSize windowSize)
+{
+ m_page->drawingArea()->setSize(windowSize, IntSize());
+}
+
+void WebView::handleKeyboardEvent(GdkEventKey* event)
+{
+ m_page->handleKeyboardEvent(NativeWebKeyboardEvent(reinterpret_cast<GdkEvent*>(event)));
+}
+
+void WebView::handleMouseEvent(GdkEvent* event, int currentClickCount)
+{
+ m_page->handleMouseEvent(WebEventFactory::createWebMouseEvent(event, currentClickCount));
+}
+
+void WebView::handleWheelEvent(GdkEventScroll* event)
+{
+ m_page->handleWheelEvent(WebEventFactory::createWebWheelEvent(event));
+}
+
+bool WebView::isActive()
+{
+ return m_isPageActive;
+}
+
+void WebView::close()
+{
+ m_page->close();
+}
+
+// PageClient's pure virtual functions
+PassOwnPtr<DrawingAreaProxy> WebView::createDrawingAreaProxy()
+{
+ return ChunkedUpdateDrawingAreaProxy::create(this, m_page.get());
+}
+
+void WebView::setViewNeedsDisplay(const WebCore::IntRect&)
+{
+ notImplemented();
+}
+
+void WebView::displayView()
+{
+ notImplemented();
+}
+
+void WebView::scrollView(const WebCore::IntRect& scrollRect, const WebCore::IntSize& scrollOffset)
+{
+ notImplemented();
+}
+
+WebCore::IntSize WebView::viewSize()
+{
+ GtkAllocation allocation;
+ gtk_widget_get_allocation(m_viewWidget, &allocation);
+ return IntSize(allocation.width, allocation.height);
+}
+
+bool WebView::isViewWindowActive()
+{
+ notImplemented();
+ return true;
+}
+
+bool WebView::isViewFocused()
+{
+ notImplemented();
+ return true;
+}
+
+bool WebView::isViewVisible()
+{
+ notImplemented();
+ return true;
+}
+
+bool WebView::isViewInWindow()
+{
+ notImplemented();
+ return true;
+}
+
+void WebView::WebView::processDidCrash()
+{
+ notImplemented();
+}
+
+void WebView::didRelaunchProcess()
+{
+ notImplemented();
+}
+
+void WebView::takeFocus(bool)
+{
+ notImplemented();
+}
+
+void WebView::toolTipChanged(const String&, const String&)
+{
+ notImplemented();
+}
+
+void WebView::setCursor(const Cursor&)
+{
+ notImplemented();
+}
+
+void WebView::setViewportArguments(const WebCore::ViewportArguments&)
+{
+ notImplemented();
+}
+
+void WebView::registerEditCommand(PassRefPtr<WebEditCommandProxy>, WebPageProxy::UndoOrRedo)
+{
+ notImplemented();
+}
+
+void WebView::clearAllEditCommands()
+{
+ notImplemented();
+}
+
+FloatRect WebView::convertToDeviceSpace(const FloatRect& viewRect)
+{
+ notImplemented();
+ return viewRect;
+}
+
+FloatRect WebView::convertToUserSpace(const FloatRect& viewRect)
+{
+ notImplemented();
+ return viewRect;
+}
+
+void WebView::doneWithKeyEvent(const NativeWebKeyboardEvent&, bool wasEventHandled)
+{
+ notImplemented();
+}
+
+void WebView::didNotHandleKeyEvent(const NativeWebKeyboardEvent& event)
+{
+ notImplemented();
+}
+
+PassRefPtr<WebPopupMenuProxy> WebView::createPopupMenuProxy(WebPageProxy*)
+{
+ notImplemented();
+ return 0;
+}
+
+PassRefPtr<WebContextMenuProxy> WebView::createContextMenuProxy(WebPageProxy*)
+{
+ notImplemented();
+ return 0;
+}
+
+void WebView::setFindIndicator(PassRefPtr<FindIndicator>, bool fadeOut)
+{
+ notImplemented();
+}
+
+#if USE(ACCELERATED_COMPOSITING)
+void WebView::pageDidEnterAcceleratedCompositing()
+{
+ notImplemented();
+}
+
+void WebView::pageDidLeaveAcceleratedCompositing()
+{
+ notImplemented();
+}
+#endif // USE(ACCELERATED_COMPOSITING)
+
+void WebView::didCommitLoadForMainFrame(bool useCustomRepresentation)
+{
+}
+
+void WebView::didFinishLoadingDataForCustomRepresentation(const String& suggestedFilename, const CoreIPC::DataReference&)
+{
+}
+
+double WebView::customRepresentationZoomFactor()
+{
+ notImplemented();
+ return 0;
+}
+
+void WebView::setCustomRepresentationZoomFactor(double)
+{
+ notImplemented();
+}
+
+void WebView::pageClosed()
+{
+ notImplemented();
+}
+
+void WebView::didChangeScrollbarsForMainFrame() const
+{
+}
+
+void WebView::flashBackingStoreUpdates(const Vector<IntRect>&)
+{
+ notImplemented();
+}
+
+
+} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/gtk/WebView.h b/Source/WebKit2/UIProcess/gtk/WebView.h
new file mode 100644
index 0000000..256dc04
--- /dev/null
+++ b/Source/WebKit2/UIProcess/gtk/WebView.h
@@ -0,0 +1,122 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Portions Copyright (c) 2010 Motorola Mobility, Inc. All rights reserved.
+ * Copyright (C) 2011 Igalia S.L.
+ *
+ * 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 WebView_h
+#define WebView_h
+
+#include "PageClient.h"
+#include "WebPageProxy.h"
+#include <WebCore/IntSize.h>
+#include <gdk/gdk.h>
+#include <glib.h>
+#include <gtk/gtk.h>
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
+#include <wtf/RefPtr.h>
+
+namespace WebKit {
+
+class DrawingAreaProxy;
+class WebPageNamespace;
+
+class WebView : public RefCounted<WebView>, public PageClient {
+public:
+ ~WebView();
+ static PassRefPtr<WebView> create(WebContext* context, WebPageGroup* pageGroup)
+ {
+ return adoptRef(new WebView(context, pageGroup));
+ }
+
+ GtkWidget* window() const { return m_viewWidget; }
+
+ WebPageProxy* page() const { return m_page.get(); }
+
+ void handleFocusInEvent(GtkWidget*);
+ void handleFocusOutEvent(GtkWidget*);
+
+ void paint(GtkWidget*, GdkRectangle, cairo_t*);
+ void setSize(GtkWidget*, WebCore::IntSize);
+ void handleKeyboardEvent(GdkEventKey*);
+ void handleWheelEvent(GdkEventScroll*);
+ void handleMouseEvent(GdkEvent*, int);
+
+private:
+ WebView(WebContext*, WebPageGroup*);
+
+ GdkWindow* getWebViewWindow();
+
+ bool isActive();
+ void close();
+
+ // PageClient
+ virtual PassOwnPtr<DrawingAreaProxy> createDrawingAreaProxy();
+ virtual void setViewNeedsDisplay(const WebCore::IntRect&);
+ virtual void displayView();
+ virtual void scrollView(const WebCore::IntRect& scrollRect, const WebCore::IntSize& scrollOffset);
+ virtual WebCore::IntSize viewSize();
+ virtual bool isViewWindowActive();
+ virtual bool isViewFocused();
+ virtual bool isViewVisible();
+ virtual bool isViewInWindow();
+ virtual void processDidCrash();
+ virtual void didRelaunchProcess();
+ virtual void pageClosed();
+ virtual void takeFocus(bool direction);
+ virtual void toolTipChanged(const WTF::String&, const WTF::String&);
+ virtual void setCursor(const WebCore::Cursor&);
+ virtual void setViewportArguments(const WebCore::ViewportArguments&);
+ virtual void registerEditCommand(PassRefPtr<WebEditCommandProxy>, WebPageProxy::UndoOrRedo);
+ virtual void clearAllEditCommands();
+ virtual WebCore::FloatRect convertToDeviceSpace(const WebCore::FloatRect&);
+ virtual WebCore::FloatRect convertToUserSpace(const WebCore::FloatRect&);
+ virtual void doneWithKeyEvent(const NativeWebKeyboardEvent&, bool wasEventHandled);
+ virtual void didNotHandleKeyEvent(const NativeWebKeyboardEvent&);
+ virtual PassRefPtr<WebPopupMenuProxy> createPopupMenuProxy(WebPageProxy*);
+ virtual PassRefPtr<WebContextMenuProxy> createContextMenuProxy(WebPageProxy*);
+ virtual void setFindIndicator(PassRefPtr<FindIndicator>, bool fadeOut);
+ virtual void didChangeScrollbarsForMainFrame() const;
+ virtual void flashBackingStoreUpdates(const Vector<WebCore::IntRect>& updateRects);
+
+#if USE(ACCELERATED_COMPOSITING)
+ virtual void pageDidEnterAcceleratedCompositing();
+ virtual void pageDidLeaveAcceleratedCompositing();
+#endif
+
+ virtual void didCommitLoadForMainFrame(bool useCustomRepresentation);
+ virtual void didFinishLoadingDataForCustomRepresentation(const String& suggestedFilename, const CoreIPC::DataReference&);
+ virtual double customRepresentationZoomFactor();
+ virtual void setCustomRepresentationZoomFactor(double);
+
+ // Members of WebView class
+ GtkWidget* m_viewWidget;
+ bool m_isPageActive;
+ RefPtr<WebPageProxy> m_page;
+};
+
+} // namespace WebKit
+
+#endif // WebView_h
diff --git a/Source/WebKit2/UIProcess/gtk/WebViewWidget.cpp b/Source/WebKit2/UIProcess/gtk/WebViewWidget.cpp
new file mode 100644
index 0000000..dfdd3b2
--- /dev/null
+++ b/Source/WebKit2/UIProcess/gtk/WebViewWidget.cpp
@@ -0,0 +1,377 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Portions Copyright (c) 2010 Motorola Mobility, Inc. All rights reserved.
+ * Copyright (C) 2011 Igalia S.L.
+ *
+ * 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 "WebViewWidget.h"
+
+#include "GOwnPtrGtk.h"
+#include "GtkVersioning.h"
+#include "NotImplemented.h"
+#include "RefPtrCairo.h"
+
+using namespace WebKit;
+using namespace WebCore;
+
+static gpointer webViewWidgetParentClass = 0;
+
+struct _WebViewWidgetPrivate {
+ WebView* webViewInstance;
+ GtkIMContext* imContext;
+ gint currentClickCount;
+ IntPoint previousClickPoint;
+ guint previousClickButton;
+ guint32 previousClickTime;
+};
+
+static void webViewWidgetRealize(GtkWidget* widget)
+{
+ gtk_widget_set_realized(widget, TRUE);
+
+ GtkAllocation allocation;
+ gtk_widget_get_allocation(widget, &allocation);
+
+ GdkWindowAttr attributes;
+ attributes.window_type = GDK_WINDOW_CHILD;
+ attributes.x = allocation.x;
+ attributes.y = allocation.y;
+ attributes.width = allocation.width;
+ attributes.height = allocation.height;
+ attributes.wclass = GDK_INPUT_OUTPUT;
+ attributes.visual = gtk_widget_get_visual(widget);
+#ifdef GTK_API_VERSION_2
+ attributes.colormap = gtk_widget_get_colormap(widget);
+#endif
+ attributes.event_mask = GDK_VISIBILITY_NOTIFY_MASK
+ | GDK_EXPOSURE_MASK
+ | GDK_BUTTON_PRESS_MASK
+ | GDK_BUTTON_RELEASE_MASK
+ | GDK_POINTER_MOTION_MASK
+ | GDK_KEY_PRESS_MASK
+ | GDK_KEY_RELEASE_MASK
+ | GDK_BUTTON_MOTION_MASK
+ | GDK_BUTTON1_MOTION_MASK
+ | GDK_BUTTON2_MOTION_MASK
+ | GDK_BUTTON3_MOTION_MASK;
+
+ gint attributesMask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL;
+#ifdef GTK_API_VERSION_2
+ attributesMask |= GDK_WA_COLORMAP;
+#endif
+ GdkWindow* window = gdk_window_new(gtk_widget_get_parent_window(widget), &attributes, attributesMask);
+ gtk_widget_set_window(widget, window);
+ gdk_window_set_user_data(window, widget);
+
+#ifdef GTK_API_VERSION_2
+#if GTK_CHECK_VERSION(2, 20, 0)
+ gtk_widget_style_attach(widget);
+#else
+ widget->style = gtk_style_attach(gtk_widget_get_style(widget), window);
+#endif
+ gtk_style_set_background(gtk_widget_get_style(widget), window, GTK_STATE_NORMAL);
+#else
+ gtk_style_context_set_background(gtk_widget_get_style_context(widget), window);
+#endif
+
+ WebViewWidget* webView = WEB_VIEW_WIDGET(widget);
+ WebViewWidgetPrivate* priv = webView->priv;
+ gtk_im_context_set_client_window(priv->imContext, window);
+}
+
+static void webViewWidgetContainerAdd(GtkContainer* container, GtkWidget* widget)
+{
+ gtk_widget_set_parent(widget, GTK_WIDGET(container));
+}
+
+static void webViewWidgetDispose(GObject* gobject)
+{
+ WebViewWidget* webViewWidget = WEB_VIEW_WIDGET(gobject);
+ WebViewWidgetPrivate* priv = webViewWidget->priv;
+
+ if (priv->imContext) {
+ g_object_unref(priv->imContext);
+ priv->imContext = 0;
+ }
+
+ G_OBJECT_CLASS(webViewWidgetParentClass)->dispose(gobject);
+}
+
+static void webViewWidgetInit(WebViewWidget* webViewWidget)
+{
+ WebViewWidgetPrivate* priv = G_TYPE_INSTANCE_GET_PRIVATE(webViewWidget, WEB_VIEW_TYPE_WIDGET, WebViewWidgetPrivate);
+ webViewWidget->priv = priv;
+
+ gtk_widget_set_can_focus(GTK_WIDGET(webViewWidget), TRUE);
+ priv->imContext = gtk_im_multicontext_new();
+
+ priv->currentClickCount = 0;
+ priv->previousClickButton = 0;
+ priv->previousClickTime = 0;
+}
+
+#ifdef GTK_API_VERSION_2
+static gboolean webViewExpose(GtkWidget* widget, GdkEventExpose* event)
+{
+ WebView* webView = webViewWidgetGetWebViewInstance(WEB_VIEW_WIDGET(widget));
+ GdkRectangle clipRect;
+ gdk_region_get_clipbox(event->region, &clipRect);
+
+ GdkWindow* window = gtk_widget_get_window(widget);
+ RefPtr<cairo_t> cr = adoptRef(gdk_cairo_create(window));
+
+ webView->paint(widget, clipRect, cr.get());
+
+ return FALSE;
+}
+#else
+static gboolean webViewDraw(GtkWidget* widget, cairo_t* cr)
+{
+ WebView* webView = webViewWidgetGetWebViewInstance(WEB_VIEW_WIDGET(widget));
+ GdkRectangle clipRect;
+
+ if (!gdk_cairo_get_clip_rectangle(cr, &clipRect))
+ return FALSE;
+
+ webView->paint(widget, clipRect, cr);
+
+ return FALSE;
+}
+#endif
+
+static void webViewSizeAllocate(GtkWidget* widget, GtkAllocation* allocation)
+{
+ WebView* webView = webViewWidgetGetWebViewInstance(WEB_VIEW_WIDGET(widget));
+ GTK_WIDGET_CLASS(webViewWidgetParentClass)->size_allocate(widget, allocation);
+ webView->setSize(widget, IntSize(allocation->width, allocation->height));
+}
+
+static gboolean webViewFocusInEvent(GtkWidget* widget, GdkEventFocus* event)
+{
+ WebViewWidget* webViewWidget = WEB_VIEW_WIDGET(widget);
+ WebView* webView = webViewWidgetGetWebViewInstance(webViewWidget);
+
+ GtkWidget* toplevel = gtk_widget_get_toplevel(widget);
+ if (gtk_widget_is_toplevel(toplevel) && gtk_window_has_toplevel_focus(GTK_WINDOW(toplevel))) {
+ gtk_im_context_focus_in(webViewWidgetGetIMContext(webViewWidget));
+ webView->handleFocusInEvent(widget);
+ }
+
+ return GTK_WIDGET_CLASS(webViewWidgetParentClass)->focus_in_event(widget, event);
+}
+
+static gboolean webViewFocusOutEvent(GtkWidget* widget, GdkEventFocus* event)
+{
+ WebViewWidget* webViewWidget = WEB_VIEW_WIDGET(widget);
+ WebView* webView = webViewWidgetGetWebViewInstance(webViewWidget);
+
+ webView->handleFocusOutEvent(widget);
+ GtkIMContext* imContext = webViewWidgetGetIMContext(webViewWidget);
+ if (imContext)
+ gtk_im_context_focus_out(imContext);
+
+ return GTK_WIDGET_CLASS(webViewWidgetParentClass)->focus_out_event(widget, event);
+}
+
+static gboolean webViewKeyPressEvent(GtkWidget* widget, GdkEventKey* event)
+{
+ WebView* webView = webViewWidgetGetWebViewInstance(WEB_VIEW_WIDGET(widget));
+ webView->handleKeyboardEvent(event);
+
+ return GTK_WIDGET_CLASS(webViewWidgetParentClass)->key_press_event(widget, event);
+}
+
+static gboolean webViewKeyReleaseEvent(GtkWidget* widget, GdkEventKey* event)
+{
+ WebViewWidget* webViewWidget = WEB_VIEW_WIDGET(widget);
+ WebView* webView = webViewWidgetGetWebViewInstance(webViewWidget);
+
+ if (gtk_im_context_filter_keypress(webViewWidgetGetIMContext(webViewWidget), event))
+ return TRUE;
+
+ webView->handleKeyboardEvent(event);
+
+ return GTK_WIDGET_CLASS(webViewWidgetParentClass)->key_release_event(widget, event);
+}
+
+// Copied from webkitwebview.cpp
+static guint32 getEventTime(GdkEvent* event)
+{
+ guint32 time = gdk_event_get_time(event);
+ if (time)
+ return time;
+
+ // Real events always have a non-zero time, but events synthesized
+ // by the DRT do not and we must calculate a time manually. This time
+ // is not calculated in the DRT, because GTK+ does not work well with
+ // anything other than GDK_CURRENT_TIME on synthesized events.
+ GTimeVal timeValue;
+ g_get_current_time(&timeValue);
+ return (timeValue.tv_sec * 1000) + (timeValue.tv_usec / 1000);
+}
+
+static gboolean webViewButtonPressEvent(GtkWidget* widget, GdkEventButton* buttonEvent)
+{
+ if (buttonEvent->button == 3) {
+ // FIXME: [GTK] Add context menu support for Webkit2.
+ // https://bugs.webkit.org/show_bug.cgi?id=54827
+ notImplemented();
+ return FALSE;
+ }
+
+ gtk_widget_grab_focus(widget);
+
+ // For double and triple clicks GDK sends both a normal button press event
+ // and a specific type (like GDK_2BUTTON_PRESS). If we detect a special press
+ // coming up, ignore this event as it certainly generated the double or triple
+ // click. The consequence of not eating this event is two DOM button press events
+ // are generated.
+ GOwnPtr<GdkEvent> nextEvent(gdk_event_peek());
+ if (nextEvent && (nextEvent->any.type == GDK_2BUTTON_PRESS || nextEvent->any.type == GDK_3BUTTON_PRESS))
+ return TRUE;
+
+ gint doubleClickDistance = 250;
+ gint doubleClickTime = 5;
+ GtkSettings* settings = gtk_settings_get_for_screen(gtk_widget_get_screen(widget));
+ g_object_get(settings,
+ "gtk-double-click-distance", &doubleClickDistance,
+ "gtk-double-click-time", &doubleClickTime, NULL);
+
+ // GTK+ only counts up to triple clicks, but WebCore wants to know about
+ // quadruple clicks, quintuple clicks, ad infinitum. Here, we replicate the
+ // GDK logic for counting clicks.
+ GdkEvent* event(reinterpret_cast<GdkEvent*>(buttonEvent));
+ guint32 eventTime = getEventTime(event);
+ WebViewWidget* webViewWidget = WEB_VIEW_WIDGET(widget);
+ WebViewWidgetPrivate* priv = webViewWidget->priv;
+ if ((event->type == GDK_2BUTTON_PRESS || event->type == GDK_3BUTTON_PRESS)
+ || ((abs(buttonEvent->x - priv->previousClickPoint.x()) < doubleClickDistance)
+ && (abs(buttonEvent->y - priv->previousClickPoint.y()) < doubleClickDistance)
+ && (eventTime - priv->previousClickTime < static_cast<guint>(doubleClickTime))
+ && (buttonEvent->button == priv->previousClickButton)))
+ priv->currentClickCount++;
+ else
+ priv->currentClickCount = 1;
+
+ WebView* webView = webViewWidgetGetWebViewInstance(webViewWidget);
+ webView->handleMouseEvent(event, priv->currentClickCount);
+
+ gdouble x, y;
+ gdk_event_get_coords(event, &x, &y);
+ priv->previousClickPoint = IntPoint(x, y);
+ priv->previousClickButton = buttonEvent->button;
+ priv->previousClickTime = eventTime;
+
+ return FALSE;
+}
+
+static gboolean webViewButtonReleaseEvent(GtkWidget* widget, GdkEventButton* event)
+{
+ WebView* webView = webViewWidgetGetWebViewInstance(WEB_VIEW_WIDGET(widget));
+ gtk_widget_grab_focus(widget);
+ webView->handleMouseEvent(reinterpret_cast<GdkEvent*>(event), 0 /* currentClickCount */);
+
+ return FALSE;
+}
+
+static gboolean webViewScrollEvent(GtkWidget* widget, GdkEventScroll* event)
+{
+ WebView* webView = webViewWidgetGetWebViewInstance(WEB_VIEW_WIDGET(widget));
+ webView->handleWheelEvent(event);
+
+ return FALSE;
+}
+
+static gboolean webViewMotionNotifyEvent(GtkWidget* widget, GdkEventMotion* event)
+{
+ WebView* webView = webViewWidgetGetWebViewInstance(WEB_VIEW_WIDGET(widget));
+ webView->handleMouseEvent(reinterpret_cast<GdkEvent*>(event), 0 /* currentClickCount */);
+
+ return FALSE;
+}
+
+static void webViewWidgetClassInit(WebViewWidgetClass* webViewWidgetClass)
+{
+ webViewWidgetParentClass = g_type_class_peek_parent(webViewWidgetClass);
+
+ GtkWidgetClass* widgetClass = GTK_WIDGET_CLASS(webViewWidgetClass);
+ widgetClass->realize = webViewWidgetRealize;
+#ifdef GTK_API_VERSION_2
+ widgetClass->expose_event = webViewExpose;
+#else
+ widgetClass->draw = webViewDraw;
+#endif
+ widgetClass->size_allocate = webViewSizeAllocate;
+ widgetClass->focus_in_event = webViewFocusInEvent;
+ widgetClass->focus_out_event = webViewFocusOutEvent;
+ widgetClass->key_press_event = webViewKeyPressEvent;
+ widgetClass->key_release_event = webViewKeyReleaseEvent;
+ widgetClass->button_press_event = webViewButtonPressEvent;
+ widgetClass->button_release_event = webViewButtonReleaseEvent;
+ widgetClass->scroll_event = webViewScrollEvent;
+ widgetClass->motion_notify_event = webViewMotionNotifyEvent;
+
+ GObjectClass* gobjectClass = G_OBJECT_CLASS(webViewWidgetClass);
+ gobjectClass->dispose = webViewWidgetDispose;
+
+ GtkContainerClass* containerClass = GTK_CONTAINER_CLASS(webViewWidgetClass);
+ containerClass->add = webViewWidgetContainerAdd;
+
+ g_type_class_add_private(webViewWidgetClass, sizeof(WebViewWidgetPrivate));
+}
+
+GType webViewWidgetGetType()
+{
+ static volatile gsize gDefineTypeIdVolatile = 0;
+
+ if (!g_once_init_enter(&gDefineTypeIdVolatile))
+ return gDefineTypeIdVolatile;
+
+ GType gDefineTypeId = g_type_register_static_simple(GTK_TYPE_CONTAINER,
+ g_intern_static_string("WebViewWidget"),
+ sizeof(WebViewWidgetClass),
+ reinterpret_cast<GClassInitFunc>(webViewWidgetClassInit),
+ sizeof(WebViewWidget),
+ reinterpret_cast<GInstanceInitFunc>(webViewWidgetInit),
+ static_cast<GTypeFlags>(0));
+ g_once_init_leave(&gDefineTypeIdVolatile, gDefineTypeId);
+
+ return gDefineTypeIdVolatile;
+}
+
+WebView* webViewWidgetGetWebViewInstance(WebViewWidget* webViewWidget)
+{
+ return webViewWidget->priv->webViewInstance;
+}
+
+void webViewWidgetSetWebViewInstance(WebViewWidget* webViewWidget, WebView* webViewInstance)
+{
+ webViewWidget->priv->webViewInstance = webViewInstance;
+}
+
+GtkIMContext* webViewWidgetGetIMContext(WebViewWidget* webViewWidget)
+{
+ return webViewWidget->priv->imContext;
+}
diff --git a/Source/WebKit2/UIProcess/gtk/WebViewWidget.h b/Source/WebKit2/UIProcess/gtk/WebViewWidget.h
new file mode 100644
index 0000000..ef1d87f
--- /dev/null
+++ b/Source/WebKit2/UIProcess/gtk/WebViewWidget.h
@@ -0,0 +1,70 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Portions Copyright (c) 2010 Motorola Mobility, Inc. All rights reserved.
+ * Copyright (C) 2011 Igalia S.L.
+ *
+ * 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 WebViewWidget_h
+#define WebViewWidget_h
+
+#include "WebView.h"
+
+#include <gtk/gtk.h>
+
+using namespace WebKit;
+
+G_BEGIN_DECLS
+
+#define WEB_VIEW_TYPE_WIDGET (webViewWidgetGetType())
+#define WEB_VIEW_WIDGET(object) (G_TYPE_CHECK_INSTANCE_CAST((object), WEB_VIEW_TYPE_WIDGET, WebViewWidget))
+#define WEB_VIEW_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), WEB_VIEW_TYPE_WIDGET, WebViewWidgetClass))
+#define WEB_VIEW_IS_WIDGET(object) (G_TYPE_CHECK_INSTANCE_TYPE((object), WEB_VIEW_TYPE_WIDGET))
+#define WEB_VIEW_IS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), WEB_VIEW_TYPE_WIDGET))
+#define WEB_VIEW_WIDGET_GET_CLASS(object) (G_TYPE_INSTANCE_GET_CLASS((object), WEB_VIEW_TYPE_WIDGET, WebViewWidgetClass))
+
+typedef struct _WebViewWidget WebViewWidget;
+typedef struct _WebViewWidgetClass WebViewWidgetClass;
+typedef struct _WebViewWidgetPrivate WebViewWidgetPrivate;
+
+struct _WebViewWidget {
+ GtkContainer parentInstance;
+ /*< private >*/
+ WebViewWidgetPrivate* priv;
+};
+
+struct _WebViewWidgetClass {
+ GtkContainerClass parentClass;
+};
+
+GType webViewWidgetGetType();
+
+WebView* webViewWidgetGetWebViewInstance(WebViewWidget*);
+
+void webViewWidgetSetWebViewInstance(WebViewWidget*, WebView*);
+
+GtkIMContext* webViewWidgetGetIMContext(WebViewWidget*);
+
+G_END_DECLS
+
+#endif // WebViewWidget_h
diff --git a/Source/WebKit2/UIProcess/mac/LayerBackedDrawingAreaProxyMac.mm b/Source/WebKit2/UIProcess/mac/LayerBackedDrawingAreaProxyMac.mm
deleted file mode 100644
index 1c3aee3..0000000
--- a/Source/WebKit2/UIProcess/mac/LayerBackedDrawingAreaProxyMac.mm
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Copyright (C) 2010 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#import "config.h"
-#import "LayerBackedDrawingAreaProxy.h"
-
-#import "DrawingAreaMessageKinds.h"
-#import "DrawingAreaProxyMessageKinds.h"
-#import <QuartzCore/QuartzCore.h>
-#import "WKAPICast.h"
-#import "WKView.h"
-#import "WKViewInternal.h"
-#import "WebKitSystemInterface.h"
-#import "WebPageProxy.h"
-
-using namespace WebCore;
-
-namespace WebKit {
-
-WebPageProxy* LayerBackedDrawingAreaProxy::page()
-{
- return toImpl([m_webView pageRef]);
-}
-
-void LayerBackedDrawingAreaProxy::platformSetSize()
-{
- [m_compositingRootLayer.get() setBounds:CGRectMake(0, 0, size().width(), size().height())];
-}
-
-void LayerBackedDrawingAreaProxy::attachCompositingContext(uint32_t contextID)
-{
-#if HAVE(HOSTED_CORE_ANIMATION)
- m_compositingRootLayer = WKMakeRenderLayer(contextID);
-
- // Turn off default animations.
- NSNull *nullValue = [NSNull null];
- NSDictionary *actions = [NSDictionary dictionaryWithObjectsAndKeys:
- nullValue, @"anchorPoint",
- nullValue, @"bounds",
- nullValue, @"contents",
- nullValue, @"contentsRect",
- nullValue, @"opacity",
- nullValue, @"position",
- nullValue, @"sublayerTransform",
- nullValue, @"sublayers",
- nullValue, @"transform",
- nil];
- [m_compositingRootLayer.get() setStyle:[NSDictionary dictionaryWithObject:actions forKey:@"actions"]];
-
- [m_compositingRootLayer.get() setAnchorPoint:CGPointZero];
- [m_compositingRootLayer.get() setBounds:CGRectMake(0, 0, size().width(), size().height())];
-
- // FIXME: this fixes the layer jiggle when resizing the window, but breaks layer flipping because
- // CA doesn't propagate the kCALayerFlagFlippedAbove through the remote layer.
- // [m_compositingRootLayer.get() setGeometryFlipped:YES];
-
-#ifndef NDEBUG
- [m_compositingRootLayer.get() setName:@"Compositing root layer"];
-#endif
-
- [m_webView _startAcceleratedCompositing:m_compositingRootLayer.get()];
-#endif
-}
-
-void LayerBackedDrawingAreaProxy::detachCompositingContext()
-{
- [m_webView _stopAcceleratedCompositing];
- m_compositingRootLayer = 0;
-}
-
-bool LayerBackedDrawingAreaProxy::paint(const IntRect& rect, PlatformDrawingContext context)
-{
- WebPageProxy* webPageProxy = page();
- if (webPageProxy->drawsBackground() && webPageProxy->drawsTransparentBackground()) {
- CGContextSaveGState(context);
- CGContextSetBlendMode(context, kCGBlendModeCopy);
- CGContextSetFillColorWithColor(context, CGColorGetConstantColor(kCGColorClear));
- CGContextFillRect(context, rect);
-
- CGContextRestoreGState(context);
- }
-
- return true;
-}
-
-} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/mac/TextCheckerMac.mm b/Source/WebKit2/UIProcess/mac/TextCheckerMac.mm
index ceb140a..cef3a55 100644
--- a/Source/WebKit2/UIProcess/mac/TextCheckerMac.mm
+++ b/Source/WebKit2/UIProcess/mac/TextCheckerMac.mm
@@ -297,6 +297,21 @@ void TextChecker::updateSpellingUIWithMisspelledWord(const String& misspelledWor
[[NSSpellChecker sharedSpellChecker] updateSpellingPanelWithMisspelledWord:misspelledWord];
}
+void TextChecker::updateSpellingUIWithGrammarString(const String& badGrammarPhrase, const GrammarDetail& grammarDetail)
+{
+ RetainPtr<NSMutableArray> corrections(AdoptNS, [[NSMutableArray alloc] init]);
+ for (size_t i = 0; i < grammarDetail.guesses.size(); ++i) {
+ NSString *guess = grammarDetail.guesses[i];
+ [corrections.get() addObject:guess];
+ }
+
+ NSRange grammarRange = NSMakeRange(grammarDetail.location, grammarDetail.length);
+ NSString *grammarUserDescription = grammarDetail.userDescription;
+ RetainPtr<NSMutableDictionary> grammarDetailDict(AdoptNS, [[NSDictionary alloc] initWithObjectsAndKeys:[NSValue valueWithRange:grammarRange], NSGrammarRange, grammarUserDescription, NSGrammarUserDescription, corrections.get(), NSGrammarCorrections, nil]);
+
+ [[NSSpellChecker sharedSpellChecker] updateSpellingPanelWithGrammarString:badGrammarPhrase detail:grammarDetailDict.get()];
+}
+
void TextChecker::getGuessesForWord(int64_t spellDocumentTag, const String& word, const String& context, Vector<String>& guesses)
{
#if !defined(BUILDING_ON_SNOW_LEOPARD)
diff --git a/Source/WebKit2/UIProcess/mac/WebContextMac.mm b/Source/WebKit2/UIProcess/mac/WebContextMac.mm
index 9f635c1..498b6e7 100644
--- a/Source/WebKit2/UIProcess/mac/WebContextMac.mm
+++ b/Source/WebKit2/UIProcess/mac/WebContextMac.mm
@@ -33,6 +33,7 @@
using namespace WebCore;
+NSString *WebDatabaseDirectoryDefaultsKey = @"WebDatabaseDirectory";
NSString *WebKitLocalCacheDefaultsKey = @"WebKitLocalCache";
namespace WebKit {
@@ -81,6 +82,9 @@ void WebContext::platformInitializeWebProcess(WebProcessCreationParameters& para
parameters.nsURLCacheMemoryCapacity = [urlCache memoryCapacity];
parameters.nsURLCacheDiskCapacity = [urlCache diskCapacity];
+ ASSERT(strlen(parameters.nsURLCachePath.data()));
+ ASSERT(parameters.nsURLCachePath.data()[strlen(parameters.nsURLCachePath.data()) - 1] != '/'); // Necessary for NSURLCache to find the cache file.
+
#if USE(ACCELERATED_COMPOSITING) && HAVE(HOSTED_CORE_ANIMATION)
mach_port_t renderServerPort = WKInitializeRenderServer();
if (renderServerPort != MACH_PORT_NULL)
@@ -89,11 +93,18 @@ void WebContext::platformInitializeWebProcess(WebProcessCreationParameters& para
// FIXME: This should really be configurable; we shouldn't just blindly allow read access to the UI process bundle.
parameters.uiProcessBundleResourcePath = fileSystemRepresentation([[NSBundle mainBundle] resourcePath]);
+
+#if USE(CFURLSTORAGESESSIONS)
+ parameters.uiProcessBundleIdentifier = String([[NSBundle mainBundle] bundleIdentifier]);
+#endif
}
String WebContext::platformDefaultDatabaseDirectory() const
{
- return [@"~/Library/WebKit/Databases" stringByStandardizingPath];
+ NSString *databasesDirectory = [[NSUserDefaults standardUserDefaults] objectForKey:WebDatabaseDirectoryDefaultsKey];
+ if (!databasesDirectory || ![databasesDirectory isKindOfClass:[NSString class]])
+ databasesDirectory = @"~/Library/WebKit/Databases";
+ return [databasesDirectory stringByStandardizingPath];
}
} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/mac/WebInspectorProxyMac.mm b/Source/WebKit2/UIProcess/mac/WebInspectorProxyMac.mm
index 37a6f97..67d184c 100644
--- a/Source/WebKit2/UIProcess/mac/WebInspectorProxyMac.mm
+++ b/Source/WebKit2/UIProcess/mac/WebInspectorProxyMac.mm
@@ -82,6 +82,8 @@ WebPageProxy* WebInspectorProxy::platformCreateInspectorPage()
m_inspectorView.adoptNS([[WKView alloc] initWithFrame:NSZeroRect contextRef:toAPI(page()->context()) pageGroupRef:toAPI(inspectorPageGroup())]);
ASSERT(m_inspectorView);
+ [m_inspectorView.get() setDrawsBackground:NO];
+
return toImpl(m_inspectorView.get().pageRef);
}
@@ -130,6 +132,13 @@ void WebInspectorProxy::platformClose()
m_inspectorProxyObjCAdapter = 0;
}
+void WebInspectorProxy::platformInspectedURLChanged(const String& urlString)
+{
+ // FIXME: this should be made localizable once WebKit2 supports it. <rdar://problem/8728860>
+ NSString *title = [NSString stringWithFormat:@"Web Inspector \u2014 %@", (NSString *)urlString];
+ [m_inspectorWindow.get() setTitle:title];
+}
+
String WebInspectorProxy::inspectorPageURL() const
{
NSString *path = [[NSBundle bundleWithIdentifier:@"com.apple.WebCore"] pathForResource:@"inspector" ofType:@"html" inDirectory:@"inspector"];
diff --git a/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm b/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm
index e641fe0..1d3ed53 100644
--- a/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm
+++ b/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm
@@ -27,7 +27,6 @@
#import "WebPageProxy.h"
#import "PageClient.h"
-#import <WebCore/Language.h>
#import <wtf/text/StringConcatenate.h>
@interface NSApplication (Details)
@@ -88,12 +87,9 @@ String WebPageProxy::standardUserAgent(const String& applicationNameForUserAgent
DEFINE_STATIC_LOCAL(String, osVersion, (macOSXVersionString()));
DEFINE_STATIC_LOCAL(String, webKitVersion, (userVisibleWebKitVersionString()));
- // FIXME: We should upate the user agent if the default language changes.
- String language = defaultLanguage();
-
if (applicationNameForUserAgent.isEmpty())
- return makeString("Mozilla/5.0 (Macintosh; U; " PROCESSOR " Mac OS X ", osVersion, "; ", language, ") AppleWebKit/", webKitVersion, " (KHTML, like Gecko)");
- return makeString("Mozilla/5.0 (Macintosh; U; " PROCESSOR " Mac OS X ", osVersion, "; ", language, ") AppleWebKit/", webKitVersion, " (KHTML, like Gecko) ", applicationNameForUserAgent);
+ return makeString("Mozilla/5.0 (Macintosh; " PROCESSOR " Mac OS X ", osVersion, ") AppleWebKit/", webKitVersion, " (KHTML, like Gecko)");
+ return makeString("Mozilla/5.0 (Macintosh; " PROCESSOR " Mac OS X ", osVersion, ") AppleWebKit/", webKitVersion, " (KHTML, like Gecko) ", applicationNameForUserAgent);
}
void WebPageProxy::getIsSpeaking(bool& isSpeaking)
diff --git a/Source/WebKit2/UIProcess/mac/WebPopupMenuProxyMac.h b/Source/WebKit2/UIProcess/mac/WebPopupMenuProxyMac.h
index 788fd20..fda5219 100644
--- a/Source/WebKit2/UIProcess/mac/WebPopupMenuProxyMac.h
+++ b/Source/WebKit2/UIProcess/mac/WebPopupMenuProxyMac.h
@@ -38,22 +38,22 @@ class WebPageProxy;
class WebPopupMenuProxyMac : public WebPopupMenuProxy {
public:
- static PassRefPtr<WebPopupMenuProxyMac> create(WKView* webView, WebPopupMenuProxy::Client* client)
+ static PassRefPtr<WebPopupMenuProxyMac> create(WKView *webView, WebPopupMenuProxy::Client* client)
{
return adoptRef(new WebPopupMenuProxyMac(webView, client));
}
~WebPopupMenuProxyMac();
- virtual void showPopupMenu(const WebCore::IntRect&, WebCore::TextDirection, const Vector<WebPopupItem>&, const PlatformPopupMenuData&, int32_t selectedIndex);
+ virtual void showPopupMenu(const WebCore::IntRect&, WebCore::TextDirection, double scaleFactor, const Vector<WebPopupItem>&, const PlatformPopupMenuData&, int32_t selectedIndex);
virtual void hidePopupMenu();
private:
- WebPopupMenuProxyMac(WKView*, WebPopupMenuProxy::Client* client);
+ WebPopupMenuProxyMac(WKView *, WebPopupMenuProxy::Client*);
- void populate(const Vector<WebPopupItem>&, WebCore::TextDirection);
+ void populate(const Vector<WebPopupItem>&, NSFont *, WebCore::TextDirection);
RetainPtr<NSPopUpButtonCell> m_popup;
- WKView* m_webView;
+ WKView *m_webView;
};
} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/mac/WebPopupMenuProxyMac.mm b/Source/WebKit2/UIProcess/mac/WebPopupMenuProxyMac.mm
index 61713fc..7ce8764 100644
--- a/Source/WebKit2/UIProcess/mac/WebPopupMenuProxyMac.mm
+++ b/Source/WebKit2/UIProcess/mac/WebPopupMenuProxyMac.mm
@@ -36,7 +36,7 @@ using namespace WebCore;
namespace WebKit {
-WebPopupMenuProxyMac::WebPopupMenuProxyMac(WKView* webView, WebPopupMenuProxy::Client* client)
+WebPopupMenuProxyMac::WebPopupMenuProxyMac(WKView *webView, WebPopupMenuProxy::Client* client)
: WebPopupMenuProxy(client)
, m_webView(webView)
{
@@ -48,7 +48,7 @@ WebPopupMenuProxyMac::~WebPopupMenuProxyMac()
[m_popup.get() setControlView:nil];
}
-void WebPopupMenuProxyMac::populate(const Vector<WebPopupItem>& items, TextDirection menuTextDirection)
+void WebPopupMenuProxyMac::populate(const Vector<WebPopupItem>& items, NSFont *font, TextDirection menuTextDirection)
{
if (m_popup)
[m_popup.get() removeAllItems];
@@ -73,7 +73,7 @@ void WebPopupMenuProxyMac::populate(const Vector<WebPopupItem>& items, TextDirec
[paragraphStyle.get() setAlignment:menuTextDirection == LTR ? NSLeftTextAlignment : NSRightTextAlignment];
RetainPtr<NSMutableDictionary> attributes(AdoptNS, [[NSMutableDictionary alloc] initWithObjectsAndKeys:
paragraphStyle.get(), NSParagraphStyleAttributeName,
- [m_popup.get() font], NSFontAttributeName,
+ font, NSFontAttributeName,
nil]);
if (items[i].m_hasTextDirectionOverride) {
RetainPtr<NSNumber> writingDirectionValue(AdoptNS, [[NSNumber alloc] initWithInteger:writingDirection + NSTextWritingDirectionOverride]);
@@ -89,15 +89,22 @@ void WebPopupMenuProxyMac::populate(const Vector<WebPopupItem>& items, TextDirec
}
}
-void WebPopupMenuProxyMac::showPopupMenu(const IntRect& rect, TextDirection textDirection, const Vector<WebPopupItem>& items, const PlatformPopupMenuData&, int32_t selectedIndex)
+void WebPopupMenuProxyMac::showPopupMenu(const IntRect& rect, TextDirection textDirection, double scaleFactor, const Vector<WebPopupItem>& items, const PlatformPopupMenuData& data, int32_t selectedIndex)
{
- populate(items, textDirection);
+ NSFont *font;
+ if (data.fontInfo.fontAttributeDictionary) {
+ NSFontDescriptor *fontDescriptor = [NSFontDescriptor fontDescriptorWithFontAttributes:(NSDictionary *)data.fontInfo.fontAttributeDictionary.get()];
+ font = [NSFont fontWithDescriptor:fontDescriptor size:((scaleFactor != 1) ? [fontDescriptor pointSize] * scaleFactor : 0)];
+ } else
+ font = [NSFont menuFontOfSize:0];
+
+ populate(items, font, textDirection);
[m_popup.get() attachPopUpWithFrame:rect inView:m_webView];
[m_popup.get() selectItemAtIndex:selectedIndex];
[m_popup.get() setUserInterfaceLayoutDirection:textDirection == LTR ? NSUserInterfaceLayoutDirectionLeftToRight : NSUserInterfaceLayoutDirectionRightToLeft];
- NSMenu* menu = [m_popup.get() menu];
+ NSMenu *menu = [m_popup.get() menu];
// These values were borrowed from AppKit to match their placement of the menu.
const int popOverHorizontalAdjust = -10;
@@ -111,7 +118,7 @@ void WebPopupMenuProxyMac::showPopupMenu(const IntRect& rect, TextDirection text
[m_webView addSubview:dummyView.get()];
location = [dummyView.get() convertPoint:location fromView:m_webView];
- WKPopupMenu(menu, location, roundf(NSWidth(rect)), dummyView.get(), selectedIndex, [NSFont menuFontOfSize:0]);
+ WKPopupMenu(menu, location, roundf(NSWidth(rect)), dummyView.get(), selectedIndex, font);
[m_popup.get() dismissPopUp];
[dummyView.get() removeFromSuperview];
diff --git a/Source/WebKit2/UIProcess/qt/TextCheckerQt.cpp b/Source/WebKit2/UIProcess/qt/TextCheckerQt.cpp
index 2e124d5..a28b867 100644
--- a/Source/WebKit2/UIProcess/qt/TextCheckerQt.cpp
+++ b/Source/WebKit2/UIProcess/qt/TextCheckerQt.cpp
@@ -26,8 +26,8 @@
#include "config.h"
#include "TextChecker.h"
-#include "NotImplemented.h"
#include "TextCheckerState.h"
+#include <WebCore/NotImplemented.h>
using namespace WebCore;
@@ -81,6 +81,11 @@ void TextChecker::updateSpellingUIWithMisspelledWord(const String& misspelledWor
notImplemented();
}
+void TextChecker::updateSpellingUIWithGrammarString(const String& badGrammarPhrase, const GrammarDetail& grammarDetail)
+{
+ notImplemented();
+}
+
void TextChecker::getGuessesForWord(int64_t spellDocumentTag, const String& word, const String& context, Vector<String>& guesses)
{
notImplemented();
diff --git a/Source/WebKit2/UIProcess/qt/WebContextMenuProxyQt.cpp b/Source/WebKit2/UIProcess/qt/WebContextMenuProxyQt.cpp
index 09638b6..777f98c 100644
--- a/Source/WebKit2/UIProcess/qt/WebContextMenuProxyQt.cpp
+++ b/Source/WebKit2/UIProcess/qt/WebContextMenuProxyQt.cpp
@@ -28,6 +28,7 @@
#include "WebContextMenuProxyQt.h"
#include <IntPoint.h>
+#include <OwnPtr.h>
#include <WebContextMenuItemData.h>
#include <qmenu.h>
#include <qwkpage.h>
@@ -81,19 +82,24 @@ PassRefPtr<WebContextMenuProxyQt> WebContextMenuProxyQt::create(QWKPage* page)
void WebContextMenuProxyQt::showContextMenu(const IntPoint& position, const Vector<WebContextMenuItemData>& items)
{
- if (QMenu* menu = createContextMenu(items)) {
- menu->move(position);
- emit m_page->showContextMenu(menu);
- }
+ OwnPtr<QMenu> menu = createContextMenu(items);
+
+ // We send the signal, even with no items, because the client should be able to show custom items
+ // even if WebKit has nothing to show.
+ if (!menu)
+ menu = adoptPtr(new QMenu);
+
+ menu->move(position);
+ emit m_page->showContextMenu(QSharedPointer<QMenu>(menu.leakPtr()));
}
void WebContextMenuProxyQt::hideContextMenu()
{
}
-QMenu* WebContextMenuProxyQt::createContextMenu(const Vector<WebContextMenuItemData>& items)
+PassOwnPtr<QMenu> WebContextMenuProxyQt::createContextMenu(const Vector<WebContextMenuItemData>& items) const
{
- QMenu* menu = new QMenu;
+ OwnPtr<QMenu> menu = adoptPtr(new QMenu);
for (int i = 0; i < items.size(); ++i) {
const WebContextMenuItemData& item = items.at(i);
switch (item.type()) {
@@ -114,9 +120,11 @@ QMenu* WebContextMenuProxyQt::createContextMenu(const Vector<WebContextMenuItemD
menu->addSeparator();
break;
case WebCore::SubmenuType:
- if (QMenu *subMenu = createContextMenu(item.submenu())) {
+ if (OwnPtr<QMenu> subMenu = createContextMenu(item.submenu())) {
+ subMenu->setParent(menu.get());
+ QMenu* const subMenuPtr = subMenu.leakPtr();
subMenu->setTitle(item.title());
- menu->addAction(subMenu->menuAction());
+ menu->addMenu(subMenuPtr);
}
break;
@@ -124,22 +132,19 @@ QMenu* WebContextMenuProxyQt::createContextMenu(const Vector<WebContextMenuItemD
}
// Do not show sub-menus with just disabled actions.
- if (menu->isEmpty()) {
- delete menu;
- return 0;
- }
+ if (menu->isEmpty())
+ return PassOwnPtr<QMenu>();
+
bool isAnyActionEnabled = false;
QList<QAction *> actions = menu->actions();
for (int i = 0; i < actions.count(); ++i) {
if (actions.at(i)->isVisible())
isAnyActionEnabled |= actions.at(i)->isEnabled();
}
- if (!isAnyActionEnabled) {
- delete menu;
- return 0;
- }
+ if (!isAnyActionEnabled)
+ return PassOwnPtr<QMenu>();
- return menu;
+ return menu.release();
}
} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/qt/WebContextMenuProxyQt.h b/Source/WebKit2/UIProcess/qt/WebContextMenuProxyQt.h
index 435204f..60d83a5 100644
--- a/Source/WebKit2/UIProcess/qt/WebContextMenuProxyQt.h
+++ b/Source/WebKit2/UIProcess/qt/WebContextMenuProxyQt.h
@@ -28,6 +28,7 @@
#define WebContextMenuProxyQt_h
#include "WebContextMenuProxy.h"
+#include <PassOwnPtr.h>
class QMenu;
class QWKPage;
@@ -45,7 +46,7 @@ private:
virtual void showContextMenu(const WebCore::IntPoint&, const Vector<WebContextMenuItemData>&);
virtual void hideContextMenu();
- QMenu* createContextMenu(const Vector<WebContextMenuItemData>& items);
+ PassOwnPtr<QMenu> createContextMenu(const Vector<WebContextMenuItemData>& items) const;
QWKPage* const m_page;
};
diff --git a/Source/WebKit2/UIProcess/qt/WebInspectorProxyQt.cpp b/Source/WebKit2/UIProcess/qt/WebInspectorProxyQt.cpp
index fe0dac5..6e3d9eb 100644
--- a/Source/WebKit2/UIProcess/qt/WebInspectorProxyQt.cpp
+++ b/Source/WebKit2/UIProcess/qt/WebInspectorProxyQt.cpp
@@ -28,11 +28,9 @@
#if ENABLE(INSPECTOR)
+#include <WebCore/NotImplemented.h>
#include <wtf/text/WTFString.h>
-#define DISABLE_NOT_IMPLEMENTED_WARNINGS 1
-#include "NotImplemented.h"
-
namespace WebKit {
WebPageProxy* WebInspectorProxy::platformCreateInspectorPage()
@@ -51,6 +49,11 @@ void WebInspectorProxy::platformClose()
notImplemented();
}
+void WebInspectorProxy::platformInspectedURLChanged(const String&)
+{
+ notImplemented();
+}
+
String WebInspectorProxy::inspectorPageURL() const
{
notImplemented();
diff --git a/Source/WebKit2/UIProcess/qt/WebPageProxyQt.cpp b/Source/WebKit2/UIProcess/qt/WebPageProxyQt.cpp
index 1fa90bb..d6e8639 100644
--- a/Source/WebKit2/UIProcess/qt/WebPageProxyQt.cpp
+++ b/Source/WebKit2/UIProcess/qt/WebPageProxyQt.cpp
@@ -31,7 +31,7 @@ namespace WebKit {
String WebPageProxy::standardUserAgent(const String& applicationNameForUserAgent)
{
// FIXME: This should not be hard coded.
- return "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6; en-us) AppleWebKit/531.4 (KHTML, like Gecko) Version/4.0.3 Safari/531.4";
+ return "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6) AppleWebKit/531.4 (KHTML, like Gecko) Version/4.0.3 Safari/531.4";
}
} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/qt/WebPopupMenuProxyQt.cpp b/Source/WebKit2/UIProcess/qt/WebPopupMenuProxyQt.cpp
index a79cc3c..1e97d74 100644
--- a/Source/WebKit2/UIProcess/qt/WebPopupMenuProxyQt.cpp
+++ b/Source/WebKit2/UIProcess/qt/WebPopupMenuProxyQt.cpp
@@ -42,7 +42,7 @@ WebPopupMenuProxyQt::~WebPopupMenuProxyQt()
{
}
-void WebPopupMenuProxyQt::showPopupMenu(const IntRect& rect, WebCore::TextDirection, const Vector<WebPopupItem>& items, const PlatformPopupMenuData&, int32_t selectedIndex)
+void WebPopupMenuProxyQt::showPopupMenu(const IntRect& rect, WebCore::TextDirection, double, const Vector<WebPopupItem>& items, const PlatformPopupMenuData&, int32_t selectedIndex)
{
}
diff --git a/Source/WebKit2/UIProcess/qt/WebPopupMenuProxyQt.h b/Source/WebKit2/UIProcess/qt/WebPopupMenuProxyQt.h
index f41432c..e7197d5 100644
--- a/Source/WebKit2/UIProcess/qt/WebPopupMenuProxyQt.h
+++ b/Source/WebKit2/UIProcess/qt/WebPopupMenuProxyQt.h
@@ -38,7 +38,7 @@ public:
}
~WebPopupMenuProxyQt();
- virtual void showPopupMenu(const WebCore::IntRect&, WebCore::TextDirection, const Vector<WebPopupItem>&, const PlatformPopupMenuData&, int32_t selectedIndex);
+ virtual void showPopupMenu(const WebCore::IntRect&, WebCore::TextDirection, double scaleFactor, const Vector<WebPopupItem>&, const PlatformPopupMenuData&, int32_t selectedIndex);
virtual void hidePopupMenu();
private:
diff --git a/Source/WebKit2/UIProcess/win/TextCheckerWin.cpp b/Source/WebKit2/UIProcess/win/TextCheckerWin.cpp
index a16f169..dbc6fdc 100644
--- a/Source/WebKit2/UIProcess/win/TextCheckerWin.cpp
+++ b/Source/WebKit2/UIProcess/win/TextCheckerWin.cpp
@@ -26,9 +26,8 @@
#include "config.h"
#include "TextChecker.h"
-#define DISABLE_NOT_IMPLEMENTED_WARNINGS 1
-#include "NotImplemented.h"
#include "TextCheckerState.h"
+#include <WebCore/NotImplemented.h>
using namespace WebCore;
@@ -82,6 +81,11 @@ void TextChecker::updateSpellingUIWithMisspelledWord(const String& misspelledWor
notImplemented();
}
+void TextChecker::updateSpellingUIWithGrammarString(const String& badGrammarPhrase, const GrammarDetail& grammarDetail)
+{
+ notImplemented();
+}
+
void TextChecker::getGuessesForWord(int64_t spellDocumentTag, const String& word, const String& context, Vector<String>& guesses)
{
notImplemented();
diff --git a/Source/WebKit2/UIProcess/win/WebContextMenuProxyWin.cpp b/Source/WebKit2/UIProcess/win/WebContextMenuProxyWin.cpp
index f8f3a24..5afd07e 100644
--- a/Source/WebKit2/UIProcess/win/WebContextMenuProxyWin.cpp
+++ b/Source/WebKit2/UIProcess/win/WebContextMenuProxyWin.cpp
@@ -26,7 +26,7 @@
#include "config.h"
#include "WebContextMenuProxyWin.h"
-#include "NotImplemented.h"
+#include <WebCore/NotImplemented.h>
using namespace WebCore;
diff --git a/Source/WebKit2/UIProcess/win/WebContextWin.cpp b/Source/WebKit2/UIProcess/win/WebContextWin.cpp
index 210d6cc..26708d7 100644
--- a/Source/WebKit2/UIProcess/win/WebContextWin.cpp
+++ b/Source/WebKit2/UIProcess/win/WebContextWin.cpp
@@ -30,6 +30,11 @@
#include "WebProcessMessages.h"
#include <WebCore/FileSystem.h>
+#if USE(CFNETWORK)
+#include <CFNetwork/CFURLCachePriv.h>
+#include <WebKitSystemInterface/WebKitSystemInterface.h>
+#endif
+
using namespace WebCore;
namespace WebKit {
@@ -51,6 +56,24 @@ void WebContext::setShouldPaintNativeControls(bool b)
void WebContext::platformInitializeWebProcess(WebProcessCreationParameters& parameters)
{
parameters.shouldPaintNativeControls = m_shouldPaintNativeControls;
+
+#if USE(CFNETWORK)
+ RetainPtr<CFURLCacheRef> cfurlCache(AdoptCF, CFURLCacheCopySharedURLCache());
+ parameters.cfURLCacheDiskCapacity = CFURLCacheDiskCapacity(cfurlCache.get());
+ parameters.cfURLCacheMemoryCapacity = CFURLCacheMemoryCapacity(cfurlCache.get());
+
+ RetainPtr<CFStringRef> cfURLCachePath(AdoptCF, wkCopyFoundationCacheDirectory());
+ parameters.cfURLCachePath = String(cfURLCachePath.get());
+ // Remove the ending '/' (necessary to have CFNetwork find the Cache file).
+ ASSERT(parameters.cfURLCachePath.length());
+ if (parameters.cfURLCachePath[parameters.cfURLCachePath.length() - 1] == '/')
+ parameters.cfURLCachePath.remove(parameters.cfURLCachePath.length() - 1);
+
+#if USE(CFURLSTORAGESESSIONS)
+ parameters.uiProcessBundleIdentifier = String(reinterpret_cast<CFStringRef>(CFBundleGetValueForInfoDictionaryKey(CFBundleGetMainBundle(), kCFBundleIdentifierKey)));
+#endif // USE(CFURLSTORAGESESSIONS)
+
+#endif // USE(CFNETWORK)
}
String WebContext::platformDefaultDatabaseDirectory() const
diff --git a/Source/WebKit2/UIProcess/win/WebInspectorProxyWin.cpp b/Source/WebKit2/UIProcess/win/WebInspectorProxyWin.cpp
index 35d73ac..30b012e 100644
--- a/Source/WebKit2/UIProcess/win/WebInspectorProxyWin.cpp
+++ b/Source/WebKit2/UIProcess/win/WebInspectorProxyWin.cpp
@@ -28,11 +28,13 @@
#if ENABLE(INSPECTOR)
+#include "WebKitBundle.h"
#include "WebPageProxy.h"
#include "WebView.h"
#include <WebCore/WebCoreInstanceHandle.h>
#include <wtf/PassRefPtr.h>
#include <wtf/RetainPtr.h>
+#include <wtf/text/StringConcatenate.h>
#include <wtf/text/WTFString.h>
using namespace WebCore;
@@ -184,9 +186,16 @@ void WebInspectorProxy::platformClose()
m_inspectorView = 0;
}
+void WebInspectorProxy::platformInspectedURLChanged(const String& urlString)
+{
+ // FIXME: this should be made localizable once WebKit2 supports it. <rdar://problem/8728860>
+ String title = makeString("Web Inspector ", static_cast<UChar>(0x2014), ' ', urlString);
+ ::SetWindowTextW(m_inspectorWindow, title.charactersWithNullTermination());
+}
+
String WebInspectorProxy::inspectorPageURL() const
{
- RetainPtr<CFURLRef> htmlURLRef(AdoptCF, CFBundleCopyResourceURL(CFBundleGetBundleWithIdentifier(CFSTR("com.apple.WebKit")), CFSTR("inspector"), CFSTR("html"), CFSTR("inspector")));
+ RetainPtr<CFURLRef> htmlURLRef(AdoptCF, CFBundleCopyResourceURL(webKitBundle(), CFSTR("inspector"), CFSTR("html"), CFSTR("inspector")));
if (!htmlURLRef)
return String();
diff --git a/Source/WebKit2/UIProcess/win/WebPageProxyWin.cpp b/Source/WebKit2/UIProcess/win/WebPageProxyWin.cpp
index f70363c..186ad44 100644
--- a/Source/WebKit2/UIProcess/win/WebPageProxyWin.cpp
+++ b/Source/WebKit2/UIProcess/win/WebPageProxyWin.cpp
@@ -26,8 +26,8 @@
#include "config.h"
#include "WebPageProxy.h"
+#include "resource.h"
#include <tchar.h>
-#include <WebCore/Language.h>
#include <WebCore/WebCoreInstanceHandle.h>
#include <wtf/StdLibExtras.h>
#include <wtf/text/StringConcatenate.h>
@@ -62,53 +62,21 @@ static String windowsVersion()
static String userVisibleWebKitVersionString()
{
- String versionStr = "420+";
- void* data = 0;
+ LPWSTR buildNumberStringPtr;
+ if (!::LoadStringW(instanceHandle(), BUILD_NUMBER, reinterpret_cast<LPWSTR>(&buildNumberStringPtr), 0) || !buildNumberStringPtr)
+ return "534+";
- struct LANGANDCODEPAGE {
- WORD wLanguage;
- WORD wCodePage;
- } *lpTranslate;
-
- TCHAR path[MAX_PATH];
- ::GetModuleFileName(instanceHandle(), path, WTF_ARRAY_LENGTH(path));
- DWORD handle;
- DWORD versionSize = ::GetFileVersionInfoSize(path, &handle);
- if (!versionSize)
- goto exit;
- data = fastMalloc(versionSize);
- if (!data)
- goto exit;
- if (!::GetFileVersionInfo(path, 0, versionSize, data))
- goto exit;
- UINT cbTranslate;
- if (!::VerQueryValue(data, TEXT("\\VarFileInfo\\Translation"), (LPVOID*)&lpTranslate, &cbTranslate))
- goto exit;
- TCHAR key[256];
- _stprintf_s(key, WTF_ARRAY_LENGTH(key), TEXT("\\StringFileInfo\\%04x%04x\\ProductVersion"), lpTranslate[0].wLanguage, lpTranslate[0].wCodePage);
- LPCTSTR productVersion;
- UINT productVersionLength;
- if (!::VerQueryValue(data, (LPTSTR)(LPCTSTR)key, (void**)&productVersion, &productVersionLength))
- goto exit;
- versionStr = String(productVersion, productVersionLength - 1);
-
-exit:
- if (data)
- fastFree(data);
- return versionStr;
+ return buildNumberStringPtr;
}
String WebPageProxy::standardUserAgent(const String& applicationNameForUserAgent)
{
- DEFINE_STATIC_LOCAL(String, osVersion, (windowsVersion()));
- DEFINE_STATIC_LOCAL(String, webKitVersion, (userVisibleWebKitVersionString()));
-
- // FIXME: We should upate the user agent if the default language changes.
- String language = defaultLanguage();
+ DEFINE_STATIC_LOCAL(String, osVersion, (windowsVersion()));
+ DEFINE_STATIC_LOCAL(String, webKitVersion, (userVisibleWebKitVersionString()));
- if (applicationNameForUserAgent.isEmpty())
- return makeString("Mozilla/5.0 (Windows; U; ", osVersion, "; ", language, ") AppleWebKit/", webKitVersion, " (KHTML, like Gecko)");
- return makeString("Mozilla/5.0 (Windows; U; ", osVersion, "; ", language, ") AppleWebKit/", webKitVersion, " (KHTML, like Gecko) ", applicationNameForUserAgent);
+ if (applicationNameForUserAgent.isEmpty())
+ return makeString("Mozilla/5.0 (", osVersion, ") AppleWebKit/", webKitVersion, " (KHTML, like Gecko)");
+ return makeString("Mozilla/5.0 (", osVersion, ") AppleWebKit/", webKitVersion, " (KHTML, like Gecko) ", applicationNameForUserAgent);
}
} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/win/WebPopupMenuProxyWin.cpp b/Source/WebKit2/UIProcess/win/WebPopupMenuProxyWin.cpp
index 4039c49..eebde75 100644
--- a/Source/WebKit2/UIProcess/win/WebPopupMenuProxyWin.cpp
+++ b/Source/WebKit2/UIProcess/win/WebPopupMenuProxyWin.cpp
@@ -188,7 +188,7 @@ WebPopupMenuProxyWin::~WebPopupMenuProxyWin()
m_scrollbar->setParent(0);
}
-void WebPopupMenuProxyWin::showPopupMenu(const IntRect& rect, TextDirection, const Vector<WebPopupItem>& items, const PlatformPopupMenuData& data, int32_t selectedIndex)
+void WebPopupMenuProxyWin::showPopupMenu(const IntRect& rect, TextDirection, double, const Vector<WebPopupItem>& items, const PlatformPopupMenuData& data, int32_t selectedIndex)
{
m_items = items;
m_data = data;
diff --git a/Source/WebKit2/UIProcess/win/WebPopupMenuProxyWin.h b/Source/WebKit2/UIProcess/win/WebPopupMenuProxyWin.h
index 2d09bb9..5a20edf 100644
--- a/Source/WebKit2/UIProcess/win/WebPopupMenuProxyWin.h
+++ b/Source/WebKit2/UIProcess/win/WebPopupMenuProxyWin.h
@@ -48,7 +48,7 @@ public:
}
~WebPopupMenuProxyWin();
- virtual void showPopupMenu(const WebCore::IntRect&, WebCore::TextDirection, const Vector<WebPopupItem>&, const PlatformPopupMenuData&, int32_t selectedIndex);
+ virtual void showPopupMenu(const WebCore::IntRect&, WebCore::TextDirection, double scaleFactor, const Vector<WebPopupItem>&, const PlatformPopupMenuData&, int32_t selectedIndex);
virtual void hidePopupMenu();
void hide() { hidePopupMenu(); }
diff --git a/Source/WebKit2/UIProcess/win/WebView.cpp b/Source/WebKit2/UIProcess/win/WebView.cpp
index eea43c5..62e0c42 100644
--- a/Source/WebKit2/UIProcess/win/WebView.cpp
+++ b/Source/WebKit2/UIProcess/win/WebView.cpp
@@ -29,7 +29,6 @@
#include "ChunkedUpdateDrawingAreaProxy.h"
#include "DrawingAreaProxyImpl.h"
#include "FindIndicator.h"
-#include "LayerBackedDrawingAreaProxy.h"
#include "Logging.h"
#include "NativeWebKeyboardEvent.h"
#include "Region.h"
@@ -415,6 +414,7 @@ static void drawPageBackground(HDC dc, const RECT& rect)
void WebView::paint(HDC hdc, const IntRect& dirtyRect)
{
+ m_page->endPrinting();
if (useNewDrawingArea()) {
if (DrawingAreaProxyImpl* drawingArea = static_cast<DrawingAreaProxyImpl*>(m_page->drawingArea())) {
// FIXME: We should port WebKit1's rect coalescing logic here.
@@ -438,11 +438,33 @@ void WebView::paint(HDC hdc, const IntRect& dirtyRect)
}
}
+static void flashRects(HDC dc, const IntRect rects[], size_t rectCount, HBRUSH brush)
+{
+ for (size_t i = 0; i < rectCount; ++i) {
+ RECT winRect = rects[i];
+ ::FillRect(dc, &winRect, brush);
+ }
+
+ ::GdiFlush();
+ ::Sleep(50);
+}
+
+static OwnPtr<HBRUSH> createBrush(const Color& color)
+{
+ return adoptPtr(::CreateSolidBrush(RGB(color.red(), color.green(), color.blue())));
+}
+
LRESULT WebView::onPaintEvent(HWND hWnd, UINT message, WPARAM, LPARAM, bool& handled)
{
PAINTSTRUCT paintStruct;
HDC hdc = ::BeginPaint(m_window, &paintStruct);
+ if (WebPageProxy::debugPaintFlags() & kWKDebugFlashViewUpdates) {
+ static HBRUSH brush = createBrush(WebPageProxy::viewUpdatesFlashColor().rgb()).leakPtr();
+ IntRect rect = paintStruct.rcPaint;
+ flashRects(hdc, &rect, 1, brush);
+ }
+
paint(hdc, paintStruct.rcPaint);
::EndPaint(m_window, &paintStruct);
@@ -650,6 +672,14 @@ void WebView::scrollView(const IntRect& scrollRect, const IntSize& scrollOffset)
setViewNeedsDisplay(scrollRect);
}
+void WebView::flashBackingStoreUpdates(const Vector<IntRect>& updateRects)
+{
+ static HBRUSH brush = createBrush(WebPageProxy::backingStoreUpdatesFlashColor().rgb()).leakPtr();
+ HDC dc = ::GetDC(m_window);
+ flashRects(dc, updateRects.data(), updateRects.size(), brush);
+ ::ReleaseDC(m_window, dc);
+}
+
WebCore::IntSize WebView::viewSize()
{
RECT clientRect;
@@ -771,10 +801,6 @@ void WebView::clearAllEditCommands()
{
}
-void WebView::setEditCommandState(const String&, bool, int)
-{
-}
-
FloatRect WebView::convertToDeviceSpace(const FloatRect& rect)
{
return rect;
@@ -1114,7 +1140,7 @@ void WebView::didCommitLoadForMainFrame(bool useCustomRepresentation)
{
}
-void WebView::didFinishLoadingDataForCustomRepresentation(const CoreIPC::DataReference&)
+void WebView::didFinishLoadingDataForCustomRepresentation(const String& suggestedFilename, const CoreIPC::DataReference&)
{
}
@@ -1153,46 +1179,6 @@ void WebView::exitAcceleratedCompositingMode()
ASSERT_NOT_REACHED();
}
-void WebView::pageDidEnterAcceleratedCompositing()
-{
- ASSERT(!useNewDrawingArea());
- switchToDrawingAreaTypeIfNecessary(DrawingAreaInfo::LayerBacked);
-}
-
-void WebView::pageDidLeaveAcceleratedCompositing()
-{
- ASSERT(!useNewDrawingArea());
- switchToDrawingAreaTypeIfNecessary(DrawingAreaInfo::ChunkedUpdate);
-}
-
-void WebView::switchToDrawingAreaTypeIfNecessary(DrawingAreaInfo::Type type)
-{
- ASSERT(!useNewDrawingArea());
-
- DrawingAreaInfo::Type existingDrawingAreaType = m_page->drawingArea() ? m_page->drawingArea()->info().type : DrawingAreaInfo::None;
- if (existingDrawingAreaType == type)
- return;
-
- OwnPtr<DrawingAreaProxy> newDrawingArea;
- switch (type) {
- case DrawingAreaInfo::Impl:
- case DrawingAreaInfo::None:
- break;
- case DrawingAreaInfo::ChunkedUpdate:
- newDrawingArea = ChunkedUpdateDrawingAreaProxy::create(this, m_page.get());
- break;
- case DrawingAreaInfo::LayerBacked:
- newDrawingArea = LayerBackedDrawingAreaProxy::create(this, m_page.get());
- break;
- }
-
- if (m_page->drawingArea())
- newDrawingArea->setSize(m_page->drawingArea()->size(), IntSize());
-
- m_page->drawingArea()->detachCompositingContext();
- m_page->setDrawingArea(newDrawingArea.release());
-}
-
#endif // USE(ACCELERATED_COMPOSITING)
HWND WebView::nativeWindow()
diff --git a/Source/WebKit2/UIProcess/win/WebView.h b/Source/WebKit2/UIProcess/win/WebView.h
index 297b6ad..28aedd6 100644
--- a/Source/WebKit2/UIProcess/win/WebView.h
+++ b/Source/WebKit2/UIProcess/win/WebView.h
@@ -133,6 +133,7 @@ private:
virtual void setViewNeedsDisplay(const WebCore::IntRect&);
virtual void displayView();
virtual void scrollView(const WebCore::IntRect& scrollRect, const WebCore::IntSize& scrollOffset);
+ virtual void flashBackingStoreUpdates(const Vector<WebCore::IntRect>& updateRects);
virtual WebCore::IntSize viewSize();
virtual bool isViewWindowActive();
@@ -148,7 +149,6 @@ private:
virtual void setViewportArguments(const WebCore::ViewportArguments&);
virtual void registerEditCommand(PassRefPtr<WebEditCommandProxy>, WebPageProxy::UndoOrRedo);
virtual void clearAllEditCommands();
- virtual void setEditCommandState(const WTF::String&, bool, int);
virtual WebCore::FloatRect convertToDeviceSpace(const WebCore::FloatRect&);
virtual WebCore::FloatRect convertToUserSpace(const WebCore::FloatRect&);
virtual void doneWithKeyEvent(const NativeWebKeyboardEvent&, bool wasEventHandled);
@@ -160,14 +160,10 @@ private:
#if USE(ACCELERATED_COMPOSITING)
virtual void enterAcceleratedCompositingMode(const LayerTreeContext&);
virtual void exitAcceleratedCompositingMode();
-
- virtual void pageDidEnterAcceleratedCompositing();
- virtual void pageDidLeaveAcceleratedCompositing();
- void switchToDrawingAreaTypeIfNecessary(DrawingAreaInfo::Type);
#endif
void didCommitLoadForMainFrame(bool useCustomRepresentation);
- void didFinishLoadingDataForCustomRepresentation(const CoreIPC::DataReference&);
+ void didFinishLoadingDataForCustomRepresentation(const String& suggestedFilename, const CoreIPC::DataReference&);
virtual double customRepresentationZoomFactor();
virtual void setCustomRepresentationZoomFactor(double);
WebCore::DragOperation keyStateToDragOperation(DWORD grfKeyState) const;