CEF3: 3.2171.2069
Mac OS 10.10
Xcode 6.1.1
I'd like to intercept OnBeforeBrowse to open up URLs in tabs. I created a function called LaunchInNewTab (cefclient.h and cefclient_mac.mm) and then based on certain conditions (e.g. is not a local file) I call this LaunchInNewTab function. Alas, I keep getting linker errors. I've tried to enclose it in extern "C" comments in cefclient.h and cefclient_mac to no avail. Any recommendations?
Thanks.
#ifdef __cplusplus
extern "C" {
#endif
bool LaunchInNewTab(CefString& url);
#ifdef __cplusplus
}
#endif
and
bool ClientHandler::OnBeforeBrowse(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
CefRefPtr<CefRequest> request,
bool is_redirect) {
CEF_REQUIRE_UI_THREAD();
///message_router_->OnBeforeBrowse(browser, frame);
///return false;
CefString url = request->GetURL();
CefURLParts url_parts;
if (!CefParseURL(url, url_parts))
return true;
CefString scheme(&url_parts.scheme);
if (UrlIsFromPermittedHost(url_parts)
|| scheme.compare("about") == 0
|| scheme.compare("chrome-devtools") == 0
|| scheme.compare("data") == 0) {
return false;
}
bool isLocalFile = scheme.compare("file") == 0;
if (IsHerokuError(url))
return false;
if (!isLocalFile) LaunchInNewTab(url);
return true;
}