Changeset 72101 in webkit
- Timestamp:
- Nov 16, 2010 8:28:14 AM (13 years ago)
- Location:
- trunk
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKit/qt/Api/qwebpage.cpp
r71806 r72101 2124 2124 #if ENABLE(NOTIFICATIONS) 2125 2125 if (policy == PermissionGranted) 2126 NotificationPresenterClientQt::notificationPresenter()->allowNotificationForFrame(frame );2126 NotificationPresenterClientQt::notificationPresenter()->allowNotificationForFrame(frame->d->frame); 2127 2127 #endif 2128 2128 break; -
trunk/WebKit/qt/Api/qwebpage.h
r71806 r72101 395 395 396 396 void requestPermissionFromUser(QWebFrame* frame, QWebPage::PermissionDomain domain); 397 void checkPermissionFromUser(QWebFrame* frame, QWebPage::PermissionDomain domain, QWebPage::PermissionPolicy& policy);398 397 void cancelRequestsForPermission(QWebFrame* frame, QWebPage::PermissionDomain domain); 399 398 -
trunk/WebKit/qt/ChangeLog
r72061 r72101 1 2010-11-16 Simon Hausmann <simon.hausmann@nokia.com> 2 3 Reviewed by Andreas Kling. 4 5 [Qt] Remove synchronous QWebPage::checkPermissions signal 6 https://bugs.webkit.org/show_bug.cgi?id=46810 7 8 As decided in the API review, we remove this signal and replace its only use currently 9 with cached credentials. 10 11 * Api/qwebpage.cpp: 12 (QWebPage::setUserPermission): Pass the WebCore frame instead of the QWebFrame. 13 * Api/qwebpage.h: 14 * WebCoreSupport/NotificationPresenterClientQt.cpp: 15 (WebCore::NotificationPresenterClientQt::checkPermission): Replaced explicit 16 signal emission with hash lookup of previously granted permission (or not). 17 (WebCore::NotificationPresenterClientQt::cancelRequestsForPermission): Remove 18 any previously cached/granted permission for the given script execution context. 19 (WebCore::NotificationPresenterClientQt::allowNotificationForFrame): Do not 20 only serve pending permission requests but before calling the JS callbacks, remember 21 the permission for subsequent synchronous checkPermission() calls. 22 * WebCoreSupport/NotificationPresenterClientQt.h: Add cache for permissions. 23 1 24 2010-11-15 Gavin Barraclough <barraclough@apple.com> 2 25 -
trunk/WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.cpp
r69143 r72101 336 336 NotificationPresenter::Permission NotificationPresenterClientQt::checkPermission(ScriptExecutionContext* context) 337 337 { 338 QWebPage::PermissionPolicy policy = QWebPage::PermissionUnknown; 339 if (toPage(context) && toFrame(context)) 340 emit toPage(context)->checkPermissionFromUser(toFrame(context), QWebPage::NotificationsPermissionDomain, policy); 341 342 switch (policy) { 343 case QWebPage::PermissionGranted: 344 return NotificationPresenter::PermissionAllowed; 345 case QWebPage::PermissionUnknown: 346 return NotificationPresenter::PermissionNotAllowed; 347 case QWebPage::PermissionDenied: 348 return NotificationPresenter::PermissionDenied; 349 } 350 ASSERT_NOT_REACHED(); 351 return NotificationPresenter::PermissionNotAllowed; 338 return m_cachedPermissions.value(context, NotificationPresenter::PermissionNotAllowed); 352 339 } 353 340 354 341 void NotificationPresenterClientQt::cancelRequestsForPermission(ScriptExecutionContext* context) 355 342 { 343 m_cachedPermissions.remove(context); 344 356 345 QHash<ScriptExecutionContext*, CallbacksInfo >::iterator iter = m_pendingPermissionRequests.find(context); 357 346 if (iter == m_pendingPermissionRequests.end()) … … 373 362 } 374 363 375 void NotificationPresenterClientQt::allowNotificationForFrame(QWebFrame* frame) 376 { 364 void NotificationPresenterClientQt::allowNotificationForFrame(Frame* frame) 365 { 366 m_cachedPermissions.insert(frame->document(), NotificationPresenter::PermissionAllowed); 367 377 368 QHash<ScriptExecutionContext*, CallbacksInfo>::iterator iter = m_pendingPermissionRequests.begin(); 378 369 while (iter != m_pendingPermissionRequests.end()) { 379 if ( toFrame(iter.key()) == frame)370 if (iter.key() == frame->document()) 380 371 break; 381 372 } -
trunk/WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.h
r67272 r72101 49 49 50 50 class Document; 51 class Frame; 51 52 class ScriptExecutionContext; 52 53 … … 96 97 void cancel(NotificationWrapper*); 97 98 98 void allowNotificationForFrame( QWebFrame*);99 void allowNotificationForFrame(Frame*); 99 100 100 101 static bool dumpNotification; … … 124 125 }; 125 126 QHash<ScriptExecutionContext*, CallbacksInfo > m_pendingPermissionRequests; 127 QHash<ScriptExecutionContext*, NotificationPresenter::Permission> m_cachedPermissions; 126 128 127 129 NotificationsQueue m_notifications; -
trunk/WebKitTools/ChangeLog
r72098 r72101 1 2010-11-16 Simon Hausmann <simon.hausmann@nokia.com> 2 3 Reviewed by Andreas Kling. 4 5 [Qt] Remove synchronous QWebPage::checkPermissions signal 6 https://bugs.webkit.org/show_bug.cgi?id=46810 7 8 * DumpRenderTree/qt/DumpRenderTreeQt.cpp: 9 (WebCore::WebPage::WebPage): 10 * DumpRenderTree/qt/LayoutTestControllerQt.cpp: 11 (LayoutTestController::grantDesktopNotificationPermission): When granting 12 permission, grant it directly on the QWebPage/Frame, that will remember it. 13 * QtTestBrowser/webpage.cpp: 14 (WebPage::WebPage): 15 * QtTestBrowser/webpage.h: 16 17 1 18 2010-11-16 Andras Becsi <abecsi@inf.u-szeged.hu> 2 19 -
trunk/WebKitTools/DumpRenderTree/qt/DumpRenderTreeQt.cpp
r69473 r72101 160 160 161 161 connect(this, SIGNAL(requestPermissionFromUser(QWebFrame*, QWebPage::PermissionDomain)), this, SLOT(requestPermission(QWebFrame*, QWebPage::PermissionDomain))); 162 connect(this, SIGNAL(checkPermissionFromUser(QWebFrame*, QWebPage::PermissionDomain, QWebPage::PermissionPolicy&)), this, SLOT(checkPermission(QWebFrame*, QWebPage::PermissionDomain, QWebPage::PermissionPolicy&)));163 162 connect(this, SIGNAL(cancelRequestsForPermission(QWebFrame*, QWebPage::PermissionDomain)), this, SLOT(cancelPermission(QWebFrame*, QWebPage::PermissionDomain))); 164 163 } … … 237 236 m_pendingGeolocationRequests.append(frame); 238 237 break; 239 default:240 break;241 }242 }243 244 void WebPage::checkPermission(QWebFrame* frame, QWebPage::PermissionDomain domain, QWebPage::PermissionPolicy& policy)245 {246 switch (domain) {247 case NotificationsPermissionDomain:248 {249 QUrl url = frame->url();250 policy = m_drt->layoutTestController()->checkDesktopNotificationPermission(url.scheme() + "://" + url.host()) ? PermissionGranted : PermissionDenied;251 break;252 }253 238 default: 254 239 break; -
trunk/WebKitTools/DumpRenderTree/qt/DumpRenderTreeQt.h
r68825 r72101 200 200 bool shouldInterruptJavaScript() { return false; } 201 201 void requestPermission(QWebFrame* frame, QWebPage::PermissionDomain domain); 202 void checkPermission(QWebFrame* frame, QWebPage::PermissionDomain domain, QWebPage::PermissionPolicy& policy);203 202 void cancelPermission(QWebFrame* frame, QWebPage::PermissionDomain domain); 204 203 -
trunk/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.cpp
r72098 r72101 198 198 void LayoutTestController::grantDesktopNotificationPermission(const QString& origin) 199 199 { 200 QWebFrame* frame = m_drt->webPage()->mainFrame(); 201 m_drt->webPage()->setUserPermission(frame, QWebPage::NotificationsPermissionDomain, QWebPage::PermissionGranted); 200 202 m_desktopNotificationAllowedOrigins.append(origin); 201 203 } -
trunk/WebKitTools/QtTestBrowser/webpage.cpp
r64297 r72101 52 52 this, SLOT(authenticationRequired(QNetworkReply*, QAuthenticator*))); 53 53 connect(this, SIGNAL(requestPermissionFromUser(QWebFrame*, QWebPage::PermissionDomain)), this, SLOT(requestPermission(QWebFrame*, QWebPage::PermissionDomain))); 54 connect(this, SIGNAL(checkPermissionFromUser(QWebFrame*, QWebPage::PermissionDomain, QWebPage::PermissionPolicy&)), this, SLOT(checkPermission(QWebFrame*, QWebPage::PermissionDomain, QWebPage::PermissionPolicy&)));55 54 connect(this, SIGNAL(cancelRequestsForPermission(QWebFrame*, QWebPage::PermissionDomain)), this, SLOT(cancelRequestsForPermission(QWebFrame*, QWebPage::PermissionDomain))); 56 55 } … … 172 171 { 173 172 setUserPermission(frame, domain, PermissionGranted); 174 }175 176 void WebPage::checkPermission(QWebFrame* frame, QWebPage::PermissionDomain domain, QWebPage::PermissionPolicy& policy)177 {178 switch (domain) {179 case NotificationsPermissionDomain:180 policy = PermissionGranted;181 break;182 default:183 break;184 }185 173 } 186 174 -
trunk/WebKitTools/QtTestBrowser/webpage.h
r63921 r72101 59 59 void authenticationRequired(QNetworkReply*, QAuthenticator*); 60 60 void requestPermission(QWebFrame* frame, QWebPage::PermissionDomain domain); 61 void checkPermission(QWebFrame* frame, QWebPage::PermissionDomain domain, QWebPage::PermissionPolicy& policy);62 61 void cancelRequestsForPermission(QWebFrame* frame, QWebPage::PermissionDomain domain); 63 62
Note: See TracChangeset
for help on using the changeset viewer.