本文整理汇总了C++中WKRetainPtr类的典型用法代码示例。如果您正苦于以下问题:C++ WKRetainPtr类的具体用法?C++ WKRetainPtr怎么用?C++ WKRetainPtr使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了WKRetainPtr类的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: startUpdatingCallback
static void startUpdatingCallback(WKGeolocationManagerRef manager, const void* clientInfo)
{
GeolocationStateTracker* stateTracker = static_cast<GeolocationStateTracker*>(const_cast<void*>(clientInfo));
stateTracker->events.push_back(GeolocationEvent::StartUpdating);
stateTracker->eventsChanged();
WKRetainPtr<WKGeolocationPositionRef> position = adoptWK(WKGeolocationPositionCreate(0, 50.644358, 3.345453, 2.53));
WKGeolocationManagerProviderDidChangePosition(manager, position.get());
}
开发者ID:cheekiatng,项目名称:webkit,代码行数:9,代码来源:Geolocation.cpp
示例2: toWK
void LayoutTestController::addUserScript(JSStringRef source, bool runAtStart, bool allFrames)
{
WKRetainPtr<WKStringRef> sourceWK = toWK(source);
WKRetainPtr<WKBundleScriptWorldRef> scriptWorld(AdoptWK, WKBundleScriptWorldCreateWorld());
WKBundleAddUserScript(InjectedBundle::shared().bundle(), scriptWorld.get(), sourceWK.get(), 0, 0, 0,
(runAtStart ? kWKInjectAtDocumentStart : kWKInjectAtDocumentEnd),
(allFrames ? kWKInjectInAllFrames : kWKInjectInTopFrameOnly));
}
开发者ID:achellies,项目名称:WinCEWebKit,代码行数:9,代码来源:LayoutTestController.cpp
示例3: adoptWK
void TestRunner::setUserStyleSheetEnabled(bool enabled)
{
m_userStyleSheetEnabled = enabled;
WKRetainPtr<WKStringRef> emptyUrl = adoptWK(WKStringCreateWithUTF8CString(""));
WKStringRef location = enabled ? m_userStyleSheetLocation.get() : emptyUrl.get();
auto& injectedBundle = InjectedBundle::singleton();
WKBundleSetUserStyleSheetLocation(injectedBundle.bundle(), injectedBundle.pageGroup(), location);
}
开发者ID:cheekiatng,项目名称:webkit,代码行数:9,代码来源:TestRunner.cpp
示例4: willSendRequestForFrame
static WKURLRequestRef willSendRequestForFrame(WKBundlePageRef, WKBundleFrameRef frame, uint64_t resourceIdentifier, WKURLRequestRef request, WKURLResponseRef redirectResponse, const void *clientInfo)
{
// Allow the loading of the main resource, but don't allow the loading of an iframe, return null from willSendRequest.
if (WKBundleFrameIsMainFrame(frame)) {
WKRetainPtr<WKURLRequestRef> newRequest = request;
return newRequest.leakRef();
}
return 0;
}
开发者ID:CannedFish,项目名称:webkitgtk,代码行数:10,代码来源:LoadCanceledNoServerRedirectCallback_Bundle.cpp
示例5: TEST_F
TEST_F(WebKit2UserMessageRoundTripTest, WKString)
{
WKRetainPtr<WKStringRef> string = adoptWK(WKStringCreateWithUTF8CString("An important string"));
roundTrip(string.get());
WKTypeRef roundTrippedTypeRef = recievedBody.get();
WKRetainPtr<WKStringRef> roundTrippedString = static_cast<WKStringRef>(roundTrippedTypeRef);
EXPECT_TRUE(WKStringIsEqual(roundTrippedString.get(), string.get()));
}
开发者ID:cheekiatng,项目名称:webkit,代码行数:10,代码来源:UserMessage.cpp
示例6: didAssociateFormControls
static void didAssociateFormControls(WKBundlePageRef page, WKArrayRef elementHandles, const void*)
{
WKRetainPtr<WKMutableDictionaryRef> messageBody = adoptWK(WKMutableDictionaryCreate());
WKDictionarySetItem(messageBody.get(), Util::toWK("Page").get(), page);
WKRetainPtr<WKUInt64Ref> numberOfElements = adoptWK(WKUInt64Create(WKArrayGetSize(elementHandles)));
WKDictionarySetItem(messageBody.get(), Util::toWK("NumberOfControls").get(), numberOfElements.get());
WKBundlePostMessage(InjectedBundleController::singleton().bundle(), Util::toWK("DidReceiveDidAssociateFormControls").get(), messageBody.get());
}
开发者ID:Comcast,项目名称:WebKitForWayland,代码行数:10,代码来源:DidAssociateFormControls_Bundle.cpp
示例7: bundlePathForExtension
Ref<EwkContext> EwkContext::create(const String& extensionsPath)
{
String bundlePath = bundlePathForExtension();
if (bundlePath.isEmpty())
return adoptRef(*new EwkContext(adoptWK(WKContextCreate()).get()));
WKRetainPtr<WKStringRef> path = adoptWK(toCopiedAPI(bundlePath));
return adoptRef(*new EwkContext(adoptWK(WKContextCreateWithInjectedBundlePath(path.get())).get(), extensionsPath));
}
开发者ID:cheekiatng,项目名称:webkit,代码行数:10,代码来源:ewk_context.cpp
示例8: adoptWK
/**
* @internal
* The url of view was changed by the frame loader.
*
* Emits signal: "url,changed" with pointer to new url string.
*/
void EwkView::informURLChange()
{
WKRetainPtr<WKURLRef> wkActiveURL = adoptWK(WKPageCopyActiveURL(wkPage()));
WKRetainPtr<WKStringRef> wkURLString = wkActiveURL ? adoptWK(WKURLCopyString(wkActiveURL.get())) : adoptWK(WKStringCreateWithUTF8CString(""));
if (WKStringIsEqualToUTF8CString(wkURLString.get(), m_url))
return;
m_url = WKEinaSharedString(wkURLString.get());
smartCallback<URLChanged>().call(m_url);
}
开发者ID:cheekiatng,项目名称:webkit,代码行数:17,代码来源:EwkView.cpp
示例9: initEcoreEvas
PlatformWebView::PlatformWebView(WKContextRef contextRef, WKPageGroupRef pageGroupRef)
{
m_window = initEcoreEvas();
m_view = EWKViewCreate(contextRef, pageGroupRef, ecore_evas_get(m_window), /* smart */ 0);
WKRetainPtr<WKStringRef> wkTheme = adoptWK(WKStringCreateWithUTF8CString(TEST_THEME_DIR "/default.edj"));
WKViewSetThemePath(EWKViewGetWKView(m_view), wkTheme.get());
evas_object_smart_callback_add(m_view, "webprocess,crashed", onWebProcessCrashed, 0);
resizeTo(600, 800);
}
开发者ID:massa84,项目名称:phantomjs-webkit,代码行数:12,代码来源:PlatformWebView.cpp
示例10: filterFirstItemCallback
static bool filterFirstItemCallback(WKPageRef page, WKStringRef valueType, WKTypeRef value, void* context)
{
if (!WKStringIsEqual(valueType, WKPageGetSessionBackForwardListItemValueType()))
return true;
ASSERT(WKGetTypeID(value) == WKBackForwardListItemGetTypeID());
WKBackForwardListItemRef backForwardListItem = static_cast<WKBackForwardListItemRef>(value);
WKRetainPtr<WKURLRef> url = adoptWK(WKBackForwardListItemCopyURL(backForwardListItem));
WKRetainPtr<WKStringRef> path = adoptWK(WKURLCopyLastPathComponent(url.get()));
return !WKStringIsEqualToUTF8CString(path.get(), "simple.html");
}
开发者ID:cheekiatng,项目名称:webkit,代码行数:13,代码来源:WKPageCopySessionStateWithFiltering.cpp
示例11: EWKViewCreate
Evas_Object* EWKViewCreate(WKContextRef context, WKPageGroupRef pageGroup, Evas* canvas, Evas_Smart* smart)
{
if (!EwkMain::singleton().isInitialized()) {
EINA_LOG_CRIT("EWebKit has not been initialized. You must call ewk_init() before creating view.");
return nullptr;
}
WKRetainPtr<WKViewRef> wkView = adoptWK(WKViewCreate(context, pageGroup));
if (EwkView* ewkView = EwkView::create(wkView.get(), canvas, smart))
return ewkView->evasObject();
return nullptr;
}
开发者ID:cheekiatng,项目名称:webkit,代码行数:13,代码来源:ewk_view.cpp
示例12: adoptWK
void QtWebPageUIClient::runOpenPanel(WKPageRef, WKFrameRef, WKOpenPanelParametersRef parameters, WKOpenPanelResultListenerRef listener, const void* clientInfo)
{
WKRetainPtr<WKArrayRef> wkSelectedFileNames = adoptWK(WKOpenPanelParametersCopySelectedFileNames(parameters));
QStringList selectedFileNames;
size_t selectedFilesSize = WKArrayGetSize(wkSelectedFileNames.get());
selectedFileNames.reserve(selectedFilesSize);
for (size_t i = 0; i < selectedFilesSize; ++i)
selectedFileNames += WKStringCopyQString(static_cast<WKStringRef>(WKArrayGetItemAtIndex(wkSelectedFileNames.get(), i)));
FileChooserType allowMultipleFiles = WKOpenPanelParametersGetAllowsMultipleFiles(parameters) ? MultipleFilesSelection : SingleFileSelection;
toQtWebPageUIClient(clientInfo)->runOpenPanel(listener, selectedFileNames, allowMultipleFiles);
}
开发者ID:valbok,项目名称:qtwebkit,代码行数:13,代码来源:QtWebPageUIClient.cpp
示例13: WKBundlePageGetMainFrame
void EventSendingController::mouseDown(int button, JSValueRef modifierArray)
{
WKBundlePageRef page = InjectedBundle::shared().page()->page();
WKBundleFrameRef frame = WKBundlePageGetMainFrame(page);
JSContextRef context = WKBundleFrameGetJavaScriptContext(frame);
WKEventModifiers modifiers = parseModifierArray(context, modifierArray);
#ifdef USE_WEBPROCESS_EVENT_SIMULATION
updateClickCount(button);
WKBundlePageSimulateMouseDown(page, button, m_position, m_clickCount, modifiers, m_time);
#else
WKRetainPtr<WKStringRef> EventSenderMessageName(AdoptWK, WKStringCreateWithUTF8CString("EventSender"));
WKRetainPtr<WKMutableDictionaryRef> EventSenderMessageBody(AdoptWK, WKMutableDictionaryCreate());
WKRetainPtr<WKStringRef> subMessageKey(AdoptWK, WKStringCreateWithUTF8CString("SubMessage"));
WKRetainPtr<WKStringRef> subMessageName(AdoptWK, WKStringCreateWithUTF8CString("MouseDown"));
WKDictionaryAddItem(EventSenderMessageBody.get(), subMessageKey.get(), subMessageName.get());
WKRetainPtr<WKStringRef> buttonKey = adoptWK(WKStringCreateWithUTF8CString("Button"));
WKRetainPtr<WKUInt64Ref> buttonRef = adoptWK(WKUInt64Create(button));
WKDictionaryAddItem(EventSenderMessageBody.get(), buttonKey.get(), buttonRef.get());
WKRetainPtr<WKStringRef> modifiersKey = adoptWK(WKStringCreateWithUTF8CString("Modifiers"));
WKRetainPtr<WKUInt64Ref> modifiersRef = adoptWK(WKUInt64Create(modifiers));
WKDictionaryAddItem(EventSenderMessageBody.get(), modifiersKey.get(), modifiersRef.get());
WKBundlePostSynchronousMessage(InjectedBundle::shared().bundle(), EventSenderMessageName.get(), EventSenderMessageBody.get(), 0);
#endif
}
开发者ID:sanyaade-webdev,项目名称:webkit,代码行数:29,代码来源:EventSendingController.cpp
示例14: ASSERT
WebPageProxy* WebInspectorProxy::platformCreateInspectorPage()
{
ASSERT(m_inspectedPage);
#ifdef HAVE_ECORE_X
const char* engine = "opengl_x11";
m_inspectorWindow = ecore_evas_new(engine, 0, 0, initialWindowWidth, initialWindowHeight, 0);
// Gracefully fall back to software if evas_gl engine is not available.
if (!m_inspectorWindow)
#endif
m_inspectorWindow = ecore_evas_new(0, 0, 0, initialWindowWidth, initialWindowHeight, 0);
if (!m_inspectorWindow)
return 0;
WKContextRef wkContext = toAPI(&inspectorProcessPool());
WKRetainPtr<WKStringRef> wkGroupIdentifier = adoptWK(WKStringCreateWithUTF8CString(inspectorPageGroupIdentifier().utf8().data()));
WKPageGroupRef wkPageGroup = WKPageGroupCreateWithIdentifier(wkGroupIdentifier.get());
WKRetainPtr<WKPageConfigurationRef> wkPageConfiguration = adoptWK(WKPageConfigurationCreate());
WKPageConfigurationSetContext(wkPageConfiguration.get(), wkContext);
WKPageConfigurationSetPageGroup(wkPageConfiguration.get(), wkPageGroup);
m_inspectorView = EWKViewCreate(wkContext, wkPageConfiguration.get(), ecore_evas_get(m_inspectorWindow), /* smart */ 0);
WKViewRef wkView = EWKViewGetWKView(m_inspectorView);
WKRetainPtr<WKStringRef> wkTheme = adoptWK(WKStringCreateWithUTF8CString(DEFAULT_THEME_DIR "/default.edj"));
WKViewSetThemePath(wkView, wkTheme.get());
WKPreferencesRef wkPreferences = WKPageGroupGetPreferences(wkPageGroup);
WKPreferencesSetFileAccessFromFileURLsAllowed(wkPreferences, true);
WKPreferencesSetJavaScriptRuntimeFlags(wkPreferences, 0);
return toImpl(WKViewGetPage(wkView));
}
开发者ID:valbok,项目名称:WebKitForWayland,代码行数:35,代码来源:WebInspectorProxyEfl.cpp
示例15: willLoadDataRequest
static void willLoadDataRequest(WKBundlePageRef page, WKURLRequestRef request, WKDataRef data, WKStringRef MIMEType, WKStringRef encodingName, WKURLRef unreachableURL, WKTypeRef userData, const void *clientInfo)
{
WKRetainPtr<WKMutableDictionaryRef> messageBody = adoptWK(WKMutableDictionaryCreate());
WKDictionarySetItem(messageBody.get(), Util::toWK("URLRequestReturn").get(), request);
WKDictionarySetItem(messageBody.get(), Util::toWK("DataReturn").get(), data);
WKDictionarySetItem(messageBody.get(), Util::toWK("MIMETypeReturn").get(), MIMEType);
WKDictionarySetItem(messageBody.get(), Util::toWK("EncodingNameReturn").get(), encodingName);
WKDictionarySetItem(messageBody.get(), Util::toWK("UnreachableURLReturn").get(), unreachableURL);
WKDictionarySetItem(messageBody.get(), Util::toWK("UserDataReturn").get(), userData);
WKBundlePostMessage(InjectedBundleController::singleton().bundle(), Util::toWK("WillLoadDataRequestReturn").get(), messageBody.get());
}
开发者ID:Comcast,项目名称:WebKitForWayland,代码行数:14,代码来源:WillLoad_Bundle.cpp
示例16: TEST
TEST(WebKit2, AboutBlankLoad)
{
WKRetainPtr<WKContextRef> context = adoptWK(WKContextCreate());
PlatformWebView webView(context.get());
WKPageLoaderClient loaderClient;
memset(&loaderClient, 0 , sizeof(loaderClient));
loaderClient.didFinishLoadForFrame = didFinishLoadForFrame;
WKPageSetPageLoaderClient(webView.page(), &loaderClient);
WKPageLoadURL(webView.page(), adoptWK(WKURLCreateWithUTF8CString("about:blank")).get());
Util::run(&done);
}
开发者ID:BennyH26,项目名称:phantomjs,代码行数:14,代码来源:AboutBlankLoad.cpp
示例17: sprintf
void DOMWindowExtensionBasic::sendExtensionStateMessage()
{
char body[16384];
sprintf(body, "Extension states:\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s",
m_extensionRecords[0].name, stateNames[m_extensionRecords[0].state],
m_extensionRecords[1].name, stateNames[m_extensionRecords[1].state],
m_extensionRecords[2].name, stateNames[m_extensionRecords[2].state],
m_extensionRecords[3].name, stateNames[m_extensionRecords[3].state],
m_extensionRecords[4].name, stateNames[m_extensionRecords[4].state],
m_extensionRecords[5].name, stateNames[m_extensionRecords[5].state]);
WKRetainPtr<WKStringRef> messageName = adoptWK(WKStringCreateWithUTF8CString("ExtensionStates"));
WKRetainPtr<WKStringRef> messageBody = adoptWK(WKStringCreateWithUTF8CString(body));
WKBundlePostMessage(m_bundle, messageName.get(), messageBody.get());
}
开发者ID:conioh,项目名称:os-design,代码行数:15,代码来源:DOMWindowExtensionBasic_Bundle.cpp
示例18: didFinishLoadForFrame
static void didFinishLoadForFrame(WKBundlePageRef page, WKBundleFrameRef frame, WKTypeRef* userData, const void *clientInfo)
{
if (!WKBundleFrameIsMainFrame(frame)) {
childFrame = frame;
return;
}
bool isParentFrameCheckSuccessful = childFrame ? WKBundleFrameGetParentFrame(childFrame.get()) == frame : false;
WKBundlePostMessage(testBundle.get(), Util::toWK("DidCheckParentFrame").get(), adoptWK(WKBooleanCreate(isParentFrameCheckSuccessful)).get());
}
开发者ID:3163504123,项目名称:phantomjs,代码行数:10,代码来源:ParentFrame_Bundle.cpp
示例19: roundTrip
// Used to test sending a WKType round trip to the WebProcess and back.
// Result is stored into the recievedBody member variable.
void roundTrip(WKTypeRef object)
{
WKTypeID storedTypeID = WKGetTypeID(object);
recievedBody.clear();
didReceiveMessage = false;
WKContextPostMessageToInjectedBundle(context.get(), Util::toWK("RoundTrip").get(), object);
Util::run(&didReceiveMessage);
EXPECT_NOT_NULL(recievedBody);
EXPECT_EQ(storedTypeID, WKGetTypeID(recievedBody.get()));
}
开发者ID:cheekiatng,项目名称:webkit,代码行数:14,代码来源:UserMessage.cpp
注:本文中的WKRetainPtr类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论