Diff
Modified: trunk/Source/WebCore/ChangeLog (123768 => 123769)
--- trunk/Source/WebCore/ChangeLog 2012-07-26 17:25:00 UTC (rev 123768)
+++ trunk/Source/WebCore/ChangeLog 2012-07-26 17:47:18 UTC (rev 123769)
@@ -1,3 +1,26 @@
+2012-07-26 Christophe Dumez <[email protected]>
+
+ [EFL][WK2] Implement Network Information provider
+ https://bugs.webkit.org/show_bug.cgi?id=92343
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ Moved Network Information provider code from WebKit1
+ to WebCore so that it can be shared with WebKit2.
+
+ No new tests, no behavior change.
+
+ * PlatformEfl.cmake:
+ * platform/efl/NetworkInfoProviderEfl.cpp: Copied from Source/WebKit/efl/WebCoreSupport/NetworkInfoClientEfl.cpp.
+ (WebCore):
+ (WebCore::NetworkInfoProviderEfl::NetworkInfoProviderEfl):
+ (WebCore::NetworkInfoProviderEfl::startUpdating):
+ (WebCore::NetworkInfoProviderEfl::stopUpdating):
+ (WebCore::NetworkInfoProviderEfl::bandwidth):
+ * platform/efl/NetworkInfoProviderEfl.h: Added.
+ (WebCore):
+ (NetworkInfoProviderEfl):
+
2012-07-25 Pavel Feldman <[email protected]>
Web Inspector: SASS source mapping straw man (behind experiment)
Modified: trunk/Source/WebCore/PlatformEfl.cmake (123768 => 123769)
--- trunk/Source/WebCore/PlatformEfl.cmake 2012-07-26 17:25:00 UTC (rev 123768)
+++ trunk/Source/WebCore/PlatformEfl.cmake 2012-07-26 17:47:18 UTC (rev 123769)
@@ -42,6 +42,7 @@
platform/efl/LocalizedStringsEfl.cpp
platform/efl/LoggingEfl.cpp
platform/efl/MIMETypeRegistryEfl.cpp
+ platform/efl/NetworkInfoProviderEfl.cpp
platform/efl/PasteboardEfl.cpp
platform/efl/PlatformKeyboardEventEfl.cpp
platform/efl/PlatformMouseEventEfl.cpp
@@ -318,7 +319,7 @@
ADD_DEFINITIONS(-DUNINSTALLED_AUDIO_RESOURCES_DIR="${WEBCORE_DIR}/platform/audio/resources")
ENDIF ()
-IF (ENABLE_GAMEPAD)
+IF (ENABLE_GAMEPAD OR ENABLE_NETWORK_INFO)
LIST(APPEND WebCore_INCLUDE_DIRECTORIES
${EEZE_INCLUDE_DIRS}
)
Copied: trunk/Source/WebCore/platform/efl/NetworkInfoProviderEfl.cpp (from rev 123768, trunk/Source/WebKit/efl/WebCoreSupport/NetworkInfoClientEfl.cpp) (0 => 123769)
--- trunk/Source/WebCore/platform/efl/NetworkInfoProviderEfl.cpp (rev 0)
+++ trunk/Source/WebCore/platform/efl/NetworkInfoProviderEfl.cpp 2012-07-26 17:47:18 UTC (rev 123769)
@@ -0,0 +1,87 @@
+/*
+ * Copyright (C) 2012 Samsung Electronics. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "NetworkInfoProviderEfl.h"
+
+#if ENABLE(NETWORK_INFO)
+
+#include <Eeze.h>
+#include <Eeze_Net.h>
+#include <limits>
+#include <wtf/text/WTFString.h>
+
+namespace WebCore {
+
+static const char ethernetInterface[] = "eth0";
+
+NetworkInfoProviderEfl::NetworkInfoProviderEfl()
+{
+}
+
+void NetworkInfoProviderEfl::startUpdating()
+{
+ if (!eeze_init())
+ fprintf(stderr, "Fail to start network information client.\n");
+}
+
+void NetworkInfoProviderEfl::stopUpdating()
+{
+ eeze_shutdown();
+}
+
+double NetworkInfoProviderEfl::bandwidth() const
+{
+ // FIXME : This function should consider cellular network as well. For example, 2G, 3G and 4G.
+ // See https://bugs.webkit.org/show_bug.cgi?id=89851 for detail.
+ Eeze_Net* ethNet = eeze_net_new(ethernetInterface);
+ if (!ethNet)
+ return std::numeric_limits<double>::infinity(); // Spec says we should return infinity if unknown
+
+ eeze_net_scan(ethNet);
+
+ // FIXME : The eeze library doesn't support EEZE_NET_ADDR_TYPE_IP type yet. So, EEZE_NET_ADDR_TYPE_BROADCAST
+ // is used for now.
+ // See https://bugs.webkit.org/show_bug.cgi?id=89852 for detail.
+ const char* address = eeze_net_addr_get(ethNet, EEZE_NET_ADDR_TYPE_BROADCAST);
+ if (!address)
+ return 0; // If network is offline, return 0.
+
+ double bandwidth;
+ const char* attribute = eeze_net_attribute_get(ethNet, "speed");
+ if (attribute) {
+ bool ok;
+ bandwidth = String::fromUTF8(attribute).toUIntStrict(&ok);
+ } else
+ bandwidth = std::numeric_limits<double>::infinity(); // If bandwidth is unknown, return infinity value.
+
+ eeze_net_free(ethNet);
+
+ return bandwidth / 8; // MB/s
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(NETWORK_INFO)
Added: trunk/Source/WebCore/platform/efl/NetworkInfoProviderEfl.h (0 => 123769)
--- trunk/Source/WebCore/platform/efl/NetworkInfoProviderEfl.h (rev 0)
+++ trunk/Source/WebCore/platform/efl/NetworkInfoProviderEfl.h 2012-07-26 17:47:18 UTC (rev 123769)
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2012 Samsung Electronics. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef NetworkInfoProviderEfl_h
+#define NetworkInfoProviderEfl_h
+
+#if ENABLE(NETWORK_INFO)
+
+namespace WebCore {
+
+class NetworkInfoProviderEfl {
+public:
+ NetworkInfoProviderEfl();
+
+ void startUpdating();
+ void stopUpdating();
+
+ double bandwidth() const;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(NETWORK_INFO)
+
+#endif // NetworkInfoProviderEfl_h
Modified: trunk/Source/WebKit/CMakeLists.txt (123768 => 123769)
--- trunk/Source/WebKit/CMakeLists.txt 2012-07-26 17:25:00 UTC (rev 123768)
+++ trunk/Source/WebKit/CMakeLists.txt 2012-07-26 17:47:18 UTC (rev 123769)
@@ -2,6 +2,7 @@
"${WEBKIT_DIR}"
"${WEBCORE_DIR}"
"${WEBCORE_DIR}/Modules/intents"
+ "${WEBCORE_DIR}/Modules/networkinfo"
"${WEBCORE_DIR}/Modules/webdatabase"
"${WEBCORE_DIR}/accessibility"
"${WEBCORE_DIR}/bindings/generic"
Modified: trunk/Source/WebKit/ChangeLog (123768 => 123769)
--- trunk/Source/WebKit/ChangeLog 2012-07-26 17:25:00 UTC (rev 123768)
+++ trunk/Source/WebKit/ChangeLog 2012-07-26 17:47:18 UTC (rev 123769)
@@ -1,3 +1,17 @@
+2012-07-26 Christophe Dumez <[email protected]>
+
+ [EFL][WK2] Implement Network Information provider
+ https://bugs.webkit.org/show_bug.cgi?id=92343
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ WebKit EFL not longer needs to link against EEZE
+ library since the Network Information provider
+ was moved to WebCore.
+
+ * CMakeLists.txt:
+ * PlatformEfl.cmake:
+
2012-07-26 Zoltan Nyul <[email protected]>
[EFL] EFL port should use XDG paths
Modified: trunk/Source/WebKit/PlatformEfl.cmake (123768 => 123769)
--- trunk/Source/WebKit/PlatformEfl.cmake 2012-07-26 17:25:00 UTC (rev 123768)
+++ trunk/Source/WebKit/PlatformEfl.cmake 2012-07-26 17:47:18 UTC (rev 123769)
@@ -70,19 +70,6 @@
)
ENDIF ()
-IF (ENABLE_NETWORK_INFO)
- LIST(APPEND WebKit_LINK_FLAGS
- ${EEZE_LDFLAGS}
- )
- LIST(APPEND WebKit_INCLUDE_DIRECTORIES
- "${WEBCORE_DIR}/Modules/networkinfo"
- ${EEZE_INCLUDE_DIRS}
- )
- LIST(APPEND WebKit_LIBRARIES
- ${EEZE_LIBRARIES}
- )
-ENDIF ()
-
IF (ENABLE_NOTIFICATIONS)
LIST(APPEND WebKit_INCLUDE_DIRECTORIES
"${WEBCORE_DIR}/Modules/notifications"
Modified: trunk/Source/WebKit/efl/ChangeLog (123768 => 123769)
--- trunk/Source/WebKit/efl/ChangeLog 2012-07-26 17:25:00 UTC (rev 123768)
+++ trunk/Source/WebKit/efl/ChangeLog 2012-07-26 17:47:18 UTC (rev 123769)
@@ -1,3 +1,23 @@
+2012-07-26 Christophe Dumez <[email protected]>
+
+ [EFL][WK2] Implement Network Information provider
+ https://bugs.webkit.org/show_bug.cgi?id=92343
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ Make NetworkInfoClientEfl use NetworkInfoProviderEfl
+ from WebCore to avoid code duplication with WebKit2.
+
+ * WebCoreSupport/NetworkInfoClientEfl.cpp:
+ (WebCore::NetworkInfoClientEfl::startUpdating):
+ (WebCore::NetworkInfoClientEfl::stopUpdating):
+ (WebCore::NetworkInfoClientEfl::bandwidth):
+ (WebCore::NetworkInfoClientEfl::metered):
+ (WebCore):
+ * WebCoreSupport/NetworkInfoClientEfl.h:
+ (WebCore):
+ (NetworkInfoClientEfl):
+
2012-07-26 Zoltan Nyul <[email protected]>
[EFL] EFL port should use XDG paths
Modified: trunk/Source/WebKit/efl/WebCoreSupport/NetworkInfoClientEfl.cpp (123768 => 123769)
--- trunk/Source/WebKit/efl/WebCoreSupport/NetworkInfoClientEfl.cpp 2012-07-26 17:25:00 UTC (rev 123768)
+++ trunk/Source/WebKit/efl/WebCoreSupport/NetworkInfoClientEfl.cpp 2012-07-26 17:47:18 UTC (rev 123769)
@@ -29,22 +29,12 @@
#include "NetworkInfoClientEfl.h"
#if ENABLE(NETWORK_INFO)
-#include "NetworkInfo.h"
+
#include "NotImplemented.h"
-#include "ewk_private.h"
-#include <Eeze.h>
-#include <Eeze_Net.h>
-#include <wtf/text/CString.h>
-#include <wtf/text/WTFString.h>
-
namespace WebCore {
-static const char* ethernetInterface = "eth0";
-
NetworkInfoClientEfl::NetworkInfoClientEfl()
- : m_controller(0)
- , m_metered(false)
{
}
@@ -54,52 +44,26 @@
void NetworkInfoClientEfl::startUpdating()
{
- if (!eeze_init()) {
- ERR("Fail to start network information client.");
- return;
- }
+ m_provider.startUpdating();
}
void NetworkInfoClientEfl::stopUpdating()
{
- eeze_shutdown();
+ m_provider.stopUpdating();
}
double NetworkInfoClientEfl::bandwidth() const
{
- // FIXME : This function should consider cellular network as well. For example, 2G, 3G and 4G.
- // See https://bugs.webkit.org/show_bug.cgi?id=89851 for detail.
- Eeze_Net* ethNet = eeze_net_new(ethernetInterface);
- if (!ethNet)
- return 0;
-
- eeze_net_scan(ethNet);
-
- // FIXME : The eeze library doesn't support EEZE_NET_ADDR_TYPE_IP type yet. So, EEZE_NET_ADDR_TYPE_BROADCAST
- // is used for now.
- // See https://bugs.webkit.org/show_bug.cgi?id=89852 for detail.
- const char* address = eeze_net_addr_get(ethNet, EEZE_NET_ADDR_TYPE_BROADCAST);
- if (!address)
- return 0; // If network is offline, return 0.
-
- double bandwidth;
- const char* attribute = eeze_net_attribute_get(ethNet, "speed");
- if (attribute) {
- bool ok;
- bandwidth = String::fromUTF8(attribute).toUIntStrict(&ok);
- } else
- bandwidth = std::numeric_limits<double>::infinity(); // If bandwidth is unknown, return infinity value.
-
- eeze_net_free(ethNet);
-
- return bandwidth / 8; // MB/s
+ return m_provider.bandwidth();
}
bool NetworkInfoClientEfl::metered() const
{
notImplemented();
- return m_metered;
-}
+ return false;
}
+
+} // namespace WebCore
+
#endif
Modified: trunk/Source/WebKit/efl/WebCoreSupport/NetworkInfoClientEfl.h (123768 => 123769)
--- trunk/Source/WebKit/efl/WebCoreSupport/NetworkInfoClientEfl.h 2012-07-26 17:25:00 UTC (rev 123768)
+++ trunk/Source/WebKit/efl/WebCoreSupport/NetworkInfoClientEfl.h 2012-07-26 17:47:18 UTC (rev 123769)
@@ -31,10 +31,11 @@
#if ENABLE(NETWORK_INFO)
-#include "NetworkInfoClient.h"
-#include "NetworkInfoController.h"
+#include <NetworkInfoClient.h>
+#include <NetworkInfoProviderEfl.h>
namespace WebCore {
+
class NetworkInfoClientEfl : public WebCore::NetworkInfoClient {
public:
NetworkInfoClientEfl();
@@ -47,11 +48,10 @@
virtual bool metered() const;
private:
- NetworkInfoController* m_controller;
-
- bool m_metered;
+ WebCore::NetworkInfoProviderEfl m_provider;
};
-}
+} // namespace WebCore
+
#endif
#endif // NetworkInfoClientEfl_h
Modified: trunk/Source/WebKit2/CMakeLists.txt (123768 => 123769)
--- trunk/Source/WebKit2/CMakeLists.txt 2012-07-26 17:25:00 UTC (rev 123768)
+++ trunk/Source/WebKit2/CMakeLists.txt 2012-07-26 17:47:18 UTC (rev 123769)
@@ -45,6 +45,7 @@
"${WEBCORE_DIR}"
"${WEBCORE_DIR}/Modules/battery"
"${WEBCORE_DIR}/Modules/intents"
+ "${WEBCORE_DIR}/Modules/networkinfo"
"${WEBCORE_DIR}/Modules/vibration"
"${WEBCORE_DIR}/accessibility"
"${WEBCORE_DIR}/bindings/js"
Modified: trunk/Source/WebKit2/ChangeLog (123768 => 123769)
--- trunk/Source/WebKit2/ChangeLog 2012-07-26 17:25:00 UTC (rev 123768)
+++ trunk/Source/WebKit2/ChangeLog 2012-07-26 17:47:18 UTC (rev 123769)
@@ -1,5 +1,34 @@
2012-07-26 Christophe Dumez <[email protected]>
+ [EFL][WK2] Implement Network Information provider
+ https://bugs.webkit.org/show_bug.cgi?id=92343
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ Add Network Information provider for WebKit2 EFL
+ by using NetworkInfoProviderEfl class from
+ WebCore.
+
+ * CMakeLists.txt:
+ * PlatformEfl.cmake:
+ * UIProcess/API/efl/NetworkInfoProvider.cpp: Added.
+ (toNetworkInfoProvider):
+ (startUpdatingCallback):
+ (stopUpdatingCallback):
+ (getBandwidthCallback):
+ (isMeteredCallback):
+ (NetworkInfoProvider::create):
+ (NetworkInfoProvider::NetworkInfoProvider):
+ (NetworkInfoProvider::~NetworkInfoProvider):
+ (NetworkInfoProvider::bandwidth):
+ (NetworkInfoProvider::metered):
+ (NetworkInfoProvider::startUpdating):
+ (NetworkInfoProvider::stopUpdating):
+ * UIProcess/API/efl/NetworkInfoProvider.h: Added.
+ (NetworkInfoProvider):
+
+2012-07-26 Christophe Dumez <[email protected]>
+
[EFL][WK2] Compilation warning in EWK2UnitTestServer.cpp
https://bugs.webkit.org/show_bug.cgi?id=92387
Modified: trunk/Source/WebKit2/PlatformEfl.cmake (123768 => 123769)
--- trunk/Source/WebKit2/PlatformEfl.cmake 2012-07-26 17:25:00 UTC (rev 123768)
+++ trunk/Source/WebKit2/PlatformEfl.cmake 2012-07-26 17:47:18 UTC (rev 123769)
@@ -38,6 +38,7 @@
UIProcess/API/C/soup/WKSoupRequestManager.cpp
UIProcess/API/efl/BatteryProvider.cpp
+ UIProcess/API/efl/NetworkInfoProvider.cpp
UIProcess/API/efl/PageClientImpl.cpp
UIProcess/API/efl/VibrationProvider.cpp
UIProcess/API/efl/ewk_context.cpp
Added: trunk/Source/WebKit2/UIProcess/API/efl/NetworkInfoProvider.cpp (0 => 123769)
--- trunk/Source/WebKit2/UIProcess/API/efl/NetworkInfoProvider.cpp (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/efl/NetworkInfoProvider.cpp 2012-07-26 17:47:18 UTC (rev 123769)
@@ -0,0 +1,106 @@
+/*
+ * Copyright (C) 2012 Intel Corporation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "NetworkInfoProvider.h"
+
+#if ENABLE(NETWORK_INFO)
+
+#include "WKNetworkInfoManager.h"
+#include <NotImplemented.h>
+
+static inline NetworkInfoProvider* toNetworkInfoProvider(const void* clientInfo)
+{
+ return static_cast<NetworkInfoProvider*>(const_cast<void*>(clientInfo));
+}
+
+static void startUpdatingCallback(WKNetworkInfoManagerRef, const void* clientInfo)
+{
+ toNetworkInfoProvider(clientInfo)->startUpdating();
+}
+
+static void stopUpdatingCallback(WKNetworkInfoManagerRef, const void* clientInfo)
+{
+ toNetworkInfoProvider(clientInfo)->stopUpdating();
+}
+
+static double getBandwidthCallback(WKNetworkInfoManagerRef, const void* clientInfo)
+{
+ return toNetworkInfoProvider(clientInfo)->bandwidth();
+}
+
+static bool isMeteredCallback(WKNetworkInfoManagerRef, const void* clientInfo)
+{
+ return toNetworkInfoProvider(clientInfo)->metered();
+}
+
+PassRefPtr<NetworkInfoProvider> NetworkInfoProvider::create(WKNetworkInfoManagerRef wkManager)
+{
+ return adoptRef(new NetworkInfoProvider(wkManager));
+}
+
+NetworkInfoProvider::NetworkInfoProvider(WKNetworkInfoManagerRef wkManager)
+ : m_wkNetworkInfoManager(wkManager)
+{
+ ASSERT(wkManager);
+
+ WKNetworkInfoProvider wkNetworkInfoProvider = {
+ kWKNetworkInfoProviderCurrentVersion,
+ this, // clientInfo
+ startUpdatingCallback,
+ stopUpdatingCallback,
+ getBandwidthCallback,
+ isMeteredCallback
+ };
+ WKNetworkInfoManagerSetProvider(m_wkNetworkInfoManager.get(), &wkNetworkInfoProvider);
+}
+
+NetworkInfoProvider::~NetworkInfoProvider()
+{
+}
+
+double NetworkInfoProvider::bandwidth() const
+{
+ return m_provider.bandwidth();
+}
+
+bool NetworkInfoProvider::metered() const
+{
+ notImplemented();
+
+ return false;
+}
+
+void NetworkInfoProvider::startUpdating()
+{
+ m_provider.startUpdating();
+}
+
+void NetworkInfoProvider::stopUpdating()
+{
+ m_provider.stopUpdating();
+}
+
+#endif // ENABLE(NETWORK_INFO)
Added: trunk/Source/WebKit2/UIProcess/API/efl/NetworkInfoProvider.h (0 => 123769)
--- trunk/Source/WebKit2/UIProcess/API/efl/NetworkInfoProvider.h (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/efl/NetworkInfoProvider.h 2012-07-26 17:47:18 UTC (rev 123769)
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2012 Intel Corporation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef NetworkInfoProvider_h
+#define NetworkInfoProvider_h
+
+#if ENABLE(NETWORK_INFO)
+
+#include <NetworkInfoClient.h>
+#include <NetworkInfoProviderEfl.h>
+#include <WebKit2/WKBase.h>
+#include <WebKit2/WKRetainPtr.h>
+#include <wtf/PassRefPtr.h>
+
+class NetworkInfoProvider : public RefCounted<NetworkInfoProvider>, public WebCore::NetworkInfoClient {
+public:
+ virtual ~NetworkInfoProvider();
+ static PassRefPtr<NetworkInfoProvider> create(WKNetworkInfoManagerRef);
+
+ // NetworkInfoClient interface.
+ virtual double bandwidth() const;
+ virtual bool metered() const;
+
+ virtual void startUpdating();
+ virtual void stopUpdating();
+
+private:
+ NetworkInfoProvider(WKNetworkInfoManagerRef);
+
+ WKRetainPtr<WKNetworkInfoManagerRef> m_wkNetworkInfoManager;
+ WebCore::NetworkInfoProviderEfl m_provider;
+};
+
+#endif // ENABLE(NETWORK_INFO)
+
+#endif // NetworkInfoProvider_h