<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[177073] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/177073">177073</a></dd>
<dt>Author</dt> <dd>gns@gnome.org</dd>
<dt>Date</dt> <dd>2014-12-10 09:36:40 -0800 (Wed, 10 Dec 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>[GTK][WK2] Add HTML5 Notifications support
https://bugs.webkit.org/show_bug.cgi?id=61140

.:

Patch by Gustavo Noronha Silva &lt;gustavo.noronha@collabora.com&gt; 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  &lt;csaavedra@igalia.com&gt; and Gustavo Noronha Silva &lt;gustavo.noronha@collabora.com&gt; 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 &lt;gustavo.noronha@collabora.com&gt; 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 &lt;gustavo.noronha@collabora.com&gt; on 2014-12-09
Reviewed by Carlos Garcia Campos.

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

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkChangeLog">trunk/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsplatformgtkTestExpectations">trunk/LayoutTests/platform/gtk/TestExpectations</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2PlatformGTKcmake">trunk/Source/WebKit2/PlatformGTK.cmake</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIgtkWebKitForwardDeclarationsh">trunk/Source/WebKit2/UIProcess/API/gtk/WebKitForwardDeclarations.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIgtkWebKitUIClientcpp">trunk/Source/WebKit2/UIProcess/API/gtk/WebKitUIClient.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIgtkWebKitWebContextcpp">trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIgtkWebKitWebViewcpp">trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIgtkWebKitWebViewh">trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIgtkWebKitWebViewPrivateh">trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewPrivate.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIgtkdocswebkit2gtksectionstxt">trunk/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIgtkwebkit2h">trunk/Source/WebKit2/UIProcess/API/gtk/webkit2.h</a></li>
<li><a href="#trunkSourcecmakeOptionsGTKcmake">trunk/Source/cmake/OptionsGTK.cmake</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsMiniBrowsergtkBrowserWindowc">trunk/Tools/MiniBrowser/gtk/BrowserWindow.c</a></li>
<li><a href="#trunkToolsScriptswebkitperlFeatureListpm">trunk/Tools/Scripts/webkitperl/FeatureList.pm</a></li>
<li><a href="#trunkToolsTestWebKitAPITestsWebKit2GtkTestWebKitWebViewcpp">trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestWebKitWebView.cpp</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2UIProcessAPIgtkWebKitNotificationcpp">trunk/Source/WebKit2/UIProcess/API/gtk/WebKitNotification.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIgtkWebKitNotificationh">trunk/Source/WebKit2/UIProcess/API/gtk/WebKitNotification.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIgtkWebKitNotificationPermissionRequestcpp">trunk/Source/WebKit2/UIProcess/API/gtk/WebKitNotificationPermissionRequest.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIgtkWebKitNotificationPermissionRequesth">trunk/Source/WebKit2/UIProcess/API/gtk/WebKitNotificationPermissionRequest.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIgtkWebKitNotificationPermissionRequestPrivateh">trunk/Source/WebKit2/UIProcess/API/gtk/WebKitNotificationPermissionRequestPrivate.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIgtkWebKitNotificationPrivateh">trunk/Source/WebKit2/UIProcess/API/gtk/WebKitNotificationPrivate.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIgtkWebKitNotificationProvidercpp">trunk/Source/WebKit2/UIProcess/API/gtk/WebKitNotificationProvider.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIgtkWebKitNotificationProviderh">trunk/Source/WebKit2/UIProcess/API/gtk/WebKitNotificationProvider.h</a></li>
<li><a href="#trunkSourcecmakeFindLibNotifycmake">trunk/Source/cmake/FindLibNotify.cmake</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/ChangeLog (177072 => 177073)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/ChangeLog        2014-12-10 17:12:28 UTC (rev 177072)
+++ trunk/ChangeLog        2014-12-10 17:36:40 UTC (rev 177073)
</span><span class="lines">@@ -1,3 +1,14 @@
</span><ins>+2014-12-09  Gustavo Noronha Silva  &lt;gustavo.noronha@collabora.com&gt;
+
+        [GTK][WK2] Add HTML5 Notifications support
+        https://bugs.webkit.org/show_bug.cgi?id=61140
+
+        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.
+
</ins><span class="cx"> 2014-12-09  Bem Jones-Bey  &lt;bjonesbe@adobe.com&gt;
</span><span class="cx"> 
</span><span class="cx">         REGRESSION(r155906): Page content disappears on Tuaw article after loading
</span></span></pre></div>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (177072 => 177073)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2014-12-10 17:12:28 UTC (rev 177072)
+++ trunk/LayoutTests/ChangeLog        2014-12-10 17:36:40 UTC (rev 177073)
</span><span class="lines">@@ -1,3 +1,12 @@
</span><ins>+2014-12-09  Gustavo Noronha Silva  &lt;gustavo.noronha@collabora.com&gt;
+
+        [GTK][WK2] Add HTML5 Notifications support
+        https://bugs.webkit.org/show_bug.cgi?id=61140
+
+        Reviewed by Carlos Garcia Campos.
+
+        * platform/gtk/TestExpectations: unskip the HTTP tests for new-style notifications.
+
</ins><span class="cx"> 2014-12-09  Alexey Proskuryakov  &lt;ap@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Unskip more multipart tests
</span></span></pre></div>
<a id="trunkLayoutTestsplatformgtkTestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/gtk/TestExpectations (177072 => 177073)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/gtk/TestExpectations        2014-12-10 17:12:28 UTC (rev 177072)
+++ trunk/LayoutTests/platform/gtk/TestExpectations        2014-12-10 17:36:40 UTC (rev 177073)
</span><span class="lines">@@ -146,10 +146,17 @@
</span><span class="cx"> webkit.org/b/98927 fast/dom/DeviceMotion [ Skip ]
</span><span class="cx"> webkit.org/b/98927 fast/dom/DeviceOrientation [ Skip ]
</span><span class="cx"> 
</span><del>-# Desktop notifications are not yet supported.
-webkit.org/b/61140 fast/notifications [ Skip ]
-webkit.org/b/61140 http/tests/notifications [ Skip ]
</del><ins>+# https://bugs.webkit.org/show_bug.cgi?id=81697 Skip file:// based notifications tests
+fast/notifications
</ins><span class="cx"> 
</span><ins>+# we do not enable legacy notifications
+http/tests/notifications/legacy/window-show-on-click.html
+http/tests/notifications/legacy/request.html
+http/tests/notifications/legacy/request-no-callback.html
+http/tests/notifications/legacy/events.html
+http/tests/notifications/legacy/show.html
+http/tests/notifications/legacy/double-show.html
+
</ins><span class="cx"> # StorageTracker is not enabled.
</span><span class="cx"> webkit.org/b/98933 storage/domstorage/localstorage/storagetracker [ Skip ]
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (177072 => 177073)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-12-10 17:12:28 UTC (rev 177072)
+++ trunk/Source/WebKit2/ChangeLog        2014-12-10 17:36:40 UTC (rev 177073)
</span><span class="lines">@@ -1,3 +1,59 @@
</span><ins>+2014-12-09  Claudio Saavedra  &lt;csaavedra@igalia.com&gt; and Gustavo Noronha Silva  &lt;gustavo.noronha@collabora.com&gt;
+
+        [GTK][WK2] Add HTML5 Notifications support
+        https://bugs.webkit.org/show_bug.cgi?id=61140
+
+        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.
+
</ins><span class="cx"> 2014-12-10  Grzegorz Czajkowski  &lt;g.czajkowski@samsung.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [EFL][[WK2] test_ewk2_text_checker is failed
</span></span></pre></div>
<a id="trunkSourceWebKit2PlatformGTKcmake"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/PlatformGTK.cmake (177072 => 177073)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/PlatformGTK.cmake        2014-12-10 17:12:28 UTC (rev 177072)
+++ trunk/Source/WebKit2/PlatformGTK.cmake        2014-12-10 17:36:40 UTC (rev 177073)
</span><span class="lines">@@ -158,6 +158,14 @@
</span><span class="cx">     UIProcess/API/gtk/WebKitNavigationPolicyDecision.cpp
</span><span class="cx">     UIProcess/API/gtk/WebKitNavigationPolicyDecision.h
</span><span class="cx">     UIProcess/API/gtk/WebKitNavigationPolicyDecisionPrivate.h
</span><ins>+    UIProcess/API/gtk/WebKitNotificationPermissionRequest.cpp
+    UIProcess/API/gtk/WebKitNotificationPermissionRequest.h
+    UIProcess/API/gtk/WebKitNotificationPermissionRequestPrivate.h
+    UIProcess/API/gtk/WebKitNotificationProvider.cpp
+    UIProcess/API/gtk/WebKitNotificationProvider.h
+    UIProcess/API/gtk/WebKitNotification.cpp
+    UIProcess/API/gtk/WebKitNotification.h
+    UIProcess/API/gtk/WebKitNotificationPrivate.h
</ins><span class="cx">     UIProcess/API/gtk/WebKitPermissionRequest.cpp
</span><span class="cx">     UIProcess/API/gtk/WebKitPermissionRequest.h
</span><span class="cx">     UIProcess/API/gtk/WebKitPlugin.cpp
</span><span class="lines">@@ -351,6 +359,8 @@
</span><span class="cx">     ${WEBKIT2_DIR}/UIProcess/API/gtk/WebKitMimeInfo.h
</span><span class="cx">     ${WEBKIT2_DIR}/UIProcess/API/gtk/WebKitNavigationAction.h
</span><span class="cx">     ${WEBKIT2_DIR}/UIProcess/API/gtk/WebKitNavigationPolicyDecision.h
</span><ins>+    ${WEBKIT2_DIR}/UIProcess/API/gtk/WebKitNotificationPermissionRequest.h
+    ${WEBKIT2_DIR}/UIProcess/API/gtk/WebKitNotification.h
</ins><span class="cx">     ${WEBKIT2_DIR}/UIProcess/API/gtk/WebKitPermissionRequest.h
</span><span class="cx">     ${WEBKIT2_DIR}/UIProcess/API/gtk/WebKitPlugin.h
</span><span class="cx">     ${WEBKIT2_DIR}/UIProcess/API/gtk/WebKitPolicyDecision.h
</span><span class="lines">@@ -455,6 +465,12 @@
</span><span class="cx">     ${LIBSOUP_INCLUDE_DIRS}
</span><span class="cx"> )
</span><span class="cx"> 
</span><ins>+if (LIBNOTIFY_FOUND)
+list(APPEND WebKit2_INCLUDE_DIRECTORIES
+    ${LIBNOTIFY_INCLUDE_DIRS}
+)
+endif ()
+
</ins><span class="cx"> set(WebKit2CommonIncludeDirectories ${WebKit2_INCLUDE_DIRECTORIES})
</span><span class="cx"> 
</span><span class="cx"> list(APPEND WebKit2_INCLUDE_DIRECTORIES
</span><span class="lines">@@ -489,6 +505,13 @@
</span><span class="cx">     WebCorePlatformGTK
</span><span class="cx">     ${GTK_UNIX_PRINT_LIBRARIES}
</span><span class="cx"> )
</span><ins>+
+if (LIBNOTIFY_FOUND)
+list(APPEND WebKit2_LIBRARIES
+    ${LIBNOTIFY_LIBRARIES}
+)
+endif ()
+
</ins><span class="cx"> ADD_WHOLE_ARCHIVE_TO_LIBRARIES(WebKit2_LIBRARIES)
</span><span class="cx"> 
</span><span class="cx"> set(WebKit2_MARSHAL_LIST ${WEBKIT2_DIR}/UIProcess/API/gtk/webkit2marshal.list)
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIgtkWebKitForwardDeclarationsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitForwardDeclarations.h (177072 => 177073)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitForwardDeclarations.h        2014-12-10 17:12:28 UTC (rev 177072)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitForwardDeclarations.h        2014-12-10 17:36:40 UTC (rev 177073)
</span><span class="lines">@@ -35,5 +35,6 @@
</span><span class="cx"> typedef struct _WebKitWebView         WebKitWebView;
</span><span class="cx"> typedef struct _WebKitContextMenu     WebKitContextMenu;
</span><span class="cx"> typedef struct _WebKitContextMenuItem WebKitContextMenuItem;
</span><ins>+typedef struct _WebKitNotification    WebKitNotification;
</ins><span class="cx"> 
</span><span class="cx"> #endif // WebKitForward_h
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIgtkWebKitNotificationcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitNotification.cpp (0 => 177073)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitNotification.cpp                                (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitNotification.cpp        2014-12-10 17:36:40 UTC (rev 177073)
</span><span class="lines">@@ -0,0 +1,189 @@
</span><ins>+/*
+ * Copyright (C) 2014 Collabora Ltd.
+ *
+ * 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 &quot;config.h&quot;
+#include &quot;WebKitNotification.h&quot;
+
+#include &quot;WebKitNotificationPrivate.h&quot;
+#include &quot;WebKitPrivate.h&quot;
+#include &quot;WebNotification.h&quot;
+#include &lt;glib/gi18n-lib.h&gt;
+#include &lt;wtf/text/CString.h&gt;
+
+/**
+ * SECTION: WebKitNotification
+ * @Short_description: Object used to hold information about a notification that should be shown to the user.
+ * @Title: WebKitNotification
+ *
+ * Since: 2.8
+ */
+
+enum {
+    PROP_0,
+
+    PROP_ID,
+    PROP_TITLE,
+    PROP_BODY
+};
+
+struct _WebKitNotificationPrivate {
+    CString title;
+    CString body;
+    guint64 id;
+
+    WebKitWebView* webView;
+};
+
+WEBKIT_DEFINE_TYPE(WebKitNotification, webkit_notification, G_TYPE_OBJECT)
+
+static void webkitNotificationGetProperty(GObject* object, guint propId, GValue* value, GParamSpec* paramSpec)
+{
+    WebKitNotification* notification = WEBKIT_NOTIFICATION(object);
+
+    switch (propId) {
+    case PROP_ID:
+        g_value_set_uint64(value, webkit_notification_get_id(notification));
+        break;
+    case PROP_TITLE:
+        g_value_set_string(value, webkit_notification_get_title(notification));
+        break;
+    case PROP_BODY:
+        g_value_set_string(value, webkit_notification_get_body(notification));
+        break;
+    default:
+        G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propId, paramSpec);
+    }
+}
+
+static void webkit_notification_class_init(WebKitNotificationClass* notificationClass)
+{
+    GObjectClass* objectClass = G_OBJECT_CLASS(notificationClass);
+    objectClass-&gt;get_property = webkitNotificationGetProperty;
+
+    /**
+     * WebKitNotification:id:
+     *
+     * The unique id for the notification.
+     *
+     * Since: 2.8
+     */
+    g_object_class_install_property(objectClass,
+        PROP_ID,
+        g_param_spec_uint64(&quot;id&quot;,
+            _(&quot;ID&quot;),
+            _(&quot;The unique id for the notification&quot;),
+            0, G_MAXUINT64, 0,
+            WEBKIT_PARAM_READABLE));
+
+    /**
+     * WebKitNotification:title:
+     *
+     * The title for the notification.
+     *
+     * Since: 2.8
+     */
+    g_object_class_install_property(objectClass,
+        PROP_TITLE,
+        g_param_spec_string(&quot;title&quot;,
+            _(&quot;Title&quot;),
+            _(&quot;The title for the notification&quot;),
+            nullptr,
+            WEBKIT_PARAM_READABLE));
+
+    /**
+     * WebKitNotification:body:
+     *
+     * The body for the notification.
+     *
+     * Since: 2.8
+     */
+    g_object_class_install_property(objectClass,
+        PROP_BODY,
+        g_param_spec_string(&quot;body&quot;,
+            _(&quot;Body&quot;),
+            _(&quot;The body for the notification&quot;),
+            nullptr,
+            WEBKIT_PARAM_READABLE));
+}
+
+WebKitNotification* webkitNotificationCreate(WebKitWebView* webView, const WebKit::WebNotification&amp; webNotification)
+{
+    WebKitNotification* notification = WEBKIT_NOTIFICATION(g_object_new(WEBKIT_TYPE_NOTIFICATION, nullptr));
+    notification-&gt;priv-&gt;id = webNotification.notificationID();
+    notification-&gt;priv-&gt;title = webNotification.title().utf8();
+    notification-&gt;priv-&gt;body = webNotification.body().utf8();
+    notification-&gt;priv-&gt;webView = webView;
+    return notification;
+}
+
+WebKitWebView* webkitNotificationGetWebView(WebKitNotification* notification)
+{
+    return notification-&gt;priv-&gt;webView;
+}
+
+/**
+ * webkit_notification_get_id:
+ * @notification: a #WebKitNotification
+ *
+ * Obtains the unique id for the notification.
+ *
+ * Returns: the unique id for the notification
+ *
+ * Since: 2.8
+ */
+guint64 webkit_notification_get_id(WebKitNotification* notification)
+{
+    g_return_val_if_fail(WEBKIT_IS_NOTIFICATION(notification), 0);
+
+    return notification-&gt;priv-&gt;id;
+}
+
+/**
+ * webkit_notification_get_title:
+ * @notification: a #WebKitNotification
+ *
+ * Obtains the title for the notification.
+ *
+ * Returns: the title for the notification
+ *
+ * Since: 2.8
+ */
+const gchar* webkit_notification_get_title(WebKitNotification* notification)
+{
+    g_return_val_if_fail(WEBKIT_IS_NOTIFICATION(notification), nullptr);
+
+    return notification-&gt;priv-&gt;title.data();
+}
+
+/**
+ * webkit_notification_get_body:
+ * @notification: a #WebKitNotification
+ *
+ * Obtains the body for the notification.
+ *
+ * Returns: the body for the notification
+ *
+ * Since: 2.8
+ */
+const gchar* webkit_notification_get_body(WebKitNotification* notification)
+{
+    g_return_val_if_fail(WEBKIT_IS_NOTIFICATION(notification), nullptr);
+
+    return notification-&gt;priv-&gt;body.data();
+}
</ins></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIgtkWebKitNotificationh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitNotification.h (0 => 177073)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitNotification.h                                (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitNotification.h        2014-12-10 17:36:40 UTC (rev 177073)
</span><span class="lines">@@ -0,0 +1,75 @@
</span><ins>+/*
+ * Copyright (C) 2014 Collabora Ltd.
+ *
+ * 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.
+ */
+
+#if !defined(__WEBKIT2_H_INSIDE__) &amp;&amp; !defined(WEBKIT2_COMPILATION)
+#error &quot;Only &lt;webkit2/webkit2.h&gt; can be included directly.&quot;
+#endif
+
+#ifndef WebKitNotification_h
+#define WebKitNotification_h
+
+#include &lt;glib-object.h&gt;
+#include &lt;webkit2/WebKitDefines.h&gt;
+#include &lt;webkit2/WebKitForwardDeclarations.h&gt;
+
+G_BEGIN_DECLS
+
+#define WEBKIT_TYPE_NOTIFICATION            (webkit_notification_get_type())
+#define WEBKIT_NOTIFICATION(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj), WEBKIT_TYPE_NOTIFICATION, WebKitNotification))
+#define WEBKIT_IS_NOTIFICATION(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj), WEBKIT_TYPE_NOTIFICATION))
+#define WEBKIT_NOTIFICATION_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass),  WEBKIT_TYPE_NOTIFICATION, WebKitNotificationClass))
+#define WEBKIT_IS_NOTIFICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),  WEBKIT_TYPE_NOTIFICATION))
+#define WEBKIT_NOTIFICATION_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj),  WEBKIT_TYPE_NOTIFICATION, WebKitNotificationClass))
+
+typedef struct _WebKitNotification        WebKitNotification;
+typedef struct _WebKitNotificationClass   WebKitNotificationClass;
+typedef struct _WebKitNotificationPrivate WebKitNotificationPrivate;
+
+struct _WebKitNotification {
+    GObject parent;
+
+    WebKitNotificationPrivate *priv;
+};
+
+struct _WebKitNotificationClass {
+    GObjectClass parent_class;
+
+    void (*_webkit_reserved0) (void);
+    void (*_webkit_reserved1) (void);
+    void (*_webkit_reserved2) (void);
+    void (*_webkit_reserved3) (void);
+    void (*_webkit_reserved4) (void);
+    void (*_webkit_reserved5) (void);
+};
+
+WEBKIT_API GType
+webkit_notification_get_type                 (void);
+
+WEBKIT_API guint64
+webkit_notification_get_id                   (WebKitNotification *notification);
+
+WEBKIT_API const gchar *
+webkit_notification_get_title                (WebKitNotification *notification);
+
+WEBKIT_API const gchar *
+webkit_notification_get_body                 (WebKitNotification *notification);
+
+G_END_DECLS
+
+#endif
</ins></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIgtkWebKitNotificationPermissionRequestcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitNotificationPermissionRequest.cpp (0 => 177073)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitNotificationPermissionRequest.cpp                                (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitNotificationPermissionRequest.cpp        2014-12-10 17:36:40 UTC (rev 177073)
</span><span class="lines">@@ -0,0 +1,103 @@
</span><ins>+/*
+ * Copyright (C) 2013 Igalia S.L.
+ *
+ * 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 &quot;config.h&quot;
+#include &quot;WebKitNotificationPermissionRequest.h&quot;
+
+#include &quot;NotificationPermissionRequest.h&quot;
+#include &quot;WebKitNotificationPermissionRequestPrivate.h&quot;
+#include &quot;WebKitPermissionRequest.h&quot;
+
+using namespace WebKit;
+
+/**
+ * SECTION: WebKitNotificationPermissionRequest
+ * @Short_description: A permission request for displaying web notifications
+ * @Title: WebKitNotificationPermissionRequest
+ * @See_also: #WebKitPermissionRequest, #WebKitWebView
+ *
+ * WebKitNotificationPermissionRequest represents a request for
+ * permission to decide whether WebKit should provide the user with
+ * notifications through the Web Notification API.
+ */
+
+static void webkit_permission_request_interface_init(WebKitPermissionRequestIface*);
+
+struct _WebKitNotificationPermissionRequestPrivate {
+    RefPtr&lt;NotificationPermissionRequest&gt; request;
+    bool madeDecision;
+};
+
+WEBKIT_DEFINE_TYPE_WITH_CODE(
+    WebKitNotificationPermissionRequest, webkit_notification_permission_request, G_TYPE_OBJECT,
+    G_IMPLEMENT_INTERFACE(WEBKIT_TYPE_PERMISSION_REQUEST, webkit_permission_request_interface_init))
+
+static void webkitNotificationPermissionRequestAllow(WebKitPermissionRequest* request)
+{
+    ASSERT(WEBKIT_IS_NOTIFICATION_PERMISSION_REQUEST(request));
+
+    WebKitNotificationPermissionRequestPrivate* priv = WEBKIT_NOTIFICATION_PERMISSION_REQUEST(request)-&gt;priv;
+
+    // Only one decision at a time.
+    if (priv-&gt;madeDecision)
+        return;
+
+    priv-&gt;request-&gt;allow();
+    priv-&gt;madeDecision = true;
+}
+
+static void webkitNotificationPermissionRequestDeny(WebKitPermissionRequest* request)
+{
+    ASSERT(WEBKIT_IS_NOTIFICATION_PERMISSION_REQUEST(request));
+
+    WebKitNotificationPermissionRequestPrivate* priv = WEBKIT_NOTIFICATION_PERMISSION_REQUEST(request)-&gt;priv;
+
+    // Only one decision at a time.
+    if (priv-&gt;madeDecision)
+        return;
+
+    priv-&gt;request-&gt;deny();
+    priv-&gt;madeDecision = true;
+}
+
+static void webkit_permission_request_interface_init(WebKitPermissionRequestIface* iface)
+{
+    iface-&gt;allow = webkitNotificationPermissionRequestAllow;
+    iface-&gt;deny = webkitNotificationPermissionRequestDeny;
+}
+
+static void webkitNotificationPermissionRequestDispose(GObject* object)
+{
+    // Default behaviour when no decision has been made is denying the request.
+    webkitNotificationPermissionRequestDeny(WEBKIT_PERMISSION_REQUEST(object));
+    G_OBJECT_CLASS(webkit_notification_permission_request_parent_class)-&gt;dispose(object);
+}
+
+static void webkit_notification_permission_request_class_init(WebKitNotificationPermissionRequestClass* klass)
+{
+    GObjectClass* objectClass = G_OBJECT_CLASS(klass);
+    objectClass-&gt;dispose = webkitNotificationPermissionRequestDispose;
+}
+
+WebKitNotificationPermissionRequest* webkitNotificationPermissionRequestCreate(NotificationPermissionRequest* request)
+{
+    WebKitNotificationPermissionRequest* notificationPermissionRequest = WEBKIT_NOTIFICATION_PERMISSION_REQUEST(g_object_new(WEBKIT_TYPE_NOTIFICATION_PERMISSION_REQUEST, nullptr));
+    notificationPermissionRequest-&gt;priv-&gt;request = request;
+    return notificationPermissionRequest;
+}
</ins></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIgtkWebKitNotificationPermissionRequesth"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitNotificationPermissionRequest.h (0 => 177073)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitNotificationPermissionRequest.h                                (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitNotificationPermissionRequest.h        2014-12-10 17:36:40 UTC (rev 177073)
</span><span class="lines">@@ -0,0 +1,59 @@
</span><ins>+/*
+ * Copyright (C) 2013 Igalia S.L.
+ *
+ * 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.
+ */
+
+#if !defined(__WEBKIT2_H_INSIDE__) &amp;&amp; !defined(WEBKIT2_COMPILATION)
+#error &quot;Only &lt;webkit2/webkit2.h&gt; can be included directly.&quot;
+#endif
+
+#ifndef WebKitNotificationPermissionRequest_h
+#define WebKitNotificationPermissionRequest_h
+
+#include &lt;glib-object.h&gt;
+#include &lt;webkit2/WebKitDefines.h&gt;
+
+G_BEGIN_DECLS
+
+#define WEBKIT_TYPE_NOTIFICATION_PERMISSION_REQUEST            (webkit_notification_permission_request_get_type())
+#define WEBKIT_NOTIFICATION_PERMISSION_REQUEST(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj), WEBKIT_TYPE_NOTIFICATION_PERMISSION_REQUEST, WebKitNotificationPermissionRequest))
+#define WEBKIT_NOTIFICATION_PERMISSION_REQUEST_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass),  WEBKIT_TYPE_NOTIFICATION_PERMISSION_REQUEST, WebKitNotificationPermissionRequestClass))
+#define WEBKIT_IS_NOTIFICATION_PERMISSION_REQUEST(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj), WEBKIT_TYPE_NOTIFICATION_PERMISSION_REQUEST))
+#define WEBKIT_IS_NOTIFICATION_PERMISSION_REQUEST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),  WEBKIT_TYPE_NOTIFICATION_PERMISSION_REQUEST))
+#define WEBKIT_NOTIFICATION_PERMISSION_REQUEST_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj),  WEBKIT_TYPE_NOTIFICATION_PERMISSION_REQUEST, WebKitNotificationPermissionRequestClass))
+
+typedef struct _WebKitNotificationPermissionRequest        WebKitNotificationPermissionRequest;
+typedef struct _WebKitNotificationPermissionRequestClass   WebKitNotificationPermissionRequestClass;
+typedef struct _WebKitNotificationPermissionRequestPrivate WebKitNotificationPermissionRequestPrivate;
+
+struct _WebKitNotificationPermissionRequest {
+    GObject parent;
+
+    /*&lt; private &gt;*/
+    WebKitNotificationPermissionRequestPrivate *priv;
+};
+
+struct _WebKitNotificationPermissionRequestClass {
+    GObjectClass parent_class;
+};
+
+WEBKIT_API GType
+webkit_notification_permission_request_get_type (void);
+
+G_END_DECLS
+
+#endif
</ins></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIgtkWebKitNotificationPermissionRequestPrivateh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitNotificationPermissionRequestPrivate.h (0 => 177073)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitNotificationPermissionRequestPrivate.h                                (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitNotificationPermissionRequestPrivate.h        2014-12-10 17:36:40 UTC (rev 177073)
</span><span class="lines">@@ -0,0 +1,28 @@
</span><ins>+/*
+ * Copyright (C) 2013 Igalia S.L.
+ *
+ * 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.
+ */
+
+#ifndef WebKitNotificationPermissionRequestPrivate_h
+#define WebKitNotificationPermissionRequestPrivate_h
+
+#include &quot;WebKitNotificationPermissionRequest.h&quot;
+#include &quot;WebKitPrivate.h&quot;
+
+WebKitNotificationPermissionRequest* webkitNotificationPermissionRequestCreate(WebKit::NotificationPermissionRequest*);
+
+#endif // WebKitNotificationPermissionRequestPrivate_h
</ins></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIgtkWebKitNotificationPrivateh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitNotificationPrivate.h (0 => 177073)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitNotificationPrivate.h                                (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitNotificationPrivate.h        2014-12-10 17:36:40 UTC (rev 177073)
</span><span class="lines">@@ -0,0 +1,31 @@
</span><ins>+/*
+ * Copyright (C) 2014 Collabora Ltd.
+ *
+ * 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.
+ */
+
+#ifndef WebKitNotificationPrivate_h
+#define WebKitNotificationPrivate_h
+
+#include &quot;WebKitNotification.h&quot;
+#include &quot;WebKitPrivate.h&quot;
+#include &quot;WebNotification.h&quot;
+#include &lt;wtf/text/CString.h&gt;
+
+WebKitNotification* webkitNotificationCreate(WebKitWebView*, const WebKit::WebNotification&amp;);
+WebKitWebView* webkitNotificationGetWebView(WebKitNotification*);
+
+#endif // WebKitNotificationPrivate_h
</ins></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIgtkWebKitNotificationProvidercpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitNotificationProvider.cpp (0 => 177073)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitNotificationProvider.cpp                                (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitNotificationProvider.cpp        2014-12-10 17:36:40 UTC (rev 177073)
</span><span class="lines">@@ -0,0 +1,119 @@
</span><ins>+/*
+ * Copyright (C) 2013 Igalia S.L.
+ * Copyright (C) 2014 Collabora Ltd.
+ *
+ * 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 &quot;config.h&quot;
+#include &quot;WebKitNotificationProvider.h&quot;
+
+#include &quot;APIArray.h&quot;
+#include &quot;WKNotificationManager.h&quot;
+#include &quot;WebKitNotificationPrivate.h&quot;
+#include &quot;WebKitWebViewPrivate.h&quot;
+#include &quot;WebNotificationManagerProxy.h&quot;
+#include &quot;WebPageProxy.h&quot;
+#include &lt;wtf/text/CString.h&gt;
+
+using namespace WebKit;
+
+static inline WebKitNotificationProvider* toNotificationProvider(const void* clientInfo)
+{
+    return static_cast&lt;WebKitNotificationProvider*&gt;(const_cast&lt;void*&gt;(clientInfo));
+}
+
+static void showCallback(WKPageRef page, WKNotificationRef notification, const void* clientInfo)
+{
+    toNotificationProvider(clientInfo)-&gt;show(toImpl(page), *toImpl(notification));
+}
+
+static void cancelCallback(WKNotificationRef notification, const void* clientInfo)
+{
+    toNotificationProvider(clientInfo)-&gt;cancel(*toImpl(notification));
+}
+
+static void clearNotificationsCallback(WKArrayRef notificationIDs, const void* clientInfo)
+{
+    toNotificationProvider(clientInfo)-&gt;clearNotifications(toImpl(notificationIDs));
+}
+
+WebKitNotificationProvider::~WebKitNotificationProvider()
+{
+}
+
+PassRefPtr&lt;WebKitNotificationProvider&gt; WebKitNotificationProvider::create(WebNotificationManagerProxy* notificationManager)
+{
+    return adoptRef(new WebKitNotificationProvider(notificationManager));
+}
+
+WebKitNotificationProvider::WebKitNotificationProvider(WebNotificationManagerProxy* notificationManager)
+    : m_notificationManager(notificationManager)
+{
+    ASSERT(notificationManager);
+
+    WKNotificationProviderV0 wkNotificationProvider = {
+        kWKNotificationProviderCurrentVersion,
+        this, // clientInfo,
+        showCallback,
+        cancelCallback,
+        0, // didDestroyNotificationCallback,
+        0, // addNotificationManagerCallback,
+        0, // removeNotificationManagerCallback,
+        0, // notificationPermissionsCallback,
+        clearNotificationsCallback,
+    };
+
+    WKNotificationManagerSetProvider(toAPI(notificationManager), reinterpret_cast&lt;WKNotificationProviderBase*&gt;(&amp;wkNotificationProvider));
+}
+
+void WebKitNotificationProvider::show(WebPageProxy* page, const WebNotification&amp; webNotification)
+{
+    GRefPtr&lt;WebKitNotification&gt; notification = m_notifications.get(webNotification.notificationID());
+
+    if (!notification) {
+        notification = adoptGRef(webkitNotificationCreate(WEBKIT_WEB_VIEW(page-&gt;viewWidget()), webNotification));
+        m_notifications.set(webNotification.notificationID(), notification);
+    }
+
+    if (webkitWebViewEmitShowNotification(WEBKIT_WEB_VIEW(page-&gt;viewWidget()), notification.get()))
+        m_notificationManager-&gt;providerDidShowNotification(webNotification.notificationID());
+}
+
+void WebKitNotificationProvider::cancelNotificationByID(uint64_t notificationID)
+{
+    if (GRefPtr&lt;WebKitNotification&gt; notification = m_notifications.get(notificationID))
+        webkitWebViewEmitCloseNotification(webkitNotificationGetWebView(notification.get()), notification.get());
+
+    m_notifications.remove(notificationID);
+}
+
+void WebKitNotificationProvider::cancel(const WebNotification&amp; webNotification)
+{
+    cancelNotificationByID(webNotification.notificationID());
+}
+
+void WebKitNotificationProvider::clearNotifications(const API::Array* notificationIDs)
+{
+    for (const auto&amp; item : notificationIDs-&gt;elementsOfType&lt;API::UInt64&gt;())
+        cancelNotificationByID(item-&gt;value());
+}
</ins></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIgtkWebKitNotificationProviderh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitNotificationProvider.h (0 => 177073)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitNotificationProvider.h                                (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitNotificationProvider.h        2014-12-10 17:36:40 UTC (rev 177073)
</span><span class="lines">@@ -0,0 +1,55 @@
</span><ins>+/*
+ * Copyright (C) 2013 Igalia S.L.
+ *
+ * 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.
+ */
+
+#ifndef WebKitNotificationProvider_h
+#define WebKitNotificationProvider_h
+
+#include &quot;WebKitPrivate.h&quot;
+#include &quot;WebKitNotification.h&quot;
+#include &lt;wtf/HashMap.h&gt;
+#include &lt;wtf/PassRefPtr.h&gt;
+#include &lt;wtf/RefCounted.h&gt;
+
+namespace API {
+class Array;
+};
+
+namespace WebKit {
+
+class WebKitNotificationProvider : public RefCounted&lt;WebKitNotificationProvider&gt; {
+public:
+    virtual ~WebKitNotificationProvider();
+    static PassRefPtr&lt;WebKitNotificationProvider&gt; create(WebNotificationManagerProxy*);
+
+    void show(WebPageProxy*, const WebNotification&amp;);
+    void cancel(const WebNotification&amp;);
+    void clearNotifications(const API::Array*);
+
+private:
+    WebKitNotificationProvider(WebNotificationManagerProxy*);
+
+    void cancelNotificationByID(uint64_t);
+
+    RefPtr&lt;WebNotificationManagerProxy&gt; m_notificationManager;
+    HashMap&lt;uint64_t, GRefPtr&lt;WebKitNotification&gt;&gt; m_notifications;
+};
+
+} // namespace WebKit
+
+#endif
</ins></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIgtkWebKitUIClientcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitUIClient.cpp (177072 => 177073)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitUIClient.cpp        2014-12-10 17:12:28 UTC (rev 177072)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitUIClient.cpp        2014-12-10 17:36:40 UTC (rev 177073)
</span><span class="lines">@@ -24,6 +24,7 @@
</span><span class="cx"> #include &quot;WebKitFileChooserRequestPrivate.h&quot;
</span><span class="cx"> #include &quot;WebKitGeolocationPermissionRequestPrivate.h&quot;
</span><span class="cx"> #include &quot;WebKitNavigationActionPrivate.h&quot;
</span><ins>+#include &quot;WebKitNotificationPermissionRequestPrivate.h&quot;
</ins><span class="cx"> #include &quot;WebKitPrivate.h&quot;
</span><span class="cx"> #include &quot;WebKitURIRequestPrivate.h&quot;
</span><span class="cx"> #include &quot;WebKitUserMediaPermissionRequestPrivate.h&quot;
</span><span class="lines">@@ -166,6 +167,13 @@
</span><span class="cx">         return true;
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    virtual bool decidePolicyForNotificationPermissionRequest(WebPageProxy*, WebSecurityOrigin*, NotificationPermissionRequest* permissionRequest) override
+    {
+        GRefPtr&lt;WebKitNotificationPermissionRequest&gt; notificationPermissionRequest = adoptGRef(webkitNotificationPermissionRequestCreate(permissionRequest));
+        webkitWebViewMakePermissionRequest(m_webView, WEBKIT_PERMISSION_REQUEST(notificationPermissionRequest.get()));
+        return true;
+    }
+
</ins><span class="cx">     virtual void printFrame(WebPageProxy*, WebFrameProxy* frame) override
</span><span class="cx">     {
</span><span class="cx">         webkitWebViewPrintFrame(m_webView, frame);
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIgtkWebKitWebContextcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp (177072 => 177073)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp        2014-12-10 17:12:28 UTC (rev 177072)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp        2014-12-10 17:36:40 UTC (rev 177073)
</span><span class="lines">@@ -33,6 +33,7 @@
</span><span class="cx"> #include &quot;WebKitFaviconDatabasePrivate.h&quot;
</span><span class="cx"> #include &quot;WebKitGeolocationProvider.h&quot;
</span><span class="cx"> #include &quot;WebKitInjectedBundleClient.h&quot;
</span><ins>+#include &quot;WebKitNotificationProvider.h&quot;
</ins><span class="cx"> #include &quot;WebKitPluginPrivate.h&quot;
</span><span class="cx"> #include &quot;WebKitPrivate.h&quot;
</span><span class="cx"> #include &quot;WebKitRequestManagerClient.h&quot;
</span><span class="lines">@@ -44,6 +45,7 @@
</span><span class="cx"> #include &quot;WebKitWebContextPrivate.h&quot;
</span><span class="cx"> #include &quot;WebKitWebViewBasePrivate.h&quot;
</span><span class="cx"> #include &quot;WebKitWebViewPrivate.h&quot;
</span><ins>+#include &quot;WebNotificationManagerProxy.h&quot;
</ins><span class="cx"> #include &quot;WebResourceCacheManagerProxy.h&quot;
</span><span class="cx"> #include &lt;WebCore/FileSystem.h&gt;
</span><span class="cx"> #include &lt;WebCore/IconDatabase.h&gt;
</span><span class="lines">@@ -166,6 +168,9 @@
</span><span class="cx"> #if ENABLE(BATTERY_STATUS)
</span><span class="cx">     RefPtr&lt;WebKitBatteryProvider&gt; batteryProvider;
</span><span class="cx"> #endif
</span><ins>+#if ENABLE(NOTIFICATIONS)
+    RefPtr&lt;WebKitNotificationProvider&gt; notificationProvider;
+#endif
</ins><span class="cx"> #if ENABLE(SPELLCHECK)
</span><span class="cx">     std::unique_ptr&lt;WebKitTextChecker&gt; textChecker;
</span><span class="cx"> #endif
</span><span class="lines">@@ -278,6 +283,9 @@
</span><span class="cx"> #if ENABLE(BATTERY_STATUS)
</span><span class="cx">     priv-&gt;batteryProvider = WebKitBatteryProvider::create(priv-&gt;context-&gt;supplement&lt;WebBatteryManagerProxy&gt;());
</span><span class="cx"> #endif
</span><ins>+#if ENABLE(NOTIFICATIONS)
+    priv-&gt;notificationProvider = WebKitNotificationProvider::create(priv-&gt;context-&gt;supplement&lt;WebNotificationManagerProxy&gt;());
+#endif
</ins><span class="cx"> #if ENABLE(SPELLCHECK)
</span><span class="cx">     priv-&gt;textChecker = WebKitTextChecker::create();
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIgtkWebKitWebViewcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp (177072 => 177073)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp        2014-12-10 17:12:28 UTC (rev 177072)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp        2014-12-10 17:36:40 UTC (rev 177073)
</span><span class="lines">@@ -1,6 +1,7 @@
</span><span class="cx"> /*
</span><span class="cx">  * Copyright (C) 2011 Igalia S.L.
</span><span class="cx">  * Portions Copyright (c) 2011 Motorola Mobility, Inc.  All rights reserved.
</span><ins>+ * Copyright (C) 2014 Collabora Ltd.
</ins><span class="cx">  *
</span><span class="cx">  * This library is free software; you can redistribute it and/or
</span><span class="cx">  * modify it under the terms of the GNU Library General Public
</span><span class="lines">@@ -42,6 +43,7 @@
</span><span class="cx"> #include &quot;WebKitJavascriptResultPrivate.h&quot;
</span><span class="cx"> #include &quot;WebKitLoaderClient.h&quot;
</span><span class="cx"> #include &quot;WebKitMarshal.h&quot;
</span><ins>+#include &quot;WebKitNotificationPrivate.h&quot;
</ins><span class="cx"> #include &quot;WebKitPolicyClient.h&quot;
</span><span class="cx"> #include &quot;WebKitPrintOperationPrivate.h&quot;
</span><span class="cx"> #include &quot;WebKitPrivate.h&quot;
</span><span class="lines">@@ -69,6 +71,10 @@
</span><span class="cx"> #include &lt;wtf/gobject/GRefPtr.h&gt;
</span><span class="cx"> #include &lt;wtf/text/CString.h&gt;
</span><span class="cx"> 
</span><ins>+#if USE(LIBNOTIFY)
+#include &lt;libnotify/notify.h&gt;
+#endif
+
</ins><span class="cx"> using namespace WebKit;
</span><span class="cx"> using namespace WebCore;
</span><span class="cx"> 
</span><span class="lines">@@ -124,6 +130,9 @@
</span><span class="cx"> 
</span><span class="cx">     AUTHENTICATE,
</span><span class="cx"> 
</span><ins>+    SHOW_NOTIFICATION,
+    CLOSE_NOTIFICATION,
+
</ins><span class="cx">     LAST_SIGNAL
</span><span class="cx"> };
</span><span class="cx"> 
</span><span class="lines">@@ -144,6 +153,9 @@
</span><span class="cx"> 
</span><span class="cx"> typedef HashMap&lt;uint64_t, GRefPtr&lt;WebKitWebResource&gt; &gt; LoadingResourcesMap;
</span><span class="cx"> typedef HashMap&lt;uint64_t, GRefPtr&lt;GTask&gt; &gt; SnapshotResultsMap;
</span><ins>+#if USE(LIBNOTIFY)
+typedef HashMap&lt;uint64_t, GRefPtr&lt;NotifyNotification&gt;&gt; NotifyNotificationsMap;
+#endif
</ins><span class="cx"> class PageLoadStateObserver;
</span><span class="cx"> 
</span><span class="cx"> struct _WebKitWebViewPrivate {
</span><span class="lines">@@ -194,6 +206,10 @@
</span><span class="cx"> 
</span><span class="cx">     SnapshotResultsMap snapshotResultsMap;
</span><span class="cx">     GRefPtr&lt;WebKitAuthenticationRequest&gt; authenticationRequest;
</span><ins>+
+#if USE(LIBNOTIFY)
+    NotifyNotificationsMap notifyNotificationsMap;
+#endif
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> static guint signals[LAST_SIGNAL] = { 0, };
</span><span class="lines">@@ -562,6 +578,44 @@
</span><span class="cx">     webkitDownloadSetWebView(download.get(), WEBKIT_WEB_VIEW(webViewBase));
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+static gboolean webkitWebViewShowNotification(WebKitWebView* webView, WebKitNotification* webNotification)
+{
+#if USE(LIBNOTIFY)
+    if (!notify_is_initted())
+        notify_init(g_get_prgname());
+
+    GRefPtr&lt;NotifyNotification&gt; notification = webView-&gt;priv-&gt;notifyNotificationsMap.get(webkit_notification_get_id(webNotification));
+    if (!notification) {
+        notification = adoptGRef(notify_notification_new(webkit_notification_get_title(webNotification),
+            webkit_notification_get_body(webNotification), nullptr));
+
+        webView-&gt;priv-&gt;notifyNotificationsMap.set(webkit_notification_get_id(webNotification), notification);
+    } else
+        notify_notification_update(notification.get(), webkit_notification_get_title(webNotification),
+            webkit_notification_get_body(webNotification), nullptr);
+
+    notify_notification_show(notification.get(), nullptr);
+    return TRUE;
+#else
+    UNUSED_PARAM(webNotification);
+    return FALSE;
+#endif
+}
+
+static gboolean webkitWebViewCloseNotification(WebKitWebView* webView, WebKitNotification* webNotification)
+{
+#if USE(LIBNOTIFY)
+    if (GRefPtr&lt;NotifyNotification&gt; notification = webView-&gt;priv-&gt;notifyNotificationsMap.get(webkit_notification_get_id(webNotification))) {
+        notify_notification_close(notification.get(), nullptr);
+        webView-&gt;priv-&gt;notifyNotificationsMap.remove(webkit_notification_get_id(webNotification));
+    }
+    return TRUE;
+#else
+    UNUSED_PARAM(webNotification);
+    return FALSE;
+#endif
+}
+
</ins><span class="cx"> static void webkitWebViewConstructed(GObject* object)
</span><span class="cx"> {
</span><span class="cx">     G_OBJECT_CLASS(webkit_web_view_parent_class)-&gt;constructed(object);
</span><span class="lines">@@ -713,6 +767,8 @@
</span><span class="cx">     webViewClass-&gt;permission_request = webkitWebViewPermissionRequest;
</span><span class="cx">     webViewClass-&gt;run_file_chooser = webkitWebViewRunFileChooser;
</span><span class="cx">     webViewClass-&gt;authenticate = webkitWebViewAuthenticate;
</span><ins>+    webViewClass-&gt;show_notification = webkitWebViewShowNotification;
+    webViewClass-&gt;close_notification = webkitWebViewCloseNotification;
</ins><span class="cx"> 
</span><span class="cx">     /**
</span><span class="cx">      * WebKitWebView:web-context:
</span><span class="lines">@@ -1574,6 +1630,56 @@
</span><span class="cx">             webkit_marshal_BOOLEAN__OBJECT,
</span><span class="cx">             G_TYPE_BOOLEAN, 1, /* number of parameters */
</span><span class="cx">             WEBKIT_TYPE_AUTHENTICATION_REQUEST);
</span><ins>+
+    /**
+     * WebKitWebView::show-notification:
+     * @web_view: the #WebKitWebView
+     * @notification: a #WebKitNofication
+     *
+     * This signal is emitted when a notification should be presented to the
+     * user. The @notification is kept alive until either: 1) the web page cancels it
+     * or 2) a navigation happens.
+     *
+     * The default handler will emit a notification using libnotify, if built with
+     * support for it.
+     *
+     * Returns: %TRUE to stop other handlers from being invoked. %FALSE otherwise.
+     *
+     * Since: 2.8
+     */
+    signals[SHOW_NOTIFICATION] =
+        g_signal_new(&quot;show-notification&quot;,
+            G_TYPE_FROM_CLASS(gObjectClass),
+            G_SIGNAL_RUN_LAST,
+            G_STRUCT_OFFSET(WebKitWebViewClass, show_notification),
+            g_signal_accumulator_true_handled, nullptr /* accumulator data */,
+            webkit_marshal_BOOLEAN__OBJECT,
+            G_TYPE_BOOLEAN, 1,
+            WEBKIT_TYPE_NOTIFICATION);
+
+    /**
+     * WebKitNotification::close-notification:
+     * @web_view: the #WebKitWebView
+     * @notification: a #WebKitNofication
+     *
+     * This signal is emitted when a notification should be withdrawn.
+     *
+     * The default handler will close the notification using libnotify, if built with
+     * support for it.
+     *
+     * Returns: %TRUE to stop other handlers from being invoked. %FALSE otherwise.
+     *
+     * Since: 2.8
+     */
+    signals[CLOSE_NOTIFICATION] =
+        g_signal_new(&quot;close-notification&quot;,
+            G_TYPE_FROM_CLASS(gObjectClass),
+            G_SIGNAL_RUN_LAST,
+            G_STRUCT_OFFSET(WebKitWebViewClass, close_notification),
+            g_signal_accumulator_true_handled, nullptr /* accumulator data */,
+            webkit_marshal_BOOLEAN__OBJECT,
+            G_TYPE_BOOLEAN, 1,
+            WEBKIT_TYPE_NOTIFICATION);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static void webkitWebViewCancelAuthenticationRequest(WebKitWebView* webView)
</span><span class="lines">@@ -1957,6 +2063,19 @@
</span><span class="cx">     g_signal_emit(webView, signals[INSECURE_CONTENT_DETECTED], 0, type);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+bool webkitWebViewEmitShowNotification(WebKitWebView* webView, WebKitNotification* webNotification)
+{
+    gboolean handled;
+    g_signal_emit(webView, signals[SHOW_NOTIFICATION], 0, webNotification, &amp;handled);
+    return handled;
+}
+
+void webkitWebViewEmitCloseNotification(WebKitWebView* webView, WebKitNotification* webNotification)
+{
+    gboolean handled;
+    g_signal_emit(webView, signals[CLOSE_NOTIFICATION], 0, webNotification, &amp;handled);
+}
+
</ins><span class="cx"> /**
</span><span class="cx">  * webkit_web_view_new:
</span><span class="cx">  *
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIgtkWebKitWebViewh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.h (177072 => 177073)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.h        2014-12-10 17:12:28 UTC (rev 177072)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.h        2014-12-10 17:36:40 UTC (rev 177073)
</span><span class="lines">@@ -238,12 +238,15 @@
</span><span class="cx">                                                 const gchar                 *failing_uri,
</span><span class="cx">                                                 GTlsCertificate             *certificate,
</span><span class="cx">                                                 GTlsCertificateFlags         errors);
</span><ins>+    gboolean   (* show_notification)           (WebKitWebView               *web_view,
+                                                WebKitNotification          *notification);
+    gboolean   (* close_notification)          (WebKitWebView               *web_view,
+                                                WebKitNotification          *notification);
+
</ins><span class="cx">     void (*_webkit_reserved0) (void);
</span><span class="cx">     void (*_webkit_reserved1) (void);
</span><span class="cx">     void (*_webkit_reserved2) (void);
</span><span class="cx">     void (*_webkit_reserved3) (void);
</span><del>-    void (*_webkit_reserved4) (void);
-    void (*_webkit_reserved5) (void);
</del><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> WEBKIT_API GType
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIgtkWebKitWebViewPrivateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewPrivate.h (177072 => 177073)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewPrivate.h        2014-12-10 17:12:28 UTC (rev 177072)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewPrivate.h        2014-12-10 17:36:40 UTC (rev 177073)
</span><span class="lines">@@ -57,6 +57,8 @@
</span><span class="cx"> void webkitWebViewSubmitFormRequest(WebKitWebView*, WebKitFormSubmissionRequest*);
</span><span class="cx"> void webkitWebViewHandleAuthenticationChallenge(WebKitWebView*, WebKit::AuthenticationChallengeProxy*);
</span><span class="cx"> void webkitWebViewInsecureContentDetected(WebKitWebView*, WebKitInsecureContentEvent);
</span><ins>+bool webkitWebViewEmitShowNotification(WebKitWebView*, WebKitNotification*);
+void webkitWebViewEmitCloseNotification(WebKitWebView*, WebKitNotification*);
</ins><span class="cx"> void webkitWebViewWebProcessCrashed(WebKitWebView*);
</span><span class="cx"> 
</span><span class="cx"> #endif // WebKitWebViewPrivate_h
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIgtkdocswebkit2gtksectionstxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt (177072 => 177073)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt        2014-12-10 17:12:28 UTC (rev 177072)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt        2014-12-10 17:36:40 UTC (rev 177073)
</span><span class="lines">@@ -616,6 +616,45 @@
</span><span class="cx"> &lt;/SECTION&gt;
</span><span class="cx"> 
</span><span class="cx"> &lt;SECTION&gt;
</span><ins>+&lt;FILE&gt;WebKitNotification&lt;/FILE&gt;
+WebKitNotification
+webkit_notification_get_id
+webkit_notification_get_title
+webkit_notification_get_body
+
+&lt;SUBSECTION Standard&gt;
+WebKitNotificationClass
+WEBKIT_TYPE_NOTIFICATION
+WEBKIT_IS_NOTIFICATION
+WEBKIT_NOTIFICATION
+WEBKIT_NOTIFICATION_CLASS
+WEBKIT_IS_NOTIFICATION_CLASS
+WEBKIT_NOTIFICATION_GET_CLASS
+
+&lt;SUBSECTION Private&gt;
+WebKitNotificationPrivate
+webkit_notification_get_type
+&lt;/SECTION&gt;
+
+&lt;SECTION&gt;
+&lt;FILE&gt;WebKitNotificationPermissionRequest&lt;/FILE&gt;
+WebKitNotificationPermissionRequest
+
+&lt;SUBSECTION Standard&gt;
+WebKitNotificationPermissionRequestClass
+WEBKIT_TYPE_NOTIFICATION_PERMISSION_REQUEST
+WEBKIT_NOTIFICATION_PERMISSION_REQUEST
+WEBKIT_IS_NOTIFICATION_PERMISSION_REQUEST
+WEBKIT_NOTIFICATION_PERMISSION_REQUEST_CLASS
+WEBKIT_IS_NOTIFICATION_PERMISSION_REQUEST_CLASS
+WEBKIT_NOTIFICATION_PERMISSION_REQUEST_GET_CLASS
+
+&lt;SUBSECTION Private&gt;
+WebKitNotificationPermissionRequestPrivate
+webkit_notification_permission_request_get_type
+&lt;/SECTION&gt;
+
+&lt;SECTION&gt;
</ins><span class="cx"> &lt;FILE&gt;WebKitPolicyDecision&lt;/FILE&gt;
</span><span class="cx"> WebKitPolicyDecision
</span><span class="cx"> webkit_policy_decision_download
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIgtkwebkit2h"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/gtk/webkit2.h (177072 => 177073)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/gtk/webkit2.h        2014-12-10 17:12:28 UTC (rev 177072)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/webkit2.h        2014-12-10 17:36:40 UTC (rev 177073)
</span><span class="lines">@@ -50,6 +50,8 @@
</span><span class="cx"> #include &lt;webkit2/WebKitMimeInfo.h&gt;
</span><span class="cx"> #include &lt;webkit2/WebKitNavigationAction.h&gt;
</span><span class="cx"> #include &lt;webkit2/WebKitNavigationPolicyDecision.h&gt;
</span><ins>+#include &lt;webkit2/WebKitNotification.h&gt;
+#include &lt;webkit2/WebKitNotificationPermissionRequest.h&gt;
</ins><span class="cx"> #include &lt;webkit2/WebKitPermissionRequest.h&gt;
</span><span class="cx"> #include &lt;webkit2/WebKitPlugin.h&gt;
</span><span class="cx"> #include &lt;webkit2/WebKitPrintOperation.h&gt;
</span></span></pre></div>
<a id="trunkSourcecmakeFindLibNotifycmake"></a>
<div class="addfile"><h4>Added: trunk/Source/cmake/FindLibNotify.cmake (0 => 177073)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/cmake/FindLibNotify.cmake                                (rev 0)
+++ trunk/Source/cmake/FindLibNotify.cmake        2014-12-10 17:36:40 UTC (rev 177073)
</span><span class="lines">@@ -0,0 +1,55 @@
</span><ins>+# - Try to find LibNotify
+# This module defines the following variables:
+#
+#  LIBNOTIFY_FOUND - LibNotify was found
+#  LIBNOTIFY_INCLUDE_DIRS - the LibNotify include directories
+#  LIBNOTIFY_LIBRARIES - link these to use LibNotify
+#
+# Copyright (C) 2012 Raphael Kubo da Costa &lt;rakuco@webkit.org&gt;
+# Copyright (C) 2014 Collabora Ltd.
+#
+# 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 THE COPYRIGHT HOLDER 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 THE COPYRIGHT HOLDER 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.
+
+find_package(PkgConfig)
+pkg_check_modules(LIBNOTIFY QUIET libnotify)
+
+find_path(LIBNOTIFY_INCLUDE_DIRS
+    NAMES notify.h
+    HINTS ${LIBNOTIFY_INCLUDEDIR}
+          ${LIBNOTIFY_INCLUDE_DIRS}
+    PATH_SUFFIXES libnotify
+)
+
+find_library(LIBNOTIFY_LIBRARIES
+    NAMES notify
+    HINTS ${LIBNOTIFY_LIBDIR}
+          ${LIBNOTIFY_LIBRARY_DIRS}
+)
+
+include(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibNotify REQUIRED_VARS LIBNOTIFY_INCLUDE_DIRS LIBNOTIFY_LIBRARIES
+                                            VERSION_VAR   LIBNOTIFY_VERSION)
+
+mark_as_advanced(
+    LIBNOTIFY_INCLUDE_DIRS
+    LIBNOTIFY_LIBRARIES
+)
</ins></span></pre></div>
<a id="trunkSourcecmakeOptionsGTKcmake"></a>
<div class="modfile"><h4>Modified: trunk/Source/cmake/OptionsGTK.cmake (177072 => 177073)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/cmake/OptionsGTK.cmake        2014-12-10 17:12:28 UTC (rev 177072)
+++ trunk/Source/cmake/OptionsGTK.cmake        2014-12-10 17:36:40 UTC (rev 177073)
</span><span class="lines">@@ -50,6 +50,7 @@
</span><span class="cx"> find_package(EGL)
</span><span class="cx"> find_package(GeoClue2 2.1.5)
</span><span class="cx"> find_package(GnuTLS 3.0.0)
</span><ins>+find_package(LibNotify)
</ins><span class="cx"> 
</span><span class="cx"> if (NOT GEOCLUE2_FOUND)
</span><span class="cx">     find_package(GeoClue)
</span><span class="lines">@@ -151,6 +152,7 @@
</span><span class="cx"> WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_NAVIGATOR_CONTENT_UTILS OFF)
</span><span class="cx"> WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_NAVIGATOR_HWCONCURRENCY ON)
</span><span class="cx"> WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_NETSCAPE_PLUGIN_API ON)
</span><ins>+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_NOTIFICATIONS ON)
</ins><span class="cx"> WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_PICTURE_SIZES ON)
</span><span class="cx"> WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_QUOTA OFF)
</span><span class="cx"> WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_RESOLUTION_MEDIA_QUERY OFF)
</span><span class="lines">@@ -173,6 +175,12 @@
</span><span class="cx"> WEBKIT_OPTION_DEFAULT_PORT_VALUE(WTF_USE_TILED_BACKING_STORE OFF)
</span><span class="cx"> WEBKIT_OPTION_END()
</span><span class="cx"> 
</span><ins>+if (LIBNOTIFY_FOUND)
+    add_definitions(-DWTF_USE_LIBNOTIFY=1)
+else ()
+    add_definitions(-DWTF_USE_LIBNOTIFY=0)
+endif ()
+
</ins><span class="cx"> if (ENABLE_PLUGIN_PROCESS_GTK2)
</span><span class="cx">     find_package(GTK2 2.24.10 REQUIRED)
</span><span class="cx">     find_package(GDK2 2.24.10 REQUIRED)
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (177072 => 177073)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2014-12-10 17:12:28 UTC (rev 177072)
+++ trunk/Tools/ChangeLog        2014-12-10 17:36:40 UTC (rev 177073)
</span><span class="lines">@@ -1,3 +1,19 @@
</span><ins>+2014-12-09  Gustavo Noronha Silva  &lt;gustavo.noronha@collabora.com&gt;
+
+        [GTK][WK2] Add HTML5 Notifications support
+        https://bugs.webkit.org/show_bug.cgi?id=61140
+
+        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.
+
</ins><span class="cx"> 2014-12-09  Benjamin Poulain  &lt;bpoulain@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Fix webkitpy test expectation
</span></span></pre></div>
<a id="trunkToolsMiniBrowsergtkBrowserWindowc"></a>
<div class="modfile"><h4>Modified: trunk/Tools/MiniBrowser/gtk/BrowserWindow.c (177072 => 177073)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/MiniBrowser/gtk/BrowserWindow.c        2014-12-10 17:12:28 UTC (rev 177072)
+++ trunk/Tools/MiniBrowser/gtk/BrowserWindow.c        2014-12-10 17:36:40 UTC (rev 177073)
</span><span class="lines">@@ -416,6 +416,10 @@
</span><span class="cx">         dialog_title = &quot;Geolocation request&quot;;
</span><span class="cx">         dialog_message_format = &quot;%s&quot;;
</span><span class="cx">         dialog_message = &quot;Allow geolocation request?&quot;;
</span><ins>+    } else if (WEBKIT_IS_NOTIFICATION_PERMISSION_REQUEST(request)) {
+        dialog_title = &quot;Notification request&quot;;
+        dialog_message_format = &quot;%s&quot;;
+        dialog_message = &quot;Allow notifications request?&quot;;
</ins><span class="cx">     } else if (WEBKIT_IS_USER_MEDIA_PERMISSION_REQUEST(request)) {
</span><span class="cx">         dialog_message_format = &quot;Allow access to %s device?&quot;;
</span><span class="cx">         gboolean is_for_audio_device = webkit_user_media_permission_is_for_audio_device(WEBKIT_USER_MEDIA_PERMISSION_REQUEST(request));
</span></span></pre></div>
<a id="trunkToolsScriptswebkitperlFeatureListpm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/webkitperl/FeatureList.pm (177072 => 177073)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/webkitperl/FeatureList.pm        2014-12-10 17:12:28 UTC (rev 177072)
+++ trunk/Tools/Scripts/webkitperl/FeatureList.pm        2014-12-10 17:36:40 UTC (rev 177073)
</span><span class="lines">@@ -327,7 +327,7 @@
</span><span class="cx">       define =&gt; &quot;ENABLE_NOSNIFF&quot;, default =&gt; isEfl(), value =&gt; \$nosniffSupport },
</span><span class="cx"> 
</span><span class="cx">     { option =&gt; &quot;notifications&quot;, desc =&gt; &quot;Toggle Notifications support&quot;,
</span><del>-      define =&gt; &quot;ENABLE_NOTIFICATIONS&quot;, default =&gt; 0, value =&gt; \$notificationsSupport },
</del><ins>+      define =&gt; &quot;ENABLE_NOTIFICATIONS&quot;, default =&gt; isGtk(), value =&gt; \$notificationsSupport },
</ins><span class="cx"> 
</span><span class="cx">     { option =&gt; &quot;orientation-events&quot;, desc =&gt; &quot;Toggle Orientation Events support&quot;,
</span><span class="cx">       define =&gt; &quot;ENABLE_ORIENTATION_EVENTS&quot;, default =&gt; isIOSWebKit(), value =&gt; \$orientationEventsSupport },
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWebKit2GtkTestWebKitWebViewcpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestWebKitWebView.cpp (177072 => 177073)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestWebKitWebView.cpp        2014-12-10 17:12:28 UTC (rev 177072)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestWebKitWebView.cpp        2014-12-10 17:36:40 UTC (rev 177073)
</span><span class="lines">@@ -1,5 +1,6 @@
</span><span class="cx"> /*
</span><span class="cx">  * Copyright (C) 2011 Igalia S.L.
</span><ins>+ * Copyright (C) 2014 Collabora Ltd.
</ins><span class="cx">  *
</span><span class="cx">  * This library is free software; you can redistribute it and/or
</span><span class="cx">  * modify it under the terms of the GNU Lesser General Public
</span><span class="lines">@@ -18,12 +19,15 @@
</span><span class="cx">  */
</span><span class="cx"> 
</span><span class="cx"> #include &quot;config.h&quot;
</span><ins>+#include &quot;WebKitTestServer.h&quot;
</ins><span class="cx"> #include &quot;WebViewTest.h&quot;
</span><span class="cx"> #include &lt;JavaScriptCore/JSStringRef.h&gt;
</span><span class="cx"> #include &lt;JavaScriptCore/JSValueRef.h&gt;
</span><span class="cx"> #include &lt;glib/gstdio.h&gt;
</span><span class="cx"> #include &lt;wtf/gobject/GRefPtr.h&gt;
</span><span class="cx"> 
</span><ins>+static WebKitTestServer* gServer;
+
</ins><span class="cx"> static void testWebViewWebContext(WebViewTest* test, gconstpointer)
</span><span class="cx"> {
</span><span class="cx">     g_assert(webkit_web_view_get_context(test-&gt;m_webView) == test-&gt;m_webContext.get());
</span><span class="lines">@@ -581,8 +585,142 @@
</span><span class="cx">     g_assert(test-&gt;getSnapshotAndCancel());
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+class NotificationWebViewTest: public WebViewTest {
+public:
+    MAKE_GLIB_TEST_FIXTURE(NotificationWebViewTest);
+
+    enum NotificationEvent {
+        None,
+        Permission,
+        Shown,
+        Cancelled
+    };
+
+    static gboolean permissionRequestCallback(WebKitWebView*, WebKitPermissionRequest *request, NotificationWebViewTest* test)
+    {
+        g_assert(WEBKIT_IS_NOTIFICATION_PERMISSION_REQUEST(request));
+        test-&gt;assertObjectIsDeletedWhenTestFinishes(G_OBJECT(request));
+
+        test-&gt;m_event = Permission;
+
+        webkit_permission_request_allow(request);
+
+        g_main_loop_quit(test-&gt;m_mainLoop);
+
+        return TRUE;
+    }
+
+    static gboolean showNotificationCallback(WebKitWebView*, WebKitNotification* notification, NotificationWebViewTest* test)
+    {
+        test-&gt;assertObjectIsDeletedWhenTestFinishes(G_OBJECT(notification));
+        test-&gt;m_notification = notification;
+        test-&gt;m_event = Shown;
+        g_main_loop_quit(test-&gt;m_mainLoop);
+        return TRUE;
+    }
+
+    static gboolean closeNotificationCallback(WebKitWebView*, WebKitNotification*, NotificationWebViewTest* test)
+    {
+        test-&gt;m_notification = nullptr;
+        test-&gt;m_event = Cancelled;
+        g_main_loop_quit(test-&gt;m_mainLoop);
+        return TRUE;
+    }
+
+    NotificationWebViewTest()
+        : m_event(None)
+    {
+        g_signal_connect(m_webView, &quot;permission-request&quot;, G_CALLBACK(permissionRequestCallback), this);
+        g_signal_connect(m_webView, &quot;show-notification&quot;, G_CALLBACK(showNotificationCallback), this);
+        g_signal_connect(m_webView, &quot;close-notification&quot;, G_CALLBACK(closeNotificationCallback), this);
+
+    }
+
+    ~NotificationWebViewTest()
+    {
+        g_signal_handlers_disconnect_matched(m_webView, G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, this);
+    }
+
+   void requestPermissionAndWaitUntilGiven()
+    {
+        m_event = None;
+        webkit_web_view_run_javascript(m_webView, &quot;Notification.requestPermission();&quot;, nullptr, nullptr, nullptr);
+        g_main_loop_run(m_mainLoop);
+    }
+
+    void requestNotificationAndWaitUntilShown(const char* title, const char* body)
+    {
+        m_event = None;
+
+        GUniquePtr&lt;char&gt; jscode(g_strdup_printf(&quot;n = new Notification('%s', { body: '%s'});&quot;, title, body));
+        webkit_web_view_run_javascript(m_webView, jscode.get(), nullptr, nullptr, nullptr);
+
+        g_main_loop_run(m_mainLoop);
+    }
+
+    void closeNotificationAndWaitUntilCancelled()
+    {
+        m_event = None;
+        webkit_web_view_run_javascript(m_webView, &quot;n.close()&quot;, nullptr, nullptr, nullptr);
+        g_main_loop_run(m_mainLoop);
+    }
+
+    NotificationEvent m_event;
+    WebKitNotification* m_notification;
+};
+
+static void testWebViewNotification(NotificationWebViewTest* test, gconstpointer)
+{
+    // Notifications don't work with local or special schemes.
+    test-&gt;loadURI(gServer-&gt;getURIForPath(&quot;/&quot;).data());
+    test-&gt;waitUntilLoadFinished();
+
+    test-&gt;requestPermissionAndWaitUntilGiven();
+
+    g_assert(test-&gt;m_event == NotificationWebViewTest::Permission);
+
+    static const char* title = &quot;This is a notification&quot;;
+    static const char* body = &quot;This is the body.&quot;;
+    test-&gt;requestNotificationAndWaitUntilShown(title, body);
+
+    g_assert(test-&gt;m_event == NotificationWebViewTest::Shown);
+    g_assert(test-&gt;m_notification);
+    g_assert_cmpstr(webkit_notification_get_title(test-&gt;m_notification), ==, title);
+    g_assert_cmpstr(webkit_notification_get_body(test-&gt;m_notification), ==, body);
+
+    test-&gt;closeNotificationAndWaitUntilCancelled();
+
+    g_assert(test-&gt;m_event == NotificationWebViewTest::Cancelled);
+
+    test-&gt;requestNotificationAndWaitUntilShown(title, body);
+
+    g_assert(test-&gt;m_event == NotificationWebViewTest::Shown);
+
+    test-&gt;loadURI(gServer-&gt;getURIForPath(&quot;/&quot;).data());
+    test-&gt;waitUntilLoadFinished();
+
+    g_assert(test-&gt;m_event == NotificationWebViewTest::Cancelled);
+}
+
+static void serverCallback(SoupServer* server, SoupMessage* message, const char* path, GHashTable*, SoupClientContext*, gpointer)
+{
+    if (message-&gt;method != SOUP_METHOD_GET) {
+        soup_message_set_status(message, SOUP_STATUS_NOT_IMPLEMENTED);
+        return;
+    }
+
+    if (g_str_equal(path, &quot;/&quot;)) {
+        soup_message_set_status(message, SOUP_STATUS_OK);
+        soup_message_body_complete(message-&gt;response_body);
+    } else
+        soup_message_set_status(message, SOUP_STATUS_NOT_FOUND);
+}
+
</ins><span class="cx"> void beforeAll()
</span><span class="cx"> {
</span><ins>+    gServer = new WebKitTestServer();
+    gServer-&gt;run(serverCallback);
+
</ins><span class="cx">     WebViewTest::add(&quot;WebKitWebView&quot;, &quot;web-context&quot;, testWebViewWebContext);
</span><span class="cx">     WebViewTest::add(&quot;WebKitWebView&quot;, &quot;custom-charset&quot;, testWebViewCustomCharset);
</span><span class="cx">     WebViewTest::add(&quot;WebKitWebView&quot;, &quot;settings&quot;, testWebViewSettings);
</span><span class="lines">@@ -594,6 +732,7 @@
</span><span class="cx">     SaveWebViewTest::add(&quot;WebKitWebView&quot;, &quot;save&quot;, testWebViewSave);
</span><span class="cx">     SnapshotWebViewTest::add(&quot;WebKitWebView&quot;, &quot;snapshot&quot;, testWebViewSnapshot);
</span><span class="cx">     WebViewTest::add(&quot;WebKitWebView&quot;, &quot;page-visibility&quot;, testWebViewPageVisibility);
</span><ins>+    NotificationWebViewTest::add(&quot;WebKitWebView&quot;, &quot;notification&quot;, testWebViewNotification);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void afterAll()
</span></span></pre>
</div>
</div>

</body>
</html>