Changeset 55888 in webkit
- Timestamp:
- Mar 11, 2010 10:11:58 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r55882 r55888 1 2010-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 1 16 2010-03-11 Dmitry Titov <dimich@chromium.org> 2 17 -
trunk/WebCore/notifications/Notification.cpp
r54015 r55888 50 50 { 51 51 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) { 54 53 ec = SECURITY_ERR; 55 54 return; … … 71 70 { 72 71 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) { 75 73 ec = SECURITY_ERR; 76 74 return; -
trunk/WebCore/notifications/NotificationCenter.cpp
r54015 r55888 50 50 if (!presenter()) 51 51 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()); 55 53 } 56 54 -
trunk/WebCore/notifications/NotificationPresenter.h
r54015 r55888 72 72 virtual void requestPermission(SecurityOrigin*, PassRefPtr<VoidCallback>) = 0; 73 73 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; 78 76 }; 79 77 -
trunk/WebKit/chromium/ChangeLog
r55877 r55888 1 2010-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 1 17 2010-03-11 Stuart Morgan <stuartmorgan@chromium.org> 2 18 -
trunk/WebKit/chromium/public/WebNotificationPresenter.h
r54015 r55888 32 32 #define WebNotificationPresenter_h 33 33 34 #include "WebNotificationPermissionCallback.h" 35 #include "WebSecurityOrigin.h" 34 36 #include "WebString.h" 35 37 … … 38 40 class WebDocument; 39 41 class WebNotification; 40 class WebNotificationPermissionCallback;41 42 class WebURL; 42 43 … … 60 61 virtual void objectDestroyed(const WebNotification&) = 0; 61 62 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 62 70 // Checks the permission level for the given URL. If the URL is being displayed in a document 63 71 // (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 } 65 77 66 78 // Requests permission for a given origin. This operation is asynchronous and the callback provided 67 79 // will be invoked when the permission decision is made. Callback pointer must remain 68 80 // 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 } 70 92 }; 71 93 -
trunk/WebKit/chromium/src/NotificationPresenterImpl.cpp
r54015 r55888 34 34 #if ENABLE(NOTIFICATIONS) 35 35 36 #include " Document.h"36 #include "KURL.h" 37 37 #include "Notification.h" 38 38 #include "SecurityOrigin.h" 39 39 40 #include "WebDocument.h"41 40 #include "WebNotification.h" 42 41 #include "WebNotificationPermissionCallback.h" … … 93 92 } 94 93 95 NotificationPresenter::Permission NotificationPresenterImpl::checkPermission( const KURL& url, Document* document)94 NotificationPresenter::Permission NotificationPresenterImpl::checkPermission(SecurityOrigin* origin) 96 95 { 97 WebDocument webDocument; 98 if (document) 99 webDocument = document; 96 int result = m_presenter->checkPermission(WebSecurityOrigin(origin)); 100 97 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 102 102 return static_cast<NotificationPresenter::Permission>(result); 103 103 } … … 105 105 void NotificationPresenterImpl::requestPermission(SecurityOrigin* origin, PassRefPtr<VoidCallback> callback) 106 106 { 107 // FIXME: Remove the first call once clients are updated to use the second signature. 107 108 m_presenter->requestPermission(origin->toString(), new VoidCallbackClient(callback)); 109 m_presenter->requestPermission(WebSecurityOrigin(origin), new VoidCallbackClient(callback)); 108 110 } 109 111 -
trunk/WebKit/chromium/src/NotificationPresenterImpl.h
r54015 r55888 55 55 virtual void cancel(WebCore::Notification* object); 56 56 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); 58 58 virtual void requestPermission(WebCore::SecurityOrigin* origin, WTF::PassRefPtr<WebCore::VoidCallback> callback); 59 59 -
trunk/WebKit/chromium/src/WebDocument.cpp
r55866 r55888 33 33 34 34 #include "Document.h" 35 #include "DocumentLoader.h"36 35 #include "Element.h" 37 36 #include "HTMLAllCollection.h" … … 111 110 WebString WebDocument::applicationID() const 112 111 { 113 const char* kChromeApplicationHeader = "x-chrome-application";114 115 // First check if the document's response included a header indicating the116 // 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 141 112 return WebString(); 142 113 } -
trunk/WebKit/win/ChangeLog
r55864 r55888 1 2010-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 1 14 2010-03-11 Anders Carlsson <andersca@apple.com> 2 15 -
trunk/WebKit/win/WebCoreSupport/WebDesktopNotificationsDelegate.cpp
r54015 r55888 175 175 NotificationPresenter::Permission WebDesktopNotificationsDelegate::checkPermission(const KURL& url, Document*) 176 176 { 177 return NotificationPresenter::PermissionNotAllowed; 178 } 179 180 NotificationPresenter::Permission WebDesktopNotificationsDelegate::checkPermission(SecurityOrigin* origin) 181 { 177 182 int out = 0; 178 BString org( SecurityOrigin::create(url)->toString());183 BString org(origin->toString()); 179 184 if (hasNotificationDelegate()) 180 185 notificationDelegate()->checkNotificationPermission(org, &out); -
trunk/WebKit/win/WebCoreSupport/WebDesktopNotificationsDelegate.h
r54015 r55888 52 52 virtual void requestPermission(WebCore::SecurityOrigin* origin, PassRefPtr<WebCore::VoidCallback> callback); 53 53 virtual WebCore::NotificationPresenter::Permission checkPermission(const KURL& url, Document* document); 54 virtual WebCore::NotificationPresenter::Permission checkPermission(const WebCore::SecurityOrigin* origin); 54 55 55 56 private:
Note: See TracChangeset
for help on using the changeset viewer.