/*this fonction allows to show the title of iframe in the title bar*/ void FrameLoaderClientWebUI::dispatchDidReceiveTitle(const String& title) { if ((m_frame->tree()->name())!="_ui") { String message = title.deprecatedString().ascii(); message = message.replace("'","\\'"); executeJS(m_frame, "showTitle('"+message+"')"); } }
/*this function allows to realize the notification, calling JS function "loadBar" with the percentage of loading in parameter */ void FrameLoaderClientWebUI::postProgressEstimateChangedNotification() { char s[4]; double progress = m_frame->page()->progress()->estimatedProgress(); int valp = static_cast<int>(progress * 100); sprintf(s, "%i", valp); if ((m_frame->tree()->name()) != "_ui") executeJS(m_frame , "loadBar('" + String(s) + "')"); // m_frame->view()->setDirtyRect(IntRect(0, 0, m_frame->view()->width(), m_frame->view()->height())); }
int main(int argc, const char * argv[]) { // c++ execute javascript file executeJS(); // c++ invoke javascript function // invokeJSFunction(); // bind c++ class to js // registerClass(); return 0; }
/*this function shows an error message in a popup*/ void FrameLoaderClientWebUI::dispatchDidFailProvisionalLoad(const ResourceError& error) { if (!(error.isNull())) { char errorCode[2]; sprintf(errorCode, "%i", error.errorCode()); String description = error.localizedDescription().deprecatedString().ascii(); description = description.replace("'","\\'"); executeJS(m_frame, "errorLoad('" + String(error.domain().deprecatedString().ascii()) + "','" + String(errorCode) + "','" + String(error.failingURL().deprecatedString().ascii()) + "','" + description + "')"); } m_loadFailed = true; }