Skip to content
Snippets Groups Projects
Commit 2a3ae1e2 authored by svornost's avatar svornost
Browse files

Current versions of CEF no longer support CefFrame::LoadString, so switch to a...

Current versions of CEF no longer support CefFrame::LoadString, so switch to a data-URI scheme instead
parent f86e8e41
No related branches found
No related tags found
1 merge request!6644Update FCHost to build with newer versions of CEF
......@@ -10,6 +10,7 @@
#include "include/base/cef_bind.h"
#include "include/cef_app.h"
#include "include/cef_parser.h"
#include "include/views/cef_browser_view.h"
#include "include/views/cef_window.h"
#include "include/wrapper/cef_closure_task.h"
......@@ -19,6 +20,13 @@ namespace {
FCHostHandler* g_instance = NULL;
// Returns a data: URI with the specified contents.
std::string GetDataURI(const std::string& data, const std::string& mime_type) {
return "data:" + mime_type + ";base64," +
CefURIEncode(CefBase64Encode(data.data(), data.size()), false)
.ToString();
}
} // namespace
FCHostHandler::FCHostHandler(bool use_views)
......@@ -142,7 +150,8 @@ void FCHostHandler::OnLoadError(CefRefPtr<CefBrowser> browser,
"<h2>Failed to load URL "
<< std::string(failedUrl) << " with error " << std::string(errorText)
<< " (" << errorCode << ").</h2></body></html>";
frame->LoadString(ss.str(), failedUrl);
frame->LoadURL(GetDataURI(ss.str(), "text/html"));
}
void FCHostHandler::OnBeforeDownload(CefRefPtr<CefBrowser> browser,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment