Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 308 var tabs = this._tabs.slice(); | 308 var tabs = this._tabs.slice(); |
| 309 for (var i = 0; i < tabs.length; ++i) { | 309 for (var i = 0; i < tabs.length; ++i) { |
| 310 if (tabs[i].id !== id) | 310 if (tabs[i].id !== id) |
| 311 result.push(tabs[i].id); | 311 result.push(tabs[i].id); |
| 312 } | 312 } |
| 313 return result; | 313 return result; |
| 314 }, | 314 }, |
| 315 | 315 |
| 316 /** | 316 /** |
| 317 * @param {string} id | 317 * @param {string} id |
| 318 * @return {!Array.<string>} | |
| 319 */ | |
| 320 tabsToTheRight: function(id) | |
|
alph
2015/01/15 17:35:17
_tabsToTheRight
lushnikov
2015/01/18 18:17:41
Done.
| |
| 321 { | |
| 322 var tabs = this._tabs.slice(); | |
|
alph
2015/01/15 17:35:17
why do you need slice?
lushnikov
2015/01/18 18:17:41
It came due to copy-pasting of other methods; remo
| |
| 323 var index = -1; | |
| 324 for (var i = 0; i < tabs.length; ++i) { | |
| 325 if (tabs[i].id === id) { | |
| 326 index = i; | |
| 327 break; | |
| 328 } | |
| 329 } | |
| 330 if (index === -1) | |
| 331 return []; | |
| 332 var result = []; | |
|
alph
2015/01/15 17:35:17
nit:
return tabs.slice(index + 1).map(function(tab
lushnikov
2015/01/18 18:17:41
Done.
| |
| 333 for (var i = index + 1; i < tabs.length; ++i) | |
| 334 result.push(tabs[i].id); | |
| 335 return result; | |
| 336 }, | |
| 337 | |
| 338 /** | |
| 339 * @param {string} id | |
| 318 * @param {boolean=} userGesture | 340 * @param {boolean=} userGesture |
| 319 * @return {boolean} | 341 * @return {boolean} |
| 320 */ | 342 */ |
| 321 selectTab: function(id, userGesture) | 343 selectTab: function(id, userGesture) |
| 322 { | 344 { |
| 323 if (this._currentTabLocked) | 345 if (this._currentTabLocked) |
| 324 return false; | 346 return false; |
| 325 var focused = this.hasFocus(); | 347 var focused = this.hasFocus(); |
| 326 var tab = this._tabsById[id]; | 348 var tab = this._tabsById[id]; |
| 327 if (!tab) | 349 if (!tab) |
| (...skipping 736 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1064 } | 1086 } |
| 1065 | 1087 |
| 1066 /** | 1088 /** |
| 1067 * @this {WebInspector.TabbedPaneTab} | 1089 * @this {WebInspector.TabbedPaneTab} |
| 1068 */ | 1090 */ |
| 1069 function closeAll() | 1091 function closeAll() |
| 1070 { | 1092 { |
| 1071 this._closeTabs(this._tabbedPane.allTabs()); | 1093 this._closeTabs(this._tabbedPane.allTabs()); |
| 1072 } | 1094 } |
| 1073 | 1095 |
| 1096 /** | |
| 1097 * @this {WebInspector.TabbedPaneTab} | |
| 1098 */ | |
| 1099 function closeToTheRight() | |
| 1100 { | |
| 1101 this._closeTabs(this._tabbedPane.tabsToTheRight(this.id)); | |
| 1102 } | |
| 1103 | |
| 1074 var contextMenu = new WebInspector.ContextMenu(event); | 1104 var contextMenu = new WebInspector.ContextMenu(event); |
| 1075 contextMenu.appendItem(WebInspector.UIString.capitalize("Close"), close. bind(this)); | 1105 contextMenu.appendItem(WebInspector.UIString.capitalize("Close"), close. bind(this)); |
| 1076 contextMenu.appendItem(WebInspector.UIString.capitalize("Close ^others") , closeOthers.bind(this)); | 1106 contextMenu.appendItem(WebInspector.UIString.capitalize("Close ^others") , closeOthers.bind(this)); |
| 1107 contextMenu.appendItem(WebInspector.UIString.capitalize("Close ^tabs ^to ^the ^right"), closeToTheRight.bind(this)); | |
|
alph
2015/01/15 17:35:17
Prepositions and articles should not be capitalize
lushnikov
2015/01/18 18:17:41
Done.
| |
| 1077 contextMenu.appendItem(WebInspector.UIString.capitalize("Close ^all"), c loseAll.bind(this)); | 1108 contextMenu.appendItem(WebInspector.UIString.capitalize("Close ^all"), c loseAll.bind(this)); |
| 1078 contextMenu.show(); | 1109 contextMenu.show(); |
| 1079 }, | 1110 }, |
| 1080 | 1111 |
| 1081 /** | 1112 /** |
| 1082 * @param {!Event} event | 1113 * @param {!Event} event |
| 1083 * @return {boolean} | 1114 * @return {boolean} |
| 1084 */ | 1115 */ |
| 1085 _startTabDragging: function(event) | 1116 _startTabDragging: function(event) |
| 1086 { | 1117 { |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1286 /** | 1317 /** |
| 1287 * @param {string} id1 | 1318 * @param {string} id1 |
| 1288 * @param {string} id2 | 1319 * @param {string} id2 |
| 1289 * @return {number} | 1320 * @return {number} |
| 1290 */ | 1321 */ |
| 1291 _tabOrderComparator: function(id1, id2) | 1322 _tabOrderComparator: function(id1, id2) |
| 1292 { | 1323 { |
| 1293 return this._tabOrders[id2] = this._tabOrders[id1]; | 1324 return this._tabOrders[id2] = this._tabOrders[id1]; |
| 1294 } | 1325 } |
| 1295 } | 1326 } |
| OLD | NEW |