Changeset 47084 in webkit


Ignore:
Timestamp:
Aug 11, 2009 8:30:17 PM (15 years ago)
Author:
mrowe@apple.com
Message:

2009-08-11 John Gregg <johnnyg@google.com>

Reviewed by Maciej Stachowiak.

WebCore:
Move the accessor for notifications presenter from WebUIDelegate
to WebUIDelegate2 which extends it. When making this call from
WebCoreSupport, check using QueryInterface before calling.

https://bugs.webkit.org/show_bug.cgi?id=28198

  • Interfaces/IWebUIDelegate.idl:
  • Interfaces/IWebUIDelegate2.idl: Added.
  • Interfaces/WebKit.idl:
  • WebCoreSupport/WebDesktopNotificationsDelegate.cpp:

(WebDesktopNotificationsDelegate::show):
(WebDesktopNotificationsDelegate::cancel):
(WebDesktopNotificationsDelegate::notificationObjectDestroyed):
(WebDesktopNotificationsDelegate::requestPermission):
(WebDesktopNotificationsDelegate::checkPermission):
(WebDesktopNotificationsDelegate::hasNotificationDelegate):
(WebDesktopNotificationsDelegate::notificationDelegate):

  • WebCoreSupport/WebDesktopNotificationsDelegate.h:

DumpRenderTree:
Switch DumpRenderTree to contain a WebUIDelegate2, which extends
WebUIDelegate, so that the notifications tests will still work.
https://bugs.webkit.org/show_bug.cgi?id=28198

  • DumpRenderTree/win/UIDelegate.h:
Location:
trunk
Files:
7 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/WebKit/win/ChangeLog

    r47064 r47084  
     12009-08-11  John Gregg  <johnnyg@google.com>
     2
     3        Reviewed by Maciej Stachowiak.
     4
     5        Move the accessor for notifications presenter from WebUIDelegate
     6        to WebUIDelegate2 which extends it.  When making this call from
     7        WebCoreSupport, check using QueryInterface before calling.
     8
     9        https://bugs.webkit.org/show_bug.cgi?id=28198
     10
     11        * Interfaces/IWebUIDelegate.idl:
     12        * Interfaces/IWebUIDelegate2.idl: Added.
     13        * Interfaces/WebKit.idl:
     14        * WebCoreSupport/WebDesktopNotificationsDelegate.cpp:
     15        (WebDesktopNotificationsDelegate::show):
     16        (WebDesktopNotificationsDelegate::cancel):
     17        (WebDesktopNotificationsDelegate::notificationObjectDestroyed):
     18        (WebDesktopNotificationsDelegate::requestPermission):
     19        (WebDesktopNotificationsDelegate::checkPermission):
     20        (WebDesktopNotificationsDelegate::hasNotificationDelegate):
     21        (WebDesktopNotificationsDelegate::notificationDelegate):
     22        * WebCoreSupport/WebDesktopNotificationsDelegate.h:
     23
    1242009-08-11  Drew Wilson  <atwilson@google.com>
    225
  • trunk/WebKit/win/Interfaces/IWebUIDelegate.idl

    r47056 r47084  
    756756                                 [in] WebScrollbarControlPart pressedPart, [in] BOOL vertical, [in] float value, [in] float proportion, [in] WebScrollbarControlPartMask parts);
    757757    HRESULT paintCustomScrollCorner([in] IWebView* webView, [in] HDC hDC, [in] RECT rect);
    758 
    759     HRESULT desktopNotificationsDelegate([out, retval] IWebDesktopNotificationsDelegate** result);
    760758}
  • trunk/WebKit/win/Interfaces/IWebUIDelegate2.idl

    r47083 r47084  
    2929 */
    3030
    31 #include <WebCore/COMPtr.h>
    32 #include <WebCore/Notification.h>
    33 #include <WebCore/NotificationPresenter.h>
     31#ifndef DO_NO_IMPORTS
     32import "oaidl.idl";
     33import "ocidl.idl";
     34#endif
    3435
    35 #if ENABLE(NOTIFICATIONS)
     36/*!
     37    @category WebUIDelegate2
     38    @discussion An extension of WebUIDelegate which additionally
     39    provides access to a notification presenter.
     40    @interface NSObject (WebUIDelegate2)
     41*/
     42[
     43    object,
     44    oleautomation,
     45    uuid(C6DEF152-86CD-11de-8BF4-ADD456D89593),
     46    pointer_default(unique)
     47]
    3648
    37 interface IWebDesktopNotificationPresenter;
    38 
    39 class WebDesktopNotificationsDelegate : public WebCore::NotificationPresenter {
    40 public:
    41     WebDesktopNotificationsDelegate(WebView* view);
    42 
    43     /* WebCore::NotificationPresenter interface */
    44     virtual bool show(WebCore::Notification* object);
    45     virtual void cancel(WebCore::Notification* object);
    46     virtual void notificationObjectDestroyed(WebCore::Notification* object);
    47     virtual void requestPermission(WebCore::SecurityOrigin* origin, PassRefPtr<WebCore::VoidCallback> callback);
    48     virtual WebCore::NotificationPresenter::Permission checkPermission(WebCore::SecurityOrigin* origin);
    49 
    50 private:
    51     COMPtr<IWebDesktopNotificationsDelegate> notificationDelegate();
    52    
    53     WebView* m_webView;
    54 };
    55 
    56 #endif
     49interface IWebUIDelegate2 : IWebUIDelegate
     50{
     51    /*!
     52        @method desktopNotificationsDelegate:
     53        @abstract Returns the notifications delegate object.
     54    */
     55    HRESULT desktopNotificationsDelegate([out, retval] IWebDesktopNotificationsDelegate** result);
     56}
  • trunk/WebKit/win/Interfaces/WebKit.idl

    r47056 r47084  
    113113#include "IWebTextRenderer.idl"
    114114#include "IWebUIDelegate.idl"
     115#include "IWebUIDelegate2.idl"
    115116#include "IWebUIDelegatePrivate.idl"
    116117#include "IWebURLAuthenticationChallenge.idl"
  • trunk/WebKit/win/WebCoreSupport/WebDesktopNotificationsDelegate.cpp

    r47056 r47084  
    147147bool WebDesktopNotificationsDelegate::show(Notification* object)
    148148{
    149     notificationDelegate()->showDesktopNotification(NotificationCOMWrapper::create(object));
     149    if (hasNotificationDelegate())
     150        notificationDelegate()->showDesktopNotification(NotificationCOMWrapper::create(object));
    150151    return true;
    151152}
     
    153154void WebDesktopNotificationsDelegate::cancel(Notification* object)
    154155{
    155     notificationDelegate()->cancelDesktopNotification(NotificationCOMWrapper::create(object));
     156    if (hasNotificationDelegate())
     157        notificationDelegate()->cancelDesktopNotification(NotificationCOMWrapper::create(object));
    156158}
    157159
    158160void WebDesktopNotificationsDelegate::notificationObjectDestroyed(Notification* object)
    159161{
    160     notificationDelegate()->notificationDestroyed(NotificationCOMWrapper::create(object));
     162    if (hasNotificationDelegate())
     163        notificationDelegate()->notificationDestroyed(NotificationCOMWrapper::create(object));
    161164}
    162165
     
    164167{
    165168    BString org(origin->toString());
    166     notificationDelegate()->requestNotificationPermission(org);
     169    if (hasNotificationDelegate())
     170        notificationDelegate()->requestNotificationPermission(org);
    167171}
    168172
    169173NotificationPresenter::Permission WebDesktopNotificationsDelegate::checkPermission(SecurityOrigin* origin)
    170 { 
    171     int out;
     174{
     175    int out = 0;
    172176    BString org(origin->toString());
    173     notificationDelegate()->checkNotificationPermission(org, &out);
     177    if (hasNotificationDelegate())
     178        notificationDelegate()->checkNotificationPermission(org, &out);
    174179    return (NotificationPresenter::Permission) out;
    175180}
    176181
    177 COMPtr<IWebDesktopNotificationsDelegate> WebDesktopNotificationsDelegate::notificationDelegate()
     182bool WebDesktopNotificationsDelegate::hasNotificationDelegate()
    178183{
    179184    COMPtr<IWebUIDelegate> ui;
    180185    m_webView->uiDelegate(&ui);
    181    
     186
     187    COMPtr<IWebUIDelegate2> ui2;
     188    if (SUCCEEDED(ui->QueryInterface(IID_IWebUIDelegate2, &ui2)))
     189        return true;
     190}
     191
     192COMPtr<IWebDesktopNotificationsDelegate> WebDesktopNotificationsDelegate::notificationDelegate()
     193{
     194    COMPtr<IWebUIDelegate> ui;
     195    m_webView->uiDelegate(&ui);
     196
     197    COMPtr<IWebUIDelegate2> ui2;
    182198    COMPtr<IWebDesktopNotificationsDelegate> delegate;
    183     ui->desktopNotificationsDelegate(&delegate);
    184    
     199    if (SUCCEEDED(ui->QueryInterface(IID_IWebUIDelegate2, &ui2)))
     200        ui2->desktopNotificationsDelegate(&delegate);
     201
    185202    return delegate;
    186203}
  • trunk/WebKit/win/WebCoreSupport/WebDesktopNotificationsDelegate.h

    r47063 r47084  
    4949
    5050private:
     51    bool hasNotificationDelegate();
    5152    COMPtr<IWebDesktopNotificationsDelegate> notificationDelegate();
    52    
     53
    5354    WebView* m_webView;
    5455};
  • trunk/WebKitTools/ChangeLog

    r47080 r47084  
     12009-08-11  John Gregg  <johnnyg@google.com>
     2
     3        Reviewed by Maciej Stachowiak.
     4
     5        Switch DumpRenderTree to contain a WebUIDelegate2, which extends
     6        WebUIDelegate, so that the notifications tests will still work.
     7        https://bugs.webkit.org/show_bug.cgi?id=28198
     8
     9        * DumpRenderTree/win/UIDelegate.h:
     10
    1112009-08-11  Darin Adler  <darin@apple.com>
    212
  • trunk/WebKitTools/DumpRenderTree/win/UIDelegate.h

    r47056 r47084  
    3838class DRTDesktopNotificationPresenter;
    3939
    40 class UIDelegate : public IWebUIDelegate, IWebUIDelegatePrivate {
     40class UIDelegate : public IWebUIDelegate2, IWebUIDelegatePrivate {
    4141public:
    4242    UIDelegate();
Note: See TracChangeset for help on using the changeset viewer.