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

[CEF125+] Fix DevTools to popup #221

Merged
merged 2 commits into from
Jul 10, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
8 changes: 8 additions & 0 deletions BroView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1561,9 +1561,17 @@ void CChildView::ShowDevTools()
CefBrowserSettings settings;
CefRefPtr<CefClient> 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);
}
}
Expand Down
13 changes: 13 additions & 0 deletions client_handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,17 @@ bool ClientHandler::OnBeforePopup(CefRefPtr<CefBrowser> 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<CefBrowser> browser,
CefWindowInfo& windowInfo,
CefRefPtr<CefClient>& client,
CefBrowserSettings& settings,
CefRefPtr<CefDictionaryValue>& extra_info,
bool* use_default_window)
{
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

現状は実装が空なのだが、 https://github.com/ThinBridge/Chronos/pull/221/files#diff-62b66b5116e3e70c2a991899db0ba77b0bee41543e09a6aaf9b6e1f014f206f9R1564 で言及していることもあり、削除せずに空実装のまま残している。

}
#endif

void ClientHandler::OnBeforeContextMenu(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
CefRefPtr<CefContextMenuParams> params,
Expand Down Expand Up @@ -2104,6 +2115,8 @@ bool ClientHandler::OnBeforeUnloadDialog(CefRefPtr<CefBrowser> browser,
return TRUE;
}



bool ClientHandler::OnDragEnter(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefDragData> dragData,
DragOperationsMask mask)
Expand Down
3 changes: 3 additions & 0 deletions client_handler.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ class ClientHandler : public CefClient,
virtual void OnAfterCreated(CefRefPtr<CefBrowser> browser) override;
virtual void OnBeforeClose(CefRefPtr<CefBrowser> browser) override;
virtual bool OnBeforePopup(CefRefPtr<CefBrowser> browser, CefRefPtr<CefFrame> frame, const CefString& target_url, const CefString& target_frame_name, WindowOpenDisposition target_disposition, bool user_gesture, const CefPopupFeatures& popupFeatures, CefWindowInfo& windowInfo, CefRefPtr<CefClient>& client, CefBrowserSettings& settings, CefRefPtr<CefDictionaryValue>& extra_info, bool* no_javascript_access) override;
#if CHROME_VERSION_MAJOR > 125
virtual void OnBeforeDevToolsPopup(CefRefPtr<CefBrowser> browser, CefWindowInfo& windowInfo, CefRefPtr<CefClient>& client, CefBrowserSettings& settings, CefRefPtr<CefDictionaryValue>& extra_info, bool* use_default_window);
#endif

// CefContextMenuHandler methods
virtual void OnBeforeContextMenu(CefRefPtr<CefBrowser> browser, CefRefPtr<CefFrame> frame, CefRefPtr<CefContextMenuParams> params, CefRefPtr<CefMenuModel> model) override;
Expand Down