summaryrefslogtreecommitdiff
path: root/Source/WebKit/blackberry/Api
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebKit/blackberry/Api')
-rw-r--r--Source/WebKit/blackberry/Api/WebPage.cpp63
-rw-r--r--Source/WebKit/blackberry/Api/WebPage.h8
-rw-r--r--Source/WebKit/blackberry/Api/WebPageClient.h13
-rw-r--r--Source/WebKit/blackberry/Api/WebPage_p.h12
4 files changed, 82 insertions, 14 deletions
diff --git a/Source/WebKit/blackberry/Api/WebPage.cpp b/Source/WebKit/blackberry/Api/WebPage.cpp
index bd372b961..aece95429 100644
--- a/Source/WebKit/blackberry/Api/WebPage.cpp
+++ b/Source/WebKit/blackberry/Api/WebPage.cpp
@@ -93,7 +93,7 @@
#include "NavigatorContentUtilsClientBlackBerry.h"
#endif
#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
-#include "NotificationPresenterImpl.h"
+#include "NotificationClientBlackBerry.h"
#endif
#include "Page.h"
#include "PageCache.h"
@@ -429,6 +429,9 @@ WebPagePrivate::WebPagePrivate(WebPage* webPage, WebPageClient* client, const In
, m_autofillManager(AutofillManager::create(this))
, m_documentStyleRecalcPostponed(false)
, m_documentChildNeedsStyleRecalc(false)
+#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
+ , m_notificationManager(this)
+#endif
{
static bool isInitialized = false;
if (!isInitialized) {
@@ -561,7 +564,7 @@ void WebPagePrivate::init(const BlackBerry::Platform::String& pageGroupName)
#endif
#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
- WebCore::provideNotification(m_page, NotificationPresenterImpl::instance());
+ WebCore::provideNotification(m_page, new NotificationClientBlackBerry(this));
#endif
#if ENABLE(NAVIGATOR_CONTENT_UTILS)
@@ -5887,16 +5890,6 @@ BlackBerry::Platform::String WebPage::textHasAttribute(const BlackBerry::Platfor
return "";
}
-void WebPage::setAllowNotification(const BlackBerry::Platform::String& domain, bool allow)
-{
-#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
- static_cast<NotificationPresenterImpl*>(NotificationPresenterImpl::instance())->onPermission(domain.c_str(), allow);
-#else
- UNUSED_PARAM(domain);
- UNUSED_PARAM(allow);
-#endif
-}
-
void WebPage::setJavaScriptCanAccessClipboard(bool enabled)
{
d->m_page->settings()->setJavaScriptCanAccessClipboard(enabled);
@@ -6160,5 +6153,51 @@ void WebPagePrivate::didComposite()
InspectorInstrumentation::didComposite(m_page);
}
+void WebPage::updateNotificationPermission(const BlackBerry::Platform::String& requestId, bool allowed)
+{
+#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
+ d->notificationManager().updatePermission(requestId, allowed);
+#else
+ UNUSED_PARAM(requestId);
+ UNUSED_PARAM(allowed);
+#endif
+}
+
+void WebPage::notificationClicked(const BlackBerry::Platform::String& notificationId)
+{
+#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
+ d->notificationManager().notificationClicked(notificationId);
+#else
+ UNUSED_PARAM(notificationId);
+#endif
+}
+
+void WebPage::notificationClosed(const BlackBerry::Platform::String& notificationId)
+{
+#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
+ d->notificationManager().notificationClosed(notificationId);
+#else
+ UNUSED_PARAM(notificationId);
+#endif
+}
+
+void WebPage::notificationError(const BlackBerry::Platform::String& notificationId)
+{
+#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
+ d->notificationManager().notificationError(notificationId);
+#else
+ UNUSED_PARAM(notificationId);
+#endif
+}
+
+void WebPage::notificationShown(const BlackBerry::Platform::String& notificationId)
+{
+#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
+ d->notificationManager().notificationShown(notificationId);
+#else
+ UNUSED_PARAM(notificationId);
+#endif
+}
+
}
}
diff --git a/Source/WebKit/blackberry/Api/WebPage.h b/Source/WebKit/blackberry/Api/WebPage.h
index 2fe56ca31..fc75b0f9a 100644
--- a/Source/WebKit/blackberry/Api/WebPage.h
+++ b/Source/WebKit/blackberry/Api/WebPage.h
@@ -268,8 +268,6 @@ public:
BlackBerry::Platform::String textHasAttribute(const BlackBerry::Platform::String& query) const;
- void setAllowNotification(const BlackBerry::Platform::String& domain, bool allow);
-
Platform::WebContext webContext(TargetDetectionStrategy) const;
typedef intptr_t BackForwardId;
@@ -366,6 +364,12 @@ public:
BlackBerry::Platform::String renderTreeAsText();
+ void updateNotificationPermission(const BlackBerry::Platform::String& requestId, bool allowed);
+ void notificationClicked(const BlackBerry::Platform::String& notificationId);
+ void notificationClosed(const BlackBerry::Platform::String& notificationId);
+ void notificationError(const BlackBerry::Platform::String& notificationId);
+ void notificationShown(const BlackBerry::Platform::String& notificationId);
+
private:
virtual ~WebPage();
diff --git a/Source/WebKit/blackberry/Api/WebPageClient.h b/Source/WebKit/blackberry/Api/WebPageClient.h
index 69035ba1f..26ddf0918 100644
--- a/Source/WebKit/blackberry/Api/WebPageClient.h
+++ b/Source/WebKit/blackberry/Api/WebPageClient.h
@@ -267,6 +267,19 @@ public:
virtual void requestUserMedia(const Platform::WebUserMediaRequest&) = 0;
virtual void cancelUserMediaRequest(const Platform::WebUserMediaRequest&) = 0;
virtual void updateFindStringResult(int numMatches, int currentIndex) = 0;
+
+ // Match with NotificationClient::Permission.
+ enum Permission {
+ PermissionAllowed, // User has allowed notifications
+ PermissionNotAllowed, // User has not yet allowed
+ PermissionDenied // User has explicitly denied permission
+ };
+ virtual void requestNotificationPermission(const BlackBerry::Platform::String& /*requestId*/, const BlackBerry::Platform::String& /*origin*/) = 0;
+ virtual Permission checkNotificationPermission(const BlackBerry::Platform::String& /*origin*/) = 0;
+ virtual void showNotification(const BlackBerry::Platform::String& /*notificationId*/, const BlackBerry::Platform::String& /*title*/, const BlackBerry::Platform::String& /*body*/, const BlackBerry::Platform::String& /*iconUrl*/, const BlackBerry::Platform::String& /*tag*/, const BlackBerry::Platform::String& /*origin*/) = 0;
+ virtual void cancelNotification(const BlackBerry::Platform::String& /*id*/) = 0;
+ virtual void clearNotifications(const std::vector<BlackBerry::Platform::String>& /*notificationIds*/) = 0;
+ virtual void notificationDestroyed(const BlackBerry::Platform::String& /*notificationId*/) = 0;
};
} // namespace WebKit
} // namespace BlackBerry
diff --git a/Source/WebKit/blackberry/Api/WebPage_p.h b/Source/WebKit/blackberry/Api/WebPage_p.h
index 9c0a26dcb..10a209e33 100644
--- a/Source/WebKit/blackberry/Api/WebPage_p.h
+++ b/Source/WebKit/blackberry/Api/WebPage_p.h
@@ -31,6 +31,9 @@
#include <EGL/egl.h>
#endif
#include "KURL.h"
+#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
+#include "NotificationManager.h"
+#endif
#include "PageClientBlackBerry.h"
#include "PlatformMouseEvent.h"
#include "ScriptSourceCode.h"
@@ -461,6 +464,10 @@ public:
void willComposite();
void didComposite();
+#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
+ NotificationManager& notificationManager() { return m_notificationManager; };
+#endif
+
WebPage* m_webPage;
WebPageClient* m_client;
WebCore::InspectorClientBlackBerry* m_inspectorClient;
@@ -635,6 +642,11 @@ public:
WebCore::IntPoint m_cachedHitTestContentPos;
WebCore::HitTestResult m_cachedHitTestResult;
+
+#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
+ NotificationManager m_notificationManager;
+#endif
+
protected:
virtual ~WebPagePrivate();
};