Compare commits

..

4 Commits

Author SHA1 Message Date
Marshall Greenblatt 3d8f1c9064 Update to Chromium version 125.0.6422.112 2024-05-27 13:57:38 +00:00
pkv e997249d53 alloy: Fix audio capturer crash on exit (fixes #3689) 2024-05-21 14:00:37 -04:00
Marshall Greenblatt 3ccd305f6d cefclient: Use default window for DevTools non-Views popup (see #3681)
Chrome runtime only supports creation of a Views-hosted DevTools
popup in ChromeBrowserDelegate::CreateDevToolsBrowser if the parent
is also Views-hosted.

To test:
- Run `cefclient --use-native`
- Right click, select "Show DevTools"
- Close both windows and the app should exit
2024-05-20 18:47:34 -04:00
Marshall Greenblatt 99c85e32ac osr: Support DevTools windows with Chrome runtime Alloy style (see #3681) 2024-05-20 18:44:01 -04:00
11 changed files with 82 additions and 26 deletions

View File

@ -7,6 +7,6 @@
# https://bitbucket.org/chromiumembedded/cef/wiki/BranchesAndBuilding
{
'chromium_checkout': 'refs/tags/125.0.6422.41',
'chromium_checkout': 'refs/tags/125.0.6422.112',
'depot_tools_checkout': '19199514e8'
}

View File

@ -117,8 +117,11 @@ void CefAudioCapturer::OnCaptureError(
media::AudioCapturerSource::ErrorCode code,
const std::string& message) {
audio_handler_->OnAudioStreamError(browser_, message);
if (code != media::AudioCapturerSource::ErrorCode::kSocketError) {
StopStream();
}
}
void CefAudioCapturer::StopStream() {
if (audio_input_device_) {

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

@ -74,7 +74,7 @@ index 8fbc9ab537c6d..e87d068678767 100644
}
diff --git chrome/browser/ui/BUILD.gn chrome/browser/ui/BUILD.gn
index d6c14b3d70a75..577586f0dd8b4 100644
index aba6af9ae6940..6904372deb361 100644
--- chrome/browser/ui/BUILD.gn
+++ chrome/browser/ui/BUILD.gn
@@ -8,6 +8,7 @@ import("//build/config/compiler/compiler.gni")
@ -113,7 +113,7 @@ index d6c14b3d70a75..577586f0dd8b4 100644
"views/apps/app_info_dialog/arc_app_info_links_panel.cc",
"views/apps/app_info_dialog/arc_app_info_links_panel.h",
"views/apps/chrome_app_window_client_views_chromeos.cc",
@@ -5062,8 +5070,6 @@ static_library("ui") {
@@ -5063,8 +5071,6 @@ static_library("ui") {
"views/accessibility/theme_tracking_non_accessible_image_view.h",
"views/apps/app_dialog/app_dialog_view.cc",
"views/apps/app_dialog/app_dialog_view.h",
@ -122,7 +122,7 @@ index d6c14b3d70a75..577586f0dd8b4 100644
"views/apps/app_info_dialog/app_info_dialog_container.cc",
"views/apps/app_info_dialog/app_info_dialog_container.h",
"views/apps/app_info_dialog/app_info_dialog_views.cc",
@@ -6895,6 +6901,7 @@ static_library("ui") {
@@ -6896,6 +6902,7 @@ static_library("ui") {
if (enable_printing) {
deps += [
"//components/printing/browser",

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;
}

View File

@ -61,7 +61,7 @@ index 1a49cf67e0b17..edf5896d3594e 100644
case ui::SHOW_STATE_MAXIMIZED:
return kSerializedShowStateMaximized;
diff --git content/browser/renderer_host/render_widget_host_view_base.cc content/browser/renderer_host/render_widget_host_view_base.cc
index b1fd8fe22daa6..290912f76fb02 100644
index c87f6ad832393..23cd3314c1bfe 100644
--- content/browser/renderer_host/render_widget_host_view_base.cc
+++ content/browser/renderer_host/render_widget_host_view_base.cc
@@ -669,6 +669,14 @@ float RenderWidgetHostViewBase::GetScaleOverrideForCapture() const {
@ -350,7 +350,7 @@ index 3151a2c872f4e..e14caeb1e6645 100644
base::WeakPtrFactory<DesktopWindowTreeHostLinux> weak_factory_{this};
};
diff --git ui/views/widget/desktop_aura/desktop_window_tree_host_platform.cc ui/views/widget/desktop_aura/desktop_window_tree_host_platform.cc
index 26b46d12db49d..4d591f6453b3d 100644
index 44462f6079955..88b24cb1a2a71 100644
--- ui/views/widget/desktop_aura/desktop_window_tree_host_platform.cc
+++ ui/views/widget/desktop_aura/desktop_window_tree_host_platform.cc
@@ -285,8 +285,8 @@ void DesktopWindowTreeHostPlatform::Init(const Widget::InitParams& params) {

View File

@ -1,5 +1,5 @@
diff --git content/browser/web_contents/web_contents_impl.cc content/browser/web_contents/web_contents_impl.cc
index c455f395b3d89..f39ffa5e1a7a4 100644
index f1a5a2e1f4d66..262bcc0181333 100644
--- content/browser/web_contents/web_contents_impl.cc
+++ content/browser/web_contents/web_contents_impl.cc
@@ -3551,6 +3551,12 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params,
@ -33,7 +33,7 @@ index c455f395b3d89..f39ffa5e1a7a4 100644
}
void WebContentsImpl::RenderWidgetDeleted(
@@ -4583,6 +4593,15 @@ FrameTree* WebContentsImpl::CreateNewWindow(
@@ -4584,6 +4594,15 @@ FrameTree* WebContentsImpl::CreateNewWindow(
create_params.picture_in_picture_options = *(params.pip_options);
}
@ -49,7 +49,7 @@ index c455f395b3d89..f39ffa5e1a7a4 100644
// Check whether there is an available prerendered page for this navigation if
// this is not for guest. If it exists, take WebContents pre-created for
// hosting the prerendered page instead of creating new WebContents.
@@ -8894,6 +8913,9 @@ void WebContentsImpl::SetFocusedFrame(FrameTreeNode* node,
@@ -8895,6 +8914,9 @@ void WebContentsImpl::SetFocusedFrame(FrameTreeNode* node,
}
CloseListenerManager::DidChangeFocusedFrame(this);

View File

@ -115,9 +115,13 @@ class ClientRequestContextHandler : public CefRequestContextHandler,
// Ensure a compatible set of window creation attributes.
void SanityCheckWindowConfig(const bool is_devtools,
bool& use_views,
const bool use_views,
bool& use_alloy_style,
bool& with_osr) {
// This configuration is not supported by cefclient architecture and
// should use default window creation instead.
CHECK(!(is_devtools && !use_views));
if (MainContext::Get()->UseChromeBootstrap()) {
if (is_devtools && use_alloy_style) {
LOG(WARNING)
@ -125,13 +129,6 @@ void SanityCheckWindowConfig(const bool is_devtools,
" using Chrome style.";
use_alloy_style = false;
}
if (is_devtools && !use_views) {
LOG(WARNING)
<< "Native parent is not supported with Chrome runtime DevTools;"
" using Views.";
use_views = true;
}
}
if (!use_alloy_style && with_osr) {
@ -195,15 +192,15 @@ scoped_refptr<RootWindow> RootWindowManager::CreateRootWindowAsPopup(
CefBrowserSettings& settings) {
CEF_REQUIRE_UI_THREAD();
SanityCheckWindowConfig(is_devtools, use_views, use_alloy_style, with_osr);
if (MainContext::Get()->UseDefaultPopup()) {
if (MainContext::Get()->UseDefaultPopup() || (is_devtools && !use_views)) {
// Use default window creation for the popup. A new |client| instance is
// still required by cefclient architecture.
client = new DefaultClientHandler();
return nullptr;
}
SanityCheckWindowConfig(is_devtools, use_views, use_alloy_style, with_osr);
if (!temp_window_) {
// TempWindow must be created on the UI thread.
temp_window_.reset(new TempWindow());

View File

@ -934,10 +934,15 @@ class AudioTestHandler : public TestHandler, public CefAudioHandler {
void OnAudioStreamError(CefRefPtr<CefBrowser> browser,
const CefString& message) override {
// Since 7c88225, when Chromium closes a socket, the following error is
// propagated to the audio capturer. Ignore this error for test destruction.
const CefString& socket_error("Socket closed unexpectedly");
if (message.compare(socket_error) != 0) {
LOG(WARNING) << "OnAudioStreamError: message = " << message << ".";
got_on_audio_stream_error_.yes();
DestroyTest();
}
}
protected:
void DestroyTest() override {
@ -945,8 +950,6 @@ class AudioTestHandler : public TestHandler, public CefAudioHandler {
EXPECT_TRUE(got_audio_parameters_);
EXPECT_TRUE(got_on_audio_stream_started_);
EXPECT_TRUE(got_on_audio_stream_packet_);
EXPECT_TRUE(got_on_audio_stream_stopped_);
EXPECT_FALSE(got_on_audio_stream_error_);
TestHandler::DestroyTest();
}