bool ClientAdapter::OnConsoleMessage(CefRefPtr<CefBrowser> browser, const CefString& message, const CefString& source, int line) { String^ messageStr = toClr(message); String^ sourceStr = toClr(source); _browserControl->RaiseConsoleMessage(messageStr, sourceStr, line); return true; }
void ClientAdapter::OnAddressChange(CefRefPtr<CefBrowser> browser, CefRefPtr<CefFrame> frame, const CefString& url) { if(frame->IsMain()) { _browserControl->SetAddress(toClr(url)); } }
void ScriptCore::UIT_Evaluate(CefRefPtr<CefBrowser> browser, CefString script) { CefRefPtr<CefFrame> mainFrame; if (TryGetMainFrame(browser, mainFrame)) { CefRefPtr<CefV8Context> context = mainFrame->GetV8Context(); if (context.get() && context->Enter()) { CefRefPtr<CefV8Value> result; CefRefPtr<CefV8Exception> exception; bool success = context->Eval(script, result, exception); if (success) { try { _result = convertFromCef(result); } catch (Exception^ ex) { _exceptionMessage = ex->Message; } } else if (exception.get()) { _exceptionMessage = toClr(exception->GetMessage()); } else { _exceptionMessage = "Failed to evaluate script"; } context->Exit(); }
bool ClientAdapter::OnTooltip(CefRefPtr<CefBrowser> browser, CefString& text) { String^ str = toClr(text); if (str != _tooltip) { _tooltip = str; _browserControl->SetToolTip(_tooltip); } return true; }
void ClientAdapter::OnResourceReponse(CefRefPtr<CefBrowser> browser, const CefString& url, CefRefPtr<CefResponse> response, CefRefPtr<CefContentFilter>& filter) { IAfterResponse^ handler = _browserControl->AfterResponseHandler; if (handler != nullptr) { String^ cookie = toClr(response->GetHeader("Set-Cookie")); if (!String::IsNullOrEmpty(cookie)) { handler->HandleSetCookie(cookie); } } }
void ClientAdapter::OnTitleChange(CefRefPtr<CefBrowser> browser, const CefString& title) { _browserControl->SetTitle(toClr(title)); }
String^ CefRequestWrapper::Url::get() { return toClr(_wrappedRequest->GetURL()); }
//set the draw color with a ClrHSL value void WindowSFML::setDrawClr(ClrHSL clrIn) { drawClr=toClr(clrIn); }