Diff
Modified: trunk/Source/WebCore/ChangeLog (115010 => 115011)
--- trunk/Source/WebCore/ChangeLog 2012-04-24 08:34:25 UTC (rev 115010)
+++ trunk/Source/WebCore/ChangeLog 2012-04-24 08:35:44 UTC (rev 115011)
@@ -1,3 +1,22 @@
+2012-04-24 Yael Aharon <yael.aha...@nokia.com>
+
+ [Qt] Move notification icon download out of WebCore
+ https://bugs.webkit.org/show_bug.cgi?id=80700
+
+ Reviewed by Simon Hausmann.
+
+ Remove the code that downloads the notification's icon out of WebCore.
+ Other ports let the client decide if to download the icon or not.
+ No new tests. This patch is only removing code.
+
+ * notifications/Notification.cpp:
+ (WebCore::Notification::~Notification):
+ (WebCore::Notification::show):
+ (WebCore::Notification::close):
+ (WebCore::Notification::contextDestroyed):
+ * notifications/Notification.h:
+ (Notification):
+
2012-04-24 Rakesh KN <rakesh...@motorola.com>
RadioNodeList support in HTMLFormElement::elements
Modified: trunk/Source/WebCore/notifications/Notification.cpp (115010 => 115011)
--- trunk/Source/WebCore/notifications/Notification.cpp 2012-04-24 08:34:25 UTC (rev 115010)
+++ trunk/Source/WebCore/notifications/Notification.cpp 2012-04-24 08:35:44 UTC (rev 115011)
@@ -116,10 +116,6 @@
Notification::~Notification()
{
- if (m_state == LoadingIcon) {
- ASSERT_NOT_REACHED();
- close();
- }
}
#if ENABLE(LEGACY_NOTIFICATIONS)
@@ -171,26 +167,11 @@
void Notification::show()
{
-#if PLATFORM(QT)
- if (iconURL().isEmpty()) {
- // Set the state before actually showing, because
- // handling of ondisplay may rely on that.
- if (m_state == Idle) {
- m_state = Showing;
- if (m_notificationCenter->client()) {
- m_notificationCenter->client()->show(this);
- setPendingActivity(this);
- }
- }
- } else
- startLoadingIcon();
-#else
// prevent double-showing
if (m_state == Idle && m_notificationCenter->client() && m_notificationCenter->client()->show(this)) {
m_state = Showing;
setPendingActivity(this);
}
-#endif
}
void Notification::close()
@@ -198,15 +179,10 @@
switch (m_state) {
case Idle:
break;
- case LoadingIcon:
- m_state = CancelledIcon;
- stopLoadingIcon();
- break;
case Showing:
if (m_notificationCenter->client())
m_notificationCenter->client()->cancel(this);
break;
- case CancelledIcon:
case Closed:
break;
}
@@ -229,66 +205,6 @@
m_notificationCenter->client()->notificationObjectDestroyed(this);
}
-void Notification::startLoadingIcon()
-{
- if (m_state != Idle)
- return;
- setPendingActivity(this);
- m_state = LoadingIcon;
- ThreadableLoaderOptions options;
- options.sendLoadCallbacks = DoNotSendCallbacks;
- options.sniffContent = DoNotSniffContent;
- options.preflightPolicy = ConsiderPreflight;
- options.allowCredentials = AllowStoredCredentials;
- options.crossOriginRequestPolicy = AllowCrossOriginRequests;
- m_loader = ThreadableLoader::create(scriptExecutionContext(), this, ResourceRequest(iconURL()), options);
-}
-
-void Notification::stopLoadingIcon()
-{
- m_iconData = 0;
- RefPtr<ThreadableLoader> protect(m_loader);
- m_loader->cancel();
-}
-
-void Notification::didReceiveResponse(unsigned long, const ResourceResponse& response)
-{
- int status = response.httpStatusCode();
- if (status && (status < 200 || status > 299)) {
- stopLoadingIcon();
- return;
- }
- m_iconData = SharedBuffer::create();
-}
-
-void Notification::didReceiveData(const char* data, int dataLength)
-{
- m_iconData->append(data, dataLength);
-}
-
-void Notification::didFinishLoading(unsigned long, double)
-{
- finishLoadingIcon();
-}
-
-void Notification::didFail(const ResourceError&)
-{
- finishLoadingIcon();
-}
-
-void Notification::didFailRedirectCheck()
-{
- finishLoadingIcon();
-}
-
-void Notification::finishLoadingIcon()
-{
- if (m_state == LoadingIcon) {
- if (m_notificationCenter->client() && m_notificationCenter->client()->show(this))
- m_state = Showing;
- }
-}
-
void Notification::finalize()
{
if (m_state == Closed)
Modified: trunk/Source/WebCore/notifications/Notification.h (115010 => 115011)
--- trunk/Source/WebCore/notifications/Notification.h 2012-04-24 08:34:25 UTC (rev 115010)
+++ trunk/Source/WebCore/notifications/Notification.h 2012-04-24 08:35:44 UTC (rev 115011)
@@ -61,7 +61,7 @@
typedef int ExceptionCode;
-class Notification : public RefCounted<Notification>, public ActiveDOMObject, public ThreadableLoaderClient, public EventTarget {
+class Notification : public RefCounted<Notification>, public ActiveDOMObject, public EventTarget {
WTF_MAKE_FAST_ALLOCATED;
public:
Notification();
@@ -130,18 +130,9 @@
void stopLoadingIcon();
- SharedBuffer* iconData() { return m_iconData.get(); }
- void releaseIconData() { m_iconData = 0; }
-
// Deprecated. Use functions from NotificationCenter.
void detachPresenter() { }
- virtual void didReceiveResponse(unsigned long, const ResourceResponse&);
- virtual void didReceiveData(const char* data, int dataLength);
- virtual void didFinishLoading(unsigned long identifier, double finishTime);
- virtual void didFail(const ResourceError&);
- virtual void didFailRedirectCheck();
-
void finalize();
private:
@@ -182,10 +173,8 @@
enum NotificationState {
Idle = 0,
- LoadingIcon = 1,
- Showing = 2,
- CancelledIcon = 3,
- Closed = 4,
+ Showing = 1,
+ Closed = 2,
};
NotificationState m_state;
@@ -194,8 +183,6 @@
EventTargetData m_eventTargetData;
- RefPtr<ThreadableLoader> m_loader;
- RefPtr<SharedBuffer> m_iconData;
#if ENABLE(NOTIFICATIONS)
OwnPtr<Timer<Notification> > m_showTaskTimer;
#endif
Modified: trunk/Source/WebKit/qt/Api/qwebkitplatformplugin.h (115010 => 115011)
--- trunk/Source/WebKit/qt/Api/qwebkitplatformplugin.h 2012-04-24 08:34:25 UTC (rev 115010)
+++ trunk/Source/WebKit/qt/Api/qwebkitplatformplugin.h 2012-04-24 08:35:44 UTC (rev 115011)
@@ -75,7 +75,7 @@
virtual const QString title() const = 0;
virtual const QString message() const = 0;
- virtual const QByteArray iconData() const = 0;
+ virtual const QUrl iconUrl() const = 0;
virtual const QUrl openerPageUrl() const = 0;
};
@@ -180,7 +180,7 @@
};
QT_BEGIN_NAMESPACE
-Q_DECLARE_INTERFACE(QWebKitPlatformPlugin, "com.nokia.Qt.WebKit.PlatformPlugin/1.8");
+Q_DECLARE_INTERFACE(QWebKitPlatformPlugin, "com.nokia.Qt.WebKit.PlatformPlugin/1.9");
QT_END_NAMESPACE
#endif // QWEBKITPLATFORMPLUGIN_H
Modified: trunk/Source/WebKit/qt/ChangeLog (115010 => 115011)
--- trunk/Source/WebKit/qt/ChangeLog 2012-04-24 08:34:25 UTC (rev 115010)
+++ trunk/Source/WebKit/qt/ChangeLog 2012-04-24 08:35:44 UTC (rev 115011)
@@ -1,3 +1,33 @@
+2012-04-24 Yael Aharon <yael.aha...@nokia.com>
+
+ [Qt] Move notification icon download out of WebCore
+ https://bugs.webkit.org/show_bug.cgi?id=80700
+
+ Reviewed by Simon Hausmann.
+
+ Remove the code that handles the notification's icon and use the icon url instead.
+ The "display" event has to be asynchronous, so a timer was added to achieve that.
+ The platform plugin API and example were updated to reflect this change.
+ This change does not address the recent changes in web notifications spec.
+
+ * Api/qwebkitplatformplugin.h:
+ (QWebNotificationData):
+ * WebCoreSupport/NotificationPresenterClientQt.cpp:
+ (WebCore::NotificationWrapper::NotificationWrapper):
+ (WebCore::NotificationWrapper::sendDisplayEvent):
+ (WebCore):
+ (WebCore::NotificationWrapper::iconUrl):
+ (WebCore::NotificationPresenterClientQt::show):
+ (WebCore::NotificationPresenterClientQt::displayNotification):
+ (WebCore::NotificationPresenterClientQt::sendDisplayEvent):
+ * WebCoreSupport/NotificationPresenterClientQt.h:
+ (NotificationWrapper):
+ (NotificationPresenterClientQt):
+ * examples/platformplugin/WebNotificationPresenter.cpp:
+ (WebNotificationWidget::showNotification):
+ * examples/platformplugin/qwebkitplatformplugin.h:
+ (QWebNotificationData):
+
2012-04-18 Allan Sandfeld Jensen <allan.jen...@nokia.com>
Clean-up WheelEvent Conversion.
Modified: trunk/Source/WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.cpp (115010 => 115011)
--- trunk/Source/WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.cpp 2012-04-24 08:34:25 UTC (rev 115010)
+++ trunk/Source/WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.cpp 2012-04-24 08:35:44 UTC (rev 115011)
@@ -69,6 +69,7 @@
NotificationWrapper::NotificationWrapper()
: m_closeTimer(this, &NotificationWrapper::close)
+ , m_displayEventTimer(this, &NotificationWrapper::sendDisplayEvent)
{
#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
@@ -86,6 +87,13 @@
#endif
}
+void NotificationWrapper::sendDisplayEvent(Timer<NotificationWrapper>*)
+{
+#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
+ NotificationPresenterClientQt::notificationPresenter()->sendDisplayEvent(this);
+#endif
+}
+
const QString NotificationWrapper::title() const
{
#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
@@ -106,17 +114,14 @@
return QString();
}
-const QByteArray NotificationWrapper::iconData() const
+const QUrl NotificationWrapper::iconUrl() const
{
- QByteArray iconData;
#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
Notification* notification = NotificationPresenterClientQt::notificationPresenter()->notificationForWrapper(this);
- if (notification) {
- if (notification->iconData())
- iconData = QByteArray::fromRawData(notification->iconData()->data(), notification->iconData()->size());
- }
+ if (notification)
+ return notification->iconURL();
#endif
- return iconData;
+ return QUrl();
}
const QUrl NotificationWrapper::openerPageUrl() const
@@ -179,15 +184,11 @@
removeReplacedNotificationFromQueue(notification);
if (dumpNotification)
dumpShowText(notification);
- QByteArray iconData;
- if (notification->iconData())
- iconData = QByteArray::fromRawData(notification->iconData()->data(), notification->iconData()->size());
- displayNotification(notification, iconData);
- notification->releaseIconData();
+ displayNotification(notification);
return true;
}
-void NotificationPresenterClientQt::displayNotification(Notification* notification, const QByteArray& bytes)
+void NotificationPresenterClientQt::displayNotification(Notification* notification)
{
NotificationWrapper* wrapper = new NotificationWrapper();
m_notifications.insert(notification, wrapper);
@@ -208,16 +209,11 @@
#ifndef QT_NO_SYSTEMTRAYICON
if (!dumpNotification)
wrapper->m_closeTimer.startOneShot(notificationTimeout);
- QPixmap pixmap;
- if (bytes.length() && pixmap.loadFromData(bytes)) {
- QIcon icon(pixmap);
- wrapper->m_notificationIcon = adoptPtr(new QSystemTrayIcon(icon));
- } else
wrapper->m_notificationIcon = adoptPtr(new QSystemTrayIcon());
#endif
}
- sendEvent(notification, "display");
+ wrapper->m_displayEventTimer.startOneShot(0);
// Make sure the notification was not cancelled during handling the display event
if (m_notifications.find(notification) == m_notifications.end())
@@ -384,6 +380,14 @@
m_pendingPermissionRequests.remove(iter.key());
}
+void NotificationPresenterClientQt::sendDisplayEvent(NotificationWrapper* wrapper)
+{
+ Notification* notification = notificationForWrapper(wrapper);
+ if (notification)
+ sendEvent(notification, "display");
+}
+
+
void NotificationPresenterClientQt::sendEvent(Notification* notification, const AtomicString& eventName)
{
if (notification->scriptExecutionContext())
Modified: trunk/Source/WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.h (115010 => 115011)
--- trunk/Source/WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.h 2012-04-24 08:34:25 UTC (rev 115010)
+++ trunk/Source/WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.h 2012-04-24 08:35:44 UTC (rev 115011)
@@ -59,9 +59,10 @@
void close();
void close(Timer<NotificationWrapper>*);
+ void sendDisplayEvent(Timer<NotificationWrapper>*);
const QString title() const;
const QString message() const;
- const QByteArray iconData() const;
+ const QUrl iconUrl() const;
const QUrl openerPageUrl() const;
public Q_SLOTS:
@@ -75,6 +76,7 @@
OwnPtr<QWebNotificationPresenter> m_presenter;
Timer<NotificationWrapper> m_closeTimer;
+ Timer<NotificationWrapper> m_displayEventTimer;
};
#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
@@ -108,10 +110,11 @@
Notification* notificationForWrapper(const NotificationWrapper*) const;
void notificationClicked(NotificationWrapper*);
void notificationClicked(const QString& title);
+ void sendDisplayEvent(NotificationWrapper*);
private:
void sendEvent(Notification*, const AtomicString& eventName);
- void displayNotification(Notification*, const QByteArray&);
+ void displayNotification(Notification*);
void removeReplacedNotificationFromQueue(Notification*);
void detachNotification(Notification*);
void dumpReplacedIdText(Notification*);
Modified: trunk/Source/WebKit/qt/examples/platformplugin/WebNotificationPresenter.cpp (115010 => 115011)
--- trunk/Source/WebKit/qt/examples/platformplugin/WebNotificationPresenter.cpp 2012-04-24 08:34:25 UTC (rev 115010)
+++ trunk/Source/WebKit/qt/examples/platformplugin/WebNotificationPresenter.cpp 2012-04-24 08:35:44 UTC (rev 115011)
@@ -39,13 +39,7 @@
QGridLayout* layout = new QGridLayout(this);
layout->addWidget(new QLabel(data->title()), 0, 0, 1, 5);
int messagePosition = 0;
- QPixmap pixmap;
- if (data->iconData().length() && pixmap.loadFromData(data->iconData())) {
- QLabel* label = new QLabel;
- label->setPixmap(pixmap);
- layout->addWidget(label, 1, 0, 1, 1);
- messagePosition++;
- }
+
QLabel* messageLabel = new QLabel(data->message());
messageLabel->setMask(bitmap);
messageLabel->setWordWrap(true);
Modified: trunk/Source/WebKit/qt/examples/platformplugin/qwebkitplatformplugin.h (115010 => 115011)
--- trunk/Source/WebKit/qt/examples/platformplugin/qwebkitplatformplugin.h 2012-04-24 08:34:25 UTC (rev 115010)
+++ trunk/Source/WebKit/qt/examples/platformplugin/qwebkitplatformplugin.h 2012-04-24 08:35:44 UTC (rev 115011)
@@ -75,7 +75,7 @@
virtual const QString title() const = 0;
virtual const QString message() const = 0;
- virtual const QByteArray iconData() const = 0;
+ virtual const QUrl iconUrl() const = 0;
virtual const QUrl openerPageUrl() const = 0;
};
@@ -180,7 +180,7 @@
};
QT_BEGIN_NAMESPACE
-Q_DECLARE_INTERFACE(QWebKitPlatformPlugin, "com.nokia.Qt.WebKit.PlatformPlugin/1.8");
+Q_DECLARE_INTERFACE(QWebKitPlatformPlugin, "com.nokia.Qt.WebKit.PlatformPlugin/1.9");
QT_END_NAMESPACE
#endif // QWEBKITPLATFORMPLUGIN_H