Title: [110994] trunk/Source/WebCore
Revision
110994
Author
[email protected]
Date
2012-03-16 05:50:01 -0700 (Fri, 16 Mar 2012)

Log Message

Move Notifications APIs from DOMWindow.idl to DOMWindowNotifications.idl
https://bugs.webkit.org/show_bug.cgi?id=79636

Reviewed by Adam Barth.

For WebKit modularization, this patch moves Notifications-related APIs
from DOMWindow.idl to DOMWindowNotifications.idl.

Tests: fast/notifications/* (No change in test results)

* CMakeLists.txt: Added DOMWindowNotifications.{h,cpp,idl}.
* DerivedSources.make: Ditto.
* DerivedSources.pri: Ditto.
* GNUmakefile.list.am: Ditto.
* Target.pri: Ditto.
* WebCore.gypi: Ditto.
* WebCore.vcproj/WebCore.vcproj: Ditto.

* WebCore.exp.in: Added mangled signatures of webkitNotifications().

* notifications/DOMWindowNotifications.cpp: Added.
(WebCore):
(WebCore::DOMWindowNotifications::DOMWindowNotifications):
(WebCore::DOMWindowNotifications::~DOMWindowNotifications):
(WebCore::DOMWindowNotifications::from):
(WebCore::DOMWindowNotifications::webkitNotifications):
(WebCore::DOMWindowNotifications::ensureWebkitNotifications):
(WebCore::DOMWindowNotifications::disconnectFrame):
* notifications/DOMWindowNotifications.h: Added.
(WebCore):
(DOMWindowNotifications):
* notifications/DOMWindowNotifications.idl: Added.

* page/DOMWindow.cpp: Removed ENABLE(NOTIFICATIONS).
(WebCore::DOMWindow::~DOMWindow):
(WebCore::DOMWindow::willDetachPage):
(WebCore::DOMWindow::clear):
* page/DOMWindow.h: Ditto.
(WebCore):
(DOMWindow):
* page/DOMWindow.idl: Ditto.
* page/Frame.cpp: Ditto.
(WebCore::Frame::willDetachPage):
(WebCore::Frame::transferChildFrameToNewDocument):

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebCore/CMakeLists.txt (110993 => 110994)


--- trunk/Source/WebCore/CMakeLists.txt	2012-03-16 12:46:40 UTC (rev 110993)
+++ trunk/Source/WebCore/CMakeLists.txt	2012-03-16 12:50:01 UTC (rev 110994)
@@ -1622,12 +1622,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 (110993 => 110994)


--- trunk/Source/WebCore/ChangeLog	2012-03-16 12:46:40 UTC (rev 110993)
+++ trunk/Source/WebCore/ChangeLog	2012-03-16 12:50:01 UTC (rev 110994)
@@ -1,5 +1,52 @@
 2012-03-16  Kentaro Hara  <[email protected]>
 
+        Move Notifications APIs from DOMWindow.idl to DOMWindowNotifications.idl
+        https://bugs.webkit.org/show_bug.cgi?id=79636
+
+        Reviewed by Adam Barth.
+
+        For WebKit modularization, this patch moves Notifications-related APIs
+        from DOMWindow.idl to DOMWindowNotifications.idl.
+
+        Tests: fast/notifications/* (No change in test results)
+
+        * CMakeLists.txt: Added DOMWindowNotifications.{h,cpp,idl}.
+        * DerivedSources.make: Ditto.
+        * DerivedSources.pri: Ditto.
+        * GNUmakefile.list.am: Ditto.
+        * Target.pri: Ditto.
+        * WebCore.gypi: Ditto.
+        * WebCore.vcproj/WebCore.vcproj: Ditto.
+
+        * WebCore.exp.in: Added mangled signatures of webkitNotifications().
+
+        * notifications/DOMWindowNotifications.cpp: Added.
+        (WebCore):
+        (WebCore::DOMWindowNotifications::DOMWindowNotifications):
+        (WebCore::DOMWindowNotifications::~DOMWindowNotifications):
+        (WebCore::DOMWindowNotifications::from):
+        (WebCore::DOMWindowNotifications::webkitNotifications):
+        (WebCore::DOMWindowNotifications::ensureWebkitNotifications):
+        (WebCore::DOMWindowNotifications::disconnectFrame):
+        * notifications/DOMWindowNotifications.h: Added.
+        (WebCore):
+        (DOMWindowNotifications):
+        * notifications/DOMWindowNotifications.idl: Added.
+
+        * page/DOMWindow.cpp: Removed ENABLE(NOTIFICATIONS).
+        (WebCore::DOMWindow::~DOMWindow):
+        (WebCore::DOMWindow::willDetachPage):
+        (WebCore::DOMWindow::clear):
+        * page/DOMWindow.h: Ditto.
+        (WebCore):
+        (DOMWindow):
+        * page/DOMWindow.idl: Ditto.
+        * page/Frame.cpp: Ditto.
+        (WebCore::Frame::willDetachPage):
+        (WebCore::Frame::transferChildFrameToNewDocument):
+
+2012-03-16  Kentaro Hara  <[email protected]>
+
         [Performance] Optimize innerHTML and outerHTML
         https://bugs.webkit.org/show_bug.cgi?id=81214
 

Modified: trunk/Source/WebCore/DerivedSources.make (110993 => 110994)


--- trunk/Source/WebCore/DerivedSources.make	2012-03-16 12:46:40 UTC (rev 110993)
+++ trunk/Source/WebCore/DerivedSources.make	2012-03-16 12:50:01 UTC (rev 110994)
@@ -356,6 +356,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 (110993 => 110994)


--- trunk/Source/WebCore/DerivedSources.pri	2012-03-16 12:46:40 UTC (rev 110993)
+++ trunk/Source/WebCore/DerivedSources.pri	2012-03-16 12:50:01 UTC (rev 110994)
@@ -375,6 +375,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 (110993 => 110994)


--- trunk/Source/WebCore/GNUmakefile.list.am	2012-03-16 12:46:40 UTC (rev 110993)
+++ trunk/Source/WebCore/GNUmakefile.list.am	2012-03-16 12:50:01 UTC (rev 110994)
@@ -2828,6 +2828,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 (110993 => 110994)


--- trunk/Source/WebCore/Target.pri	2012-03-16 12:46:40 UTC (rev 110993)
+++ trunk/Source/WebCore/Target.pri	2012-03-16 12:50:01 UTC (rev 110994)
@@ -979,6 +979,7 @@
     loader/SubresourceLoader.cpp \
     loader/TextResourceDecoder.cpp \
     loader/ThreadableLoader.cpp \
+    notifications/DOMWindowNotifications.cpp \
     notifications/Notification.cpp \
     notifications/NotificationCenter.cpp \
     notifications/NotificationController.cpp \
@@ -2073,6 +2074,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 (110993 => 110994)


--- trunk/Source/WebCore/WebCore.gypi	2012-03-16 12:46:40 UTC (rev 110993)
+++ trunk/Source/WebCore/WebCore.gypi	2012-03-16 12:50:01 UTC (rev 110994)
@@ -1066,6 +1066,7 @@
             'inspector/ScriptProfile.idl',
             'inspector/ScriptProfileNode.idl',
             'loader/appcache/DOMApplicationCache.idl',
+            'notifications/DOMWindowNotifications.idl',
             'notifications/Notification.idl',
             'notifications/NotificationCenter.idl',
             'page/AbstractView.idl',
@@ -2812,6 +2813,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 (110993 => 110994)


--- trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj	2012-03-16 12:46:40 UTC (rev 110993)
+++ trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj	2012-03-16 12:50:01 UTC (rev 110994)
@@ -53606,6 +53606,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 (110993 => 110994)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2012-03-16 12:46:40 UTC (rev 110993)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2012-03-16 12:50:01 UTC (rev 110994)
@@ -4113,6 +4113,8 @@
 		A8748BE012CBF2DC001FBA41 /* HashTools.h in Headers */ = {isa = PBXBuildFile; fileRef = A8748BDF12CBF2DC001FBA41 /* HashTools.h */; };
 		A883DF270F3D045D00F19BF6 /* VisibleSelection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A883DF250F3D045D00F19BF6 /* VisibleSelection.cpp */; };
 		A883DF280F3D045D00F19BF6 /* VisibleSelection.h in Headers */ = {isa = PBXBuildFile; fileRef = A883DF260F3D045D00F19BF6 /* VisibleSelection.h */; settings = {ATTRIBUTES = (Private, ); }; };
+		A886CF761512301700D279F4 /* DOMWindowNotifications.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A886CF731512301700D279F4 /* DOMWindowNotifications.cpp */; };
+		A886CF771512301700D279F4 /* DOMWindowNotifications.h in Headers */ = {isa = PBXBuildFile; fileRef = A886CF741512301700D279F4 /* DOMWindowNotifications.h */; };
 		A88AD52F09524B92001DD196 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A85D7A2F0879EBA9006A9172 /* QuartzCore.framework */; };
 		A88DD4870B4629A300C02990 /* PathTraversalState.h in Headers */ = {isa = PBXBuildFile; fileRef = A88DD4860B4629A300C02990 /* PathTraversalState.h */; };
 		A88DD4890B4629B000C02990 /* PathTraversalState.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A88DD4880B4629B000C02990 /* PathTraversalState.cpp */; };
@@ -10908,6 +10910,7 @@
 		A86629CC09DA2B47009633A5 /* JSMouseEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSMouseEvent.cpp; sourceTree = "<group>"; };
 		A86629CD09DA2B47009633A5 /* JSKeyboardEvent.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSKeyboardEvent.h; sourceTree = "<group>"; };
 		A86629CE09DA2B47009633A5 /* JSKeyboardEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSKeyboardEvent.cpp; sourceTree = "<group>"; };
+		A86E87711512DCEA00AD14C1 /* DOMWindowNotifications.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = DOMWindowNotifications.idl; path = notifications/DOMWindowNotifications.idl; sourceTree = "<group>"; };
 		A871D44C0A127CBC00B12A68 /* HTMLPlugInElement.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = HTMLPlugInElement.h; sourceTree = "<group>"; };
 		A871D44D0A127CBC00B12A68 /* HTMLPlugInElement.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLPlugInElement.cpp; sourceTree = "<group>"; };
 		A871D44E0A127CBC00B12A68 /* HTMLParamElement.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = HTMLParamElement.h; sourceTree = "<group>"; };
@@ -10969,6 +10972,8 @@
 		A8748BDF12CBF2DC001FBA41 /* HashTools.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HashTools.h; sourceTree = "<group>"; };
 		A883DF250F3D045D00F19BF6 /* VisibleSelection.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = VisibleSelection.cpp; sourceTree = "<group>"; };
 		A883DF260F3D045D00F19BF6 /* VisibleSelection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VisibleSelection.h; sourceTree = "<group>"; };
+		A886CF731512301700D279F4 /* DOMWindowNotifications.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DOMWindowNotifications.cpp; path = notifications/DOMWindowNotifications.cpp; sourceTree = "<group>"; };
+		A886CF741512301700D279F4 /* DOMWindowNotifications.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DOMWindowNotifications.h; path = notifications/DOMWindowNotifications.h; sourceTree = "<group>"; };
 		A88DD4860B4629A300C02990 /* PathTraversalState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PathTraversalState.h; sourceTree = "<group>"; };
 		A88DD4880B4629B000C02990 /* PathTraversalState.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PathTraversalState.cpp; sourceTree = "<group>"; };
 		A89943260B42338700D7C802 /* BitmapImage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BitmapImage.h; sourceTree = "<group>"; };
@@ -14391,6 +14396,9 @@
 		333F703D0FB49C16008E12A6 /* notifications */ = {
 			isa = PBXGroup;
 			children = (
+				A86E87711512DCEA00AD14C1 /* DOMWindowNotifications.idl */,
+				A886CF731512301700D279F4 /* DOMWindowNotifications.cpp */,
+				A886CF741512301700D279F4 /* DOMWindowNotifications.h */,
 				33503CC61017A1B1003B47E1 /* Notification.cpp */,
 				333F704F0FB49CA2008E12A6 /* Notification.h */,
 				333F704E0FB49CA2008E12A6 /* Notification.idl */,
@@ -24575,6 +24583,7 @@
 				E1CDE9221501916900862CC5 /* AsyncFileStream.h in Headers */,
 				450CEBF115073BBE002BB149 /* LabelableElement.h in Headers */,
 				C5B4C24D1509236C00A6EF37 /* WebCoreNSURLExtras.h in Headers */,
+				A886CF771512301700D279F4 /* DOMWindowNotifications.h in Headers */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -27556,6 +27565,7 @@
 				C5B4C24E1509236C00A6EF37 /* WebCoreNSURLExtras.mm in Sources */,
 				9B2B7AC11509850A008932CC /* MicroDataItemValue.cpp in Sources */,
 				7157F062150B6564006EAABD /* SVGAnimatedTransformList.cpp in Sources */,
+				A886CF761512301700D279F4 /* DOMWindowNotifications.cpp in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};

Added: trunk/Source/WebCore/notifications/DOMWindowNotifications.cpp (0 => 110994)


--- trunk/Source/WebCore/notifications/DOMWindowNotifications.cpp	                        (rev 0)
+++ trunk/Source/WebCore/notifications/DOMWindowNotifications.cpp	2012-03-16 12:50:01 UTC (rev 110994)
@@ -0,0 +1,98 @@
+/*
+ * 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(DOMWindow* window)
+    : DOMWindowProperty(window->frame())
+    , m_window(window)
+{
+}
+
+DOMWindowNotifications::~DOMWindowNotifications()
+{
+}
+
+DOMWindowNotifications* DOMWindowNotifications::from(DOMWindow* window)
+{
+    DEFINE_STATIC_LOCAL(AtomicString, supplementName, ("DOMWindowNotifications"));
+    DOMWindowNotifications* supplement = static_cast<DOMWindowNotifications*>(Supplement<DOMWindow>::from(window, supplementName));
+    if (!supplement) {
+        supplement = new DOMWindowNotifications(window);
+        Supplement<DOMWindow>::provideTo(window, supplementName, adoptPtr(supplement));
+    }
+    return supplement;
+}
+
+NotificationCenter* DOMWindowNotifications::webkitNotifications(DOMWindow* window)
+{
+    return DOMWindowNotifications::from(window)->ensureWebkitNotifications();
+}
+
+NotificationCenter* DOMWindowNotifications::ensureWebkitNotifications()
+{
+    if (!m_window->isCurrentlyDisplayedInFrame())
+        return 0;
+
+    if (m_notificationCenter)
+        return m_notificationCenter.get();
+
+    Document* document = m_window->document();
+    if (!document)
+        return 0;
+
+    Page* page = document->page();
+    if (!page)
+        return 0;
+
+    NotificationClient* provider = NotificationController::clientFrom(page);
+    if (provider)
+        m_notificationCenter = NotificationCenter::create(m_window->scriptExecutionContext(), provider);
+    return m_notificationCenter.get();
+}
+
+void DOMWindowNotifications::disconnectFrame()
+{
+    if (m_notificationCenter) {
+        m_notificationCenter->disconnectFrame();
+        m_notificationCenter = 0;
+    }
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(NOTIFICATIONS)

Added: trunk/Source/WebCore/notifications/DOMWindowNotifications.h (0 => 110994)


--- trunk/Source/WebCore/notifications/DOMWindowNotifications.h	                        (rev 0)
+++ trunk/Source/WebCore/notifications/DOMWindowNotifications.h	2012-03-16 12:50:01 UTC (rev 110994)
@@ -0,0 +1,63 @@
+/*
+ * 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 ScriptExecutionContext;
+
+class DOMWindowNotifications : public Supplement<DOMWindow>, public DOMWindowProperty {
+public:
+    virtual ~DOMWindowNotifications();
+
+    static NotificationCenter* webkitNotifications(DOMWindow*);
+    static DOMWindowNotifications* from(DOMWindow*);
+
+private:
+    explicit DOMWindowNotifications(DOMWindow*);
+
+    NotificationCenter* ensureWebkitNotifications();
+    void disconnectFrame() OVERRIDE;
+
+    RefPtr<NotificationCenter> m_notificationCenter;
+    DOMWindow* m_window;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(NOTIFICATIONS)
+
+#endif // DOMWindowNotifications_h

Added: trunk/Source/WebCore/notifications/DOMWindowNotifications.idl (0 => 110994)


--- trunk/Source/WebCore/notifications/DOMWindowNotifications.idl	                        (rev 0)
+++ trunk/Source/WebCore/notifications/DOMWindowNotifications.idl	2012-03-16 12:50:01 UTC (rev 110994)
@@ -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 (110993 => 110994)


--- trunk/Source/WebCore/page/DOMWindow.cpp	2012-03-16 12:46:40 UTC (rev 110993)
+++ trunk/Source/WebCore/page/DOMWindow.cpp	2012-03-16 12:50:01 UTC (rev 110994)
@@ -72,8 +72,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 +416,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
@@ -478,12 +473,6 @@
 {
     InspectorInstrumentation::frameWindowDiscarded(m_frame, this);
 
-#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
-    // Clearing Notifications requests involves accessing the client so it must be done
-    // before the frame is detached.
-    resetNotifications();
-#endif
-
     HashSet<DOMWindowProperty*>::iterator stop = m_properties.end();
     for (HashSet<DOMWindowProperty*>::iterator it = m_properties.begin(); it != stop; ++it)
         (*it)->willDetachPage();
@@ -527,15 +516,6 @@
     HashSet<DOMWindowProperty*>::iterator stop = m_properties.end();
     for (HashSet<DOMWindowProperty*>::iterator it = m_properties.begin(); it != stop; ++it)
         (*it)->disconnectFrame();
-
-#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
-    // FIXME: Notifications shouldn't have different disconnection logic than
-    // the rest of the DOMWindowProperties.
-    // There is currently no way to reconnect them in resumeFromPageCache() so
-    // they will be broken after returning to a cached page.
-    // This should be fixed as part of https://bugs.webkit.org/show_bug.cgi?id=79636
-    resetNotifications();
-#endif
 }
 
 void DOMWindow::reconnectDOMWindowProperties()
@@ -571,11 +551,6 @@
     m_sessionStorage = 0;
     m_localStorage = 0;
     m_applicationCache = 0;
-#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
-    // FIXME: Notifications shouldn't have different disconnection logic than
-    // the rest of the DOMWindowProperties.
-    resetNotifications();
-#endif
 #if ENABLE(BLOB)
     m_domURL = 0;
 #endif
@@ -784,38 +759,6 @@
     return m_localStorage.get();
 }
 
-#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;
-}
-#endif
-
 void DOMWindow::postMessage(PassRefPtr<SerializedScriptValue> message, MessagePort* port, const String& targetOrigin, DOMWindow* source, ExceptionCode& ec)
 {
     MessagePortArray ports;

Modified: trunk/Source/WebCore/page/DOMWindow.h (110993 => 110994)


--- trunk/Source/WebCore/page/DOMWindow.h	2012-03-16 12:46:40 UTC (rev 110993)
+++ trunk/Source/WebCore/page/DOMWindow.h	2012-03-16 12:50:01 UTC (rev 110994)
@@ -56,7 +56,6 @@
     class MediaQueryList;
     class Navigator;
     class Node;
-    class NotificationCenter;
     class Page;
     class Performance;
     class PostMessageTimer;
@@ -356,13 +355,6 @@
         Storage* sessionStorage(ExceptionCode&) const;
         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
-
 #if ENABLE(QUOTA)
         StorageInfo* webkitStorageInfo() const;
 #endif
@@ -450,10 +442,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 (110993 => 110994)


--- trunk/Source/WebCore/page/DOMWindow.idl	2012-03-16 12:46:40 UTC (rev 110993)
+++ trunk/Source/WebCore/page/DOMWindow.idl	2012-03-16 12:50:01 UTC (rev 110994)
@@ -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;

Modified: trunk/Source/WebCore/page/Frame.cpp (110993 => 110994)


--- trunk/Source/WebCore/page/Frame.cpp	2012-03-16 12:46:40 UTC (rev 110993)
+++ trunk/Source/WebCore/page/Frame.cpp	2012-03-16 12:50:01 UTC (rev 110994)
@@ -687,11 +687,6 @@
     if (Frame* parent = tree()->parent())
         parent->loader()->checkLoadComplete();
 
-#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
-    if (m_domWindow)
-        m_domWindow->resetNotifications();
-#endif
-
     HashSet<FrameDestructionObserver*>::iterator stop = m_destructionObservers.end();
     for (HashSet<FrameDestructionObserver*>::iterator it = m_destructionObservers.begin(); it != stop; ++it)
         (*it)->willDetachPage();
@@ -736,12 +731,6 @@
              m_page->decrementFrameCount();
         }
 
-        if (m_domWindow) {
-#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
-            m_domWindow->resetNotifications();
-#endif
-        }
-
         HashSet<FrameDestructionObserver*>::iterator stop = m_destructionObservers.end();
         for (HashSet<FrameDestructionObserver*>::iterator it = m_destructionObservers.begin(); it != stop; ++it)
             (*it)->willDetachPage();
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to