void UnityBerkeliumWindow::onNavigationRequested(Berkelium::Window *win, Berkelium::URLString newUrl, Berkelium::URLString referrer, bool isNewWindow, bool &cancelDefaultAction)
{
	cerr << "[UnityBerkeliumWindow] onNavigationRequested called (window: " << win << ")" << endl;
	cerr << "  newUrl: " << newUrl << endl;
	cerr << "  referrer: " << referrer << endl;
	cerr << "  isNewWindow: " << (isNewWindow ? "yes" : "no") << endl;

    if(m_navHookCb && strncmp(newUrl.data(), m_navHookUrl.data(), m_navHookUrl.length()) == 0)
    {
        cerr << "  !! Hooked navigation and cancelled!! " << endl;
		m_navHookCb(newUrl.data());
        cancelDefaultAction = true;
        return;
    }
}
void ofxBerkelium::onScriptAlert(Berkelium::Window *win, Berkelium::WideString message,
						   Berkelium::WideString defaultValue, Berkelium::URLString url,
						   int flags, bool &success, Berkelium::WideString &value) {
	status = wstring2string( message.data() );
	if(listener) listener->onScriptAlert(message.data(), defaultValue.data(), url.data(),
										 flags, success, value.data());
}
void UnityBerkeliumWindow::onAddressBarChanged(Berkelium::Window *win, Berkelium::URLString newURL)
{
	cerr << "[UnityBerkeliumWindow] onAddressBarChanged called (window: " << win << ")" << endl;
	cerr << "  newURL: " << newURL << endl;
    
    m_addressUrl = newURL.data();
}
Example #4
0
	void BerkeliumBrowser::onAddressBarChanged(Berkelium::Window *win, Berkelium::URLString newURL)
	{
		mUrlEditBox->setCaption(newURL.data());
		mBackButton->setEnabled(mWebPageBerkeliumWidget->getBerkeliumWindow()->canGoBack());
		mForwardButton->setEnabled(mWebPageBerkeliumWidget->getBerkeliumWindow()->canGoForward());
	}
void ofxBerkelium::onExternalHost(Berkelium::Window *win, Berkelium::WideString message, Berkelium::URLString origin,
								  Berkelium::URLString target) {
	if(listener) listener->onExternalHost(message.data(), origin.data(), target.data());
}
void ofxBerkelium::onJavascriptCallback(Berkelium::Window *win, void* replyMsg, Berkelium::URLString url,
										Berkelium::WideString funcName, Berkelium::Script::Variant *args,
										size_t numArgs) {
	if(listener) listener->onJavascriptCallback(replyMsg, url.data(), funcName.data(), args, numArgs);
}
void ofxBerkelium::onNavigationRequested(Berkelium::Window *win, Berkelium::URLString newURL,
								   Berkelium::URLString referrer, bool isNewWindow,
								   bool &cancelDefaultAction) {
	status = "Navigating to "+string(newURL.data());
	if(listener) listener->onNavigationRequested(newURL.data(), referrer.data(), isNewWindow, cancelDefaultAction);
}
void ofxBerkelium::onProvisionalLoadError(Berkelium::Window *win, Berkelium::URLString url,
									int errorCode, bool isMainFrame) {
	if(listener) listener->onProvisionalLoadError(url.data(), errorCode, isMainFrame);
}
void ofxBerkelium::onStartLoading(Berkelium::Window *win, Berkelium::URLString newURL) {
	if(listener) listener->onStartLoading(newURL.data());
}
void ofxBerkelium::onAddressBarChanged(Berkelium::Window *win, Berkelium::URLString newURL) {
	addressBar = newURL.data();
	if(listener) listener->onAddressBarChanged(newURL.data());
}