Diff
Modified: trunk/Source/WebCore/CMakeLists.txt (111831 => 111832)
--- trunk/Source/WebCore/CMakeLists.txt 2012-03-23 06:23:37 UTC (rev 111831)
+++ trunk/Source/WebCore/CMakeLists.txt 2012-03-23 06:29:16 UTC (rev 111832)
@@ -1625,12 +1625,14 @@
IF (ENABLE_NOTIFICATIONS)
LIST(APPEND WebCore_SOURCES
+ notifications/DOMWindowNotifications.cpp
notifications/NotificationCenter.cpp
notifications/NotificationController.cpp
notifications/Notification.cpp
)
LIST(APPEND WebCore_IDL_FILES
+ notifications/DOMWindowNotifications.idl
notifications/Notification.idl
notifications/NotificationCenter.idl
)
Modified: trunk/Source/WebCore/ChangeLog (111831 => 111832)
--- trunk/Source/WebCore/ChangeLog 2012-03-23 06:23:37 UTC (rev 111831)
+++ trunk/Source/WebCore/ChangeLog 2012-03-23 06:29:16 UTC (rev 111832)
@@ -1,3 +1,46 @@
+2012-03-22 Adam Barth <[email protected]>
+
+ Move Notifications APIs from DOMWindow.idl to DOMWindowNotifications.idl (Part 1)
+ https://bugs.webkit.org/show_bug.cgi?id=82015
+
+ Reviewed by Kentaro Hara.
+
+ This patch moves DOMWindow.webkitNotifications from DOMWindow.idl to
+ DOMWindowNotificiations.idl in preparation for moving notificiations
+ into Modules.
+
+ A future patch will remove DOMWindow::resetNotificaitions in favor of
+ more general mechanisms.
+
+ * CMakeLists.txt:
+ * DerivedSources.make:
+ * DerivedSources.pri:
+ * GNUmakefile.list.am:
+ * Target.pri:
+ * WebCore.gypi:
+ * WebCore.vcproj/WebCore.vcproj:
+ * WebCore.xcodeproj/project.pbxproj:
+ * notifications/DOMWindowNotifications.cpp: Added.
+ (WebCore):
+ (WebCore::DOMWindowNotifications::DOMWindowNotifications):
+ (WebCore::DOMWindowNotifications::~DOMWindowNotifications):
+ (WebCore::DOMWindowNotifications::from):
+ (WebCore::DOMWindowNotifications::webkitNotifications):
+ (WebCore::DOMWindowNotifications::reset):
+ (WebCore::DOMWindowNotifications::supplementName):
+ * notifications/DOMWindowNotifications.h: Added.
+ (WebCore):
+ (DOMWindowNotifications):
+ * notifications/DOMWindowNotifications.idl: Added.
+ * page/DOMWindow.cpp:
+ (WebCore::DOMWindow::~DOMWindow):
+ (WebCore):
+ (WebCore::DOMWindow::resetNotifications):
+ * page/DOMWindow.h:
+ (WebCore):
+ (DOMWindow):
+ * page/DOMWindow.idl:
+
2012-03-22 Li Yin <[email protected]>
A client MUST close a connection if it detects a masked frame
Modified: trunk/Source/WebCore/DerivedSources.make (111831 => 111832)
--- trunk/Source/WebCore/DerivedSources.make 2012-03-23 06:23:37 UTC (rev 111831)
+++ trunk/Source/WebCore/DerivedSources.make 2012-03-23 06:29:16 UTC (rev 111832)
@@ -383,6 +383,7 @@
$(WebCore)/inspector/ScriptProfile.idl \
$(WebCore)/inspector/ScriptProfileNode.idl \
$(WebCore)/loader/appcache/DOMApplicationCache.idl \
+ $(WebCore)/notifications/DOMWindowNotifications.idl \
$(WebCore)/notifications/Notification.idl \
$(WebCore)/notifications/NotificationCenter.idl \
$(WebCore)/page/AbstractView.idl \
Modified: trunk/Source/WebCore/DerivedSources.pri (111831 => 111832)
--- trunk/Source/WebCore/DerivedSources.pri 2012-03-23 06:23:37 UTC (rev 111831)
+++ trunk/Source/WebCore/DerivedSources.pri 2012-03-23 06:29:16 UTC (rev 111832)
@@ -396,6 +396,7 @@
$$PWD/inspector/ScriptProfile.idl \
$$PWD/inspector/ScriptProfileNode.idl \
$$PWD/loader/appcache/DOMApplicationCache.idl \
+ $$PWD/notifications/DOMWindowNotifications.idl \
$$PWD/notifications/Notification.idl \
$$PWD/notifications/NotificationCenter.idl \
$$PWD/page/BarInfo.idl \
Modified: trunk/Source/WebCore/GNUmakefile.list.am (111831 => 111832)
--- trunk/Source/WebCore/GNUmakefile.list.am 2012-03-23 06:23:37 UTC (rev 111831)
+++ trunk/Source/WebCore/GNUmakefile.list.am 2012-03-23 06:29:16 UTC (rev 111832)
@@ -2833,6 +2833,8 @@
Source/WebCore/mathml/MathMLMathElement.h \
Source/WebCore/mathml/MathMLTextElement.cpp \
Source/WebCore/mathml/MathMLTextElement.h \
+ Source/WebCore/notifications/DOMWindowNotifications.cpp \
+ Source/WebCore/notifications/DOMWindowNotifications.h \
Source/WebCore/notifications/NotificationCenter.cpp \
Source/WebCore/notifications/NotificationCenter.h \
Source/WebCore/notifications/NotificationClient.h \
Modified: trunk/Source/WebCore/Target.pri (111831 => 111832)
--- trunk/Source/WebCore/Target.pri 2012-03-23 06:23:37 UTC (rev 111831)
+++ trunk/Source/WebCore/Target.pri 2012-03-23 06:29:16 UTC (rev 111832)
@@ -980,6 +980,7 @@
loader/SubresourceLoader.cpp \
loader/TextResourceDecoder.cpp \
loader/ThreadableLoader.cpp \
+ notifications/DOMWindowNotifications.cpp \
notifications/Notification.cpp \
notifications/NotificationCenter.cpp \
notifications/NotificationController.cpp \
@@ -2080,6 +2081,7 @@
mathml/MathMLInlineContainerElement.h \
mathml/MathMLMathElement.h \
mathml/MathMLTextElement.h \
+ notifications/DOMWindowNotifications.h \
notifications/Notification.h \
notifications/NotificationCenter.h \
notifications/NotificationClient.h \
Modified: trunk/Source/WebCore/WebCore.gypi (111831 => 111832)
--- trunk/Source/WebCore/WebCore.gypi 2012-03-23 06:23:37 UTC (rev 111831)
+++ trunk/Source/WebCore/WebCore.gypi 2012-03-23 06:29:16 UTC (rev 111832)
@@ -1095,6 +1095,7 @@
'inspector/ScriptProfile.idl',
'inspector/ScriptProfileNode.idl',
'loader/appcache/DOMApplicationCache.idl',
+ 'notifications/DOMWindowNotifications.idl',
'notifications/Notification.idl',
'notifications/NotificationCenter.idl',
'page/AbstractView.idl',
@@ -2881,6 +2882,8 @@
'mathml/MathMLMathElement.h',
'mathml/MathMLTextElement.cpp',
'mathml/MathMLTextElement.h',
+ 'notifications/DOMWindowNotifications.cpp',
+ 'notifications/DOMWindowNotifications.h',
'notifications/Notification.cpp',
'notifications/Notification.h',
'notifications/NotificationCenter.cpp',
Modified: trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj (111831 => 111832)
--- trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj 2012-03-23 06:23:37 UTC (rev 111831)
+++ trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj 2012-03-23 06:29:16 UTC (rev 111832)
@@ -53922,6 +53922,14 @@
Name="notifications"
>
<File
+ RelativePath="..\notifications\DOMWindowNotifications.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\notifications\DOMWindowNotifications.h"
+ >
+ </File>
+ <File
RelativePath="..\notifications\Notification.cpp"
>
</File>
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (111831 => 111832)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2012-03-23 06:23:37 UTC (rev 111831)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2012-03-23 06:29:16 UTC (rev 111832)
@@ -3507,6 +3507,8 @@
97AABD2D14FA09D5007457AE /* WorkerThreadableWebSocketChannel.h in Headers */ = {isa = PBXBuildFile; fileRef = 97AABD1214FA09D5007457AE /* WorkerThreadableWebSocketChannel.h */; };
97B1F02E13B025CA00F5103F /* SharedBufferChunkReader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 37569E0013AF172C00CDBA8E /* SharedBufferChunkReader.cpp */; };
97B1F02F13B025D200F5103F /* SharedBufferChunkReader.h in Headers */ = {isa = PBXBuildFile; fileRef = 37569E0213AF172C00CDBA8E /* SharedBufferChunkReader.h */; };
+ 97B38E27151C4271004622E9 /* DOMWindowNotifications.h in Headers */ = {isa = PBXBuildFile; fileRef = 97B38E24151C4264004622E9 /* DOMWindowNotifications.h */; };
+ 97B38E28151C4273004622E9 /* DOMWindowNotifications.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 97B38E23151C4264004622E9 /* DOMWindowNotifications.cpp */; };
97BC69DA1505F076001B74AC /* AbstractDatabase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 97BC69D61505F076001B74AC /* AbstractDatabase.cpp */; };
97BC69DB1505F076001B74AC /* AbstractDatabase.h in Headers */ = {isa = PBXBuildFile; fileRef = 97BC69D71505F076001B74AC /* AbstractDatabase.h */; settings = {ATTRIBUTES = (Private, ); }; };
97BC69DC1505F076001B74AC /* ChangeVersionWrapper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 97BC69D81505F076001B74AC /* ChangeVersionWrapper.cpp */; };
@@ -10472,6 +10474,9 @@
97AABD1014FA09D5007457AE /* WebSocketHandshakeResponse.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebSocketHandshakeResponse.h; path = Modules/websockets/WebSocketHandshakeResponse.h; sourceTree = "<group>"; };
97AABD1114FA09D5007457AE /* WorkerThreadableWebSocketChannel.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WorkerThreadableWebSocketChannel.cpp; path = Modules/websockets/WorkerThreadableWebSocketChannel.cpp; sourceTree = "<group>"; };
97AABD1214FA09D5007457AE /* WorkerThreadableWebSocketChannel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WorkerThreadableWebSocketChannel.h; path = Modules/websockets/WorkerThreadableWebSocketChannel.h; sourceTree = "<group>"; };
+ 97B38E23151C4264004622E9 /* DOMWindowNotifications.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DOMWindowNotifications.cpp; path = notifications/DOMWindowNotifications.cpp; sourceTree = "<group>"; };
+ 97B38E24151C4264004622E9 /* DOMWindowNotifications.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DOMWindowNotifications.h; path = notifications/DOMWindowNotifications.h; sourceTree = "<group>"; };
+ 97B38E25151C4264004622E9 /* DOMWindowNotifications.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = DOMWindowNotifications.idl; path = notifications/DOMWindowNotifications.idl; sourceTree = "<group>"; };
97BC69D61505F076001B74AC /* AbstractDatabase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = AbstractDatabase.cpp; path = Modules/webdatabase/AbstractDatabase.cpp; sourceTree = "<group>"; };
97BC69D71505F076001B74AC /* AbstractDatabase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AbstractDatabase.h; path = Modules/webdatabase/AbstractDatabase.h; sourceTree = "<group>"; };
97BC69D81505F076001B74AC /* ChangeVersionWrapper.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ChangeVersionWrapper.cpp; path = Modules/webdatabase/ChangeVersionWrapper.cpp; sourceTree = "<group>"; };
@@ -14418,6 +14423,9 @@
333F703D0FB49C16008E12A6 /* notifications */ = {
isa = PBXGroup;
children = (
+ 97B38E23151C4264004622E9 /* DOMWindowNotifications.cpp */,
+ 97B38E24151C4264004622E9 /* DOMWindowNotifications.h */,
+ 97B38E25151C4264004622E9 /* DOMWindowNotifications.idl */,
33503CC61017A1B1003B47E1 /* Notification.cpp */,
333F704F0FB49CA2008E12A6 /* Notification.h */,
333F704E0FB49CA2008E12A6 /* Notification.idl */,
@@ -22449,6 +22457,7 @@
85989DD10ACC8BBD00A0BC51 /* DOMWheelEventInternal.h in Headers */,
1403B99709EB13AF00797C7F /* DOMWindow.h in Headers */,
9712A5AE15004EDA0048AF10 /* DOMWindowIndexedDatabase.h in Headers */,
+ 97B38E27151C4271004622E9 /* DOMWindowNotifications.h in Headers */,
97D2AD0414B823A60093DF32 /* DOMWindowProperty.h in Headers */,
97BC6A351505F081001B74AC /* DOMWindowSQLDatabase.h in Headers */,
F35AE5AC14925F5B004D5776 /* DOMWrapperVisitor.h in Headers */,
@@ -25600,6 +25609,7 @@
85C7F5E80AAFBAFB004014DD /* DOMWheelEvent.mm in Sources */,
1403B99809EB13AF00797C7F /* DOMWindow.cpp in Sources */,
9712A5AD15004EDA0048AF10 /* DOMWindowIndexedDatabase.cpp in Sources */,
+ 97B38E28151C4273004622E9 /* DOMWindowNotifications.cpp in Sources */,
97D2AD0314B823A60093DF32 /* DOMWindowProperty.cpp in Sources */,
97BC6A341505F081001B74AC /* DOMWindowSQLDatabase.cpp in Sources */,
BC53DA481143134D000D817E /* DOMWrapperWorld.cpp in Sources */,
Added: trunk/Source/WebCore/notifications/DOMWindowNotifications.cpp (0 => 111832)
--- trunk/Source/WebCore/notifications/DOMWindowNotifications.cpp (rev 0)
+++ trunk/Source/WebCore/notifications/DOMWindowNotifications.cpp 2012-03-23 06:29:16 UTC (rev 111832)
@@ -0,0 +1,102 @@
+/*
+ * Copyright (C) 2006, 2007, 2008, 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``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 APPLE COMPUTER, INC. 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"
+#include "DOMWindowNotifications.h"
+
+#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
+
+#include "DOMWindow.h"
+#include "Document.h"
+#include "NotificationCenter.h"
+#include "NotificationController.h"
+#include "Page.h"
+
+namespace WebCore {
+
+DOMWindowNotifications::DOMWindowNotifications()
+{
+}
+
+DOMWindowNotifications::~DOMWindowNotifications()
+{
+}
+
+DOMWindowNotifications* DOMWindowNotifications::from(DOMWindow* window)
+{
+ DOMWindowNotifications* supplement = static_cast<DOMWindowNotifications*>(Supplement<DOMWindow>::from(window, supplementName()));
+ if (!supplement) {
+ supplement = new DOMWindowNotifications();
+ Supplement<DOMWindow>::provideTo(window, supplementName(), adoptPtr(supplement));
+ }
+ return supplement;
+}
+
+NotificationCenter* DOMWindowNotifications::webkitNotifications(DOMWindow* window)
+{
+ if (!window->isCurrentlyDisplayedInFrame())
+ return 0;
+
+ DOMWindowNotifications* supplement = DOMWindowNotifications::from(window);
+
+ if (supplement->m_notificationCenter)
+ return supplement->m_notificationCenter.get();
+
+ Document* document = window->document();
+ if (!document)
+ return 0;
+
+ Page* page = document->page();
+ if (!page)
+ return 0;
+
+ NotificationClient* provider = NotificationController::clientFrom(page);
+ if (provider)
+ supplement->m_notificationCenter = NotificationCenter::create(document, provider);
+
+ return supplement->m_notificationCenter.get();
+}
+
+void DOMWindowNotifications::reset(DOMWindow* window)
+{
+ DOMWindowNotifications* supplement = static_cast<DOMWindowNotifications*>(Supplement<DOMWindow>::from(window, supplementName()));
+ if (!supplement)
+ return;
+ if (!supplement->m_notificationCenter)
+ return;
+ supplement->m_notificationCenter->disconnectFrame();
+ supplement->m_notificationCenter = 0;
+}
+
+const AtomicString& DOMWindowNotifications::supplementName()
+{
+ DEFINE_STATIC_LOCAL(AtomicString, supplementName, ("DOMWindowNotifications"));
+ return supplementName;
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
Added: trunk/Source/WebCore/notifications/DOMWindowNotifications.h (0 => 111832)
--- trunk/Source/WebCore/notifications/DOMWindowNotifications.h (rev 0)
+++ trunk/Source/WebCore/notifications/DOMWindowNotifications.h 2012-03-23 06:29:16 UTC (rev 111832)
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2006, 2007, 2009, 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``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 APPLE COMPUTER, INC. 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 DOMWindowNotifications_h
+#define DOMWindowNotifications_h
+
+#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
+
+#include "DOMWindowProperty.h"
+#include "PlatformString.h"
+#include "Supplementable.h"
+
+namespace WebCore {
+
+class DOMWindow;
+class NotificationCenter;
+
+class DOMWindowNotifications : public Supplement<DOMWindow> {
+public:
+ virtual ~DOMWindowNotifications();
+
+ static NotificationCenter* webkitNotifications(DOMWindow*);
+ static DOMWindowNotifications* from(DOMWindow*);
+
+ static void reset(DOMWindow*);
+
+private:
+ DOMWindowNotifications();
+
+ static const AtomicString& supplementName();
+
+ RefPtr<NotificationCenter> m_notificationCenter;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
+
+#endif // DOMWindowNotifications_h
Added: trunk/Source/WebCore/notifications/DOMWindowNotifications.idl (0 => 111832)
--- trunk/Source/WebCore/notifications/DOMWindowNotifications.idl (rev 0)
+++ trunk/Source/WebCore/notifications/DOMWindowNotifications.idl 2012-03-23 06:29:16 UTC (rev 111832)
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2011 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:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``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 APPLE COMPUTER, INC. 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 window {
+
+ interface [
+ Conditional=NOTIFICATIONS|LEGACY_NOTIFICATIONS,
+ Supplemental=DOMWindow
+ ] DOMWindowNotifications {
+ readonly attribute [V8EnabledAtRuntime] NotificationCenter webkitNotifications;
+ };
+
+}
Modified: trunk/Source/WebCore/page/DOMWindow.cpp (111831 => 111832)
--- trunk/Source/WebCore/page/DOMWindow.cpp 2012-03-23 06:23:37 UTC (rev 111831)
+++ trunk/Source/WebCore/page/DOMWindow.cpp 2012-03-23 06:29:16 UTC (rev 111832)
@@ -45,6 +45,7 @@
#include "DOMTimer.h"
#include "DOMTokenList.h"
#include "DOMURL.h"
+#include "DOMWindowNotifications.h"
#include "Database.h"
#include "DatabaseCallback.h"
#include "DeviceMotionController.h"
@@ -72,8 +73,6 @@
#include "MediaQueryMatcher.h"
#include "MessageEvent.h"
#include "Navigator.h"
-#include "NotificationCenter.h"
-#include "NotificationController.h"
#include "Page.h"
#include "PageGroup.h"
#include "PageTransitionEvent.h"
@@ -418,9 +417,6 @@
ASSERT(!m_sessionStorage);
ASSERT(!m_localStorage);
ASSERT(!m_applicationCache);
-#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
- ASSERT(!m_notifications);
-#endif
#if ENABLE(BLOB)
ASSERT(!m_domURL);
#endif
@@ -785,34 +781,9 @@
}
#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
-NotificationCenter* DOMWindow::webkitNotifications() const
-{
- if (!isCurrentlyDisplayedInFrame())
- return 0;
- if (m_notifications)
- return m_notifications.get();
-
- Document* document = this->document();
- if (!document)
- return 0;
-
- Page* page = document->page();
- if (!page)
- return 0;
-
- NotificationClient* provider = NotificationController::clientFrom(page);
- if (provider)
- m_notifications = NotificationCenter::create(document, provider);
-
- return m_notifications.get();
-}
-
void DOMWindow::resetNotifications()
{
- if (!m_notifications)
- return;
- m_notifications->disconnectFrame();
- m_notifications = 0;
+ DOMWindowNotifications::reset(this);
}
#endif
Modified: trunk/Source/WebCore/page/DOMWindow.h (111831 => 111832)
--- trunk/Source/WebCore/page/DOMWindow.h 2012-03-23 06:23:37 UTC (rev 111831)
+++ trunk/Source/WebCore/page/DOMWindow.h 2012-03-23 06:29:16 UTC (rev 111832)
@@ -56,7 +56,6 @@
class MediaQueryList;
class Navigator;
class Node;
- class NotificationCenter;
class Page;
class Performance;
class PostMessageTimer;
@@ -357,9 +356,6 @@
Storage* localStorage(ExceptionCode&) const;
#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
- NotificationCenter* webkitNotifications() const;
- // Renders webkitNotifications object safely inoperable, disconnects
- // if from embedder-provided NotificationClient.
void resetNotifications();
#endif
@@ -450,10 +446,6 @@
mutable RefPtr<Storage> m_localStorage;
mutable RefPtr<DOMApplicationCache> m_applicationCache;
-#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
- mutable RefPtr<NotificationCenter> m_notifications;
-#endif
-
#if ENABLE(WEB_TIMING)
mutable RefPtr<Performance> m_performance;
#endif
Modified: trunk/Source/WebCore/page/DOMWindow.idl (111831 => 111832)
--- trunk/Source/WebCore/page/DOMWindow.idl 2012-03-23 06:23:37 UTC (rev 111831)
+++ trunk/Source/WebCore/page/DOMWindow.idl 2012-03-23 06:29:16 UTC (rev 111832)
@@ -170,10 +170,6 @@
readonly attribute [V8EnabledAtRuntime] Storage localStorage
getter raises(DOMException);
-#if (defined(ENABLE_NOTIFICATIONS) && ENABLE_NOTIFICATIONS) || (defined(ENABLE_LEGACY_NOTIFICATIONS) && ENABLE_LEGACY_NOTIFICATIONS)
- readonly attribute [V8EnabledAtRuntime] NotificationCenter webkitNotifications;
-#endif
-
#if defined(ENABLE_ORIENTATION_EVENTS) && ENABLE_ORIENTATION_EVENTS
// This is the interface orientation in degrees. Some examples are:
// 0 is straight up; -90 is when the device is rotated 90 clockwise;