Title: [108615] trunk/Source
Revision
108615
Author
commit-qu...@webkit.org
Date
2012-02-22 23:29:30 -0800 (Wed, 22 Feb 2012)

Log Message

NOTIFICATIONS should be implemented as PageSupplement
https://bugs.webkit.org/show_bug.cgi?id=79052

Patch by Hajime Morrita <morr...@chromium.org> on 2012-02-22
Reviewed by Adam Barth.

Source/WebCore:

Turned NotificationController to a PageSupplement.

No new tests. No behavior change.

* notifications/NotificationController.cpp:
(WebCore::NotificationController::clientFrom):
(WebCore):
(WebCore::NotificationController::supplementName):
(WebCore::provideNotification):
* notifications/NotificationController.h:
(NotificationController):
(WebCore::NotificationController::from):
* notifications/NotificationPresenter.h:
(WebCore):
* page/DOMWindow.cpp:
(WebCore::DOMWindow::webkitNotifications):
* page/Page.cpp:
(WebCore::Page::Page):
(WebCore::Page::PageClients::PageClients):
* page/Page.h:
(WebCore):
(PageClients):
(Page):

Source/WebKit/chromium:

* src/WebViewImpl.cpp:
(WebKit::WebViewImpl::WebViewImpl):

Source/WebKit/mac:

* WebView/WebView.mm:
(-[WebView _commonInitializationWithFrameName:groupName:]):

Source/WebKit/qt:

* Api/qwebpage.cpp:
(QWebPagePrivate::QWebPagePrivate):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (108614 => 108615)


--- trunk/Source/WebCore/ChangeLog	2012-02-23 07:22:03 UTC (rev 108614)
+++ trunk/Source/WebCore/ChangeLog	2012-02-23 07:29:30 UTC (rev 108615)
@@ -1,3 +1,34 @@
+2012-02-22  Hajime Morrita  <morr...@chromium.org>
+
+        NOTIFICATIONS should be implemented as PageSupplement
+        https://bugs.webkit.org/show_bug.cgi?id=79052
+
+        Reviewed by Adam Barth.
+
+        Turned NotificationController to a PageSupplement.
+
+        No new tests. No behavior change.
+
+        * notifications/NotificationController.cpp:
+        (WebCore::NotificationController::clientFrom):
+        (WebCore):
+        (WebCore::NotificationController::supplementName):
+        (WebCore::provideNotification):
+        * notifications/NotificationController.h:
+        (NotificationController):
+        (WebCore::NotificationController::from):
+        * notifications/NotificationPresenter.h:
+        (WebCore):
+        * page/DOMWindow.cpp:
+        (WebCore::DOMWindow::webkitNotifications):
+        * page/Page.cpp:
+        (WebCore::Page::Page):
+        (WebCore::Page::PageClients::PageClients):
+        * page/Page.h:
+        (WebCore):
+        (PageClients):
+        (Page):
+
 2012-02-22  Dmitry Lomov  <dslo...@google.com>
 
         [Chromium][V8] Support Uint8ClampedArray in postMessage

Modified: trunk/Source/WebCore/notifications/NotificationController.cpp (108614 => 108615)


--- trunk/Source/WebCore/notifications/NotificationController.cpp	2012-02-23 07:22:03 UTC (rev 108614)
+++ trunk/Source/WebCore/notifications/NotificationController.cpp	2012-02-23 07:29:30 UTC (rev 108615)
@@ -50,6 +50,24 @@
     return adoptPtr(new NotificationController(page, client));
 }
 
+NotificationPresenter* NotificationController::clientFrom(Page* page)
+{
+    if (NotificationController* controller = NotificationController::from(page))
+        return controller->client();
+    return 0;
+}
+
+const AtomicString& NotificationController::supplementName()
+{
+    DEFINE_STATIC_LOCAL(AtomicString, name, ("NotificationController"));
+    return name;
+}
+
+void provideNotification(Page* page, NotificationPresenter* client)
+{
+    PageSupplement::provideTo(page, NotificationController::supplementName(), NotificationController::create(page, client));
+}
+
 } // namespace WebCore
 
 #endif // ENABLE(NOTIFICATIONS)

Modified: trunk/Source/WebCore/notifications/NotificationController.h (108614 => 108615)


--- trunk/Source/WebCore/notifications/NotificationController.h	2012-02-23 07:22:03 UTC (rev 108614)
+++ trunk/Source/WebCore/notifications/NotificationController.h	2012-02-23 07:29:30 UTC (rev 108615)
@@ -28,6 +28,7 @@
 
 #if ENABLE(NOTIFICATIONS)
 
+#include "PageSupplement.h"
 #include <wtf/Forward.h>
 #include <wtf/Noncopyable.h>
 
@@ -36,12 +37,16 @@
 class NotificationPresenter;
 class Page;
 
-class NotificationController {
+class NotificationController : public PageSupplement {
     WTF_MAKE_NONCOPYABLE(NotificationController);
 public:
     ~NotificationController();
 
     static PassOwnPtr<NotificationController> create(Page*, NotificationPresenter*);
+    static const AtomicString& supplementName();
+    static NotificationController* from(Frame* frame) { return static_cast<NotificationController*>(PageSupplement::from(frame, supplementName())); }
+    static NotificationController* from(Page* page) { return static_cast<NotificationController*>(PageSupplement::from(page, supplementName())); }
+    static NotificationPresenter* clientFrom(Page*);
 
     NotificationPresenter* client() { return m_client; }
     

Modified: trunk/Source/WebCore/notifications/NotificationPresenter.h (108614 => 108615)


--- trunk/Source/WebCore/notifications/NotificationPresenter.h	2012-02-23 07:22:03 UTC (rev 108614)
+++ trunk/Source/WebCore/notifications/NotificationPresenter.h	2012-02-23 07:29:30 UTC (rev 108615)
@@ -40,6 +40,7 @@
 class Document;
 class Notification;
 class KURL;
+class Page;
 class ScriptExecutionContext;
 
 class NotificationPresenter {
@@ -84,6 +85,8 @@
     virtual ~NotificationPresenter() { }
 };
 
+void provideNotification(Page*, NotificationPresenter*);
+
 } // namespace WebCore
 
 #endif // NotificationPresenter_h

Modified: trunk/Source/WebCore/page/DOMWindow.cpp (108614 => 108615)


--- trunk/Source/WebCore/page/DOMWindow.cpp	2012-02-23 07:22:03 UTC (rev 108614)
+++ trunk/Source/WebCore/page/DOMWindow.cpp	2012-02-23 07:29:30 UTC (rev 108615)
@@ -719,7 +719,7 @@
     if (!page)
         return 0;
 
-    NotificationPresenter* provider = page->notificationController()->client();
+    NotificationPresenter* provider = NotificationController::clientFrom(page);
     if (provider) 
         m_notifications = NotificationCenter::create(document, provider);    
       

Modified: trunk/Source/WebCore/page/Page.cpp (108614 => 108615)


--- trunk/Source/WebCore/page/Page.cpp	2012-02-23 07:22:03 UTC (rev 108614)
+++ trunk/Source/WebCore/page/Page.cpp	2012-02-23 07:29:30 UTC (rev 108615)
@@ -51,8 +51,6 @@
 #include "MediaCanStartListener.h"
 #include "Navigator.h"
 #include "NetworkStateNotifier.h"
-#include "NotificationController.h"
-#include "NotificationPresenter.h"
 #include "PageGroup.h"
 #include "PluginData.h"
 #include "PluginView.h"
@@ -70,6 +68,7 @@
 #include "StorageArea.h"
 #include "StorageNamespace.h"
 #include "TextResourceDecoder.h"
+#include "VoidCallback.h"
 #include "Widget.h"
 #include <wtf/HashMap.h>
 #include <wtf/RefCountedLeakCounter.h>
@@ -129,9 +128,6 @@
 #if ENABLE(CLIENT_BASED_GEOLOCATION)
     , m_geolocationController(GeolocationController::create(this, pageClients.geolocationClient))
 #endif
-#if ENABLE(NOTIFICATIONS)
-    , m_notificationController(NotificationController::create(this, pageClients.notificationClient))
-#endif
 #if ENABLE(POINTER_LOCK)
     , m_pointerLockController(PointerLockController::create(this))
 #endif
@@ -1071,7 +1067,6 @@
     , dragClient(0)
     , inspectorClient(0)
     , geolocationClient(0)
-    , notificationClient(0)
 {
 }
 

Modified: trunk/Source/WebCore/page/Page.h (108614 => 108615)


--- trunk/Source/WebCore/page/Page.h	2012-02-23 07:22:03 UTC (rev 108614)
+++ trunk/Source/WebCore/page/Page.h	2012-02-23 07:29:30 UTC (rev 108615)
@@ -70,8 +70,6 @@
     class InspectorController;
     class MediaCanStartListener;
     class Node;
-    class NotificationController;
-    class NotificationPresenter;
     class PageGroup;
     class PluginData;
     class PointerLockController;
@@ -84,9 +82,6 @@
     class ScrollingCoordinator;
     class Settings;
     class StorageNamespace;
-#if ENABLE(NOTIFICATIONS)
-    class NotificationPresenter;
-#endif
 
     typedef uint64_t LinkHash;
 
@@ -114,7 +109,6 @@
             InspectorClient* inspectorClient;
             GeolocationClient* geolocationClient;
             RefPtr<BackForwardList> backForwardClient;
-            NotificationPresenter* notificationClient;
         };
 
         Page(PageClients&);
@@ -175,9 +169,6 @@
 #if ENABLE(CLIENT_BASED_GEOLOCATION)
         GeolocationController* geolocationController() const { return m_geolocationController.get(); }
 #endif
-#if ENABLE(NOTIFICATIONS)
-        NotificationController* notificationController() const { return m_notificationController.get(); }
-#endif
 #if ENABLE(POINTER_LOCK)
         PointerLockController* pointerLockController() const { return m_pointerLockController.get(); }
 #endif
@@ -369,9 +360,6 @@
 #if ENABLE(CLIENT_BASED_GEOLOCATION)
         OwnPtr<GeolocationController> m_geolocationController;
 #endif
-#if ENABLE(NOTIFICATIONS)
-        OwnPtr<NotificationController> m_notificationController;
-#endif
 #if ENABLE(POINTER_LOCK)
         OwnPtr<PointerLockController> m_pointerLockController;
 #endif
@@ -425,10 +413,6 @@
 
         RefPtr<StorageNamespace> m_sessionStorage;
 
-#if ENABLE(NOTIFICATIONS)
-        NotificationPresenter* m_notificationPresenter;
-#endif
-
         ViewMode m_viewMode;
 
         double m_minimumTimerInterval;

Modified: trunk/Source/WebKit/chromium/ChangeLog (108614 => 108615)


--- trunk/Source/WebKit/chromium/ChangeLog	2012-02-23 07:22:03 UTC (rev 108614)
+++ trunk/Source/WebKit/chromium/ChangeLog	2012-02-23 07:29:30 UTC (rev 108615)
@@ -1,3 +1,13 @@
+2012-02-22  Hajime Morrita  <morr...@chromium.org>
+
+        NOTIFICATIONS should be implemented as PageSupplement
+        https://bugs.webkit.org/show_bug.cgi?id=79052
+
+        Reviewed by Adam Barth.
+
+        * src/WebViewImpl.cpp:
+        (WebKit::WebViewImpl::WebViewImpl):
+
 2012-02-22  Dana Jansens  <dan...@chromium.org>
 
         [chromium] Add unit test for surface occlusion

Modified: trunk/Source/WebKit/chromium/src/WebViewImpl.cpp (108614 => 108615)


--- trunk/Source/WebKit/chromium/src/WebViewImpl.cpp	2012-02-23 07:22:03 UTC (rev 108614)
+++ trunk/Source/WebKit/chromium/src/WebViewImpl.cpp	2012-02-23 07:29:30 UTC (rev 108615)
@@ -398,9 +398,6 @@
     pageClients.dragClient = &m_dragClientImpl;
     pageClients.inspectorClient = &m_inspectorClientImpl;
     pageClients.geolocationClient = m_geolocationClientProxy.get();
-#if ENABLE(NOTIFICATIONS)
-    pageClients.notificationClient = notificationPresenterImpl();
-#endif
     pageClients.backForwardClient = BackForwardListChromium::create(this);
 
     m_page = adoptPtr(new Page(pageClients));
@@ -410,6 +407,9 @@
 #if ENABLE(INPUT_SPEECH)
     provideSpeechInputTo(m_page.get(), m_speechInputClient.get());
 #endif
+#if ENABLE(NOTIFICATIONS)
+    provideNotification(m_page.get(), notificationPresenterImpl());
+#endif
 
     provideDeviceOrientationTo(m_page.get(), m_deviceOrientationClientProxy.get());
     m_geolocationClientProxy->setController(m_page->geolocationController());

Modified: trunk/Source/WebKit/mac/ChangeLog (108614 => 108615)


--- trunk/Source/WebKit/mac/ChangeLog	2012-02-23 07:22:03 UTC (rev 108614)
+++ trunk/Source/WebKit/mac/ChangeLog	2012-02-23 07:29:30 UTC (rev 108615)
@@ -1,3 +1,13 @@
+2012-02-22  Hajime Morrita  <morr...@chromium.org>
+
+        NOTIFICATIONS should be implemented as PageSupplement
+        https://bugs.webkit.org/show_bug.cgi?id=79052
+
+        Reviewed by Adam Barth.
+
+        * WebView/WebView.mm:
+        (-[WebView _commonInitializationWithFrameName:groupName:]):
+
 2012-02-21  Ryosuke Niwa  <rn...@webkit.org>
 
         Remove the remaining uses of CSSStyleDeclaration in Editor

Modified: trunk/Source/WebKit/mac/WebView/WebView.mm (108614 => 108615)


--- trunk/Source/WebKit/mac/WebView/WebView.mm	2012-02-23 07:22:03 UTC (rev 108614)
+++ trunk/Source/WebKit/mac/WebView/WebView.mm	2012-02-23 07:29:30 UTC (rev 108615)
@@ -742,10 +742,10 @@
 #if ENABLE(CLIENT_BASED_GEOLOCATION)
     pageClients.geolocationClient = new WebGeolocationClient(self);
 #endif
+    _private->page = new Page(pageClients);
 #if ENABLE(NOTIFICATIONS)
-    pageClients.notificationClient = new WebNotificationClient(self);
+    WebCore::provideNotification(_private->page, new WebNotificationClient(self));
 #endif
-    _private->page = new Page(pageClients);
 #if ENABLE(DEVICE_ORIENTATION)
     WebCore::provideDeviceOrientationTo(_private->page, new WebDeviceOrientationClient(self));
 #endif

Modified: trunk/Source/WebKit/qt/Api/qwebpage.cpp (108614 => 108615)


--- trunk/Source/WebKit/qt/Api/qwebpage.cpp	2012-02-23 07:22:03 UTC (rev 108614)
+++ trunk/Source/WebKit/qt/Api/qwebpage.cpp	2012-02-23 07:29:30 UTC (rev 108615)
@@ -332,9 +332,6 @@
     else
         pageClients.geolocationClient = new GeolocationClientQt(q);
 #endif
-#if ENABLE(NOTIFICATIONS)
-    pageClients.notificationClient = NotificationPresenterClientQt::notificationPresenter();
-#endif
     page = new Page(pageClients);
 #if ENABLE(DEVICE_ORIENTATION)
     if (useMock)
@@ -343,6 +340,9 @@
         WebCore::provideDeviceOrientationTo(page, new DeviceOrientationClientQt);
     WebCore::provideDeviceMotionTo(page, new DeviceMotionClientQt);
 #endif
+#if ENABLE(NOTIFICATIONS)
+    WebCore::provideNotification(page, NotificationPresenterClientQt::notificationPresenter());
+#endif
 
     // By default each page is put into their own unique page group, which affects popup windows
     // and visited links. Page groups (per process only) is a feature making it possible to use

Modified: trunk/Source/WebKit/qt/ChangeLog (108614 => 108615)


--- trunk/Source/WebKit/qt/ChangeLog	2012-02-23 07:22:03 UTC (rev 108614)
+++ trunk/Source/WebKit/qt/ChangeLog	2012-02-23 07:29:30 UTC (rev 108615)
@@ -1,3 +1,13 @@
+2012-02-22  Hajime Morrita  <morr...@chromium.org>
+
+        NOTIFICATIONS should be implemented as PageSupplement
+        https://bugs.webkit.org/show_bug.cgi?id=79052
+
+        Reviewed by Adam Barth.
+
+        * Api/qwebpage.cpp:
+        (QWebPagePrivate::QWebPagePrivate):
+
 2012-02-21  Ryosuke Niwa  <rn...@webkit.org>
 
         Remove the remaining uses of CSSStyleDeclaration in Editor
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to