From efbeb310c524145162eff59d0104a3b23626c007 Mon Sep 17 00:00:00 2001 From: Takashi Hashida Date: Tue, 9 Jul 2024 13:39:17 +0900 Subject: [PATCH 1/2] Fix DevTools to popup DevTools doesn't popup and is fixed on a current tab window when we use Chrome bootstrap and Alloy runtime style. --- BroView.cpp | 8 ++++++++ client_handler.cpp | 13 +++++++++++++ client_handler.h | 3 +++ 3 files changed, 24 insertions(+) diff --git a/BroView.cpp b/BroView.cpp index 1e90eb3..1eba246 100644 --- a/BroView.cpp +++ b/BroView.cpp @@ -1561,9 +1561,17 @@ void CChildView::ShowDevTools() CefBrowserSettings settings; CefRefPtr client; CefPoint inspect_element_at; + // We use Chrome bootstrap + Alloy runtime style since CEF125. + // On that case, we should specify DevTools behaviour at + // ClientHandler::OnBeforeDevToolsPopup + // https://github.com/chromiumembedded/cef/issues/3685 + // https://cef-builds.spotifycdn.com/docs/120.1/classCefLifeSpanHandler.html#a42d853d18238d79d2b17d04277bd636a + // https://magpcss.org/ceforum/viewtopic.php?f=6&t=19792&p=55334&hilit=Devtools+SetAsPopup#p55334 +#if CHROME_VERSION_MAJOR < 125 // Show DevTools window as popup // See https://www.magpcss.org/ceforum/viewtopic.php?f=6&t=17820 windowInfo.SetAsPopup(theApp.SafeWnd(this->m_hWnd), "ChronosDevTools"); +#endif m_cefBrowser->GetHost()->ShowDevTools(windowInfo, client, settings, inspect_element_at); } } diff --git a/client_handler.cpp b/client_handler.cpp index 97c5a85..770f932 100644 --- a/client_handler.cpp +++ b/client_handler.cpp @@ -254,6 +254,17 @@ bool ClientHandler::OnBeforePopup(CefRefPtr browser, return CefLifeSpanHandler::OnBeforePopup(browser, frame, target_url, target_frame_name, target_disposition, user_gesture, popupFeatures, windowInfo, client, settings, extra_info, no_javascript_access); } +#if CHROME_VERSION_MAJOR > 125 +void ClientHandler::OnBeforeDevToolsPopup(CefRefPtr browser, + CefWindowInfo& windowInfo, + CefRefPtr& client, + CefBrowserSettings& settings, + CefRefPtr& extra_info, + bool* use_default_window) +{ +} +#endif + void ClientHandler::OnBeforeContextMenu(CefRefPtr browser, CefRefPtr frame, CefRefPtr params, @@ -2104,6 +2115,8 @@ bool ClientHandler::OnBeforeUnloadDialog(CefRefPtr browser, return TRUE; } + + bool ClientHandler::OnDragEnter(CefRefPtr browser, CefRefPtr dragData, DragOperationsMask mask) diff --git a/client_handler.h b/client_handler.h index a75c10f..fb1beb2 100644 --- a/client_handler.h +++ b/client_handler.h @@ -84,6 +84,9 @@ class ClientHandler : public CefClient, virtual void OnAfterCreated(CefRefPtr browser) override; virtual void OnBeforeClose(CefRefPtr browser) override; virtual bool OnBeforePopup(CefRefPtr browser, CefRefPtr frame, const CefString& target_url, const CefString& target_frame_name, WindowOpenDisposition target_disposition, bool user_gesture, const CefPopupFeatures& popupFeatures, CefWindowInfo& windowInfo, CefRefPtr& client, CefBrowserSettings& settings, CefRefPtr& extra_info, bool* no_javascript_access) override; +#if CHROME_VERSION_MAJOR > 125 + virtual void OnBeforeDevToolsPopup(CefRefPtr browser, CefWindowInfo& windowInfo, CefRefPtr& client, CefBrowserSettings& settings, CefRefPtr& extra_info, bool* use_default_window); +#endif // CefContextMenuHandler methods virtual void OnBeforeContextMenu(CefRefPtr browser, CefRefPtr frame, CefRefPtr params, CefRefPtr model) override; From a93becb9c4387e06fcc6230e4fed43b524d24183 Mon Sep 17 00:00:00 2001 From: Takashi Hashida Date: Wed, 10 Jul 2024 17:27:45 +0900 Subject: [PATCH 2/2] Remove needless newlines --- client_handler.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/client_handler.cpp b/client_handler.cpp index 770f932..0316638 100644 --- a/client_handler.cpp +++ b/client_handler.cpp @@ -2115,8 +2115,6 @@ bool ClientHandler::OnBeforeUnloadDialog(CefRefPtr browser, return TRUE; } - - bool ClientHandler::OnDragEnter(CefRefPtr browser, CefRefPtr dragData, DragOperationsMask mask)