virtual void onNavigationRequested(Window *win, URLString newURL, URLString referrer, bool isNewWindow, bool &cancelDefaultAction) { if (isNewWindow) cancelDefaultAction = true; // Parse prefix of new URL, and call appropriate handler const char *start = newURL.data(); const char *end = newURL.data() + newURL.length(); const char *colon = std::find(start, end, ':'); if (colon != end) { char prefix[128] = {0}; size_t colonOffset = colon - start; memcpy_s(prefix, (_countof(prefix) - 1) * sizeof(prefix[0]), start, colonOffset); EternityWebBrowser::UrlHandler *h = g_pBrowserManager->FindURLHandler(prefix); if (h && h->fn && newURL.length() > colonOffset + 3) { // Send rest of the URL string to the handler h->fn(newURL.data() + colonOffset + 3); } } #ifdef BERKELIM_EXTENDED_LOG r3dOutToLog("*** onNavigationRequested %s\n", newURL.data()); #endif }
virtual void onNavigationRequested(Window *win, URLString newUrl, URLString referrer, bool isNewWindow, bool &cancelDefaultAction) { WindowDelegate::onNavigationRequested(win,newUrl,referrer,isNewWindow,cancelDefaultAction); m_owner->__FIRE_OnNavigationRequested(m_owner,newUrl.data(),referrer.data(),isNewWindow); }
virtual void onProvisionalLoadError(Window *win, URLString url, int errorCode, bool isMainFrame) { #ifdef BERKELIM_EXTENDED_LOG r3dOutToLog("*** onProvisionalLoadError %s\n", url.data()); #endif }
virtual void onStartLoading(Window *win, URLString newURL) { #ifdef BERKELIM_EXTENDED_LOG r3dOutToLog("*** onStartLoading %s\n", newURL.data()); #endif Berkelium::WideString ws = Berkelium::WideString::point_to(L"javascript:void(document.body.style.background = \"#2e3e4a\");"); win->executeJavascript(ws); }
virtual void onJavascriptCallback(Window *win, void* replyMsg, URLString origin, WideString funcName, Script::Variant *args, size_t numArgs) { WindowDelegate::onJavascriptCallback(win,replyMsg,origin,funcName,args,numArgs); std::vector<core::stringw> argsVal; for (int i=0;i<numArgs;++i) { switch(args[i].type()) { case Script::Variant::JSSTRING: argsVal.push_back(args[i].toString().data()); break; case Script::Variant::JSBOOLEAN: argsVal.push_back(core::string_to_wchar(core::StringConverter::toString(args[i].toBoolean()))); break; case Script::Variant::JSDOUBLE: argsVal.push_back(core::string_to_wchar(core::StringConverter::toString(args[i].toDouble()))); break; default: argsVal.push_back(L"0"); } } m_owner->__FIRE_OnJavascriptCallback(m_owner,origin.data(),funcName.data(),argsVal); }
virtual void onAddressBarChanged(Window *win, URLString newURL) { #ifdef BERKELIM_EXTENDED_LOG r3dOutToLog("*** onAddressBarChanged %s\n", newURL.data()); #endif }
virtual void onStartLoading(Window *win, URLString newURL) { m_owner->__FIRE_OnStartLoading(m_owner,newURL.data()); }
virtual void onAddressBarChanged(Window *win, URLString newURL) { m_owner->__FIRE_OnAddressChanged(m_owner,newURL.data()); }