Changeset 72601 in webkit


Ignore:
Timestamp:
Nov 23, 2010 6:23:24 AM (13 years ago)
Author:
Simon Hausmann
Message:

[Qt] Review the setUserPermission & friends API
https://bugs.webkit.org/show_bug.cgi?id=46810

Reviewed by Tor Arne Vestbø.

Rename PermissionDomain to Feature, NotificationsPermissionDomain to Notifications
and GeolocationPermissionDomain to Geolocation.

WebKit/qt:

  • Api/qwebpage.cpp:

(QWebPage::setUserPermission):

  • Api/qwebpage.h:
  • WebCoreSupport/GeolocationPermissionClientQt.cpp:

(WebCore::GeolocationPermissionClientQt::requestGeolocationPermissionForFrame):
(WebCore::GeolocationPermissionClientQt::cancelGeolocationPermissionRequestForFrame):

  • WebCoreSupport/NotificationPresenterClientQt.cpp:

(WebCore::NotificationPresenterClientQt::requestPermission):
(WebCore::NotificationPresenterClientQt::cancelRequestsForPermission):

  • tests/qwebpage/tst_qwebpage.cpp:

(JSTestPage::requestPermission):
(tst_QWebPage::geolocationRequestJS):

WebKitTools:

  • DumpRenderTree/qt/DumpRenderTreeQt.cpp:

(WebCore::WebPage::WebPage):
(WebCore::WebPage::requestPermission):
(WebCore::WebPage::cancelPermission):
(WebCore::WebPage::permissionSet):
(WebCore::DumpRenderTree::geolocationPermissionSet):

  • DumpRenderTree/qt/DumpRenderTreeQt.h:
  • DumpRenderTree/qt/LayoutTestControllerQt.cpp:

(LayoutTestController::grantDesktopNotificationPermission):

  • QtTestBrowser/webpage.cpp:

(WebPage::WebPage):
(WebPage::requestPermission):
(WebPage::cancelRequestsForPermission):

  • QtTestBrowser/webpage.h:
Location:
trunk
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKit/qt/Api/qwebpage.cpp

    r72600 r72601  
    21122112}
    21132113
    2114 void QWebPage::setUserPermission(QWebFrame* frame, PermissionDomain domain, PermissionPolicy policy)
    2115 {
    2116     switch (domain) {
    2117     case NotificationsPermissionDomain:
     2114void QWebPage::setUserPermission(QWebFrame* frame, Feature feature, PermissionPolicy policy)
     2115{
     2116    switch (feature) {
     2117    case Notifications:
    21182118#if ENABLE(NOTIFICATIONS)
    21192119        if (policy == PermissionGrantedByUser)
     
    21212121#endif
    21222122        break;
    2123     case GeolocationPermissionDomain:
     2123    case Geolocation:
    21242124#if ENABLE(GEOLOCATION)
    21252125        GeolocationPermissionClientQt::geolocationPermissionClient()->setPermission(frame, policy);
  • trunk/WebKit/qt/Api/qwebpage.h

    r72600 r72601  
    204204    };
    205205
    206     enum PermissionDomain {
    207         NotificationsPermissionDomain,
    208         GeolocationPermissionDomain
     206    enum Feature {
     207        Notifications,
     208        Geolocation
    209209    };
    210210
     
    309309    QMenu *createStandardContextMenu();
    310310
    311     void setUserPermission(QWebFrame* frame, PermissionDomain domain, PermissionPolicy policy);
     311    void setUserPermission(QWebFrame* frame, Feature feature, PermissionPolicy policy);
    312312
    313313    QStringList supportedContentTypes() const;
     
    394394    void viewportChangeRequested();
    395395
    396     void requestPermissionFromUser(QWebFrame* frame, QWebPage::PermissionDomain domain);
    397     void cancelRequestsForPermission(QWebFrame* frame, QWebPage::PermissionDomain domain);
     396    void requestPermissionFromUser(QWebFrame* frame, QWebPage::Feature feature);
     397    void cancelRequestsForPermission(QWebFrame* frame, QWebPage::Feature feature);
    398398
    399399protected:
  • trunk/WebKit/qt/ChangeLog

    r72600 r72601  
     12010-11-23  Simon Hausmann  <simon.hausmann@nokia.com>
     2
     3        Reviewed by Tor Arne Vestbø.
     4
     5        [Qt] Review the setUserPermission & friends API
     6        https://bugs.webkit.org/show_bug.cgi?id=46810
     7
     8        Rename PermissionDomain to Feature, NotificationsPermissionDomain to Notifications
     9        and GeolocationPermissionDomain to Geolocation.
     10
     11        * Api/qwebpage.cpp:
     12        (QWebPage::setUserPermission):
     13        * Api/qwebpage.h:
     14        * WebCoreSupport/GeolocationPermissionClientQt.cpp:
     15        (WebCore::GeolocationPermissionClientQt::requestGeolocationPermissionForFrame):
     16        (WebCore::GeolocationPermissionClientQt::cancelGeolocationPermissionRequestForFrame):
     17        * WebCoreSupport/NotificationPresenterClientQt.cpp:
     18        (WebCore::NotificationPresenterClientQt::requestPermission):
     19        (WebCore::NotificationPresenterClientQt::cancelRequestsForPermission):
     20        * tests/qwebpage/tst_qwebpage.cpp:
     21        (JSTestPage::requestPermission):
     22        (tst_QWebPage::geolocationRequestJS):
     23
    1242010-11-23  Simon Hausmann  <simon.hausmann@nokia.com>
    225
  • trunk/WebKit/qt/WebCoreSupport/GeolocationPermissionClientQt.cpp

    r72600 r72601  
    6666
    6767    QWebPage* page = webFrame->page();
    68     emit page->requestPermissionFromUser(webFrame, QWebPage::GeolocationPermissionDomain);
     68    emit page->requestPermissionFromUser(webFrame, QWebPage::Geolocation);
    6969}
    7070
     
    7575
    7676    QWebPage* page = webFrame->page();
    77     emit page->cancelRequestsForPermission(webFrame, QWebPage::GeolocationPermissionDomain);
     77    emit page->cancelRequestsForPermission(webFrame, QWebPage::Geolocation);
    7878}
    7979
  • trunk/WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.cpp

    r72101 r72601  
    329329        if (toPage(context) && toFrame(context)) {
    330330            m_pendingPermissionRequests.insert(context, info);
    331             emit toPage(context)->requestPermissionFromUser(toFrame(context), QWebPage::NotificationsPermissionDomain);
     331            emit toPage(context)->requestPermissionFromUser(toFrame(context), QWebPage::Notifications);
    332332        }
    333333    }
     
    359359        printf("DESKTOP NOTIFICATION PERMISSION REQUEST CANCELLED: %s\n", QString(context->securityOrigin()->toString()).toUtf8().constData());
    360360
    361     emit page->cancelRequestsForPermission(frame, QWebPage::NotificationsPermissionDomain);
     361    emit page->cancelRequestsForPermission(frame, QWebPage::Notifications);
    362362}
    363363
  • trunk/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp

    r72600 r72601  
    221221        return true;
    222222    }
    223     void requestPermission(QWebFrame* frame, QWebPage::PermissionDomain domain)
     223    void requestPermission(QWebFrame* frame, QWebPage::Feature feature)
    224224    {
    225225        if (m_allowGeolocation)
    226             setUserPermission(frame, domain, PermissionGrantedByUser);
     226            setUserPermission(frame, feature, PermissionGrantedByUser);
    227227        else
    228             setUserPermission(frame, domain, PermissionDeniedByUser);
     228            setUserPermission(frame, feature, PermissionDeniedByUser);
    229229    }
    230230
     
    257257
    258258    JSTestPage* newPage = new JSTestPage(m_view);
    259     connect(newPage, SIGNAL(requestPermissionFromUser(QWebFrame*, QWebPage::PermissionDomain)),
    260             newPage, SLOT(requestPermission(QWebFrame*, QWebPage::PermissionDomain)));
     259    connect(newPage, SIGNAL(requestPermissionFromUser(QWebFrame*, QWebPage::Feature)),
     260            newPage, SLOT(requestPermission(QWebFrame*, QWebPage::Feature)));
    261261
    262262    newPage->setGeolocationPermission(false);
  • trunk/WebKitTools/ChangeLog

    r72600 r72601  
     12010-11-23  Simon Hausmann  <simon.hausmann@nokia.com>
     2
     3        Reviewed by Tor Arne Vestbø.
     4
     5        [Qt] Review the setUserPermission & friends API
     6        https://bugs.webkit.org/show_bug.cgi?id=46810
     7
     8        Rename PermissionDomain to Feature, NotificationsPermissionDomain to Notifications
     9        and GeolocationPermissionDomain to Geolocation.
     10
     11        * DumpRenderTree/qt/DumpRenderTreeQt.cpp:
     12        (WebCore::WebPage::WebPage):
     13        (WebCore::WebPage::requestPermission):
     14        (WebCore::WebPage::cancelPermission):
     15        (WebCore::WebPage::permissionSet):
     16        (WebCore::DumpRenderTree::geolocationPermissionSet):
     17        * DumpRenderTree/qt/DumpRenderTreeQt.h:
     18        * DumpRenderTree/qt/LayoutTestControllerQt.cpp:
     19        (LayoutTestController::grantDesktopNotificationPermission):
     20        * QtTestBrowser/webpage.cpp:
     21        (WebPage::WebPage):
     22        (WebPage::requestPermission):
     23        (WebPage::cancelRequestsForPermission):
     24        * QtTestBrowser/webpage.h:
     25
    1262010-11-23  Simon Hausmann  <simon.hausmann@nokia.com>
    227
  • trunk/WebKitTools/DumpRenderTree/qt/DumpRenderTreeQt.cpp

    r72600 r72601  
    159159    setPluginFactory(new TestPlugin(this));
    160160
    161     connect(this, SIGNAL(requestPermissionFromUser(QWebFrame*, QWebPage::PermissionDomain)), this, SLOT(requestPermission(QWebFrame*, QWebPage::PermissionDomain)));
    162     connect(this, SIGNAL(cancelRequestsForPermission(QWebFrame*, QWebPage::PermissionDomain)), this, SLOT(cancelPermission(QWebFrame*, QWebPage::PermissionDomain)));
     161    connect(this, SIGNAL(requestPermissionFromUser(QWebFrame*, QWebPage::Feature)), this, SLOT(requestPermission(QWebFrame*, QWebPage::Feature)));
     162    connect(this, SIGNAL(cancelRequestsForPermission(QWebFrame*, QWebPage::Feature)), this, SLOT(cancelPermission(QWebFrame*, QWebPage::Feature)));
    163163}
    164164
     
    220220}
    221221
    222 void WebPage::requestPermission(QWebFrame* frame, QWebPage::PermissionDomain domain)
    223 {
    224     switch (domain) {
    225     case NotificationsPermissionDomain:
     222void WebPage::requestPermission(QWebFrame* frame, QWebPage::Feature feature)
     223{
     224    switch (feature) {
     225    case Notifications:
    226226        if (!m_drt->layoutTestController()->ignoreReqestForPermission())
    227             setUserPermission(frame, domain, PermissionGrantedByUser);
     227            setUserPermission(frame, feature, PermissionGrantedByUser);
    228228        break;
    229     case GeolocationPermissionDomain:
     229    case Geolocation:
    230230        if (m_drt->layoutTestController()->isGeolocationPermissionSet())
    231231            if (m_drt->layoutTestController()->geolocationPermission())
    232                 setUserPermission(frame, domain, PermissionGrantedByUser);
     232                setUserPermission(frame, feature, PermissionGrantedByUser);
    233233            else
    234                 setUserPermission(frame, domain, PermissionDeniedByUser);
     234                setUserPermission(frame, feature, PermissionDeniedByUser);
    235235        else
    236236            m_pendingGeolocationRequests.append(frame);
     
    241241}
    242242
    243 void WebPage::cancelPermission(QWebFrame* frame, QWebPage::PermissionDomain domain)
    244 {
    245     switch (domain) {
    246     case GeolocationPermissionDomain:
     243void WebPage::cancelPermission(QWebFrame* frame, QWebPage::Feature feature)
     244{
     245    switch (feature) {
     246    case Geolocation:
    247247        m_pendingGeolocationRequests.removeOne(frame);
    248248        break;
     
    252252}
    253253
    254 void WebPage::permissionSet(QWebPage::PermissionDomain domain)
    255 {
    256     switch (domain) {
    257     case GeolocationPermissionDomain:
     254void WebPage::permissionSet(QWebPage::Feature feature)
     255{
     256    switch (feature) {
     257    case Geolocation:
    258258        {
    259259        Q_ASSERT(m_drt->layoutTestController()->isGeolocationPermissionSet());
    260260        foreach (QWebFrame* frame, m_pendingGeolocationRequests)
    261261            if (m_drt->layoutTestController()->geolocationPermission())
    262                 setUserPermission(frame, domain, PermissionGrantedByUser);
     262                setUserPermission(frame, feature, PermissionGrantedByUser);
    263263            else
    264                 setUserPermission(frame, domain, PermissionDeniedByUser);
     264                setUserPermission(frame, feature, PermissionDeniedByUser);
    265265
    266266        m_pendingGeolocationRequests.clear();
     
    10781078void DumpRenderTree::geolocationPermissionSet()
    10791079{
    1080     m_page->permissionSet(QWebPage::GeolocationPermissionDomain);
     1080    m_page->permissionSet(QWebPage::Geolocation);
    10811081}
    10821082
  • trunk/WebKitTools/DumpRenderTree/qt/DumpRenderTreeQt.h

    r72101 r72601  
    195195    QObject* createPlugin(const QString&, const QUrl&, const QStringList&, const QStringList&);
    196196
    197     void permissionSet(QWebPage::PermissionDomain domain);
     197    void permissionSet(QWebPage::Feature feature);
    198198
    199199public slots:
    200200    bool shouldInterruptJavaScript() { return false; }
    201     void requestPermission(QWebFrame* frame, QWebPage::PermissionDomain domain);
    202     void cancelPermission(QWebFrame* frame, QWebPage::PermissionDomain domain);
     201    void requestPermission(QWebFrame* frame, QWebPage::Feature feature);
     202    void cancelPermission(QWebFrame* frame, QWebPage::Feature feature);
    203203
    204204protected:
  • trunk/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.cpp

    r72600 r72601  
    199199{
    200200    QWebFrame* frame = m_drt->webPage()->mainFrame();
    201     m_drt->webPage()->setUserPermission(frame, QWebPage::NotificationsPermissionDomain, QWebPage::PermissionGrantedByUser);
     201    m_drt->webPage()->setUserPermission(frame, QWebPage::Notifications, QWebPage::PermissionGrantedByUser);
    202202    m_desktopNotificationAllowedOrigins.append(origin);
    203203}
  • trunk/WebKitTools/QtTestBrowser/webpage.cpp

    r72600 r72601  
    5151    connect(networkAccessManager(), SIGNAL(authenticationRequired(QNetworkReply*, QAuthenticator*)),
    5252            this, SLOT(authenticationRequired(QNetworkReply*, QAuthenticator*)));
    53     connect(this, SIGNAL(requestPermissionFromUser(QWebFrame*, QWebPage::PermissionDomain)), this, SLOT(requestPermission(QWebFrame*, QWebPage::PermissionDomain)));
    54     connect(this, SIGNAL(cancelRequestsForPermission(QWebFrame*, QWebPage::PermissionDomain)), this, SLOT(cancelRequestsForPermission(QWebFrame*, QWebPage::PermissionDomain)));
     53    connect(this, SIGNAL(requestPermissionFromUser(QWebFrame*, QWebPage::Feature)), this, SLOT(requestPermission(QWebFrame*, QWebPage::Feature)));
     54    connect(this, SIGNAL(cancelRequestsForPermission(QWebFrame*, QWebPage::Feature)), this, SLOT(cancelRequestsForPermission(QWebFrame*, QWebPage::Feature)));
    5555}
    5656
     
    168168}
    169169
    170 void WebPage::requestPermission(QWebFrame* frame, QWebPage::PermissionDomain domain)
    171 {
    172     setUserPermission(frame, domain, PermissionGrantedByUser);
    173 }
    174 
    175 void WebPage::cancelRequestsForPermission(QWebFrame*, QWebPage::PermissionDomain)
     170void WebPage::requestPermission(QWebFrame* frame, QWebPage::Feature feature)
     171{
     172    setUserPermission(frame, feature, PermissionGrantedByUser);
     173}
     174
     175void WebPage::cancelRequestsForPermission(QWebFrame*, QWebPage::Feature)
    176176{
    177177}
  • trunk/WebKitTools/QtTestBrowser/webpage.h

    r72101 r72601  
    5858    bool shouldInterruptJavaScript();
    5959    void authenticationRequired(QNetworkReply*, QAuthenticator*);
    60     void requestPermission(QWebFrame* frame, QWebPage::PermissionDomain domain);
    61     void cancelRequestsForPermission(QWebFrame* frame, QWebPage::PermissionDomain domain);
     60    void requestPermission(QWebFrame* frame, QWebPage::Feature feature);
     61    void cancelRequestsForPermission(QWebFrame* frame, QWebPage::Feature feature);
    6262
    6363private:
Note: See TracChangeset for help on using the changeset viewer.