bool CD3D9WebkitNotification::LoadUpdate(EA::WebKit::LoadInfo& info) { const char * szURI = ConvertUnicodeToANSI(g_pWebkit->GetWebKit()->GetCharacters(info.mURI)); const char * szTitle = ConvertUnicodeToANSI(g_pWebkit->GetWebKit()->GetCharacters(info.mPageTitle)); CD3D9WebView * pView = (CD3D9WebView*)info.mpView->GetUserData(); CLogFile::Printf("[WEBKIT]: View: 0x%x", pView); CSquirrelArguments table; table.push(pView->GetName().Get()); table.push(info.mbCompleted); table.push((int)info.mContentLength); table.push((int)info.mLastChangedTime); table.push(szTitle); table.push(info.mStatusCode); table.push(szURI); g_pEvents->Call("webkitLoadUpdate", &table); SAFE_DELETE( szURI ); SAFE_DELETE( szTitle ); return true; }
char const *PhonemeEditor::CloseCaption_StreamToShortName( CCloseCaptionPhrase *phrase ) { static char shortname[ 32 ]; char converted[ 1024 ]; ConvertUnicodeToANSI( phrase->GetStream(), converted, sizeof( converted ) ); Q_strncpy( shortname, converted, sizeof( shortname ) ); if ( strlen( shortname ) > 16 ) { shortname[ 16 ] = 0; strcat( shortname, "..." ); } return shortname; }
bool CD3D9WebkitNotification::JavascriptMethodInvoked(EA::WebKit::JavascriptMethodInvokedInfo& info) { CSquirrelArguments table; CD3D9WebView * pView = (CD3D9WebView*)info.mpView->GetUserData(); table.push(pView->GetName().Get()); table.push(info.mMethodName); CSquirrelArguments array; const char * strings[10U] = {0}; int stringsCount = 0; for(int i = 0; i < (int)info.mArgumentCount; i++) { switch(info.mArguments[i].GetType()) { case EA::WebKit::JavascriptValueType_Boolean: array.push(info.mArguments[i].GetBooleanValue()); break; case EA::WebKit::JavascriptValueType_Number: array.push((float)info.mArguments[i].GetNumberValue()); break; case EA::WebKit::JavascriptValueType_String: strings[stringsCount] = ConvertUnicodeToANSI(info.mArguments[i].GetStringCharacters()); array.push(strings[stringsCount]); stringsCount++; break; default: array.push("undefined"); break; } } table.push(array, true); g_pEvents->Call("webkitJSMethodInvoked", &table); for(int i = 0; i < stringsCount; i++) { if(strings[i] != 0) { SAFE_DELETE( strings[i] ); } } return true; }