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

hausmann at webkit.org hausmann at webkit.org
Thu Apr 8 00:57:20 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit ccf72ccb90d70f73a9ebbdc8668c2ae89776249b
Author: hausmann at webkit.org <hausmann at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Jan 7 17:29:22 2010 +0000

    [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 at 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):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@52928 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 71d5c67..fea2de1 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,22 @@
+2010-01-07  Yael Aharon  <yael.aharon at nokia.com>
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        [Qt] Allow the application to override online/offline network status
+        https://bugs.webkit.org/show_bug.cgi?id=32684
+
+        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):
+
 2010-01-07  Simon Hausmann  <simon.hausmann at nokia.com>
 
         Reviewed by Tor Arne Vestbø.
diff --git a/WebCore/platform/network/NetworkStateNotifier.h b/WebCore/platform/network/NetworkStateNotifier.h
index 81dd081..781259c 100644
--- a/WebCore/platform/network/NetworkStateNotifier.h
+++ b/WebCore/platform/network/NetworkStateNotifier.h
@@ -58,7 +58,11 @@ public:
     void setNetworkStateChangedFunction(void (*)());
     
     bool onLine() const { return m_isOnLine; }
-    
+
+#if (PLATFORM(QT) && ENABLE(QT_BEARER))
+    void setNetworkAccessAllowed(bool);
+#endif
+
 private:    
     bool m_isOnLine;
     void (*m_networkStateChangedFunction)();
diff --git a/WebCore/platform/network/qt/NetworkStateNotifierPrivate.h b/WebCore/platform/network/qt/NetworkStateNotifierPrivate.h
index 7af6392..536b06a 100644
--- a/WebCore/platform/network/qt/NetworkStateNotifierPrivate.h
+++ b/WebCore/platform/network/qt/NetworkStateNotifierPrivate.h
@@ -37,10 +37,12 @@ public:
     ~NetworkStateNotifierPrivate();
 public slots:
     void onlineStateChanged(bool);
+    void networkAccessPermissionChanged(bool);
 
 public:
     QtMobility::QNetworkConfigurationManager* m_configurationManager;
     bool m_online;
+    bool m_networkAccessAllowed;
     NetworkStateNotifier* m_notifier;
 };
 
diff --git a/WebCore/platform/network/qt/NetworkStateNotifierQt.cpp b/WebCore/platform/network/qt/NetworkStateNotifierQt.cpp
index f74398b..e694264 100644
--- a/WebCore/platform/network/qt/NetworkStateNotifierQt.cpp
+++ b/WebCore/platform/network/qt/NetworkStateNotifierQt.cpp
@@ -30,6 +30,7 @@ namespace WebCore {
 NetworkStateNotifierPrivate::NetworkStateNotifierPrivate(NetworkStateNotifier* notifier)
     : m_configurationManager(new QNetworkConfigurationManager())
     , m_online(m_configurationManager->isOnline())
+    , m_networkAccessAllowed(true)
     , m_notifier(notifier)
 {
     Q_ASSERT(notifier);
@@ -42,7 +43,18 @@ void NetworkStateNotifierPrivate::onlineStateChanged(bool isOnline)
         return;
 
     m_online = isOnline;
-    m_notifier->updateState();
+    if (m_networkAccessAllowed)
+        m_notifier->updateState();
+}
+
+void NetworkStateNotifierPrivate::networkAccessPermissionChanged(bool isAllowed)
+{
+    if (isAllowed == m_networkAccessAllowed)
+        return;
+
+    m_networkAccessAllowed = isAllowed;
+    if (m_online)
+        m_notifier->updateState();
 }
 
 NetworkStateNotifierPrivate::~NetworkStateNotifierPrivate()
@@ -52,10 +64,10 @@ NetworkStateNotifierPrivate::~NetworkStateNotifierPrivate()
 
 void NetworkStateNotifier::updateState()
 {
-    if (m_isOnLine == p->m_online)
+    if (m_isOnLine == (p->m_online && p->m_networkAccessAllowed))
         return;
 
-    m_isOnLine = p->m_online;
+    m_isOnLine = p->m_online && p->m_networkAccessAllowed;
     if (m_networkStateChangedFunction)
         m_networkStateChangedFunction();
 }
@@ -65,7 +77,12 @@ NetworkStateNotifier::NetworkStateNotifier()
     , m_networkStateChangedFunction(0)
 {
     p = new NetworkStateNotifierPrivate(this);
-    m_isOnLine = p->m_online;
+    m_isOnLine = p->m_online && p->m_networkAccessAllowed;
+}
+
+void NetworkStateNotifier::setNetworkAccessAllowed(bool isAllowed)
+{
+    p->networkAccessPermissionChanged(isAllowed);
 }
 
 } // namespace WebCore
diff --git a/WebKit/qt/Api/qwebsettings.cpp b/WebKit/qt/Api/qwebsettings.cpp
index 9a5ab46..ff7d33e 100644
--- a/WebKit/qt/Api/qwebsettings.cpp
+++ b/WebKit/qt/Api/qwebsettings.cpp
@@ -47,6 +47,17 @@
 #include <QUrl>
 #include <QFileInfo>
 
+#if ENABLE(QT_BEARER)
+#include "NetworkStateNotifier.h"
+#endif
+
+void QWEBKIT_EXPORT qt_networkAccessAllowed(bool isAllowed)
+{
+#if ENABLE(QT_BEARER)
+    WebCore::networkStateNotifier().setNetworkAccessAllowed(isAllowed);
+#endif
+}
+
 class QWebSettingsPrivate {
 public:
     QWebSettingsPrivate(WebCore::Settings* wcSettings = 0)
diff --git a/WebKit/qt/ChangeLog b/WebKit/qt/ChangeLog
index 90cdd4e..9da774b 100644
--- a/WebKit/qt/ChangeLog
+++ b/WebKit/qt/ChangeLog
@@ -1,3 +1,17 @@
+2010-01-07  Yael Aharon  <yael.aharon at nokia.com>
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        [Qt] Allow the application to override online/offline network status
+        https://bugs.webkit.org/show_bug.cgi?id=32684
+
+        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):
+
 2010-01-07  Yongjun Zhang  <yongjun.zhang at nokia.com>, Laszlo Gombos  <laszlo.1.gombos at nokia.com>
 
         Reviewed by Simon Hausmann.

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list