mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Add OnProtocolExecution callback to CefRequestHandler (issue #582).
git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@711 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
@ -275,6 +275,14 @@ void ClientHandler::OnLoadError(CefRefPtr<CefBrowser> browser,
|
||||
if (errorCode == ERR_ABORTED)
|
||||
return;
|
||||
|
||||
// Don't display an error for external protocols that we allow the OS to
|
||||
// handle. See OnProtocolExecution().
|
||||
if (errorCode == ERR_UNKNOWN_URL_SCHEME) {
|
||||
std::string urlStr = frame->GetURL();
|
||||
if (urlStr.find("spotify:") == 0)
|
||||
return;
|
||||
}
|
||||
|
||||
// Display a load error message.
|
||||
std::stringstream ss;
|
||||
ss << "<html><body><h2>Failed to load URL " << std::string(failedUrl) <<
|
||||
@ -346,6 +354,16 @@ CefRefPtr<CefResourceHandler> ClientHandler::GetResourceHandler(
|
||||
return handler;
|
||||
}
|
||||
|
||||
void ClientHandler::OnProtocolExecution(CefRefPtr<CefBrowser> browser,
|
||||
const CefString& url,
|
||||
bool& allow_os_execution) {
|
||||
std::string urlStr = url;
|
||||
|
||||
// Allow OS execution of Spotify URIs.
|
||||
if (urlStr.find("spotify:") == 0)
|
||||
allow_os_execution = true;
|
||||
}
|
||||
|
||||
void ClientHandler::SetMainHwnd(CefWindowHandle hwnd) {
|
||||
AutoLock lock_scope(this);
|
||||
m_MainHwnd = hwnd;
|
||||
|
Reference in New Issue
Block a user