[GTK][WK2] Add HTML5 Notifications support
authorgns@gnome.org <gns@gnome.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 10 Dec 2014 17:36:40 +0000 (17:36 +0000)
committergns@gnome.org <gns@gnome.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 10 Dec 2014 17:36:40 +0000 (17:36 +0000)
commit5ed4090be5723d6f42d457639454505d1ae27e40
tree7a9d130c5be483aa017b754ecf4f3a1c278242e9
parentb755d47cacec37087b790ed56d314e883aa8414b
[GTK][WK2] Add HTML5 Notifications support
https://bugs.webkit.org/show_bug.cgi?id=61140

.:

Patch by Gustavo Noronha Silva <gustavo.noronha@collabora.com> on 2014-12-09
Reviewed by Carlos Garcia Campos.

* Source/cmake/FindLibNotify.cmake: Added.
* Source/cmake/OptionsGTK.cmake: add option to enable notifications, look for
libnotify and use it for a default implementation when found.

Source/WebKit2:

Patch by Claudio Saavedra  <csaavedra@igalia.com> and Gustavo Noronha Silva <gustavo.noronha@collabora.com> on 2014-12-09
Reviewed by Carlos Garcia Campos.

* PlatformGTK.cmake: add new files to the build.
* UIProcess/API/gtk/WebKitForwardDeclarations.h:
* UIProcess/API/gtk/WebKitNotification.cpp: Added. New GObject used to expose information about
the notification to the API.
(webkitNotificationGetProperty):
(webkit_notification_class_init):
(webkitNotificationCreate):
(webkit_notification_get_id):
(webkit_notification_get_title):
(webkit_notification_get_body):
* UIProcess/API/gtk/WebKitNotification.h: Added.
* UIProcess/API/gtk/WebKitNotificationPermissionRequest.cpp: Added. Permission request object
for notifications.
(webkitNotificationPermissionRequestAllow):
(webkitNotificationPermissionRequestDeny):
(webkit_permission_request_interface_init):
(webkitNotificationPermissionRequestDispose):
(webkit_notification_permission_request_class_init):
(webkitNotificationPermissionRequestCreate):
* UIProcess/API/gtk/WebKitNotificationPermissionRequest.h: Added.
* UIProcess/API/gtk/WebKitNotificationPermissionRequestPrivate.h: Added.
* UIProcess/API/gtk/WebKitNotificationPrivate.h: Added.
* UIProcess/API/gtk/WebKitNotificationProvider.cpp: Added. Notification provider that emits signals.
The C API allows overriding the notification providers and managers for customizing the handling of
notifications. We decided to go for a single manager and a single provider which provide more idiomatic
GObject API - signals.
(toNotificationProvider):
(showCallback):
(cancelCallback):
(WebKitNotificationProvider::~WebKitNotificationProvider):
(WebKitNotificationProvider::create):
(WebKitNotificationProvider::WebKitNotificationProvider):
(WebKitNotificationProvider::show):
(WebKitNotificationProvider::cancel):
* UIProcess/API/gtk/WebKitNotificationProvider.h: Added.
* UIProcess/API/gtk/WebKitUIClient.cpp: implemented decidePolicyForNotificationPermissionRequest.
* UIProcess/API/gtk/WebKitWebContext.cpp:
(webkitWebContextConstructed): initialize the notification provider.
* UIProcess/API/gtk/WebKitWebView.cpp:
(webkitWebViewShowNotification): default implementation for showing the notification, currently
using GNotification, about to be ported to libnotify.
(webkit_web_view_class_init): set the default implementation for the show-notification signal.
(webkitWebViewEmitCloseNotification): emit the close-notification signal.
(webkitWebViewEmitShowNotification): emit the show-notification signal.
* UIProcess/API/gtk/WebKitWebView.h:
* UIProcess/API/gtk/WebKitWebViewPrivate.h:
* UIProcess/API/gtk/docs/webkit2gtk-sections.txt: list new objects and methods.
* UIProcess/API/gtk/webkit2.h: include new headers.

Tools:

Patch by Gustavo Noronha Silva <gustavo.noronha@collabora.com> on 2014-12-09
Reviewed by Carlos Garcia Campos.

* Scripts/webkitperl/FeatureList.pm: enable notifications for GTK+.
* TestWebKitAPI/Tests/WebKit2Gtk/TestWebKitWebView.cpp:
(testWebViewNotification):
(beforeAll):
* MiniBrowser/gtk/BrowserWindow.c: also handle notification permission requests.
(permissionRequestDialogCallback):
(webViewDecidePermissionRequest):
(geolocationRequestDialogCallback): Deleted.

LayoutTests:

Patch by Gustavo Noronha Silva <gustavo.noronha@collabora.com> on 2014-12-09
Reviewed by Carlos Garcia Campos.

* platform/gtk/TestExpectations: unskip the HTTP tests for new-style notifications.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@177073 268f45cc-cd09-0410-ab3c-d52691b4dbfc
27 files changed:
ChangeLog
LayoutTests/ChangeLog
LayoutTests/platform/gtk/TestExpectations
Source/WebKit2/ChangeLog
Source/WebKit2/PlatformGTK.cmake
Source/WebKit2/UIProcess/API/gtk/WebKitForwardDeclarations.h
Source/WebKit2/UIProcess/API/gtk/WebKitNotification.cpp [new file with mode: 0644]
Source/WebKit2/UIProcess/API/gtk/WebKitNotification.h [new file with mode: 0644]
Source/WebKit2/UIProcess/API/gtk/WebKitNotificationPermissionRequest.cpp [new file with mode: 0644]
Source/WebKit2/UIProcess/API/gtk/WebKitNotificationPermissionRequest.h [new file with mode: 0644]
Source/WebKit2/UIProcess/API/gtk/WebKitNotificationPermissionRequestPrivate.h [new file with mode: 0644]
Source/WebKit2/UIProcess/API/gtk/WebKitNotificationPrivate.h [new file with mode: 0644]
Source/WebKit2/UIProcess/API/gtk/WebKitNotificationProvider.cpp [new file with mode: 0644]
Source/WebKit2/UIProcess/API/gtk/WebKitNotificationProvider.h [new file with mode: 0644]
Source/WebKit2/UIProcess/API/gtk/WebKitUIClient.cpp
Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp
Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp
Source/WebKit2/UIProcess/API/gtk/WebKitWebView.h
Source/WebKit2/UIProcess/API/gtk/WebKitWebViewPrivate.h
Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt
Source/WebKit2/UIProcess/API/gtk/webkit2.h
Source/cmake/FindLibNotify.cmake [new file with mode: 0644]
Source/cmake/OptionsGTK.cmake
Tools/ChangeLog
Tools/MiniBrowser/gtk/BrowserWindow.c
Tools/Scripts/webkitperl/FeatureList.pm
Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestWebKitWebView.cpp