Diff
Modified: trunk/Source/WebKit2/ChangeLog (127018 => 127019)
--- trunk/Source/WebKit2/ChangeLog 2012-08-29 17:42:16 UTC (rev 127018)
+++ trunk/Source/WebKit2/ChangeLog 2012-08-29 17:47:54 UTC (rev 127019)
@@ -1,3 +1,32 @@
+2012-08-29 Jon Lee <[email protected]>
+
+ [WK2] Add SPI to retrieve internal IDs for web notifications
+ https://bugs.webkit.org/show_bug.cgi?id=95100
+ <rdar://problem/12180208>
+
+ Reviewed by Alexey Proskuryakov.
+
+ This is work toward providing Mac support for web notifications in DRT and WTR (77969).
+
+ Add function to retrieve the internal ID for a notification. This is needed by tests to support simulating
+ a user click on a notification.
+
+ * DerivedSources.pri: Expose JSNotification.h as private header.
+ * WebProcess/InjectedBundle/API/c/WKBundle.cpp:
+ (WKBundleGetWebNotificationID): Calls into notification manager to get internal ID.
+ * WebProcess/InjectedBundle/API/c/WKBundlePrivate.h: Add WKBundleGetWebNotificationID() to be able
+ retrieve notification ID.
+ * WebProcess/InjectedBundle/InjectedBundle.cpp:
+ (WebKit::InjectedBundle::webNotificationID):
+ (WebKit):
+ * WebProcess/InjectedBundle/InjectedBundle.h:
+ (InjectedBundle):
+ * WebProcess/Notifications/WebNotificationManager.cpp:
+ (WebKit::WebNotificationManager::notificationIDForTesting):
+ (WebKit):
+ * WebProcess/Notifications/WebNotificationManager.h:
+ (WebNotificationManager):
+
2012-08-28 Martin Robinson <[email protected]>
[GTK] Enable the edge distance anti-aliasing for accelerated compositing layers
Modified: trunk/Source/WebKit2/DerivedSources.pri (127018 => 127019)
--- trunk/Source/WebKit2/DerivedSources.pri 2012-08-29 17:42:16 UTC (rev 127018)
+++ trunk/Source/WebKit2/DerivedSources.pri 2012-08-29 17:47:54 UTC (rev 127019)
@@ -22,6 +22,7 @@
$$WEBCORE_GENERATED_SOURCES_DIR/JSElement.h \
$$WEBCORE_GENERATED_SOURCES_DIR/JSHTMLElement.h \
$$WEBCORE_GENERATED_SOURCES_DIR/JSNode.h \
+ $$WEBCORE_GENERATED_SOURCES_DIR/JSNotification.h \
$$WEBCORE_GENERATED_SOURCES_DIR/JSRange.h \
defineReplace(message_header_generator_output) {
Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.cpp (127018 => 127019)
--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.cpp 2012-08-29 17:42:16 UTC (rev 127018)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.cpp 2012-08-29 17:47:54 UTC (rev 127019)
@@ -270,3 +270,9 @@
{
toImpl(bundleRef)->removeAllWebNotificationPermissions(toImpl(pageRef));
}
+
+uint64_t WKBundleGetWebNotificationID(WKBundleRef bundleRef, JSContextRef context, JSValueRef notification)
+{
+ return toImpl(bundleRef)->webNotificationID(context, notification);
+}
+
Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePrivate.h (127018 => 127019)
--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePrivate.h 2012-08-29 17:42:16 UTC (rev 127018)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePrivate.h 2012-08-29 17:47:54 UTC (rev 127019)
@@ -102,6 +102,8 @@
WK_EXPORT void WKBundleSetPageVisibilityState(WKBundleRef bundle, WKBundlePageRef page, int state, bool isInitialState);
+WK_EXPORT uint64_t WKBundleGetWebNotificationID(WKBundleRef bundle, JSContextRef context, JSValueRef notificaiton);
+
#ifdef __cplusplus
}
#endif
Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp (127018 => 127019)
--- trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp 2012-08-29 17:42:16 UTC (rev 127018)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp 2012-08-29 17:47:54 UTC (rev 127019)
@@ -54,6 +54,7 @@
#include <WebCore/GeolocationController.h>
#include <WebCore/GeolocationPosition.h>
#include <WebCore/JSDOMWindow.h>
+#include <WebCore/JSNotification.h>
#include <WebCore/Page.h>
#include <WebCore/PageGroup.h>
#include <WebCore/PageVisibilityState.h>
@@ -555,4 +556,16 @@
#endif
}
+uint64_t InjectedBundle::webNotificationID(JSContextRef jsContext, JSValueRef jsNotification)
+{
+#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
+ WebCore::Notification* notification = toNotification(toJS(toJS(jsContext), jsNotification));
+ if (!notification)
+ return 0;
+ return WebProcess::shared().notificationManager().notificationIDForTesting(notification);
+#else
+ return 0;
+#endif
+}
+
} // namespace WebKit
Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.h (127018 => 127019)
--- trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.h 2012-08-29 17:42:16 UTC (rev 127018)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.h 2012-08-29 17:47:54 UTC (rev 127019)
@@ -126,6 +126,7 @@
void setUserStyleSheetLocation(WebPageGroupProxy*, const String&);
void setWebNotificationPermission(WebPage*, const String& originString, bool allowed);
void removeAllWebNotificationPermissions(WebPage*);
+ uint64_t webNotificationID(JSContextRef, JSValueRef);
// UserContent API
void addUserScript(WebPageGroupProxy*, InjectedBundleScriptWorld*, const String& source, const String& url, ImmutableArray* whitelist, ImmutableArray* blacklist, WebCore::UserScriptInjectionTime, WebCore::UserContentInjectedFrames);
Modified: trunk/Source/WebKit2/WebProcess/Notifications/WebNotificationManager.cpp (127018 => 127019)
--- trunk/Source/WebKit2/WebProcess/Notifications/WebNotificationManager.cpp 2012-08-29 17:42:16 UTC (rev 127018)
+++ trunk/Source/WebKit2/WebProcess/Notifications/WebNotificationManager.cpp 2012-08-29 17:47:54 UTC (rev 127019)
@@ -112,6 +112,17 @@
#endif
}
+uint64_t WebNotificationManager::notificationIDForTesting(Notification* notification)
+{
+#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
+ if (!notification)
+ return 0;
+ return m_notificationMap.get(notification);
+#else
+ return 0;
+#endif
+}
+
bool WebNotificationManager::show(Notification* notification, WebPage* page)
{
#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
Modified: trunk/Source/WebKit2/WebProcess/Notifications/WebNotificationManager.h (127018 => 127019)
--- trunk/Source/WebKit2/WebProcess/Notifications/WebNotificationManager.h 2012-08-29 17:42:16 UTC (rev 127018)
+++ trunk/Source/WebKit2/WebProcess/Notifications/WebNotificationManager.h 2012-08-29 17:47:54 UTC (rev 127019)
@@ -64,14 +64,13 @@
void didDestroyNotification(WebCore::Notification*, WebPage*);
void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
-
+ void didUpdateNotificationDecision(const String& originString, bool allowed);
+
// Looks in local cache for permission. If not found, returns DefaultDenied.
WebCore::NotificationClient::Permission policyForOrigin(WebCore::SecurityOrigin*) const;
- void didUpdateNotificationDecision(const String& originString, bool allowed);
-
- // For testing purposes only.
void removeAllPermissionsForTesting();
+ uint64_t notificationIDForTesting(WebCore::Notification*);
private:
// Implemented in generated WebNotificationManagerMessageReceiver.cpp