Changeset 55888 in webkit


Ignore:
Timestamp:
Mar 11, 2010 10:11:58 PM (14 years ago)
Author:
eric@webkit.org
Message:

2010-03-11 Aaron Boodman <aa@chromium.org>

Kill WebDocument::applicationID() (part 1).

Modify interface to WebCore::NotificationPresenter::checkPermission()
and remove implementation of WebDocument::applicationID(). Breaking
API changes will be in a subsequent change.
https://bugs.webkit.org/show_bug.cgi?id=35846

  • notifications/Notification.cpp: (WebCore::Notification::Notification):
  • notifications/NotificationCenter.cpp: (WebCore::NotificationCenter::checkPermission):
  • notifications/NotificationPresenter.h:

2010-03-11 Aaron Boodman <aa@chromium.org>

Kill WebDocument::applicationID() (part 1).

Modify interface to WebCore::NotificationPresenter::checkPermission()
and remove implementation of WebDocument::applicationID(). Breaking
API changes will be in a subsequent change.
https://bugs.webkit.org/show_bug.cgi?id=35846

  • public/WebNotificationPresenter.h:
  • src/NotificationPresenterImpl.cpp: (WebKit::NotificationPresenterImpl::checkPermission):
  • src/NotificationPresenterImpl.h:
  • src/WebDocument.cpp: (WebKit::WebDocument::applicationID):

2010-03-11 Aaron Boodman <aa@chromium.org>

Kill WebDocument::applicationID() (part 1).

Modify interface to WebCore::NotificationPresenter::checkPermission()
and remove implementation of WebDocument::applicationID(). Breaking
API changes will be in a subsequent change.
https://bugs.webkit.org/show_bug.cgi?id=35846

  • WebCoreSupport/WebDesktopNotificationsDelegate.cpp: (WebDesktopNotificationsDelegate::checkPermission):
  • WebCoreSupport/WebDesktopNotificationsDelegate.h:
Location:
trunk
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r55882 r55888  
     12010-03-11  Aaron Boodman  <aa@chromium.org>
     2
     3        Kill WebDocument::applicationID() (part 1).
     4
     5        Modify interface to WebCore::NotificationPresenter::checkPermission()
     6        and remove implementation of WebDocument::applicationID(). Breaking
     7        API changes will be in a subsequent change.
     8        https://bugs.webkit.org/show_bug.cgi?id=35846
     9
     10        * notifications/Notification.cpp:
     11        (WebCore::Notification::Notification):
     12        * notifications/NotificationCenter.cpp:
     13        (WebCore::NotificationCenter::checkPermission):
     14        * notifications/NotificationPresenter.h:
     15
    1162010-03-11  Dmitry Titov  <dimich@chromium.org>
    217
  • trunk/WebCore/notifications/Notification.cpp

    r54015 r55888  
    5050{
    5151    ASSERT(m_presenter);
    52     Document* document = context->isDocument() ? static_cast<Document*>(context) : 0;
    53     if (m_presenter->checkPermission(context->url(), document) != NotificationPresenter::PermissionAllowed) {
     52    if (m_presenter->checkPermission(context->securityOrigin()) != NotificationPresenter::PermissionAllowed) {
    5453        ec = SECURITY_ERR;
    5554        return;
     
    7170{
    7271    ASSERT(m_presenter);
    73     Document* document = context->isDocument() ? static_cast<Document*>(context) : 0;
    74     if (m_presenter->checkPermission(context->url(), document) != NotificationPresenter::PermissionAllowed) {
     72    if (m_presenter->checkPermission(context->securityOrigin()) != NotificationPresenter::PermissionAllowed) {
    7573        ec = SECURITY_ERR;
    7674        return;
  • trunk/WebCore/notifications/NotificationCenter.cpp

    r54015 r55888  
    5050    if (!presenter())
    5151        return NotificationPresenter::PermissionDenied;
    52     return m_notificationPresenter->checkPermission(
    53         m_scriptExecutionContext->url(),
    54         m_scriptExecutionContext->isDocument() ? static_cast<Document*>(m_scriptExecutionContext) : 0);
     52    return m_notificationPresenter->checkPermission(m_scriptExecutionContext->securityOrigin());
    5553}
    5654
  • trunk/WebCore/notifications/NotificationPresenter.h

    r54015 r55888  
    7272        virtual void requestPermission(SecurityOrigin*, PassRefPtr<VoidCallback>) = 0;
    7373
    74         // Checks the current level of permission for the specified URL. If the
    75         // URL is a document (as opposed to a worker or other ScriptExecutionContext),
    76         // |document| will also be provided.
    77         virtual Permission checkPermission(const KURL&, Document*) = 0;
     74        // Checks the current level of permission.
     75        virtual Permission checkPermission(SecurityOrigin*) = 0;
    7876    };
    7977
  • trunk/WebKit/chromium/ChangeLog

    r55877 r55888  
     12010-03-11  Aaron Boodman  <aa@chromium.org>
     2
     3        Kill WebDocument::applicationID() (part 1).
     4
     5        Modify interface to WebCore::NotificationPresenter::checkPermission()
     6        and remove implementation of WebDocument::applicationID(). Breaking
     7        API changes will be in a subsequent change.
     8        https://bugs.webkit.org/show_bug.cgi?id=35846
     9
     10        * public/WebNotificationPresenter.h:
     11        * src/NotificationPresenterImpl.cpp:
     12        (WebKit::NotificationPresenterImpl::checkPermission):
     13        * src/NotificationPresenterImpl.h:
     14        * src/WebDocument.cpp:
     15        (WebKit::WebDocument::applicationID):
     16
    1172010-03-11  Stuart Morgan  <stuartmorgan@chromium.org>
    218
  • trunk/WebKit/chromium/public/WebNotificationPresenter.h

    r54015 r55888  
    3232#define WebNotificationPresenter_h
    3333
     34#include "WebNotificationPermissionCallback.h"
     35#include "WebSecurityOrigin.h"
    3436#include "WebString.h"
    3537
     
    3840class WebDocument;
    3941class WebNotification;
    40 class WebNotificationPermissionCallback;
    4142class WebURL;
    4243
     
    6061    virtual void objectDestroyed(const WebNotification&) = 0;
    6162
     63    // Checks the permission level for the given origin.
     64    // FIXME: This should become abstract when the below is removed.
     65    virtual Permission checkPermission(const WebSecurityOrigin& origin)
     66    {
     67        return PermissionNotAllowed;
     68    };
     69
    6270    // Checks the permission level for the given URL. If the URL is being displayed in a document
    6371    // (as opposed to a worker or other ScriptExecutionContext), |document| will also be provided.
    64     virtual Permission checkPermission(const WebURL& url, WebDocument* document) = 0;
     72    // FIXME: This method should be removed as clients don't need WebDocument anymore.
     73    virtual Permission checkPermission(const WebURL& url, WebDocument* document)
     74    {
     75        return PermissionNotAllowed;
     76    }
    6577
    6678    // Requests permission for a given origin.  This operation is asynchronous and the callback provided
    6779    // will be invoked when the permission decision is made.  Callback pointer must remain
    6880    // valid until called.
    69     virtual void requestPermission(const WebString& origin, WebNotificationPermissionCallback* callback) = 0;
     81    // FIXME: This method should be removed when clients are moved to the below.
     82    virtual void requestPermission(const WebString& origin, WebNotificationPermissionCallback* callback)
     83    {
     84        callback->permissionRequestComplete();
     85    }
     86   
     87    // FIXME: This method should be abstract when the above is removed.
     88    virtual void requestPermission(const WebSecurityOrigin& origin, WebNotificationPermissionCallback* callback)
     89    {
     90        callback->permissionRequestComplete();
     91    }
    7092};
    7193
  • trunk/WebKit/chromium/src/NotificationPresenterImpl.cpp

    r54015 r55888  
    3434#if ENABLE(NOTIFICATIONS)
    3535
    36 #include "Document.h"
     36#include "KURL.h"
    3737#include "Notification.h"
    3838#include "SecurityOrigin.h"
    3939
    40 #include "WebDocument.h"
    4140#include "WebNotification.h"
    4241#include "WebNotificationPermissionCallback.h"
     
    9392}
    9493
    95 NotificationPresenter::Permission NotificationPresenterImpl::checkPermission(const KURL& url, Document* document)
     94NotificationPresenter::Permission NotificationPresenterImpl::checkPermission(SecurityOrigin* origin)
    9695{
    97     WebDocument webDocument;
    98     if (document)
    99         webDocument = document;
     96    int result = m_presenter->checkPermission(WebSecurityOrigin(origin));
    10097
    101     int result = m_presenter->checkPermission(url, document ? &webDocument : 0);
     98    // FIXME: Remove this once clients are updated to use the above signature.
     99    if (result == NotificationPresenter::PermissionNotAllowed)
     100        result = m_presenter->checkPermission(KURL(KURL(), origin->toString()), 0);
     101
    102102    return static_cast<NotificationPresenter::Permission>(result);
    103103}
     
    105105void NotificationPresenterImpl::requestPermission(SecurityOrigin* origin, PassRefPtr<VoidCallback> callback)
    106106{
     107    // FIXME: Remove the first call once clients are updated to use the second signature.
    107108    m_presenter->requestPermission(origin->toString(), new VoidCallbackClient(callback));
     109    m_presenter->requestPermission(WebSecurityOrigin(origin), new VoidCallbackClient(callback));
    108110}
    109111
  • trunk/WebKit/chromium/src/NotificationPresenterImpl.h

    r54015 r55888  
    5555    virtual void cancel(WebCore::Notification* object);
    5656    virtual void notificationObjectDestroyed(WebCore::Notification* object);
    57     virtual WebCore::NotificationPresenter::Permission checkPermission(const WebCore::KURL& url, WebCore::Document* document);
     57    virtual WebCore::NotificationPresenter::Permission checkPermission(WebCore::SecurityOrigin* origin);
    5858    virtual void requestPermission(WebCore::SecurityOrigin* origin, WTF::PassRefPtr<WebCore::VoidCallback> callback);
    5959
  • trunk/WebKit/chromium/src/WebDocument.cpp

    r55866 r55888  
    3333
    3434#include "Document.h"
    35 #include "DocumentLoader.h"
    3635#include "Element.h"
    3736#include "HTMLAllCollection.h"
     
    111110WebString WebDocument::applicationID() const
    112111{
    113     const char* kChromeApplicationHeader = "x-chrome-application";
    114 
    115     // First check if the document's response included a header indicating the
    116     // application it should go with.
    117     const Document* document = constUnwrap<Document>();
    118     Frame* frame = document->frame();
    119     if (!frame)
    120         return WebString();
    121 
    122     DocumentLoader* loader = frame->loader()->documentLoader();
    123     if (!loader)
    124         return WebString();
    125 
    126     WebString headerValue =
    127         loader->response().httpHeaderField(kChromeApplicationHeader);
    128     if (!headerValue.isEmpty())
    129         return headerValue;
    130 
    131     // Otherwise, fall back to looking for the meta tag.
    132     RefPtr<NodeList> metaTags =
    133         const_cast<Document*>(document)->getElementsByTagName("meta");
    134     for (unsigned i = 0; i < metaTags->length(); ++i) {
    135         Element* element = static_cast<Element*>(metaTags->item(i));
    136         if (element->hasAttribute("http-equiv")
    137             && element->getAttribute("http-equiv").lower() == kChromeApplicationHeader)
    138             return element->getAttribute("value");
    139     }
    140 
    141112    return WebString();
    142113}
  • trunk/WebKit/win/ChangeLog

    r55864 r55888  
     12010-03-11  Aaron Boodman  <aa@chromium.org>
     2
     3        Kill WebDocument::applicationID() (part 1).
     4
     5        Modify interface to WebCore::NotificationPresenter::checkPermission()
     6        and remove implementation of WebDocument::applicationID(). Breaking
     7        API changes will be in a subsequent change.
     8        https://bugs.webkit.org/show_bug.cgi?id=35846
     9
     10        * WebCoreSupport/WebDesktopNotificationsDelegate.cpp:
     11        (WebDesktopNotificationsDelegate::checkPermission):
     12        * WebCoreSupport/WebDesktopNotificationsDelegate.h:
     13
    1142010-03-11  Anders Carlsson  <andersca@apple.com>
    215
  • trunk/WebKit/win/WebCoreSupport/WebDesktopNotificationsDelegate.cpp

    r54015 r55888  
    175175NotificationPresenter::Permission WebDesktopNotificationsDelegate::checkPermission(const KURL& url, Document*)
    176176{
     177    return NotificationPresenter::PermissionNotAllowed;
     178}
     179
     180NotificationPresenter::Permission WebDesktopNotificationsDelegate::checkPermission(SecurityOrigin* origin)
     181{
    177182    int out = 0;
    178     BString org(SecurityOrigin::create(url)->toString());
     183    BString org(origin->toString());
    179184    if (hasNotificationDelegate())
    180185        notificationDelegate()->checkNotificationPermission(org, &out);
  • trunk/WebKit/win/WebCoreSupport/WebDesktopNotificationsDelegate.h

    r54015 r55888  
    5252    virtual void requestPermission(WebCore::SecurityOrigin* origin, PassRefPtr<WebCore::VoidCallback> callback);
    5353    virtual WebCore::NotificationPresenter::Permission checkPermission(const KURL& url, Document* document);
     54    virtual WebCore::NotificationPresenter::Permission checkPermission(const WebCore::SecurityOrigin* origin);
    5455
    5556private:
Note: See TracChangeset for help on using the changeset viewer.