[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

eric at webkit.org eric at webkit.org
Thu Apr 8 02:20:23 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit 04ca1559c39d7bb33fd77953564796a972b945e6
Author: eric at webkit.org <eric at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Mar 12 06:11:58 2010 +0000

    2010-03-11  Aaron Boodman  <aa at 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 at 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 at 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:
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@55888 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 7df6dd3..4cf6bf6 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,18 @@
+2010-03-11  Aaron Boodman  <aa at 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  Dmitry Titov  <dimich at chromium.org>
 
         Reviewed by David Levin.
diff --git a/WebCore/notifications/Notification.cpp b/WebCore/notifications/Notification.cpp
index ed30800..874d2f0 100644
--- a/WebCore/notifications/Notification.cpp
+++ b/WebCore/notifications/Notification.cpp
@@ -49,8 +49,7 @@ Notification::Notification(const String& url, ScriptExecutionContext* context, E
     , m_presenter(provider)
 {
     ASSERT(m_presenter);
-    Document* document = context->isDocument() ? static_cast<Document*>(context) : 0;
-    if (m_presenter->checkPermission(context->url(), document) != NotificationPresenter::PermissionAllowed) {
+    if (m_presenter->checkPermission(context->securityOrigin()) != NotificationPresenter::PermissionAllowed) {
         ec = SECURITY_ERR;
         return;
     }
@@ -70,8 +69,7 @@ Notification::Notification(const NotificationContents& contents, ScriptExecution
     , m_presenter(provider)
 {
     ASSERT(m_presenter);
-    Document* document = context->isDocument() ? static_cast<Document*>(context) : 0;
-    if (m_presenter->checkPermission(context->url(), document) != NotificationPresenter::PermissionAllowed) {
+    if (m_presenter->checkPermission(context->securityOrigin()) != NotificationPresenter::PermissionAllowed) {
         ec = SECURITY_ERR;
         return;
     }
diff --git a/WebCore/notifications/NotificationCenter.cpp b/WebCore/notifications/NotificationCenter.cpp
index ad9fbec..205b9a9 100644
--- a/WebCore/notifications/NotificationCenter.cpp
+++ b/WebCore/notifications/NotificationCenter.cpp
@@ -49,9 +49,7 @@ int NotificationCenter::checkPermission()
 {
     if (!presenter())
         return NotificationPresenter::PermissionDenied;
-    return m_notificationPresenter->checkPermission(
-        m_scriptExecutionContext->url(),
-        m_scriptExecutionContext->isDocument() ? static_cast<Document*>(m_scriptExecutionContext) : 0);
+    return m_notificationPresenter->checkPermission(m_scriptExecutionContext->securityOrigin());
 }
 
 void NotificationCenter::requestPermission(PassRefPtr<VoidCallback> callback)
diff --git a/WebCore/notifications/NotificationPresenter.h b/WebCore/notifications/NotificationPresenter.h
index 3df03bb..9abf8a9 100644
--- a/WebCore/notifications/NotificationPresenter.h
+++ b/WebCore/notifications/NotificationPresenter.h
@@ -71,10 +71,8 @@ namespace WebCore {
         // made a decision.
         virtual void requestPermission(SecurityOrigin*, PassRefPtr<VoidCallback>) = 0;
 
-        // Checks the current level of permission for the specified URL. If the
-        // URL is a document (as opposed to a worker or other ScriptExecutionContext),
-        // |document| will also be provided.
-        virtual Permission checkPermission(const KURL&, Document*) = 0;
+        // Checks the current level of permission.
+        virtual Permission checkPermission(SecurityOrigin*) = 0;
     };
 
 } // namespace WebCore
diff --git a/WebKit/chromium/ChangeLog b/WebKit/chromium/ChangeLog
index 8f9e909..0e45628 100644
--- a/WebKit/chromium/ChangeLog
+++ b/WebKit/chromium/ChangeLog
@@ -1,3 +1,19 @@
+2010-03-11  Aaron Boodman  <aa at 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  Stuart Morgan  <stuartmorgan at chromium.org>
 
         Reviewed by Darin Fisher.
diff --git a/WebKit/chromium/public/WebNotificationPresenter.h b/WebKit/chromium/public/WebNotificationPresenter.h
index a3764aa..73c3b56 100644
--- a/WebKit/chromium/public/WebNotificationPresenter.h
+++ b/WebKit/chromium/public/WebNotificationPresenter.h
@@ -31,13 +31,14 @@
 #ifndef WebNotificationPresenter_h
 #define WebNotificationPresenter_h
 
+#include "WebNotificationPermissionCallback.h"
+#include "WebSecurityOrigin.h"
 #include "WebString.h"
 
 namespace WebKit {
 
 class WebDocument;
 class WebNotification;
-class WebNotificationPermissionCallback;
 class WebURL;
 
 // Provides the services to show desktop notifications to the user.
@@ -59,14 +60,35 @@ public:
     // being destroyed.  Does _not_ remove the notification if being shown, but detaches it from receiving events.
     virtual void objectDestroyed(const WebNotification&) = 0;
 
+    // Checks the permission level for the given origin.
+    // FIXME: This should become abstract when the below is removed.
+    virtual Permission checkPermission(const WebSecurityOrigin& origin)
+    {
+        return PermissionNotAllowed;
+    };
+
     // Checks the permission level for the given URL. If the URL is being displayed in a document
     // (as opposed to a worker or other ScriptExecutionContext), |document| will also be provided.
-    virtual Permission checkPermission(const WebURL& url, WebDocument* document) = 0;
+    // FIXME: This method should be removed as clients don't need WebDocument anymore.
+    virtual Permission checkPermission(const WebURL& url, WebDocument* document)
+    {
+        return PermissionNotAllowed;
+    }
 
     // Requests permission for a given origin.  This operation is asynchronous and the callback provided
     // will be invoked when the permission decision is made.  Callback pointer must remain
     // valid until called.
-    virtual void requestPermission(const WebString& origin, WebNotificationPermissionCallback* callback) = 0;
+    // FIXME: This method should be removed when clients are moved to the below.
+    virtual void requestPermission(const WebString& origin, WebNotificationPermissionCallback* callback)
+    {
+        callback->permissionRequestComplete();
+    }
+    
+    // FIXME: This method should be abstract when the above is removed.
+    virtual void requestPermission(const WebSecurityOrigin& origin, WebNotificationPermissionCallback* callback)
+    {
+        callback->permissionRequestComplete();
+    }
 };
 
 } // namespace WebKit
diff --git a/WebKit/chromium/src/NotificationPresenterImpl.cpp b/WebKit/chromium/src/NotificationPresenterImpl.cpp
index a38b8b5..d0a7e39 100644
--- a/WebKit/chromium/src/NotificationPresenterImpl.cpp
+++ b/WebKit/chromium/src/NotificationPresenterImpl.cpp
@@ -33,11 +33,10 @@
 
 #if ENABLE(NOTIFICATIONS)
 
-#include "Document.h"
+#include "KURL.h"
 #include "Notification.h"
 #include "SecurityOrigin.h"
 
-#include "WebDocument.h"
 #include "WebNotification.h"
 #include "WebNotificationPermissionCallback.h"
 #include "WebNotificationPresenter.h"
@@ -92,19 +91,22 @@ void NotificationPresenterImpl::notificationObjectDestroyed(Notification* notifi
     m_presenter->objectDestroyed(PassRefPtr<Notification>(notification));
 }
 
-NotificationPresenter::Permission NotificationPresenterImpl::checkPermission(const KURL& url, Document* document)
+NotificationPresenter::Permission NotificationPresenterImpl::checkPermission(SecurityOrigin* origin)
 {
-    WebDocument webDocument;
-    if (document)
-        webDocument = document;
+    int result = m_presenter->checkPermission(WebSecurityOrigin(origin));
+
+    // FIXME: Remove this once clients are updated to use the above signature.
+    if (result == NotificationPresenter::PermissionNotAllowed)
+        result = m_presenter->checkPermission(KURL(KURL(), origin->toString()), 0);
 
-    int result = m_presenter->checkPermission(url, document ? &webDocument : 0);
     return static_cast<NotificationPresenter::Permission>(result);
 }
 
 void NotificationPresenterImpl::requestPermission(SecurityOrigin* origin, PassRefPtr<VoidCallback> callback)
 {
+    // FIXME: Remove the first call once clients are updated to use the second signature.
     m_presenter->requestPermission(origin->toString(), new VoidCallbackClient(callback));
+    m_presenter->requestPermission(WebSecurityOrigin(origin), new VoidCallbackClient(callback));
 }
 
 } // namespace WebKit
diff --git a/WebKit/chromium/src/NotificationPresenterImpl.h b/WebKit/chromium/src/NotificationPresenterImpl.h
index 8e3799c..4afe9dc 100644
--- a/WebKit/chromium/src/NotificationPresenterImpl.h
+++ b/WebKit/chromium/src/NotificationPresenterImpl.h
@@ -54,7 +54,7 @@ public:
     virtual bool show(WebCore::Notification* object);
     virtual void cancel(WebCore::Notification* object);
     virtual void notificationObjectDestroyed(WebCore::Notification* object);
-    virtual WebCore::NotificationPresenter::Permission checkPermission(const WebCore::KURL& url, WebCore::Document* document);
+    virtual WebCore::NotificationPresenter::Permission checkPermission(WebCore::SecurityOrigin* origin);
     virtual void requestPermission(WebCore::SecurityOrigin* origin, WTF::PassRefPtr<WebCore::VoidCallback> callback);
 
 private:
diff --git a/WebKit/chromium/src/WebDocument.cpp b/WebKit/chromium/src/WebDocument.cpp
index c56ef77..ac33d57 100644
--- a/WebKit/chromium/src/WebDocument.cpp
+++ b/WebKit/chromium/src/WebDocument.cpp
@@ -32,7 +32,6 @@
 #include "WebDocument.h"
 
 #include "Document.h"
-#include "DocumentLoader.h"
 #include "Element.h"
 #include "HTMLAllCollection.h"
 #include "HTMLBodyElement.h"
@@ -110,34 +109,6 @@ WebNodeList WebDocument::getElementsByTagName(const WebString& tag)
 
 WebString WebDocument::applicationID() const
 {
-    const char* kChromeApplicationHeader = "x-chrome-application";
-
-    // First check if the document's response included a header indicating the
-    // application it should go with.
-    const Document* document = constUnwrap<Document>();
-    Frame* frame = document->frame();
-    if (!frame)
-        return WebString();
-
-    DocumentLoader* loader = frame->loader()->documentLoader();
-    if (!loader)
-        return WebString();
-
-    WebString headerValue =
-        loader->response().httpHeaderField(kChromeApplicationHeader);
-    if (!headerValue.isEmpty())
-        return headerValue;
-
-    // Otherwise, fall back to looking for the meta tag.
-    RefPtr<NodeList> metaTags =
-        const_cast<Document*>(document)->getElementsByTagName("meta");
-    for (unsigned i = 0; i < metaTags->length(); ++i) {
-        Element* element = static_cast<Element*>(metaTags->item(i));
-        if (element->hasAttribute("http-equiv")
-            && element->getAttribute("http-equiv").lower() == kChromeApplicationHeader)
-            return element->getAttribute("value");
-    }
-
     return WebString();
 }
 
diff --git a/WebKit/win/ChangeLog b/WebKit/win/ChangeLog
index bf37332..e09ead3 100644
--- a/WebKit/win/ChangeLog
+++ b/WebKit/win/ChangeLog
@@ -1,3 +1,16 @@
+2010-03-11  Aaron Boodman  <aa at 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:
+
 2010-03-11  Anders Carlsson  <andersca at apple.com>
 
         Reviewed by David Hyatt.
diff --git a/WebKit/win/WebCoreSupport/WebDesktopNotificationsDelegate.cpp b/WebKit/win/WebCoreSupport/WebDesktopNotificationsDelegate.cpp
index 3f6eb07..4f80d10 100644
--- a/WebKit/win/WebCoreSupport/WebDesktopNotificationsDelegate.cpp
+++ b/WebKit/win/WebCoreSupport/WebDesktopNotificationsDelegate.cpp
@@ -174,8 +174,13 @@ void WebDesktopNotificationsDelegate::requestPermission(SecurityOrigin* origin,
 
 NotificationPresenter::Permission WebDesktopNotificationsDelegate::checkPermission(const KURL& url, Document*)
 {
+    return NotificationPresenter::PermissionNotAllowed;
+}
+
+NotificationPresenter::Permission WebDesktopNotificationsDelegate::checkPermission(SecurityOrigin* origin)
+{
     int out = 0;
-    BString org(SecurityOrigin::create(url)->toString());
+    BString org(origin->toString());
     if (hasNotificationDelegate())
         notificationDelegate()->checkNotificationPermission(org, &out);
     return (NotificationPresenter::Permission) out;
diff --git a/WebKit/win/WebCoreSupport/WebDesktopNotificationsDelegate.h b/WebKit/win/WebCoreSupport/WebDesktopNotificationsDelegate.h
index d30b1e7..bdaaf52 100644
--- a/WebKit/win/WebCoreSupport/WebDesktopNotificationsDelegate.h
+++ b/WebKit/win/WebCoreSupport/WebDesktopNotificationsDelegate.h
@@ -51,6 +51,7 @@ public:
     virtual void notificationObjectDestroyed(WebCore::Notification* object);
     virtual void requestPermission(WebCore::SecurityOrigin* origin, PassRefPtr<WebCore::VoidCallback> callback);
     virtual WebCore::NotificationPresenter::Permission checkPermission(const KURL& url, Document* document);
+    virtual WebCore::NotificationPresenter::Permission checkPermission(const WebCore::SecurityOrigin* origin);
 
 private:
     bool hasNotificationDelegate();

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list