From 3c8321a9878a402395bb3f61d4817d3951988b4f Mon Sep 17 00:00:00 2001 From: Shelley Vohr Date: Thu, 12 Sep 2024 15:40:56 +0200 Subject: [PATCH] fix: EyeDropper working in devtools (#43685) --- shell/browser/ui/inspectable_web_contents.cc | 8 ++++++++ shell/browser/ui/inspectable_web_contents.h | 3 +++ 2 files changed, 11 insertions(+) diff --git a/shell/browser/ui/inspectable_web_contents.cc b/shell/browser/ui/inspectable_web_contents.cc index 19c18f00a6..454544ed93 100644 --- a/shell/browser/ui/inspectable_web_contents.cc +++ b/shell/browser/ui/inspectable_web_contents.cc @@ -784,6 +784,7 @@ void InspectableWebContents::SetEyeDropperActive(bool active) { if (delegate_) delegate_->DevToolsSetEyeDropperActive(active); } + void InspectableWebContents::ZoomIn() { double new_level = GetNextZoomLevel(GetDevToolsZoomLevel(), false); SetZoomLevelForWebContents(GetDevToolsWebContents(), new_level); @@ -965,6 +966,13 @@ void InspectableWebContents::CloseContents(content::WebContents* source) { CloseDevTools(); } +std::unique_ptr InspectableWebContents::OpenEyeDropper( + content::RenderFrameHost* frame, + content::EyeDropperListener* listener) { + auto* delegate = web_contents_->GetDelegate(); + return delegate ? delegate->OpenEyeDropper(frame, listener) : nullptr; +} + void InspectableWebContents::RunFileChooser( content::RenderFrameHost* render_frame_host, scoped_refptr listener, diff --git a/shell/browser/ui/inspectable_web_contents.h b/shell/browser/ui/inspectable_web_contents.h index c7f01159ca..029af15a42 100644 --- a/shell/browser/ui/inspectable_web_contents.h +++ b/shell/browser/ui/inspectable_web_contents.h @@ -208,6 +208,9 @@ class InspectableWebContents bool HandleKeyboardEvent(content::WebContents*, const input::NativeWebKeyboardEvent&) override; void CloseContents(content::WebContents* source) override; + std::unique_ptr OpenEyeDropper( + content::RenderFrameHost* frame, + content::EyeDropperListener* listener) override; void RunFileChooser(content::RenderFrameHost* render_frame_host, scoped_refptr listener, const blink::mojom::FileChooserParams& params) override;