[WK2] Add SPI for injected bundle to manually set permissions
authorjonlee@apple.com <jonlee@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 28 Aug 2012 18:11:53 +0000 (18:11 +0000)
committerjonlee@apple.com <jonlee@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 28 Aug 2012 18:11:53 +0000 (18:11 +0000)
commit0a61a1b9bc0c09d2bf4281ea94bcf89893169390
tree1597a6077781e4ddfd02d7c9ce76272eee00e694
parentf7d70f70f039d7f3166a02a48445adc72e7546ec
[WK2] Add SPI for injected bundle to manually set permissions
https://bugs.webkit.org/show_bug.cgi?id=95127
<rdar://problem/12182635>

Reviewed by Jessie Berlin.

This is work toward providing Mac support for web notifications in DRT and WTR (77969).

Add support functions to WebKit2 which maintain the map of permissions to origins for web notifications.
For WebKit1 the map is managed by DumpRenderTree.

* WebProcess/InjectedBundle/InjectedBundle.h: Add TestRunner SPI.
* WebProcess/InjectedBundle/InjectedBundle.cpp:
(WebKit::InjectedBundle::setWebNotificationPermission):
(WebKit::InjectedBundle::removeAllWebNotificationPermissions):

* WebProcess/InjectedBundle/API/c/WKBundlePrivate.h: Expose as WK API. Also, rearrange the ordering of the
functions so that it reflects the same order found in InjectedBundle.h.
* WebProcess/InjectedBundle/API/c/WKBundle.cpp:

* WebProcess/Notifications/NotificationPermissionRequestManager.cpp:
(WebKit::NotificationPermissionRequestManager::setPermissionLevelForTesting): Manually set the permission
level for an origin.
(WebKit::NotificationPermissionRequestManager::removeAllPermissionsForTesting):
* WebProcess/Notifications/NotificationPermissionRequestManager.h:
(NotificationPermissionRequestManager):
* WebProcess/Notifications/WebNotificationManager.cpp:
(WebKit::WebNotificationManager::removeAllPermissionsForTesting): Clear the permission map.
* WebProcess/Notifications/WebNotificationManager.h: Promote didUpdateNotificationDecision message as public
function, so that NotificationPermissionRequestManager can update the permission map.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@126899 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.cpp
Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePrivate.h
Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp
Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.h
Source/WebKit2/WebProcess/Notifications/NotificationPermissionRequestManager.cpp
Source/WebKit2/WebProcess/Notifications/NotificationPermissionRequestManager.h
Source/WebKit2/WebProcess/Notifications/WebNotificationManager.cpp
Source/WebKit2/WebProcess/Notifications/WebNotificationManager.h