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 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 326 | 326 |
| 327 this._updateTabElements(); | 327 this._updateTabElements(); |
| 328 if (focused) | 328 if (focused) |
| 329 this.focus(); | 329 this.focus(); |
| 330 | 330 |
| 331 var eventData = {tabId: id, view: tab.view, isUserGesture: userGesture}; | 331 var eventData = {tabId: id, view: tab.view, isUserGesture: userGesture}; |
| 332 this.dispatchEventToListeners(UI.TabbedPane.Events.TabSelected, eventData); | 332 this.dispatchEventToListeners(UI.TabbedPane.Events.TabSelected, eventData); |
| 333 return true; | 333 return true; |
| 334 } | 334 } |
| 335 | 335 |
| 336 selectNextTab() { | |
| 337 for (var i = 0; i < this._tabs.length; ++i) { | |
| 338 if (this._tabs[i] === this._currentTab) { | |
|
caseq
2017/01/23 22:48:27
this._tabs.indexOf(this._currentTab)
| |
| 339 var nextIndex = (i + 1) % this._tabs.length; | |
|
caseq
2017/01/23 22:48:27
let's extract this to a parameter.
| |
| 340 this.selectTab(this._tabs[nextIndex].id, true); | |
| 341 break; | |
| 342 } | |
| 343 } | |
| 344 } | |
| 345 | |
| 346 selectPrevTab() { | |
| 347 for (var i = 0; i < this._tabs.length; ++i) { | |
| 348 if (this._tabs[i] === this._currentTab) { | |
| 349 var prevIndex = (i - 1 + this._tabs.length) % this._tabs.length; | |
| 350 this.selectTab(this._tabs[prevIndex].id, true); | |
| 351 break; | |
| 352 } | |
| 353 } | |
| 354 } | |
| 355 | |
| 336 /** | 356 /** |
| 337 * @param {number} tabsCount | 357 * @param {number} tabsCount |
| 338 * @return {!Array.<string>} | 358 * @return {!Array.<string>} |
| 339 */ | 359 */ |
| 340 lastOpenedTabIds(tabsCount) { | 360 lastOpenedTabIds(tabsCount) { |
| 341 function tabToTabId(tab) { | 361 function tabToTabId(tab) { |
| 342 return tab.id; | 362 return tab.id; |
| 343 } | 363 } |
| 344 | 364 |
| 345 return this._tabsHistory.slice(0, tabsCount).map(tabToTabId); | 365 return this._tabsHistory.slice(0, tabsCount).map(tabToTabId); |
| (...skipping 857 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1203 * @param {!Array.<string>} ids | 1223 * @param {!Array.<string>} ids |
| 1204 */ | 1224 */ |
| 1205 closeTabs(tabbedPane, ids) {}, | 1225 closeTabs(tabbedPane, ids) {}, |
| 1206 | 1226 |
| 1207 /** | 1227 /** |
| 1208 * @param {string} tabId | 1228 * @param {string} tabId |
| 1209 * @param {!UI.ContextMenu} contextMenu | 1229 * @param {!UI.ContextMenu} contextMenu |
| 1210 */ | 1230 */ |
| 1211 onContextMenu(tabId, contextMenu) {} | 1231 onContextMenu(tabId, contextMenu) {} |
| 1212 }; | 1232 }; |
| OLD | NEW |