Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cef 109 #324

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmake/FindCEF.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ find_path(CEF_INCLUDE_DIR include/cef_version.h
HINTS ${CEF_ROOT_DIR}/include/cef)

# Locate library.
find_path(CEF_RESOURCE_DIR cef.pak
find_path(CEF_RESOURCE_DIR resources.pak chrome_100_percent.pak chrome_200_percent.pak
HINTS ${CEF_ROOT_DIR}/share/cef)

find_path(CEF_LIBRARY_DIR snapshot_blob.bin
Expand Down
5 changes: 3 additions & 2 deletions make_externals.bat
Original file line number Diff line number Diff line change
Expand Up @@ -386,12 +386,13 @@ echo.
echo Downloading, building and installing cef (this may take some time) ...
echo.

set CEF_DIR=cef_binary_88.1.6+g4fe33a1+chromium-88.0.4324.96_windows64_minimal
@REM WARNING: newer version of CEF require cmake > 3.19 (DLR provides 3.18.1)
set CEF_DIR=cef_binary_109.1.16+g454cbc2+chromium-109.0.5414.87_windows64_minimal

cmake -E make_directory "%BUILD_DIR%/cef/extracted" && cd "%BUILD_DIR%/cef"

IF NOT EXIST cef.tar (
curl.exe https://cef-builds.spotifycdn.com/cef_binary_88.1.6%%2Bg4fe33a1%%2Bchromium-88.0.4324.96_windows64_minimal.tar.bz2 --output cef.tar.bz2
curl.exe https://cef-builds.spotifycdn.com/cef_binary_109.1.16%%2Bg454cbc2%%2Bchromium-109.0.5414.87_windows64_minimal.tar.bz2 --output cef.tar.bz2
cd "%BUILD_DIR%/cef/extracted"
"%BUILD_DIR%/cef/bzip2/bin/bunzip2.exe" -v ../cef.tar.bz2
) else (
Expand Down
4 changes: 2 additions & 2 deletions make_externals.sh
Original file line number Diff line number Diff line change
Expand Up @@ -286,10 +286,10 @@ echo ""
echo "Downloading, building and installing cef ..."
echo ""

CEF_DIR=cef_binary_88.1.6+g4fe33a1+chromium-88.0.4324.96_linux64_minimal
CEF_DIR=cef_binary_109.1.16+g454cbc2+chromium-109.0.5414.87_linux64_minimal

cmake -E make_directory "$BUILD_DIR/cef/extracted" && cd "$BUILD_DIR/cef"
wget -nc https://cef-builds.spotifycdn.com/cef_binary_88.1.6%2Bg4fe33a1%2Bchromium-88.0.4324.96_linux64_minimal.tar.bz2
wget -nc https://cef-builds.spotifycdn.com/cef_binary_109.1.16%2Bg454cbc2%2Bchromium-109.0.5414.87_linux64_minimal.tar.bz2

cd "$BUILD_DIR/cef/extracted"
cmake -E tar xfj ../$CEF_DIR.tar.bz2
Expand Down
4 changes: 2 additions & 2 deletions plugins/csp-measurement-tools/src/FlagTool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ FlagTool::FlagTool(std::shared_ptr<cs::core::InputManager> pInputManager,
: Mark(std::move(pInputManager), std::move(pSolarSystem), std::move(settings),
std::move(objectName))
, mGuiArea(std::make_unique<cs::gui::WorldSpaceGuiArea>(600, 400))
, mGuiItem(std::make_unique<cs::gui::GuiItem>(
"file://{toolZoom}../share/resources/gui/flag.html", true)) {
, mGuiItem(
std::make_unique<cs::gui::GuiItem>("file://{toolZoom}../share/resources/gui/flag.html")) {
auto* pSG = GetVistaSystem()->GetGraphicsManager()->GetSceneGraph();

mGuiTransform.reset(pSG->NewTransformNode(mTransform.get()));
Expand Down
4 changes: 2 additions & 2 deletions plugins/csp-timings/src/Plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ void Plugin::init() {
// documentation of cs::gui::WebView::setZoomLevel in great detail. This also means that all other
// WebViews with an URL starting with "file://{mainUIZoom}../" will be automatically affected by
// the pMainUIScale factor.
mGuiItem = std::make_unique<cs::gui::GuiItem>(
"file://{mainUIZoom}../share/resources/gui/timings.html", false);
mGuiItem =
std::make_unique<cs::gui::GuiItem>("file://{mainUIZoom}../share/resources/gui/timings.html");

// Configure the positioning and attributes of the statistics GUI item.
mGuiItem->setSizeX(500);
Expand Down
2 changes: 0 additions & 2 deletions resources/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,13 @@ if(${CMAKE_CXX_COMPILER_ID} STREQUAL MSVC)
"${CEF_LIBRARY_DIR}/chrome_elf.dll"
)
install(FILES ${CEF_RESOURCES} DESTINATION "bin")
install(DIRECTORY "${CEF_LIBRARY_DIR}/swiftshader" DESTINATION "bin")
install(DIRECTORY "${CEF_RESOURCE_DIR}/" DESTINATION "bin")
else()
set(CEF_RESOURCES
"${CEF_LIBRARY_DIR}/snapshot_blob.bin"
"${CEF_LIBRARY_DIR}/v8_context_snapshot.bin"
)
install(FILES ${CEF_RESOURCES} DESTINATION "lib")
install(DIRECTORY "${CEF_LIBRARY_DIR}/swiftshader/" DESTINATION "lib")
install(DIRECTORY "${CEF_RESOURCE_DIR}/" DESTINATION "lib" PATTERN "locales" EXCLUDE)
install(DIRECTORY "${CEF_RESOURCE_DIR}/locales" DESTINATION "bin")
endif()
Expand Down
4 changes: 2 additions & 2 deletions src/cs-core/GuiManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ GuiManager::GuiManager(
// documentation of cs::gui::WebView::setZoomLevel in great detail. This also means that all other
// WebViews with an URL starting with "file://{mainUIZoom}../" will be automatically affected by
// the pMainUIScale factor.
mCosmoScoutGui = std::make_unique<gui::GuiItem>(
"file://{mainUIZoom}../share/resources/gui/cosmoscout.html", true);
mCosmoScoutGui =
std::make_unique<gui::GuiItem>("file://{mainUIZoom}../share/resources/gui/cosmoscout.html");

// Usually, all GuiItems are attached to the global world-space GuiArea if it is
// available. If not, they are added to the local screen-space GuiArea.
Expand Down
4 changes: 2 additions & 2 deletions src/cs-gui/GuiItem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ namespace cs::gui {

////////////////////////////////////////////////////////////////////////////////////////////////////

GuiItem::GuiItem(std::string const& url, bool allowLocalFileAccess)
: WebView(url, 100, 100, allowLocalFileAccess)
GuiItem::GuiItem(std::string const& url)
: WebView(url, 100, 100)
, mAreaWidth(1)
, mAreaHeight(1)
, mSizeX(0)
Expand Down
2 changes: 1 addition & 1 deletion src/cs-gui/GuiItem.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class CS_GUI_EXPORT GuiItem : public WebView {

public:
/// Creates a new GuiItem for the given page at the location of the URL.
explicit GuiItem(std::string const& url, bool allowLocalFileAccess = false);
explicit GuiItem(std::string const& url);

GuiItem(GuiItem const& other) = delete;
GuiItem(GuiItem&& other) = delete;
Expand Down
9 changes: 4 additions & 5 deletions src/cs-gui/WebView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ class DevToolsClient : public CefClient {

////////////////////////////////////////////////////////////////////////////////////////////////////

WebView::WebView(const std::string& url, int width, int height, bool allowLocalFileAccess)
WebView::WebView(const std::string& url, int width, int height)
: mClient(new detail::WebViewClient()) {
WebView::resize(width, height);

CefWindowInfo info;
info.width = width;
info.height = height;
info.bounds.width = width;
info.bounds.height = height;

#ifdef _MSC_VER
info.SetAsWindowless(nullptr);
Expand All @@ -41,7 +41,6 @@ WebView::WebView(const std::string& url, int width, int height, bool allowLocalF

int const targetFrameRate = 60;
browserSettings.windowless_frame_rate = targetFrameRate;
browserSettings.web_security = allowLocalFileAccess ? STATE_DISABLED : STATE_ENABLED;

mBrowser =
CefBrowserHost::CreateBrowserSync(info, mClient, url, browserSettings, nullptr, nullptr);
Expand Down Expand Up @@ -241,7 +240,7 @@ void WebView::redo() const {

void WebView::injectFocusEvent(bool focus) {
if (mInteractive) {
mBrowser->GetHost()->SendFocusEvent(focus);
mBrowser->GetHost()->SetFocus(focus);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/cs-gui/WebView.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ namespace cs::gui {
class CS_GUI_EXPORT WebView {
public:
/// Creates a new WebView for the given page at the location of the URL.
WebView(const std::string& url, int width, int height, bool allowLocalFileAccess = false);
WebView(const std::string& url, int width, int height);

WebView(WebView const& other) = delete;
WebView(WebView&& other) = delete;
Expand Down
4 changes: 2 additions & 2 deletions src/cs-gui/internal/RequestHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ namespace cs::gui::detail {

bool RequestHandler::OnCertificateError(CefRefPtr<CefBrowser> /*browser*/,
cef_errorcode_t /*cert_error*/, CefString const& /*request_url*/,
CefRefPtr<CefSSLInfo> /*ssl_info*/, CefRefPtr<CefRequestCallback> callback) {
CefRefPtr<CefSSLInfo> /*ssl_info*/, CefRefPtr<CefCallback> callback) {

logger().warn("Detected a certificate error in Chromium Embedded Framework. Continuing...");

callback->Continue(true);
callback->Continue();
return true;
}

Expand Down
2 changes: 1 addition & 1 deletion src/cs-gui/internal/RequestHandler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class RequestHandler : public CefRequestHandler {
/// Implements to ignore certificate errors.
bool OnCertificateError(CefRefPtr<CefBrowser> browser, cef_errorcode_t cert_error,
CefString const& request_url, CefRefPtr<CefSSLInfo> ssl_info,
CefRefPtr<CefRequestCallback> callback) override;
CefRefPtr<CefCallback> callback) override;

CefRefPtr<CefResourceRequestHandler> GetResourceRequestHandler(CefRefPtr<CefBrowser> /*browser*/,
CefRefPtr<CefFrame> /*frame*/, CefRefPtr<CefRequest> /*request*/, bool /*is_navigation*/,
Expand Down
1 change: 1 addition & 0 deletions src/cs-gui/internal/WebApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ void WebApp::OnBeforeCommandLineProcessing(
if (process_type.empty()) {
command_line->AppendSwitch("enable-overlay-scrollbar");
command_line->AppendSwitch("enable-begin-frame-scheduling");
command_line->AppendSwitch("disable-web-security");

if (!mHardwareAccelerated) {
command_line->AppendSwitch("disable-gpu");
Expand Down