Create skeleton framework for notifications support in WK2
authorjonlee@apple.com <jonlee@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 29 Nov 2011 01:08:35 +0000 (01:08 +0000)
committerjonlee@apple.com <jonlee@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 29 Nov 2011 01:08:35 +0000 (01:08 +0000)
commitd95fc1bceef5a706c71cf8a350856c25adf52ea2
tree691b2091e65182d40ae941b7f13cce37c45956ab
parente7475938b7cb9544584d83da77bc49316caf2f08
Create skeleton framework for notifications support in WK2
https://bugs.webkit.org/show_bug.cgi?id=73253
<rdar://problem/10356943>

Source/JavaScriptCore:

* Configurations/FeatureDefines.xcconfig: Split out ENABLE_NOTIFICATIONS based on platform.

Source/WebCore:

Reviewed by Sam Weinig.

Some refactoring was done to make notifications follow a similar pattern to our other clients, like
geolocation and context menu.

* Configurations/FeatureDefines.xcconfig: Split out ENABLE_NOTIFICATIONS based on platform.
* WebCore.xcodeproj/project.pbxproj: Adding new NotificationController class, and exposing
Notification and NotificationController as private headers.
* Target.pri: Ditto.
* WebCore.gypi: Ditto.

* notifications/NotificationContents.h: Converted class to struct. Members need to be accessible
in order to do WK2 argument encoding.
(WebCore::NotificationContents::NotificationContents):

* notifications/Notification.cpp: Update style of entire file.
(WebCore::Notification::Notification): Added default constructor (for WK2), and minor refactoring
with NotificationContents.
* notifications/Notification.h: Added set methods for WK2 serialization. Also, update indenting.
(WebCore::Notification::setHTML): Added.
(WebCore::Notification::setURL): Added.
(WebCore::Notification::contents): Added const version for WK2.
* notifications/NotificationCenter.h: Update style.

* notifications/NotificationController.cpp: Added.
(WebCore::NotificationController::NotificationController):
(WebCore::NotificationController::~NotificationController):
* notifications/NotificationController.h: Added.
(WebCore::NotificationController::client):
* notifications/NotificationPresenter.h: This acts like a client, and should probably be renamed as such.
Removed ifdef for exposure to WK2.
(WebCore::NotificationPresenter::~NotificationPresenter): Moved as protected instead of public.

* page/DOMWindow.cpp:
(WebCore::DOMWindow::webkitNotifications):  We move the request for the notification client from the chrome
to the controller.
* page/Page.cpp:
(WebCore::Page::Page): The page now owns a notification controller.
(WebCore::Page::PageClients::PageClients): Add notification client as a page client.
* page/Page.h:
(WebCore::Page::notificationController): Retrieve the notification controller.

* page/ChromeClient.h: We move the request for the notification client from the chrome to the controller.
Remove notificationPresenter().
* page/Chrome.cpp: Remove notificationPresenter().
* page/Chrome.h: Remove notificationPresenter().
* loader/EmptyClients.h: Remove notificationPresenter().

Source/WebKit:

Reviewed by Sam Weinig.

* WebKit.xcodeproj/project.pbxproj: Add WebNotificationClient class.

Source/WebKit/chromium:

Reviewed by Sam Weinig.

Remove notificationPresenter() from the chrome client, since it is now managed by
the notification controller.

* src/ChromeClientImpl.cpp:
* src/ChromeClientImpl.h:
* src/WebNotification.cpp:
(WebKit::WebNotification::title): Refactoring with NotificationContents conversion to struct.
(WebKit::WebNotification::body): Ditto.
* src/WebViewImpl.cpp:
(WebKit::WebViewImpl::WebViewImpl): Set notification client in web view's page clients.

Source/WebKit/mac:

Reviewed by Sam Weinig.

* Configurations/FeatureDefines.xcconfig: Split out ENABLE_NOTIFICATIONS based on platform.

* WebCoreSupport/WebNotificationClient.h: Added.
(WebNotificationClient::webView):
* WebCoreSupport/WebNotificationClient.mm: Added. Implemented as stubs for now.
(WebNotificationClient::WebNotificationClient):
(WebNotificationClient::show):
(WebNotificationClient::cancel):
(WebNotificationClient::notificationObjectDestroyed):
(WebNotificationClient::requestPermission):
(WebNotificationClient::cancelRequestsForPermission):
(WebNotificationClient::checkPermission):
* WebView/WebView.mm: Set PageClient's notification client to an instance of this stubbed class.

Source/WebKit/qt:

Reviewed by Sam Weinig.

* Api/qwebpage.cpp: Add notification client to pageClients.
(QWebPagePrivate::QWebPagePrivate):
* WebCoreSupport/ChromeClientQt.cpp: Remove notification client from ChromeClient implementation.
* WebCoreSupport/ChromeClientQt.h:
* WebCoreSupport/NotificationPresenterClientQt.cpp: Refactor with change of NotificationContents to struct
(WebCore::NotificationWrapper::title):
(WebCore::NotificationWrapper::message):
(WebCore::NotificationPresenterClientQt::displayNotification):
(WebCore::NotificationPresenterClientQt::cancel):
(WebCore::NotificationPresenterClientQt::notificationClicked):
(WebCore::NotificationPresenterClientQt::dumpReplacedIdText):
(WebCore::NotificationPresenterClientQt::dumpShowText):

Source/WebKit2:

Reviewed by Sam Weinig.

* WebKit2.xcodeproj/project.pbxproj: Added classes for notification support.
* win/WebKit2.vcproj: Ditto.
* Target.pri: Ditto.
* Configurations/FeatureDefines.xcconfig: Split out ENABLE_NOTIFICATIONS based on platform.
* DerivedSources.make: Add Notifications to VPATH.
* Platform/CoreIPC/MessageID.h: List WebNotificationManagerProxy as a class with messages.
* Scripts/webkit2/messages.py: Mark WebCore::NotificationContents as a struct.

* Shared/API/c/WKBase.h: Map opaque types to NotificationProvider, NotificationManager, and Notification.
* UIProcess/API/C/WKAPICast.h: Map WK types toNotificationProvider, NotificationManager, and Notification.
* Shared/APIObject.h: Add Notification and NotificationManager as APIObjects.
* Shared/WebCoreArgumentCoders.cpp: Added coders for KURL.
(CoreIPC::::encode):
(CoreIPC::::decode):
* Shared/WebCoreArgumentCoders.h:

* UIProcess/WebNotification.cpp: Added.
(WebKit::WebNotification::WebNotification):
(WebKit::WebNotification::~WebNotification):
(WebKit::WebNotification::encode):
(WebKit::WebNotification::decode):
* UIProcess/WebNotification.h: Added.
(WebKit::WebNotification::create):
(WebKit::WebNotification::title):
(WebKit::WebNotification::body):
(WebKit::WebNotification::type):
* UIProcess/API/C/WKNotification.cpp: Added as API.
(WKNotificationGetTypeID):
(WKNotificationCopyTitle):
(WKNotificationCopyBody):
* UIProcess/API/C/WKNotification.h: Added as API.

* WebProcess/Notifications/WebNotificationManager.h: Added. Contains for now show() and cancel().
The rest of the notification client methods will be added later. These two functions send messages
to the manager proxy.
* WebProcess/Notifications/WebNotificationManager.cpp: Added.
(WebKit::WebNotificationManager::WebNotificationManager):
(WebKit::WebNotificationManager::~WebNotificationManager):
(WebKit::WebNotificationManager::show):
(WebKit::WebNotificationManager::cancel):

* UIProcess/WebNotificationManagerProxy.cpp: Added.
(WebKit::WebNotificationManagerProxy::create):
(WebKit::WebNotificationManagerProxy::WebNotificationManagerProxy):
(WebKit::WebNotificationManagerProxy::~WebNotificationManagerProxy):
(WebKit::WebNotificationManagerProxy::invalidate):
(WebKit::WebNotificationManagerProxy::initializeProvider):
(WebKit::WebNotificationManagerProxy::didReceiveMessage):
(WebKit::WebNotificationManagerProxy::show):
(WebKit::WebNotificationManagerProxy::cancel):
* UIProcess/WebNotificationManagerProxy.h: Added.
(WebKit::WebNotificationManagerProxy::clearContext):
(WebKit::WebNotificationManagerProxy::type):
* UIProcess/WebNotificationManagerProxy.messages.in: Added.
* UIProcess/API/C/WKNotificationManager.cpp: Added.
(WKNotificationManagerGetTypeID):
(WKNotificationManagerSetProvider):
* UIProcess/API/C/WKNotificationManager.h: Added.

* UIProcess/WebContext.h: Add the notification manager to the web context.
(WebKit::WebContext::notificationManagerProxy): Access the manager.
* UIProcess/WebContext.cpp:
(WebKit::WebContext::WebContext): Boilerplate for managers.
(WebKit::WebContext::~WebContext): Boilerplate for managers.
(WebKit::WebContext::disconnectProcess): Boilerplate for managers.
(WebKit::WebContext::didReceiveMessage): Forward messages to the notification manager.
* UIProcess/API/C/WKContext.cpp: Expose as API.
(WKContextGetNotificationManager):
* UIProcess/API/C/WKContext.h: Expose as API.

* UIProcess/API/C/WKNotificationProvider.h: Added.
* UIProcess/WebNotificationProvider.h: Added as APIClient.
* UIProcess/WebNotificationProvider.cpp: Added.
(WebKit::WebNotificationProvider::show): Forward call to the client.
(WebKit::WebNotificationProvider::cancel): Forward call to the client.
* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::didReceiveMessage): Forward messages for notification manager to the context.

* WebProcess/WebCoreSupport/WebChromeClient.cpp: Remove notificationPresenter().
* WebProcess/WebCoreSupport/WebChromeClient.h: Remove notificationPresenter().

* WebProcess/WebCoreSupport/WebNotificationClient.h: Added. Forwards client methods to manager.
* WebProcess/WebCoreSupport/WebNotificationClient.cpp: Added. Mostly stub implementation for now.
(WebKit::WebNotificationClient::WebNotificationClient):
(WebKit::WebNotificationClient::~WebNotificationClient):
(WebKit::WebNotificationClient::show):
(WebKit::WebNotificationClient::cancel):
(WebKit::WebNotificationClient::notificationObjectDestroyed):
(WebKit::WebNotificationClient::requestPermission):
(WebKit::WebNotificationClient::cancelRequestsForPermission):
(WebKit::WebNotificationClient::checkPermission):

* WebProcess/WebPage/WebPage.h: Added WebNotificationClient as one of its page clients.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::WebPage): Set the notification client to WebNotificationClient.
* WebProcess/WebProcess.h: Added WebNotificationManager.
(WebKit::WebProcess::notificationManager):
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::WebProcess): Initialize notificaton manager.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@101307 268f45cc-cd09-0410-ab3c-d52691b4dbfc
79 files changed:
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/Configurations/FeatureDefines.xcconfig
Source/WebCore/ChangeLog
Source/WebCore/Configurations/FeatureDefines.xcconfig
Source/WebCore/Target.pri
Source/WebCore/WebCore.gypi
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/loader/EmptyClients.h
Source/WebCore/notifications/Notification.cpp
Source/WebCore/notifications/Notification.h
Source/WebCore/notifications/NotificationCenter.h
Source/WebCore/notifications/NotificationContents.h
Source/WebCore/notifications/NotificationController.cpp [new file with mode: 0644]
Source/WebCore/notifications/NotificationController.h [new file with mode: 0644]
Source/WebCore/notifications/NotificationPresenter.h
Source/WebCore/page/Chrome.cpp
Source/WebCore/page/Chrome.h
Source/WebCore/page/ChromeClient.h
Source/WebCore/page/DOMWindow.cpp
Source/WebCore/page/Page.cpp
Source/WebCore/page/Page.h
Source/WebKit/ChangeLog
Source/WebKit/WebKit.xcodeproj/project.pbxproj
Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/src/ChromeClientImpl.cpp
Source/WebKit/chromium/src/ChromeClientImpl.h
Source/WebKit/chromium/src/WebNotification.cpp
Source/WebKit/chromium/src/WebViewImpl.cpp
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/Configurations/FeatureDefines.xcconfig
Source/WebKit/mac/WebCoreSupport/WebNotificationClient.h [new file with mode: 0644]
Source/WebKit/mac/WebCoreSupport/WebNotificationClient.mm [new file with mode: 0644]
Source/WebKit/mac/WebView/WebView.mm
Source/WebKit/qt/Api/qwebpage.cpp
Source/WebKit/qt/ChangeLog
Source/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp
Source/WebKit/qt/WebCoreSupport/ChromeClientQt.h
Source/WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.cpp
Source/WebKit2/ChangeLog
Source/WebKit2/Configurations/FeatureDefines.xcconfig
Source/WebKit2/DerivedSources.make
Source/WebKit2/DerivedSources.pri
Source/WebKit2/Platform/CoreIPC/MessageID.h
Source/WebKit2/Scripts/webkit2/messages.py
Source/WebKit2/Shared/API/c/WKBase.h
Source/WebKit2/Shared/APIObject.h
Source/WebKit2/Shared/WebCoreArgumentCoders.cpp
Source/WebKit2/Shared/WebCoreArgumentCoders.h
Source/WebKit2/Target.pri
Source/WebKit2/UIProcess/API/C/WKAPICast.h
Source/WebKit2/UIProcess/API/C/WKContext.cpp
Source/WebKit2/UIProcess/API/C/WKContext.h
Source/WebKit2/UIProcess/API/C/WKNotification.cpp [new file with mode: 0644]
Source/WebKit2/UIProcess/API/C/WKNotification.h [new file with mode: 0644]
Source/WebKit2/UIProcess/API/C/WKNotificationManager.cpp [new file with mode: 0644]
Source/WebKit2/UIProcess/API/C/WKNotificationManager.h [new file with mode: 0644]
Source/WebKit2/UIProcess/API/C/WKNotificationProvider.h [new file with mode: 0644]
Source/WebKit2/UIProcess/WebContext.cpp
Source/WebKit2/UIProcess/WebContext.h
Source/WebKit2/UIProcess/WebNotification.cpp [new file with mode: 0644]
Source/WebKit2/UIProcess/WebNotification.h [new file with mode: 0644]
Source/WebKit2/UIProcess/WebNotificationManagerProxy.cpp [new file with mode: 0644]
Source/WebKit2/UIProcess/WebNotificationManagerProxy.h [new file with mode: 0644]
Source/WebKit2/UIProcess/WebNotificationManagerProxy.messages.in [new file with mode: 0644]
Source/WebKit2/UIProcess/WebNotificationProvider.cpp [new file with mode: 0644]
Source/WebKit2/UIProcess/WebNotificationProvider.h [new file with mode: 0644]
Source/WebKit2/UIProcess/WebProcessProxy.cpp
Source/WebKit2/WebKit2.xcodeproj/project.pbxproj
Source/WebKit2/WebProcess/Notifications/WebNotificationManager.cpp [new file with mode: 0644]
Source/WebKit2/WebProcess/Notifications/WebNotificationManager.h [new file with mode: 0644]
Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp
Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h
Source/WebKit2/WebProcess/WebCoreSupport/WebNotificationClient.cpp [new file with mode: 0644]
Source/WebKit2/WebProcess/WebCoreSupport/WebNotificationClient.h [new file with mode: 0644]
Source/WebKit2/WebProcess/WebPage/WebPage.cpp
Source/WebKit2/WebProcess/WebPage/WebPage.h
Source/WebKit2/WebProcess/WebProcess.cpp
Source/WebKit2/WebProcess/WebProcess.h
Source/WebKit2/win/WebKit2.vcproj