diff options
Diffstat (limited to 'Source/WebKit2/WebProcess/InjectedBundle/API/c')
8 files changed, 43 insertions, 83 deletions
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.cpp b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.cpp index 2085253ba..7210a9d9e 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.cpp +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.cpp @@ -46,13 +46,13 @@ void WKBundleSetClient(WKBundleRef bundleRef, WKBundleClient * wkClient) void WKBundlePostMessage(WKBundleRef bundleRef, WKStringRef messageNameRef, WKTypeRef messageBodyRef) { - toImpl(bundleRef)->postMessage(toImpl(messageNameRef)->string(), toImpl(messageBodyRef)); + toImpl(bundleRef)->postMessage(toWTFString(messageNameRef), toImpl(messageBodyRef)); } void WKBundlePostSynchronousMessage(WKBundleRef bundleRef, WKStringRef messageNameRef, WKTypeRef messageBodyRef, WKTypeRef* returnDataRef) { RefPtr<APIObject> returnData; - toImpl(bundleRef)->postSynchronousMessage(toImpl(messageNameRef)->string(), toImpl(messageBodyRef), returnData); + toImpl(bundleRef)->postSynchronousMessage(toWTFString(messageNameRef), toImpl(messageBodyRef), returnData); if (returnDataRef) *returnDataRef = toAPI(returnData.release().leakRef()); } @@ -134,7 +134,7 @@ void WKBundleRemoveAllUserContent(WKBundleRef bundleRef, WKBundlePageGroupRef pa void WKBundleOverrideBoolPreferenceForTestRunner(WKBundleRef bundleRef, WKBundlePageGroupRef pageGroupRef, WKStringRef preference, bool enabled) { - toImpl(bundleRef)->overrideBoolPreferenceForTestRunner(toImpl(pageGroupRef), toImpl(preference)->string(), enabled); + toImpl(bundleRef)->overrideBoolPreferenceForTestRunner(toImpl(pageGroupRef), toWTFString(preference), enabled); } void WKBundleSetAllowUniversalAccessFromFileURLs(WKBundleRef bundleRef, WKBundlePageGroupRef pageGroupRef, bool enabled) @@ -194,12 +194,12 @@ void WKBundleSetSpatialNavigationEnabled(WKBundleRef bundleRef, WKBundlePageGrou void WKBundleAddOriginAccessWhitelistEntry(WKBundleRef bundleRef, WKStringRef sourceOrigin, WKStringRef destinationProtocol, WKStringRef destinationHost, bool allowDestinationSubdomains) { - toImpl(bundleRef)->addOriginAccessWhitelistEntry(toImpl(sourceOrigin)->string(), toImpl(destinationProtocol)->string(), toImpl(destinationHost)->string(), allowDestinationSubdomains); + toImpl(bundleRef)->addOriginAccessWhitelistEntry(toWTFString(sourceOrigin), toWTFString(destinationProtocol), toWTFString(destinationHost), allowDestinationSubdomains); } void WKBundleRemoveOriginAccessWhitelistEntry(WKBundleRef bundleRef, WKStringRef sourceOrigin, WKStringRef destinationProtocol, WKStringRef destinationHost, bool allowDestinationSubdomains) { - toImpl(bundleRef)->removeOriginAccessWhitelistEntry(toImpl(sourceOrigin)->string(), toImpl(destinationProtocol)->string(), toImpl(destinationHost)->string(), allowDestinationSubdomains); + toImpl(bundleRef)->removeOriginAccessWhitelistEntry(toWTFString(sourceOrigin), toWTFString(destinationProtocol), toWTFString(destinationHost), allowDestinationSubdomains); } void WKBundleResetOriginAccessWhitelists(WKBundleRef bundleRef) @@ -229,7 +229,7 @@ void WKBundleClearApplicationCache(WKBundleRef bundleRef) void WKBundleClearApplicationCacheForOrigin(WKBundleRef bundleRef, WKStringRef origin) { - toImpl(bundleRef)->clearApplicationCacheForOrigin(toImpl(origin)->string()); + toImpl(bundleRef)->clearApplicationCacheForOrigin(toWTFString(origin)); } void WKBundleSetAppCacheMaximumSize(WKBundleRef bundleRef, uint64_t size) @@ -239,17 +239,17 @@ void WKBundleSetAppCacheMaximumSize(WKBundleRef bundleRef, uint64_t size) uint64_t WKBundleGetAppCacheUsageForOrigin(WKBundleRef bundleRef, WKStringRef origin) { - return toImpl(bundleRef)->appCacheUsageForOrigin(toImpl(origin)->string()); + return toImpl(bundleRef)->appCacheUsageForOrigin(toWTFString(origin)); } void WKBundleSetApplicationCacheOriginQuota(WKBundleRef bundleRef, WKStringRef origin, uint64_t bytes) { - toImpl(bundleRef)->setApplicationCacheOriginQuota(toImpl(origin)->string(), bytes); + toImpl(bundleRef)->setApplicationCacheOriginQuota(toWTFString(origin), bytes); } void WKBundleResetApplicationCacheOriginQuota(WKBundleRef bundleRef, WKStringRef origin) { - toImpl(bundleRef)->resetApplicationCacheOriginQuota(toImpl(origin)->string()); + toImpl(bundleRef)->resetApplicationCacheOriginQuota(toWTFString(origin)); } WKArrayRef WKBundleCopyOriginsWithApplicationCache(WKBundleRef bundleRef) @@ -270,7 +270,7 @@ int WKBundleNumberOfPages(WKBundleRef bundleRef, WKBundleFrameRef frameRef, doub int WKBundlePageNumberForElementById(WKBundleRef bundleRef, WKBundleFrameRef frameRef, WKStringRef idRef, double pageWidthInPixels, double pageHeightInPixels) { - return toImpl(bundleRef)->pageNumberForElementById(toImpl(frameRef), toImpl(idRef)->string(), pageWidthInPixels, pageHeightInPixels); + return toImpl(bundleRef)->pageNumberForElementById(toImpl(frameRef), toWTFString(idRef), pageWidthInPixels, pageHeightInPixels); } WKStringRef WKBundlePageSizeAndMarginsInPixels(WKBundleRef bundleRef, WKBundleFrameRef frameRef, int pageIndex, int width, int height, int marginTop, int marginRight, int marginBottom, int marginLeft) @@ -301,12 +301,12 @@ size_t WKBundleGetWorkerThreadCount(WKBundleRef) void WKBundleSetUserStyleSheetLocation(WKBundleRef bundleRef, WKBundlePageGroupRef pageGroupRef, WKStringRef location) { - toImpl(bundleRef)->setUserStyleSheetLocation(toImpl(pageGroupRef), toImpl(location)->string()); + toImpl(bundleRef)->setUserStyleSheetLocation(toImpl(pageGroupRef), toWTFString(location)); } void WKBundleSetWebNotificationPermission(WKBundleRef bundleRef, WKBundlePageRef pageRef, WKStringRef originStringRef, bool allowed) { - toImpl(bundleRef)->setWebNotificationPermission(toImpl(pageRef), toImpl(originStringRef)->string(), allowed); + toImpl(bundleRef)->setWebNotificationPermission(toImpl(pageRef), toWTFString(originStringRef), allowed); } void WKBundleRemoveAllWebNotificationPermissions(WKBundleRef bundleRef, WKBundlePageRef pageRef) @@ -323,3 +323,13 @@ void WKBundleSetTabKeyCyclesThroughElements(WKBundleRef bundleRef, WKBundlePageR { toImpl(bundleRef)->setTabKeyCyclesThroughElements(toImpl(pageRef), enabled); } + +void WKBundleSetSerialLoadingEnabled(WKBundleRef bundleRef, bool enabled) +{ + toImpl(bundleRef)->setSerialLoadingEnabled(enabled); +} + +void WKBundleDispatchPendingLoadRequests(WKBundleRef bundleRef) +{ + toImpl(bundleRef)->dispatchPendingLoadRequests(); +} diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleAPICast.h b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleAPICast.h index 018ef7970..59c3570bd 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleAPICast.h +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleAPICast.h @@ -32,8 +32,6 @@ #include "WKBundlePrivate.h" #include <WebCore/EditorInsertAction.h> #include <WebCore/TextAffinity.h> -#include <WebCore/UserContentTypes.h> -#include <WebCore/UserScriptTypes.h> namespace WebCore { class CSSStyleDeclaration; @@ -107,32 +105,6 @@ inline WKAffinityType toAPI(WebCore::EAffinity affinity) return kWKAffinityUpstream; } -inline WebCore::UserScriptInjectionTime toUserScriptInjectionTime(WKUserScriptInjectionTime wkInjectedTime) -{ - switch (wkInjectedTime) { - case kWKInjectAtDocumentStart: - return WebCore::InjectAtDocumentStart; - case kWKInjectAtDocumentEnd: - return WebCore::InjectAtDocumentEnd; - } - - ASSERT_NOT_REACHED(); - return WebCore::InjectAtDocumentStart; -} - -inline WebCore::UserContentInjectedFrames toUserContentInjectedFrames(WKUserContentInjectedFrames wkInjectedFrames) -{ - switch (wkInjectedFrames) { - case kWKInjectInAllFrames: - return WebCore::InjectInAllFrames; - case kWKInjectInTopFrameOnly: - return WebCore::InjectInTopFrameOnly; - } - - ASSERT_NOT_REACHED(); - return WebCore::InjectInAllFrames; -} - } // namespace WebKit #endif // WKBundleAPICast_h diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp index 9a2b9fc00..fe6d79ed8 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp @@ -97,12 +97,12 @@ unsigned WKBundleFrameGetNumberOfActiveAnimations(WKBundleFrameRef frameRef) bool WKBundleFramePauseAnimationOnElementWithId(WKBundleFrameRef frameRef, WKStringRef animationName, WKStringRef elementID, double time) { - return toImpl(frameRef)->pauseAnimationOnElementWithId(toImpl(animationName)->string(), toImpl(elementID)->string(), time); + return toImpl(frameRef)->pauseAnimationOnElementWithId(toWTFString(animationName), toWTFString(elementID), time); } bool WKBundleFramePauseTransitionOnElementWithId(WKBundleFrameRef frameRef, WKStringRef propertyName, WKStringRef elementID, double time) { - return toImpl(frameRef)->pauseTransitionOnElementWithId(toImpl(propertyName)->string(), toImpl(elementID)->string(), time); + return toImpl(frameRef)->pauseTransitionOnElementWithId(toWTFString(propertyName), toWTFString(elementID), time); } void WKBundleFrameSuspendAnimations(WKBundleFrameRef frameRef) @@ -194,7 +194,7 @@ WKStringRef WKBundleFrameCopyLayerTreeAsText(WKBundleFrameRef frameRef) bool WKBundleFrameAllowsFollowingLink(WKBundleFrameRef frameRef, WKURLRef urlRef) { - return toImpl(frameRef)->allowsFollowingLink(WebCore::KURL(WebCore::KURL(), toImpl(urlRef)->string())); + return toImpl(frameRef)->allowsFollowingLink(WebCore::KURL(WebCore::KURL(), toWTFString(urlRef))); } WKRect WKBundleFrameGetContentBounds(WKBundleFrameRef frameRef) @@ -234,12 +234,12 @@ bool WKBundleFrameGetDocumentBackgroundColor(WKBundleFrameRef frameRef, double* WKStringRef WKBundleFrameCopySuggestedFilenameForResourceWithURL(WKBundleFrameRef frameRef, WKURLRef urlRef) { - return toCopiedAPI(toImpl(frameRef)->suggestedFilenameForResourceWithURL(WebCore::KURL(WebCore::KURL(), toImpl(urlRef)->string()))); + return toCopiedAPI(toImpl(frameRef)->suggestedFilenameForResourceWithURL(WebCore::KURL(WebCore::KURL(), toWTFString(urlRef)))); } WKStringRef WKBundleFrameCopyMIMETypeForResourceWithURL(WKBundleFrameRef frameRef, WKURLRef urlRef) { - return toCopiedAPI(toImpl(frameRef)->mimeTypeForResourceWithURL(WebCore::KURL(WebCore::KURL(), toImpl(urlRef)->string()))); + return toCopiedAPI(toImpl(frameRef)->mimeTypeForResourceWithURL(WebCore::KURL(WebCore::KURL(), toWTFString(urlRef)))); } bool WKBundleFrameContainsAnyFormElements(WKBundleFrameRef frameRef) @@ -249,7 +249,7 @@ bool WKBundleFrameContainsAnyFormElements(WKBundleFrameRef frameRef) void WKBundleFrameSetTextDirection(WKBundleFrameRef frameRef, WKStringRef directionRef) { - toImpl(frameRef)->setTextDirection(toImpl(directionRef)->string()); + toImpl(frameRef)->setTextDirection(toWTFString(directionRef)); } WKDataRef WKBundleFrameCopyWebArchive(WKBundleFrameRef frameRef) diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleInspector.cpp b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleInspector.cpp index ae69a5394..cc22499a0 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleInspector.cpp +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleInspector.cpp @@ -52,7 +52,7 @@ void WKBundleInspectorClose(WKBundleInspectorRef inspectorRef) void WKBundleInspectorEvaluateScriptForTest(WKBundleInspectorRef inspectorRef, long callID, WKStringRef script) { - return toImpl(inspectorRef)->evaluateScriptForTest(callID, toImpl(script)->string()); + return toImpl(inspectorRef)->evaluateScriptForTest(callID, toWTFString(script)); } void WKBundleInspectorSetPageProfilingEnabled(WKBundleInspectorRef inspectorRef, bool enabled) diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleIntent.cpp b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleIntent.cpp index dc13c57fc..66bee90b0 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleIntent.cpp +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleIntent.cpp @@ -64,7 +64,7 @@ WKBundleIntentRef WKBundleIntentCreate(WKDictionaryRef dictionaryRef) MessagePortArray dummyPorts; ExceptionCode ec; - RefPtr<Intent> coreIntent = Intent::create(toImpl(action)->string(), toImpl(type)->string(), data ? static_cast<SerializedScriptValue*>(toImpl(data)->internalRepresentation()) : 0, dummyPorts, ec); + RefPtr<Intent> coreIntent = Intent::create(toWTFString(action), toWTFString(type), data ? static_cast<SerializedScriptValue*>(toImpl(data)->internalRepresentation()) : 0, dummyPorts, ec); return toAPI(InjectedBundleIntent::create(coreIntent.get()).leakRef()); #else diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp index 15088e7d6..53ddf6107 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp @@ -212,12 +212,12 @@ WKStringRef WKBundlePageCopyRenderTreeExternalRepresentation(WKBundlePageRef pag void WKBundlePageExecuteEditingCommand(WKBundlePageRef pageRef, WKStringRef name, WKStringRef argument) { - toImpl(pageRef)->executeEditingCommand(toImpl(name)->string(), toImpl(argument)->string()); + toImpl(pageRef)->executeEditingCommand(toWTFString(name), toWTFString(argument)); } bool WKBundlePageIsEditingCommandEnabled(WKBundlePageRef pageRef, WKStringRef name) { - return toImpl(pageRef)->isEditingCommandEnabled(toImpl(name)->string()); + return toImpl(pageRef)->isEditingCommandEnabled(toWTFString(name)); } void WKBundlePageClearMainFrameName(WKBundlePageRef pageRef) @@ -277,7 +277,7 @@ void WKBundlePageUninstallPageOverlay(WKBundlePageRef pageRef, WKBundlePageOverl bool WKBundlePageHasLocalDataForURL(WKBundlePageRef pageRef, WKURLRef urlRef) { - return toImpl(pageRef)->hasLocalDataForURL(WebCore::KURL(WebCore::KURL(), toImpl(urlRef)->string())); + return toImpl(pageRef)->hasLocalDataForURL(WebCore::KURL(WebCore::KURL(), toWTFString(urlRef))); } bool WKBundlePageCanHandleRequest(WKURLRequestRef requestRef) @@ -287,7 +287,7 @@ bool WKBundlePageCanHandleRequest(WKURLRequestRef requestRef) bool WKBundlePageFindString(WKBundlePageRef pageRef, WKStringRef target, WKFindOptions findOptions) { - return toImpl(pageRef)->findStringFromInjectedBundle(toImpl(target)->string(), toFindOptions(findOptions)); + return toImpl(pageRef)->findStringFromInjectedBundle(toWTFString(target), toFindOptions(findOptions)); } WKImageRef WKBundlePageCreateSnapshotWithOptions(WKBundlePageRef pageRef, WKRect rect, WKSnapshotOptions options) @@ -403,7 +403,7 @@ WKArrayRef WKBundlePageCopyTrackedRepaintRects(WKBundlePageRef pageRef) void WKBundlePageSetComposition(WKBundlePageRef pageRef, WKStringRef text, int from, int length) { - toImpl(pageRef)->setCompositionForTesting(toImpl(text)->string(), from, length); + toImpl(pageRef)->setCompositionForTesting(toWTFString(text), from, length); } bool WKBundlePageHasComposition(WKBundlePageRef pageRef) @@ -418,26 +418,12 @@ void WKBundlePageConfirmComposition(WKBundlePageRef pageRef) void WKBundlePageConfirmCompositionWithText(WKBundlePageRef pageRef, WKStringRef text) { - toImpl(pageRef)->confirmCompositionForTesting(toImpl(text)->string()); + toImpl(pageRef)->confirmCompositionForTesting(toWTFString(text)); } bool WKBundlePageCanShowMIMEType(WKBundlePageRef, WKStringRef mimeTypeRef) { - using WebCore::MIMETypeRegistry; + const String mimeType = toWTFString(mimeTypeRef); - const WTF::String mimeType = toImpl(mimeTypeRef)->string(); - - if (MIMETypeRegistry::isSupportedNonImageMIMEType(mimeType)) - return true; - - if (MIMETypeRegistry::isSupportedImageMIMEType(mimeType)) - return true; - - if (MIMETypeRegistry::isSupportedMediaMIMEType(mimeType)) - return true; - - if (mimeType.startsWith("text/", false)) - return !MIMETypeRegistry::isUnsupportedTextMIMEType(mimeType); - - return false; + return WebCore::MIMETypeRegistry::canShowMIMEType(mimeType); } diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h index dce7cf862..c2b37894a 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h @@ -154,11 +154,13 @@ struct WKBundlePageLoaderClient { // Version 3 WKBundlePageDidReceiveIntentForFrameCallback didReceiveIntentForFrame; WKBundlePageRegisterIntentServiceForFrameCallback registerIntentServiceForFrame; + + // Version 4 WKBundlePageDidLayoutCallback didLayout; }; typedef struct WKBundlePageLoaderClient WKBundlePageLoaderClient; -enum { kWKBundlePageLoaderClientCurrentVersion = 3 }; +enum { kWKBundlePageLoaderClientCurrentVersion = 4 }; enum { WKBundlePagePolicyActionPassThrough, diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePrivate.h b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePrivate.h index f032c6222..369c4302f 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePrivate.h +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePrivate.h @@ -36,18 +36,6 @@ extern "C" { #endif -enum WKUserScriptInjectionTime { - kWKInjectAtDocumentStart, - kWKInjectAtDocumentEnd -}; -typedef enum WKUserScriptInjectionTime WKUserScriptInjectionTime; - -enum WKUserContentInjectedFrames { - kWKInjectInAllFrames, - kWKInjectInTopFrameOnly -}; -typedef enum WKUserContentInjectedFrames WKUserContentInjectedFrames; - // TestRunner only SPI WK_EXPORT void WKBundleSetShouldTrackVisitedLinks(WKBundleRef bundle, bool shouldTrackVisitedLinks); WK_EXPORT void WKBundleSetAlwaysAcceptCookies(WKBundleRef bundle, bool); @@ -113,6 +101,8 @@ WK_EXPORT void WKBundleSetPageVisibilityState(WKBundleRef bundle, WKBundlePageRe WK_EXPORT size_t WKBundleGetWorkerThreadCount(WKBundleRef bundle); WK_EXPORT void WKBundleSetTabKeyCyclesThroughElements(WKBundleRef bundle, WKBundlePageRef page, bool enabled); +WK_EXPORT void WKBundleSetSerialLoadingEnabled(WKBundleRef bundle, bool enabled); +WK_EXPORT void WKBundleDispatchPendingLoadRequests(WKBundleRef bundle); #ifdef __cplusplus } |