// The output from all these methods matches what DumpRenderTree produces. bool NotificationPresenter::show(const WebNotification& notification) { WebString identifier = identifierForNotification(notification); if (!notification.replaceId().isEmpty()) { WTF::String replaceId(notification.replaceId().data(), notification.replaceId().length()); if (m_replacements.find(replaceId) != m_replacements.end()) printf("REPLACING NOTIFICATION %s\n", m_replacements.find(replaceId)->second.utf8().data()); m_replacements.set(replaceId, WTF::String(identifier.data(), identifier.length())); } if (notification.isHTML()) { printf("DESKTOP NOTIFICATION: contents at %s\n", notification.url().spec().data()); } else { printf("DESKTOP NOTIFICATION:%s icon %s, title %s, text %s\n", notification.direction() == WebTextDirectionRightToLeft ? "(RTL)" : "", notification.iconURL().isEmpty() ? "" : notification.iconURL().spec().data(), notification.title().isEmpty() ? "" : notification.title().utf8().data(), notification.body().isEmpty() ? "" : notification.body().utf8().data()); } WTF::String id(identifier.data(), identifier.length()); m_activeNotifications.set(id, notification); webKitClient()->callOnMainThread(deferredDisplayDispatch, new WebNotification(notification)); return true; }
// The output from all these methods matches what DumpRenderTree produces. bool NotificationPresenter::show(const WebNotification& notification) { WebString identifier = identifierForNotification(notification); if (!notification.replaceId().isEmpty()) { string replaceId(notification.replaceId().utf8()); if (m_replacements.find(replaceId) != m_replacements.end()) m_delegate->printMessage(string("REPLACING NOTIFICATION ") + m_replacements.find(replaceId)->second + "\n"); m_replacements[replaceId] = identifier.utf8(); } if (notification.isHTML()) m_delegate->printMessage(string("DESKTOP NOTIFICATION: contents at ") + string(notification.url().spec()) + "\n"); else { m_delegate->printMessage("DESKTOP NOTIFICATION:"); m_delegate->printMessage(notification.direction() == WebTextDirectionRightToLeft ? "(RTL)" : ""); m_delegate->printMessage(" icon "); m_delegate->printMessage(notification.iconURL().isEmpty() ? "" : notification.iconURL().spec().data()); m_delegate->printMessage(", title "); m_delegate->printMessage(notification.title().isEmpty() ? "" : notification.title().utf8().data()); m_delegate->printMessage(", text "); m_delegate->printMessage(notification.body().isEmpty() ? "" : notification.body().utf8().data()); m_delegate->printMessage("\n"); } string id(identifier.utf8()); m_activeNotifications[id] = notification; Platform::current()->callOnMainThread(deferredDisplayDispatch, new WebNotification(notification)); return true; }