Changeset 52928 in webkit


Ignore:
Timestamp:
Jan 7, 2010 9:29:22 AM (14 years ago)
Author:
Simon Hausmann
Message:

[Qt] Allow the application to override online/offline network status
https://bugs.webkit.org/show_bug.cgi?id=32684

Patch by Yael Aharon <yael.aharon@nokia.com> on 2010-01-07
Reviewed by Kenneth Rohde Christiansen.

WebCore:

Added API to NetworkStateNotifier for forcing network status.

  • platform/network/NetworkStateNotifier.h:
  • platform/network/qt/NetworkStateNotifierPrivate.h:
  • platform/network/qt/NetworkStateNotifierQt.cpp:

(WebCore::NetworkStateNotifierPrivate::NetworkStateNotifierPrivate):
(WebCore::NetworkStateNotifierPrivate::onlineStateChanged):
(WebCore::NetworkStateNotifierPrivate::networkAccessPermissionChanged):
(WebCore::NetworkStateNotifier::updateState):
(WebCore::NetworkStateNotifier::NetworkStateNotifier):
(WebCore::NetworkStateNotifier::setNetworkAccessAllowed):

WebKit/qt:

Add a setting so that applications can overide the network status.
Applications that use this setting still need to block network access
through QNAM.

  • Api/qwebsettings.cpp:

(qt_networkAccessAllowed):

Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r52926 r52928  
     12010-01-07  Yael Aharon  <yael.aharon@nokia.com>
     2
     3        Reviewed by Kenneth Rohde Christiansen.
     4
     5        [Qt] Allow the application to override online/offline network status
     6        https://bugs.webkit.org/show_bug.cgi?id=32684
     7
     8        Added API to NetworkStateNotifier for forcing network status.
     9
     10        * platform/network/NetworkStateNotifier.h:
     11        * platform/network/qt/NetworkStateNotifierPrivate.h:
     12        * platform/network/qt/NetworkStateNotifierQt.cpp:
     13        (WebCore::NetworkStateNotifierPrivate::NetworkStateNotifierPrivate):
     14        (WebCore::NetworkStateNotifierPrivate::onlineStateChanged):
     15        (WebCore::NetworkStateNotifierPrivate::networkAccessPermissionChanged):
     16        (WebCore::NetworkStateNotifier::updateState):
     17        (WebCore::NetworkStateNotifier::NetworkStateNotifier):
     18        (WebCore::NetworkStateNotifier::setNetworkAccessAllowed):
     19
    1202010-01-07  Simon Hausmann  <simon.hausmann@nokia.com>
    221
  • trunk/WebCore/platform/network/NetworkStateNotifier.h

    r52635 r52928  
    5959   
    6060    bool onLine() const { return m_isOnLine; }
    61    
     61
     62#if (PLATFORM(QT) && ENABLE(QT_BEARER))
     63    void setNetworkAccessAllowed(bool);
     64#endif
     65
    6266private:   
    6367    bool m_isOnLine;
  • trunk/WebCore/platform/network/qt/NetworkStateNotifierPrivate.h

    r52261 r52928  
    3838public slots:
    3939    void onlineStateChanged(bool);
     40    void networkAccessPermissionChanged(bool);
    4041
    4142public:
    4243    QtMobility::QNetworkConfigurationManager* m_configurationManager;
    4344    bool m_online;
     45    bool m_networkAccessAllowed;
    4446    NetworkStateNotifier* m_notifier;
    4547};
  • trunk/WebCore/platform/network/qt/NetworkStateNotifierQt.cpp

    r52261 r52928  
    3131    : m_configurationManager(new QNetworkConfigurationManager())
    3232    , m_online(m_configurationManager->isOnline())
     33    , m_networkAccessAllowed(true)
    3334    , m_notifier(notifier)
    3435{
     
    4344
    4445    m_online = isOnline;
    45     m_notifier->updateState();
     46    if (m_networkAccessAllowed)
     47        m_notifier->updateState();
     48}
     49
     50void NetworkStateNotifierPrivate::networkAccessPermissionChanged(bool isAllowed)
     51{
     52    if (isAllowed == m_networkAccessAllowed)
     53        return;
     54
     55    m_networkAccessAllowed = isAllowed;
     56    if (m_online)
     57        m_notifier->updateState();
    4658}
    4759
     
    5365void NetworkStateNotifier::updateState()
    5466{
    55     if (m_isOnLine == p->m_online)
     67    if (m_isOnLine == (p->m_online && p->m_networkAccessAllowed))
    5668        return;
    5769
    58     m_isOnLine = p->m_online;
     70    m_isOnLine = p->m_online && p->m_networkAccessAllowed;
    5971    if (m_networkStateChangedFunction)
    6072        m_networkStateChangedFunction();
     
    6678{
    6779    p = new NetworkStateNotifierPrivate(this);
    68     m_isOnLine = p->m_online;
     80    m_isOnLine = p->m_online && p->m_networkAccessAllowed;
     81}
     82
     83void NetworkStateNotifier::setNetworkAccessAllowed(bool isAllowed)
     84{
     85    p->networkAccessPermissionChanged(isAllowed);
    6986}
    7087
  • trunk/WebKit/qt/Api/qwebsettings.cpp

    r51154 r52928  
    4747#include <QUrl>
    4848#include <QFileInfo>
     49
     50#if ENABLE(QT_BEARER)
     51#include "NetworkStateNotifier.h"
     52#endif
     53
     54void QWEBKIT_EXPORT qt_networkAccessAllowed(bool isAllowed)
     55{
     56#if ENABLE(QT_BEARER)
     57    WebCore::networkStateNotifier().setNetworkAccessAllowed(isAllowed);
     58#endif
     59}
    4960
    5061class QWebSettingsPrivate {
  • trunk/WebKit/qt/ChangeLog

    r52914 r52928  
     12010-01-07  Yael Aharon  <yael.aharon@nokia.com>
     2
     3        Reviewed by Kenneth Rohde Christiansen.
     4
     5        [Qt] Allow the application to override online/offline network status
     6        https://bugs.webkit.org/show_bug.cgi?id=32684
     7
     8        Add a setting so that applications can overide the network status.
     9        Applications that use this setting still need to block network access
     10        through QNAM.
     11
     12        * Api/qwebsettings.cpp:
     13        (qt_networkAccessAllowed):
     14
    1152010-01-07  Yongjun Zhang  <yongjun.zhang@nokia.com>, Laszlo Gombos  <laszlo.1.gombos@nokia.com>
    216
Note: See TracChangeset for help on using the changeset viewer.