osr: Support DevTools windows with Chrome runtime Alloy style (see #3681)

This commit is contained in:
Marshall Greenblatt 2024-05-20 16:21:37 -04:00
parent 6da73a3d31
commit 99c85e32ac
4 changed files with 53 additions and 0 deletions

View File

@ -64,4 +64,12 @@ bool GetAlloyTabById(int tab_id,
return false;
}
bool IsAlloyContents(content::WebContents* contents, bool primary_only) {
auto browser = CefBrowserHostBase::GetBrowserForContents(contents);
if (browser && browser->IsAlloyStyle()) {
return !primary_only || browser->GetWebContents() == contents;
}
return false;
}
} // namespace cef

View File

@ -21,6 +21,10 @@ bool GetAlloyTabById(int tab_id,
bool include_incognito,
content::WebContents** contents);
// Returns true if |contents| is owned by an Alloy style CefBrowserHost.
// If |primary_only| is false then guest contents will also be matched.
bool IsAlloyContents(content::WebContents* contents, bool primary_only);
} // namespace cef
#endif // CEF_LIBCEF_BROWSER_CHROME_EXTENSIONS_CHROME_EXTENSION_UTIL_H_

View File

@ -257,6 +257,11 @@ patches = [
# https://github.com/chromiumembedded/cef/issues/2969
'name': 'chrome_browser_context_menus',
},
{
# Support DevTools windows with Chrome runtime Alloy style OSR.
# https://github.com/chromiumembedded/cef/issues/3681
'name': 'chrome_browser_devtools_osr',
},
{
# Support use of chrome native dialogs with CEF runtimes.
# - Adds support for FileSelectHelper and SelectFileDialog interception.

View File

@ -0,0 +1,36 @@
diff --git chrome/browser/devtools/chrome_devtools_manager_delegate.cc chrome/browser/devtools/chrome_devtools_manager_delegate.cc
index 19c2d39b6aa73..099dcb71a6373 100644
--- chrome/browser/devtools/chrome_devtools_manager_delegate.cc
+++ chrome/browser/devtools/chrome_devtools_manager_delegate.cc
@@ -13,6 +13,7 @@
#include "base/strings/utf_string_conversions.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
+#include "cef/libcef/features/features.h"
#include "chrome/browser/browser_features.h"
#include "chrome/browser/devtools/chrome_devtools_session.h"
#include "chrome/browser/devtools/device/android_device_manager.h"
@@ -66,6 +67,10 @@
#include "ash/constants/ash_switches.h"
#endif
+#if BUILDFLAG(ENABLE_CEF)
+#include "cef/libcef/browser/chrome/extensions/chrome_extension_util.h"
+#endif
+
using content::DevToolsAgentHost;
const char ChromeDevToolsManagerDelegate::kTypeApp[] = "app";
@@ -246,6 +251,12 @@ std::string ChromeDevToolsManagerDelegate::GetTargetType(
return DevToolsAgentHost::kTypePage;
}
+#if BUILDFLAG(ENABLE_CEF)
+ if (cef::IsAlloyContents(web_contents, /*primary_only=*/true)) {
+ return DevToolsAgentHost::kTypePage;
+ }
+#endif
+
return DevToolsAgentHost::kTypeOther;
}