[epiphany/pgriffis/web-extension-beastify] WebExtensions: Add more info to tabs.Tab object
- From: Patrick Griffis <pgriffis src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany/pgriffis/web-extension-beastify] WebExtensions: Add more info to tabs.Tab object
- Date: Mon, 23 May 2022 16:39:39 +0000 (UTC)
commit 7731505035ed16b53c9b9926417476b24b11f3e9
Author: Patrick Griffis <pgriffis igalia com>
Date: Mon May 23 11:39:34 2022 -0500
WebExtensions: Add more info to tabs.Tab object
src/webextension/api/tabs.c | 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)
---
diff --git a/src/webextension/api/tabs.c b/src/webextension/api/tabs.c
index d84402f33..f9b8c396f 100644
--- a/src/webextension/api/tabs.c
+++ b/src/webextension/api/tabs.c
@@ -69,15 +69,44 @@ add_web_view_to_json (JsonBuilder *builder,
EphyWebView *web_view,
gboolean has_tab_permission)
{
+ EphyTabView *tab_view = ephy_window_get_tab_view (window);
+ GtkWidget *page = gtk_widget_get_parent (gtk_widget_get_parent (GTK_WIDGET (web_view)));
+ gboolean is_active = ephy_tab_view_get_current_page (tab_view) == page;
+
json_builder_begin_object (builder);
if (has_tab_permission) {
json_builder_set_member_name (builder, "url");
json_builder_add_string_value (builder, ephy_web_view_get_address (web_view));
+ json_builder_set_member_name (builder, "title");
+ json_builder_add_string_value (builder, webkit_web_view_get_title (WEBKIT_WEB_VIEW (web_view)));
}
json_builder_set_member_name (builder, "id");
json_builder_add_int_value (builder, ephy_web_view_get_uid (web_view));
json_builder_set_member_name (builder, "windowId");
json_builder_add_int_value (builder, ephy_window_get_uid (window));
+ json_builder_set_member_name (builder, "active");
+ json_builder_add_boolean_value (builder, is_active);
+ json_builder_set_member_name (builder, "highlighted");
+ json_builder_add_boolean_value (builder, is_active);
+ json_builder_set_member_name (builder, "hidden");
+ json_builder_add_boolean_value (builder, FALSE);
+ json_builder_set_member_name (builder, "incognito");
+ json_builder_add_boolean_value (builder, ephy_embed_shell_get_mode (ephy_embed_shell_get_default ()) ==
EPHY_EMBED_SHELL_MODE_INCOGNITO);
+ json_builder_set_member_name (builder, "isInReaderMode");
+ json_builder_add_boolean_value (builder, ephy_web_view_get_reader_mode_state (web_view));
+ json_builder_set_member_name (builder, "isArticle");
+ json_builder_add_boolean_value (builder, ephy_web_view_is_reader_mode_available (web_view));
+ json_builder_set_member_name (builder, "pinned");
+ json_builder_add_boolean_value (builder, ephy_tab_view_get_is_pinned (tab_view, page));
+ json_builder_set_member_name (builder, "index");
+ json_builder_add_int_value (builder, ephy_tab_view_get_page_index (tab_view, page));
+ json_builder_set_member_name (builder, "status");
+ json_builder_add_string_value (builder, ephy_web_view_is_loading (web_view) ? "loading" : "complete");
+ json_builder_set_member_name (builder, "mutedInfo");
+ json_builder_begin_object (builder);
+ json_builder_set_member_name (builder, "muted");
+ json_builder_add_boolean_value (builder, webkit_web_view_get_is_muted (WEBKIT_WEB_VIEW (web_view)));
+ json_builder_end_object (builder);
json_builder_end_object (builder);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]