diff options
Diffstat (limited to 'Source/WebKit2/UIProcess/API/C')
-rw-r--r-- | Source/WebKit2/UIProcess/API/C/WKContext.cpp | 18 | ||||
-rw-r--r-- | Source/WebKit2/UIProcess/API/C/WKContext.h | 2 | ||||
-rw-r--r-- | Source/WebKit2/UIProcess/API/C/WKNetworkInfo.cpp | 53 | ||||
-rw-r--r-- | Source/WebKit2/UIProcess/API/C/WKNetworkInfo.h | 43 | ||||
-rw-r--r-- | Source/WebKit2/UIProcess/API/C/WKNetworkInfoManager.cpp | 14 | ||||
-rw-r--r-- | Source/WebKit2/UIProcess/API/C/WKNetworkInfoManager.h | 4 |
6 files changed, 134 insertions, 0 deletions
diff --git a/Source/WebKit2/UIProcess/API/C/WKContext.cpp b/Source/WebKit2/UIProcess/API/C/WKContext.cpp index 7bfc04aed..d168363e8 100644 --- a/Source/WebKit2/UIProcess/API/C/WKContext.cpp +++ b/Source/WebKit2/UIProcess/API/C/WKContext.cpp @@ -189,6 +189,15 @@ WKGeolocationManagerRef WKContextGetGeolocationManager(WKContextRef contextRef) return toAPI(toImpl(contextRef)->geolocationManagerProxy()); } +WKNetworkInfoManagerRef WKContextGetNetworkInfoManager(WKContextRef contextRef) +{ +#if ENABLE(NETWORK_INFO) + return toAPI(toImpl(contextRef)->networkInfoManagerProxy()); +#else + return 0; +#endif +} + WKIconDatabaseRef WKContextGetIconDatabase(WKContextRef contextRef) { return toAPI(toImpl(contextRef)->iconDatabase()); @@ -219,6 +228,15 @@ WKResourceCacheManagerRef WKContextGetResourceCacheManager(WKContextRef contextR return toAPI(toImpl(contextRef)->resourceCacheManagerProxy()); } +WKVibrationRef WKContextGetVibration(WKContextRef contextRef) +{ +#if ENABLE(VIBRATION) + return toAPI(toImpl(contextRef)->vibrationProxy()); +#else + return 0; +#endif +} + void WKContextStartMemorySampler(WKContextRef contextRef, WKDoubleRef interval) { toImpl(contextRef)->startMemorySampler(toImpl(interval)->value()); diff --git a/Source/WebKit2/UIProcess/API/C/WKContext.h b/Source/WebKit2/UIProcess/API/C/WKContext.h index 85e4c157c..412227de7 100644 --- a/Source/WebKit2/UIProcess/API/C/WKContext.h +++ b/Source/WebKit2/UIProcess/API/C/WKContext.h @@ -155,9 +155,11 @@ WK_EXPORT WKGeolocationManagerRef WKContextGetGeolocationManager(WKContextRef co WK_EXPORT WKIconDatabaseRef WKContextGetIconDatabase(WKContextRef context); WK_EXPORT WKKeyValueStorageManagerRef WKContextGetKeyValueStorageManager(WKContextRef context); WK_EXPORT WKMediaCacheManagerRef WKContextGetMediaCacheManager(WKContextRef context); +WK_EXPORT WKNetworkInfoManagerRef WKContextGetNetworkInfoManager(WKContextRef context); WK_EXPORT WKNotificationManagerRef WKContextGetNotificationManager(WKContextRef context); WK_EXPORT WKPluginSiteDataManagerRef WKContextGetPluginSiteDataManager(WKContextRef context); WK_EXPORT WKResourceCacheManagerRef WKContextGetResourceCacheManager(WKContextRef context); +WK_EXPORT WKVibrationRef WKContextGetVibration(WKContextRef context); typedef void (*WKContextGetStatisticsFunction)(WKDictionaryRef statistics, WKErrorRef error, void* functionContext); WK_EXPORT void WKContextGetStatistics(WKContextRef context, void* functionContext, WKContextGetStatisticsFunction function); diff --git a/Source/WebKit2/UIProcess/API/C/WKNetworkInfo.cpp b/Source/WebKit2/UIProcess/API/C/WKNetworkInfo.cpp new file mode 100644 index 000000000..a9bfd3cb1 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKNetworkInfo.cpp @@ -0,0 +1,53 @@ +/* + * 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 "WKNetworkInfo.h" + +#if ENABLE(NETWORK_INFO) +#include "WKAPICast.h" +#include "WebNetworkInfo.h" + +using namespace WebKit; +#endif + +WKTypeID WKNetworkInfoGetTypeID() +{ +#if ENABLE(NETWORK_INFO) + return toAPI(WebNetworkInfo::APIType); +#else + return 0; +#endif +} + +WKNetworkInfoRef WKNetworkInfoCreate(double bandwidth, bool isMetered) +{ +#if ENABLE(NETWORK_INFO) + RefPtr<WebNetworkInfo> networkInfo = WebNetworkInfo::create(bandwidth, isMetered); + return toAPI(networkInfo.release().leakRef()); +#else + return 0; +#endif +} diff --git a/Source/WebKit2/UIProcess/API/C/WKNetworkInfo.h b/Source/WebKit2/UIProcess/API/C/WKNetworkInfo.h new file mode 100644 index 000000000..cff864a75 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/C/WKNetworkInfo.h @@ -0,0 +1,43 @@ +/* + * 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 WKNetworkInfo_h +#define WKNetworkInfo_h + +#include <WebKit2/WKBase.h> + +#ifdef __cplusplus +extern "C" { +#endif + +WK_EXPORT WKTypeID WKNetworkInfoGetTypeID(); + +WK_EXPORT WKNetworkInfoRef WKNetworkInfoCreate(double bandwidth, bool isMetered); + +#ifdef __cplusplus +} +#endif + +#endif // WKNetworkInfo_h diff --git a/Source/WebKit2/UIProcess/API/C/WKNetworkInfoManager.cpp b/Source/WebKit2/UIProcess/API/C/WKNetworkInfoManager.cpp index 1e0733ac2..85620ad61 100644 --- a/Source/WebKit2/UIProcess/API/C/WKNetworkInfoManager.cpp +++ b/Source/WebKit2/UIProcess/API/C/WKNetworkInfoManager.cpp @@ -39,3 +39,17 @@ WKTypeID WKNetworkInfoManagerGetTypeID() return 0; #endif } + +void WKNetworkInfoManagerSetProvider(WKNetworkInfoManagerRef networkInfoManager, const WKNetworkInfoProvider* provider) +{ +#if ENABLE(NETWORK_INFO) + toImpl(networkInfoManager)->initializeProvider(provider); +#endif +} + +void WKNetworkInfoManagerProviderDidChangeNetworkInformation(WKNetworkInfoManagerRef networkInfoManager, WKStringRef eventType, WKNetworkInfoRef networkInfo) +{ +#if ENABLE(NETWORK_INFO) + toImpl(networkInfoManager)->providerDidChangeNetworkInformation(AtomicString(toImpl(eventType)->string()), toImpl(networkInfo)); +#endif +} diff --git a/Source/WebKit2/UIProcess/API/C/WKNetworkInfoManager.h b/Source/WebKit2/UIProcess/API/C/WKNetworkInfoManager.h index efecf4ef8..dd92eb868 100644 --- a/Source/WebKit2/UIProcess/API/C/WKNetworkInfoManager.h +++ b/Source/WebKit2/UIProcess/API/C/WKNetworkInfoManager.h @@ -52,6 +52,10 @@ enum { kWKNetworkInfoProviderCurrentVersion = 0 }; WK_EXPORT WKTypeID WKNetworkInfoManagerGetTypeID(); +WK_EXPORT void WKNetworkInfoManagerSetProvider(WKNetworkInfoManagerRef networkInfoManager, const WKNetworkInfoProvider* provider); + +WK_EXPORT void WKNetworkInfoManagerProviderDidChangeNetworkInformation(WKNetworkInfoManagerRef networkInfoManager, WKStringRef eventType, WKNetworkInfoRef networkInfo); + #ifdef __cplusplus } #endif |