From 7150fa783ed9b7dbec170c256e6e67f4b0d30ea4 Mon Sep 17 00:00:00 2001 From: Eryk Rakowski Date: Wed, 11 Mar 2020 08:04:31 +0100 Subject: [PATCH] fix(extensions): add more properties to port.sender.tab (#22592) * fix: add more properties to port.sender.tab * fix: apply the suggestion Co-Authored-By: Jeremy Apthorp Co-authored-by: Jeremy Apthorp --- .../browser/extensions/electron_messaging_delegate.cc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/shell/browser/extensions/electron_messaging_delegate.cc b/shell/browser/extensions/electron_messaging_delegate.cc index b1eb0fc4dde4..03e4a040ca6d 100644 --- a/shell/browser/extensions/electron_messaging_delegate.cc +++ b/shell/browser/extensions/electron_messaging_delegate.cc @@ -20,11 +20,10 @@ #include "extensions/browser/pref_names.h" #include "extensions/common/api/messaging/port_id.h" #include "extensions/common/extension.h" +#include "shell/browser/api/electron_api_web_contents.h" #include "ui/gfx/native_widget_types.h" #include "url/gurl.h" -#include "shell/browser/api/electron_api_web_contents.h" - namespace extensions { ElectronMessagingDelegate::ElectronMessagingDelegate() = default; @@ -48,6 +47,13 @@ ElectronMessagingDelegate::MaybeGetTabInfo(content::WebContents* web_contents) { auto tab = std::make_unique(); tab->SetWithoutPathExpansion( "id", std::make_unique(api_contents->ID())); + tab->SetWithoutPathExpansion( + "url", std::make_unique(api_contents->GetURL().spec())); + tab->SetWithoutPathExpansion( + "title", std::make_unique(api_contents->GetTitle())); + tab->SetWithoutPathExpansion( + "audible", + std::make_unique(api_contents->IsCurrentlyAudible())); return tab; } }