From 1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c Mon Sep 17 00:00:00 2001 From: Lorry Tar Creator Date: Tue, 27 Jun 2017 06:07:23 +0000 Subject: webkitgtk-2.16.5 --- .../Modules/notifications/NotificationCenter.h | 63 +++++++--------------- 1 file changed, 19 insertions(+), 44 deletions(-) (limited to 'Source/WebCore/Modules/notifications/NotificationCenter.h') diff --git a/Source/WebCore/Modules/notifications/NotificationCenter.h b/Source/WebCore/Modules/notifications/NotificationCenter.h index d27b45e4f..4646e182e 100644 --- a/Source/WebCore/Modules/notifications/NotificationCenter.h +++ b/Source/WebCore/Modules/notifications/NotificationCenter.h @@ -1,6 +1,6 @@ /* * Copyright (C) 2009 Google Inc. All rights reserved. - * Copyright (C) 2011, 2012 Apple Inc. All rights reserved. + * Copyright (C) 2011, 2012, 2015 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -29,75 +29,50 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef NotificationCenter_h -#define NotificationCenter_h +#pragma once -#include "ExceptionCode.h" -#include "Notification.h" -#include "ScriptExecutionContext.h" +#include "ActiveDOMObject.h" +#include "ExceptionOr.h" #include "Timer.h" -#include "VoidCallback.h" -#include -#include #include -#include #if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) namespace WebCore { +class Notification; class NotificationClient; class VoidCallback; -class NotificationCenter : public RefCounted, public ActiveDOMObject { +class NotificationCenter final : public RefCounted, private ActiveDOMObject { public: - static PassRefPtr create(ScriptExecutionContext*, NotificationClient*); + static Ref create(ScriptExecutionContext&, NotificationClient*); #if ENABLE(LEGACY_NOTIFICATIONS) - PassRefPtr createNotification(const String& iconURI, const String& title, const String& body, ExceptionCode& ec) - { - if (!client()) { - ec = INVALID_STATE_ERR; - return 0; - } - return Notification::create(title, body, iconURI, scriptExecutionContext(), ec, this); - } -#endif - - NotificationClient* client() const { return m_client; } + ExceptionOr> createNotification(const String& iconURL, const String& title, const String& body); -#if ENABLE(LEGACY_NOTIFICATIONS) int checkPermission(); - void requestPermission(PassRefPtr = 0); + void requestPermission(RefPtr&&); #endif -private: - NotificationCenter(ScriptExecutionContext*, NotificationClient*); + NotificationClient* client() const { return m_client; } - // ActiveDOMObject - virtual void stop() override; + using ActiveDOMObject::hasPendingActivity; - class NotificationRequestCallback : public RefCounted { - public: - static PassRefPtr createAndStartTimer(NotificationCenter*, PassRefPtr); - void startTimer(); - void timerFired(Timer&); - private: - NotificationRequestCallback(NotificationCenter*, PassRefPtr); +private: + NotificationCenter(ScriptExecutionContext&, NotificationClient*); - RefPtr m_notificationCenter; - Timer m_timer; - RefPtr m_callback; - }; + void stop() final; + const char* activeDOMObjectName() const final; + bool canSuspendForDocumentSuspension() const final; - void requestTimedOut(NotificationRequestCallback*); + void timerFired(); NotificationClient* m_client; - HashSet> m_callbacks; + Vector> m_callbacks; + Timer m_timer; }; } // namespace WebCore #endif // ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) - -#endif // NotificationCenter_h -- cgit v1.2.1