本文整理汇总了C++中CClientWebBrowser::GetSourceCode方法的典型用法代码示例。如果您正苦于以下问题:C++ CClientWebBrowser::GetSourceCode方法的具体用法?C++ CClientWebBrowser::GetSourceCode怎么用?C++ CClientWebBrowser::GetSourceCode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CClientWebBrowser
的用法示例。
在下文中一共展示了CClientWebBrowser::GetSourceCode方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetBrowserSource
int CLuaFunctionDefs::GetBrowserSource ( lua_State* luaVM )
{
// bool getBrowserSource ( function callback )
CClientWebBrowser* pWebBrowser; CLuaFunctionRef callbackFunction;
CScriptArgReader argStream ( luaVM );
argStream.ReadUserData ( pWebBrowser );
argStream.ReadFunction ( callbackFunction );
argStream.ReadFunctionComplete ();
if ( !argStream.HasErrors () )
{
CLuaMain* pLuaMain = m_pLuaManager->GetVirtualMachine ( luaVM );
if ( pLuaMain && VERIFY_FUNCTION ( callbackFunction ) )
{
pWebBrowser->GetSourceCode ( [callbackFunction, pLuaMain]( const std::string& code ) {
/*
This function should not be called when the resource is about to stop as
stopping the resource destroys the browser element and thus cancels the
CefStringVisitor callback class (see CWebView::GetSourceCode::MyStringVisitor)
*/
if ( VERIFY_FUNCTION ( callbackFunction ) )
{
CLuaArguments arguments;
// TODO: Use SCharStringRef/direct string access instead of copying strings around
arguments.PushString ( code );
arguments.Call ( pLuaMain, callbackFunction );
}
});
lua_pushboolean ( luaVM, true );
return 1;
}
}
else
m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage () );
lua_pushboolean ( luaVM, false );
return 1;
}