Index: Source/devtools/front_end/ui/TabbedPane.js |
diff --git a/Source/devtools/front_end/ui/TabbedPane.js b/Source/devtools/front_end/ui/TabbedPane.js |
index 7d9130721c8d7d91021e48967c7303a86a4d3511..6c67585d74bffaf5de2014082cf41dd5641323bc 100644 |
--- a/Source/devtools/front_end/ui/TabbedPane.js |
+++ b/Source/devtools/front_end/ui/TabbedPane.js |
@@ -292,9 +292,8 @@ WebInspector.TabbedPane.prototype = { |
allTabs: function() |
{ |
var result = []; |
- var tabs = this._tabs.slice(); |
- for (var i = 0; i < tabs.length; ++i) |
- result.push(tabs[i].id); |
+ for (var i = 0; i < this._tabs.length; ++i) |
alph
2015/01/19 07:23:38
nit:
return this._tabs.map(function(tab) { return
lushnikov
2015/01/19 10:54:18
Done.
|
+ result.push(this._tabs[i].id); |
return result; |
}, |
@@ -305,16 +304,33 @@ WebInspector.TabbedPane.prototype = { |
otherTabs: function(id) |
{ |
var result = []; |
- var tabs = this._tabs.slice(); |
- for (var i = 0; i < tabs.length; ++i) { |
- if (tabs[i].id !== id) |
- result.push(tabs[i].id); |
+ for (var i = 0; i < this._tabs.length; ++i) { |
+ if (this._tabs[i].id !== id) |
+ result.push(this._tabs[i].id); |
} |
return result; |
}, |
/** |
* @param {string} id |
+ * @return {!Array.<string>} |
+ */ |
+ _tabsToTheRight: function(id) |
+ { |
+ var index = -1; |
+ for (var i = 0; i < this._tabs.length; ++i) { |
+ if (this._tabs[i].id === id) { |
+ index = i; |
+ break; |
+ } |
+ } |
+ if (index === -1) |
+ return []; |
+ return this._tabs.slice(index + 1).map(function (tab) { return tab.id; }); |
+ }, |
+ |
+ /** |
+ * @param {string} id |
* @param {boolean=} userGesture |
* @return {boolean} |
*/ |
@@ -1071,9 +1087,18 @@ WebInspector.TabbedPaneTab.prototype = { |
this._closeTabs(this._tabbedPane.allTabs()); |
} |
+ /** |
+ * @this {WebInspector.TabbedPaneTab} |
+ */ |
+ function closeToTheRight() |
+ { |
+ this._closeTabs(this._tabbedPane._tabsToTheRight(this.id)); |
+ } |
+ |
var contextMenu = new WebInspector.ContextMenu(event); |
contextMenu.appendItem(WebInspector.UIString.capitalize("Close"), close.bind(this)); |
contextMenu.appendItem(WebInspector.UIString.capitalize("Close ^others"), closeOthers.bind(this)); |
+ contextMenu.appendItem(WebInspector.UIString.capitalize("Close ^tabs to the ^right"), closeToTheRight.bind(this)); |
contextMenu.appendItem(WebInspector.UIString.capitalize("Close ^all"), closeAll.bind(this)); |
contextMenu.show(); |
}, |