diff --git a/app/extensions/brave/locales/en-US/menu.properties b/app/extensions/brave/locales/en-US/menu.properties
index d1f2bc412ec..f721c14dc73 100644
--- a/app/extensions/brave/locales/en-US/menu.properties
+++ b/app/extensions/brave/locales/en-US/menu.properties
@@ -13,6 +13,7 @@ openLocation=Open Location…
openSearch=Search for "{{selectedVariable}}"
importFrom=Import from…
closeWindow=Close Window
+closeTabPage=Close tab page
savePageAs=Save Page as…
spreadTheWord=Spread the Word About Brave…
share=Share…
diff --git a/app/locale.js b/app/locale.js
index badb22149f7..80c94997186 100644
--- a/app/locale.js
+++ b/app/locale.js
@@ -76,6 +76,7 @@ var rendererIdentifiers = function () {
'closeOtherTabs',
'closeTabsToRight',
'closeTabsToLeft',
+ 'closeTabPage',
'bookmarkPage',
'bookmarkLink',
'openFile',
diff --git a/docs/windowActions.md b/docs/windowActions.md
index be1f887b98d..1170acfed66 100644
--- a/docs/windowActions.md
+++ b/docs/windowActions.md
@@ -548,6 +548,19 @@ Dispatches a mute/unmute call to all frames in a provided list (used by TabList)
+### tabPageClosed(framesList, framePropsList)
+
+Dispatches a close call to all frames in tab page
+The provided frame will be closed.
+
+**Parameters**
+
+**framesList**: `Object`, List of frames
+
+**framePropsList**: `Object`, List of frame properties to consider
+
+
+
### muteAllAudioExcept(frameToSkip)
Dispatches a mute call to all frames except the one provided.
diff --git a/js/actions/windowActions.js b/js/actions/windowActions.js
index ed878a9d489..69c7ee8654a 100644
--- a/js/actions/windowActions.js
+++ b/js/actions/windowActions.js
@@ -728,6 +728,19 @@ const windowActions = {
})
},
+ /**
+ * Dispatches a close call to all frames in tab page
+ * The provided frame will be closed.
+ *
+ * @param {Object} framesList - List of frames
+ * @param {Object} framePropsList - List of frame properties to consider
+ */
+ tabPageClosed: function (framesList, framePropsList) {
+ framePropsList.forEach((frameProps) => {
+ this.closeFrame(framesList, frameProps)
+ })
+ },
+
/**
* Dispatches a mute call to all frames except the one provided.
* The provided frame will have its audio unmuted.
diff --git a/js/components/tabPages.js b/js/components/tabPages.js
index ebb85c844aa..865d06852cc 100644
--- a/js/components/tabPages.js
+++ b/js/components/tabPages.js
@@ -35,10 +35,10 @@ class TabPage extends ImmutableComponent {
}
onDrop (e) {
- if (this.props.frames.size === 0) {
+ if (this.props.tabPageFrames.size === 0) {
return
}
- const moveToFrame = this.props.frames.get(0)
+ const moveToFrame = this.props.tabPageFrames.get(0)
const sourceDragData = dndData.getDragData(e.dataTransfer, dragTypes.TAB)
const sourceDragFromPageIndex = this.props.sourceDragFromPageIndex
// This must be executed async because the state change that this causes
@@ -63,7 +63,7 @@ class TabPage extends ImmutableComponent {
}
render () {
- const audioPlaybackActive = this.props.frames.find((frame) =>
+ const audioPlaybackActive = this.props.tabPageFrames.find((frame) =>
frame.get('audioPlaybackActive') && !frame.get('audioMuted'))
return
}
@@ -97,7 +97,8 @@ class TabPages extends ImmutableComponent {
Array.from(new Array(tabPageCount)).map((x, i) =>
{
return Number.parseInt(root.getPropertyValue('--downloads-bar-height'), 10)
}
-function tabPageTemplateInit (framePropsList) {
+function tabPageTemplateInit (framePropsList, framesList) {
return [{
label: locale.translation('unmuteTabs'),
click: (item, focusedWindow) => {
@@ -89,6 +89,11 @@ function tabPageTemplateInit (framePropsList) {
click: (item, focusedWindow) => {
windowActions.muteAllAudio(framePropsList, true)
}
+ }, {
+ label: locale.translation('closeTabPage'),
+ click: () => {
+ windowActions.tabPageClosed(framesList, framePropsList)
+ }
}]
}
@@ -1326,9 +1331,9 @@ function onDownloadsToolbarContextMenu (downloadId, downloadItem, e) {
downloadsToolbarMenu.destroy()
}
-function onTabPageContextMenu (framePropsList, e) {
+function onTabPageContextMenu (framePropsList, framesList, e) {
e.stopPropagation()
- const tabPageMenu = Menu.buildFromTemplate(tabPageTemplateInit(framePropsList))
+ const tabPageMenu = Menu.buildFromTemplate(tabPageTemplateInit(framePropsList, framesList))
tabPageMenu.popup(currentWindow)
tabPageMenu.destroy()
}