summaryrefslogtreecommitdiffstats
path: root/WebCore/notifications
diff options
context:
space:
mode:
authorSteve Block <steveblock@google.com>2011-05-06 11:45:16 +0100
committerSteve Block <steveblock@google.com>2011-05-12 13:44:10 +0100
commitcad810f21b803229eb11403f9209855525a25d57 (patch)
tree29a6fd0279be608e0fe9ffe9841f722f0f4e4269 /WebCore/notifications
parent121b0cf4517156d0ac5111caf9830c51b69bae8f (diff)
downloadexternal_webkit-cad810f21b803229eb11403f9209855525a25d57.zip
external_webkit-cad810f21b803229eb11403f9209855525a25d57.tar.gz
external_webkit-cad810f21b803229eb11403f9209855525a25d57.tar.bz2
Merge WebKit at r75315: Initial merge by git.
Change-Id: I570314b346ce101c935ed22a626b48c2af266b84
Diffstat (limited to 'WebCore/notifications')
-rw-r--r--WebCore/notifications/Notification.cpp229
-rw-r--r--WebCore/notifications/Notification.h154
-rw-r--r--WebCore/notifications/Notification.idl60
-rw-r--r--WebCore/notifications/NotificationCenter.cpp76
-rw-r--r--WebCore/notifications/NotificationCenter.h93
-rw-r--r--WebCore/notifications/NotificationCenter.idl44
-rw-r--r--WebCore/notifications/NotificationContents.h60
-rw-r--r--WebCore/notifications/NotificationPresenter.h84
8 files changed, 0 insertions, 800 deletions
diff --git a/WebCore/notifications/Notification.cpp b/WebCore/notifications/Notification.cpp
deleted file mode 100644
index 4cb2f85..0000000
--- a/WebCore/notifications/Notification.cpp
+++ /dev/null
@@ -1,229 +0,0 @@
-/*
- * Copyright (C) 2009 Google Inc. All rights reserved.
- * Copyright (C) 2009 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
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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
- * OWNER OR 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 "config.h"
-
-#if ENABLE(NOTIFICATIONS)
-
-#include "Notification.h"
-#include "NotificationCenter.h"
-#include "NotificationContents.h"
-
-#include "Document.h"
-#include "EventNames.h"
-#include "ResourceRequest.h"
-#include "ResourceResponse.h"
-#include "ThreadableLoader.h"
-#include "WorkerContext.h"
-
-namespace WebCore {
-
-Notification::Notification(const KURL& url, ScriptExecutionContext* context, ExceptionCode& ec, PassRefPtr<NotificationCenter> provider)
- : ActiveDOMObject(context, this)
- , m_isHTML(true)
- , m_state(Idle)
- , m_notificationCenter(provider)
-{
- ASSERT(m_notificationCenter->presenter());
- if (m_notificationCenter->presenter()->checkPermission(context) != NotificationPresenter::PermissionAllowed) {
- ec = SECURITY_ERR;
- return;
- }
-
- if (url.isEmpty() || !url.isValid()) {
- ec = SYNTAX_ERR;
- return;
- }
-
- m_notificationURL = url;
-}
-
-Notification::Notification(const NotificationContents& contents, ScriptExecutionContext* context, ExceptionCode& ec, PassRefPtr<NotificationCenter> provider)
- : ActiveDOMObject(context, this)
- , m_isHTML(false)
- , m_contents(contents)
- , m_state(Idle)
- , m_notificationCenter(provider)
-{
- ASSERT(m_notificationCenter->presenter());
- if (m_notificationCenter->presenter()->checkPermission(context) != NotificationPresenter::PermissionAllowed) {
- ec = SECURITY_ERR;
- return;
- }
-
- if (!contents.icon().isEmpty() && !contents.icon().isValid()) {
- ec = SYNTAX_ERR;
- return;
- }
-}
-
-Notification::~Notification()
-{
- if (m_state == Loading) {
- ASSERT_NOT_REACHED();
- cancel();
- }
-}
-
-PassRefPtr<Notification> Notification::create(const KURL& url, ScriptExecutionContext* context, ExceptionCode& ec, PassRefPtr<NotificationCenter> provider)
-{
- return adoptRef(new Notification(url, context, ec, provider));
-}
-
-PassRefPtr<Notification> Notification::create(const NotificationContents& contents, ScriptExecutionContext* context, ExceptionCode& ec, PassRefPtr<NotificationCenter> provider)
-{
- return adoptRef(new Notification(contents, context, ec, provider));
-}
-
-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->presenter())
- m_notificationCenter->presenter()->show(this);
- }
- } else
- startLoading();
-#else
- // prevent double-showing
- if (m_state == Idle && m_notificationCenter->presenter() && m_notificationCenter->presenter()->show(this))
- m_state = Showing;
-#endif
-}
-
-void Notification::cancel()
-{
- switch (m_state) {
- case Idle:
- break;
- case Loading:
- m_state = Cancelled;
- stopLoading();
- break;
- case Showing:
- if (m_notificationCenter->presenter())
- m_notificationCenter->presenter()->cancel(this);
- break;
- case Cancelled:
- break;
- }
-}
-
-EventTargetData* Notification::eventTargetData()
-{
- return &m_eventTargetData;
-}
-
-EventTargetData* Notification::ensureEventTargetData()
-{
- return &m_eventTargetData;
-}
-
-void Notification::contextDestroyed()
-{
- ActiveDOMObject::contextDestroyed();
- if (m_notificationCenter->presenter())
- m_notificationCenter->presenter()->notificationObjectDestroyed(this);
-}
-
-void Notification::startLoading()
-{
- if (m_state != Idle)
- return;
- setPendingActivity(this);
- m_state = Loading;
- ThreadableLoaderOptions options;
- options.sendLoadCallbacks = false;
- options.sniffContent = false;
- options.forcePreflight = false;
- options.allowCredentials = AllowStoredCredentials;
- options.crossOriginRequestPolicy = AllowCrossOriginRequests;
- m_loader = ThreadableLoader::create(scriptExecutionContext(), this, ResourceRequest(iconURL()), options);
-}
-
-void Notification::stopLoading()
-{
- m_iconData = 0;
- RefPtr<ThreadableLoader> protect(m_loader);
- m_loader->cancel();
-}
-
-void Notification::didReceiveResponse(const ResourceResponse& response)
-{
- int status = response.httpStatusCode();
- if (status && (status < 200 || status > 299)) {
- stopLoading();
- return;
- }
- m_iconData = SharedBuffer::create();
-}
-
-void Notification::didReceiveData(const char* data, int lengthReceived)
-{
- m_iconData->append(data, lengthReceived);
-}
-
-void Notification::didFinishLoading(unsigned long)
-{
- finishLoading();
-}
-
-void Notification::didFail(const ResourceError&)
-{
- finishLoading();
-}
-
-void Notification::didFailRedirectCheck()
-{
- finishLoading();
-}
-
-void Notification::didReceiveAuthenticationCancellation(const ResourceResponse&)
-{
- finishLoading();
-}
-
-void Notification::finishLoading()
-{
- if (m_state == Loading) {
- if (m_notificationCenter->presenter() && m_notificationCenter->presenter()->show(this))
- m_state = Showing;
- }
- unsetPendingActivity(this);
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(NOTIFICATIONS)
diff --git a/WebCore/notifications/Notification.h b/WebCore/notifications/Notification.h
deleted file mode 100644
index f14a302..0000000
--- a/WebCore/notifications/Notification.h
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * Copyright (C) 2009 Google Inc. All rights reserved.
- * Copyright (C) 2009 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
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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
- * OWNER OR 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.
- */
-
-#ifndef Notification_h
-#define Notification_h
-
-#include "ActiveDOMObject.h"
-#include "Event.h"
-#include "EventListener.h"
-#include "EventNames.h"
-#include "EventTarget.h"
-#include "ExceptionCode.h"
-#include "KURL.h"
-#include "NotificationPresenter.h"
-#include "NotificationContents.h"
-#include "RegisteredEventListener.h"
-#include "SharedBuffer.h"
-#include "TextDirection.h"
-#include "ThreadableLoader.h"
-#include "ThreadableLoaderClient.h"
-#include <wtf/OwnPtr.h>
-#include <wtf/PassRefPtr.h>
-#include <wtf/RefCounted.h>
-#include <wtf/RefPtr.h>
-#include <wtf/text/AtomicStringHash.h>
-
-#if ENABLE(NOTIFICATIONS)
-namespace WebCore {
-
- class NotificationCenter;
- class WorkerContext;
-
- class Notification : public RefCounted<Notification>, public ActiveDOMObject, public ThreadableLoaderClient, public EventTarget {
- public:
- static PassRefPtr<Notification> create(const KURL& url, ScriptExecutionContext* context, ExceptionCode& ec, PassRefPtr<NotificationCenter> provider);
- static PassRefPtr<Notification> create(const NotificationContents& contents, ScriptExecutionContext* context, ExceptionCode& ec, PassRefPtr<NotificationCenter> provider);
-
- virtual ~Notification();
-
- void show();
- void cancel();
-
- bool isHTML() { return m_isHTML; }
- KURL url() { return m_notificationURL; }
- KURL iconURL() { return m_contents.icon(); }
- NotificationContents& contents() { return m_contents; }
-
- String dir() const { return m_direction; }
- void setDir(const String& dir) { m_direction = dir; }
- String replaceId() const { return m_replaceId; }
- void setReplaceId(const String& replaceId) { m_replaceId = replaceId; }
-
- TextDirection direction() const { return dir() == "rtl" ? RTL : LTR; }
-
- DEFINE_ATTRIBUTE_EVENT_LISTENER(display);
- DEFINE_ATTRIBUTE_EVENT_LISTENER(error);
- DEFINE_ATTRIBUTE_EVENT_LISTENER(close);
- DEFINE_ATTRIBUTE_EVENT_LISTENER(click);
-
- using RefCounted<Notification>::ref;
- using RefCounted<Notification>::deref;
-
- // EventTarget interface
- virtual ScriptExecutionContext* scriptExecutionContext() const { return ActiveDOMObject::scriptExecutionContext(); }
- virtual Notification* toNotification() { return this; }
-
- // ActiveDOMObject interface
- virtual void contextDestroyed();
-
- void stopLoading();
-
- SharedBuffer* iconData() { return m_iconData.get(); }
- void releaseIconData() { m_iconData = 0; }
-
- // Deprecated. Use functions from NotificationCenter.
- void detachPresenter() { }
-
- virtual void didReceiveResponse(const ResourceResponse&);
- virtual void didReceiveData(const char* data, int lengthReceived);
- virtual void didFinishLoading(unsigned long identifier);
- virtual void didFail(const ResourceError&);
- virtual void didFailRedirectCheck();
- virtual void didReceiveAuthenticationCancellation(const ResourceResponse&);
-
- private:
- Notification(const KURL&, ScriptExecutionContext*, ExceptionCode&, PassRefPtr<NotificationCenter>);
- Notification(const NotificationContents&, ScriptExecutionContext*, ExceptionCode&, PassRefPtr<NotificationCenter>);
-
- // EventTarget interface
- virtual void refEventTarget() { ref(); }
- virtual void derefEventTarget() { deref(); }
- virtual EventTargetData* eventTargetData();
- virtual EventTargetData* ensureEventTargetData();
-
- void startLoading();
- void finishLoading();
-
- bool m_isHTML;
- KURL m_notificationURL;
- NotificationContents m_contents;
-
- String m_direction;
- String m_replaceId;
-
- enum NotificationState {
- Idle = 0,
- Loading = 1,
- Showing = 2,
- Cancelled = 3
- };
-
- NotificationState m_state;
-
- RefPtr<NotificationCenter> m_notificationCenter;
-
- EventTargetData m_eventTargetData;
-
- RefPtr<ThreadableLoader> m_loader;
- RefPtr<SharedBuffer> m_iconData;
- };
-
-} // namespace WebCore
-
-#endif // ENABLE(NOTIFICATIONS)
-
-#endif // Notifications_h
diff --git a/WebCore/notifications/Notification.idl b/WebCore/notifications/Notification.idl
deleted file mode 100644
index 66a1229..0000000
--- a/WebCore/notifications/Notification.idl
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (C) 2009 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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
- * OWNER OR 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.
- */
-
-module threads {
-
- interface [
- Conditional=NOTIFICATIONS,
- EventTarget,
- OmitConstructor
- ] Notification {
- void show();
- void cancel();
-
- attribute EventListener ondisplay;
- attribute EventListener onerror;
- attribute EventListener onclose;
- attribute EventListener onclick;
-
- attribute DOMString dir;
- attribute DOMString replaceId;
-
- // EventTarget interface
- void addEventListener(in DOMString type,
- in EventListener listener,
- in boolean useCapture);
- void removeEventListener(in DOMString type,
- in EventListener listener,
- in boolean useCapture);
- boolean dispatchEvent(in Event evt)
- raises(EventException);
- };
-
-}
diff --git a/WebCore/notifications/NotificationCenter.cpp b/WebCore/notifications/NotificationCenter.cpp
deleted file mode 100644
index a2289ec..0000000
--- a/WebCore/notifications/NotificationCenter.cpp
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Copyright (C) 2009 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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
- * OWNER OR 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 "config.h"
-
-#if ENABLE(NOTIFICATIONS)
-
-#include "NotificationCenter.h"
-
-#include "Document.h"
-#include "VoidCallback.h"
-#include "WorkerContext.h"
-
-namespace WebCore {
-
-NotificationCenter::NotificationCenter(ScriptExecutionContext* context, NotificationPresenter* presenter)
- : ActiveDOMObject(context, this)
- , m_scriptExecutionContext(context)
- , m_notificationPresenter(presenter) {}
-
-int NotificationCenter::checkPermission()
-{
- if (!presenter())
- return NotificationPresenter::PermissionDenied;
- return m_notificationPresenter->checkPermission(m_scriptExecutionContext);
-}
-
-void NotificationCenter::requestPermission(PassRefPtr<VoidCallback> callback)
-{
- if (!presenter())
- return;
- m_notificationPresenter->requestPermission(m_scriptExecutionContext, callback);
-}
-
-void NotificationCenter::disconnectFrame()
-{
- // m_notificationPresenter should never be 0. But just to be safe, we check it here.
- // Due to the mysterious bug http://code.google.com/p/chromium/issues/detail?id=49323.
- ASSERT(m_notificationPresenter);
- if (!m_notificationPresenter)
- return;
- m_notificationPresenter->cancelRequestsForPermission(m_scriptExecutionContext);
- m_notificationPresenter = 0;
- m_scriptExecutionContext = 0;
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(NOTIFICATIONS)
diff --git a/WebCore/notifications/NotificationCenter.h b/WebCore/notifications/NotificationCenter.h
deleted file mode 100644
index adad59d..0000000
--- a/WebCore/notifications/NotificationCenter.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Copyright (C) 2009 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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
- * OWNER OR 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.
- */
-
-#ifndef NotificationCenter_h
-#define NotificationCenter_h
-
-#include "Notification.h"
-#include "NotificationContents.h"
-#include "ScriptExecutionContext.h"
-#include "WorkerThread.h"
-#include <wtf/OwnPtr.h>
-#include <wtf/PassRefPtr.h>
-#include <wtf/RefCounted.h>
-#include <wtf/RefPtr.h>
-
-#if ENABLE(NOTIFICATIONS)
-
-namespace WebCore {
-
- class NotificationCenter : public RefCounted<NotificationCenter>, public ActiveDOMObject {
- public:
- static PassRefPtr<NotificationCenter> create(ScriptExecutionContext* context, NotificationPresenter* presenter) { return adoptRef(new NotificationCenter(context, presenter)); }
-
- PassRefPtr<Notification> createHTMLNotification(const String& URI, ExceptionCode& ec)
- {
- if (!presenter()) {
- ec = INVALID_STATE_ERR;
- return 0;
- }
- if (URI.isEmpty()) {
- ec = SYNTAX_ERR;
- return 0;
- }
- return Notification::create(m_scriptExecutionContext->completeURL(URI), context(), ec, this);
- }
-
- PassRefPtr<Notification> createNotification(const String& iconURI, const String& title, const String& body, ExceptionCode& ec)
- {
- if (!presenter()) {
- ec = INVALID_STATE_ERR;
- return 0;
- }
- NotificationContents contents(iconURI.isEmpty() ? KURL() : m_scriptExecutionContext->completeURL(iconURI), title, body);
- return Notification::create(contents, context(), ec, this);
- }
-
- ScriptExecutionContext* context() const { return m_scriptExecutionContext; }
- NotificationPresenter* presenter() const { return m_notificationPresenter; }
-
- int checkPermission();
- void requestPermission(PassRefPtr<VoidCallback> callback);
-
- void disconnectFrame();
-
- private:
- NotificationCenter(ScriptExecutionContext*, NotificationPresenter*);
-
- ScriptExecutionContext* m_scriptExecutionContext;
- NotificationPresenter* m_notificationPresenter;
- };
-
-} // namespace WebCore
-
-#endif // ENABLE(NOTIFICATIONS)
-
-#endif // NotificationCenter_h
diff --git a/WebCore/notifications/NotificationCenter.idl b/WebCore/notifications/NotificationCenter.idl
deleted file mode 100644
index 86420b8..0000000
--- a/WebCore/notifications/NotificationCenter.idl
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (C) 2009 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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
- * OWNER OR 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.
- */
-
-module threads {
-
- interface [
- Conditional=NOTIFICATIONS,
- OmitConstructor
- ] NotificationCenter {
- [V8Custom] Notification createHTMLNotification(in DOMString url) raises(Exception);
- [V8Custom] Notification createNotification(in DOMString iconUrl, in DOMString title, in DOMString body) raises(Exception);
-
- int checkPermission();
- [Custom] void requestPermission(in VoidCallback callback);
- };
-
-}
diff --git a/WebCore/notifications/NotificationContents.h b/WebCore/notifications/NotificationContents.h
deleted file mode 100644
index 5807f30..0000000
--- a/WebCore/notifications/NotificationContents.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (C) 2009 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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
- * OWNER OR 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.
- */
-
-#ifndef NotificationContents_h
-#define NotificationContents_h
-
-#if ENABLE(NOTIFICATIONS)
-
-namespace WebCore {
-
- class NotificationContents {
- public:
- NotificationContents() {}
- NotificationContents(const KURL& iconUrl, const String& title, const String& body)
- : m_icon(iconUrl)
- , m_title(title)
- , m_body(body) {}
-
- KURL icon() const { return m_icon; }
- String title() const { return m_title; }
- String body() const { return m_body; }
-
- private:
- KURL m_icon;
- String m_title;
- String m_body;
- };
-
-} // namespace WebCore
-
-#endif // ENABLE(NOTIFICATIONS)
-
-#endif // NotificationContents_h
diff --git a/WebCore/notifications/NotificationPresenter.h b/WebCore/notifications/NotificationPresenter.h
deleted file mode 100644
index 9602199..0000000
--- a/WebCore/notifications/NotificationPresenter.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Copyright (C) 2009 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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
- * OWNER OR 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.
- */
-
-#ifndef NotificationPresenter_h
-#define NotificationPresenter_h
-
-#include <wtf/PassRefPtr.h>
-#include "VoidCallback.h"
-
-#if ENABLE(NOTIFICATIONS)
-
-namespace WebCore {
-
- class Document;
- class Notification;
- class KURL;
- class ScriptExecutionContext;
-
- class NotificationPresenter {
-
- public:
- enum Permission {
- PermissionAllowed, // User has allowed notifications
- PermissionNotAllowed, // User has not yet allowed
- PermissionDenied // User has explicitly denied permission
- };
-
- virtual ~NotificationPresenter() {}
-
- // Requests that a notification be shown.
- virtual bool show(Notification*) = 0;
-
- // Requests that a notification that has already been shown be canceled.
- virtual void cancel(Notification*) = 0;
-
- // Informs the presenter that a Notification object has been destroyed
- // (such as by a page transition). The presenter may continue showing
- // the notification, but must not attempt to call the event handlers.
- virtual void notificationObjectDestroyed(Notification*) = 0;
-
- // Requests user permission to show desktop notifications from a particular
- // script context. The callback parameter should be run when the user has
- // made a decision.
- virtual void requestPermission(ScriptExecutionContext*, PassRefPtr<VoidCallback>) = 0;
-
- // Cancel all outstanding requests for the ScriptExecutionContext
- virtual void cancelRequestsForPermission(ScriptExecutionContext*) = 0;
-
- // Checks the current level of permission.
- virtual Permission checkPermission(ScriptExecutionContext*) = 0;
- };
-
-} // namespace WebCore
-
-#endif // ENABLE(NOTIFICATIONS)
-
-#endif // NotificationPresenter_h