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 <nornagon@nornagon.net>

Co-authored-by: Jeremy Apthorp <nornagon@nornagon.net>
This commit is contained in:
Eryk Rakowski 2020-03-11 08:04:31 +01:00 committed by GitHub
parent 34e004015d
commit 7150fa783e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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<base::DictionaryValue>();
tab->SetWithoutPathExpansion(
"id", std::make_unique<base::Value>(api_contents->ID()));
tab->SetWithoutPathExpansion(
"url", std::make_unique<base::Value>(api_contents->GetURL().spec()));
tab->SetWithoutPathExpansion(
"title", std::make_unique<base::Value>(api_contents->GetTitle()));
tab->SetWithoutPathExpansion(
"audible",
std::make_unique<base::Value>(api_contents->IsCurrentlyAudible()));
return tab;
}
}