Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 var MIN_VERSION_TAB_CLOSE = 25; | 5 var MIN_VERSION_TAB_CLOSE = 25; |
| 6 var MIN_VERSION_TARGET_ID = 26; | 6 var MIN_VERSION_TARGET_ID = 26; |
| 7 var MIN_VERSION_NEW_TAB = 29; | 7 var MIN_VERSION_NEW_TAB = 29; |
| 8 var MIN_VERSION_TAB_ACTIVATE = 30; | 8 var MIN_VERSION_TAB_ACTIVATE = 30; |
| 9 | 9 |
| 10 var queryParamsObject = {}; | 10 var queryParamsObject = {}; |
| (...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 322 handler(); | 322 handler(); |
| 323 }.bind(null, openHandler), true); | 323 }.bind(null, openHandler), true); |
| 324 | 324 |
| 325 var newPageButton = document.createElement('button'); | 325 var newPageButton = document.createElement('button'); |
| 326 newPageButton.textContent = 'Open'; | 326 newPageButton.textContent = 'Open'; |
| 327 newPage.appendChild(newPageButton); | 327 newPage.appendChild(newPageButton); |
| 328 newPageButton.addEventListener('click', openHandler, true); | 328 newPageButton.addEventListener('click', openHandler, true); |
| 329 | 329 |
| 330 browserHeader.appendChild(newPage); | 330 browserHeader.appendChild(newPage); |
| 331 } | 331 } |
| 332 | 332 |
|
pfeldman
2014/06/16 17:11:15
Is there a reason to not do something like below (
| |
| 333 if (queryParamsObject['browser-inspector']) { | 333 if (queryParamsObject['browser-inspector']) { |
| 334 var link = document.createElement('span'); | 334 var link = document.createElement('span'); |
| 335 link.classList.add('action'); | 335 link.classList.add('action'); |
| 336 link.setAttribute('tabindex', 1); | 336 link.setAttribute('tabindex', 1); |
| 337 link.textContent = 'inspect'; | 337 link.textContent = 'inspect'; |
| 338 browserHeader.appendChild(link); | 338 browserHeader.appendChild(link); |
| 339 link.addEventListener( | 339 link.addEventListener( |
| 340 'click', | 340 'click', |
| 341 sendCommand.bind(null, 'inspect-browser', browser.source, | 341 sendCommand.bind(null, 'inspect-browser', browser.source, |
| 342 browser.id, queryParamsObject['browser-inspector']), false); | 342 browser.id, queryParamsObject['browser-inspector']), false); |
| 343 } | 343 } |
| 344 | 344 |
| 345 if ('trace' in queryParamsObject || 'tracing' in queryParamsObject) { | |
| 346 var link = document.createElement('span'); | |
| 347 link.classList.add('action'); | |
| 348 link.setAttribute('tabindex', 1); | |
| 349 link.textContent = 'trace'; | |
| 350 browserHeader.appendChild(link); | |
| 351 link.addEventListener( | |
| 352 'click', | |
| 353 sendCommand.bind(null, 'trace-browser', browser.source, | |
| 354 browser.id), false); | |
| 355 } | |
| 356 | |
| 345 pageList = document.createElement('div'); | 357 pageList = document.createElement('div'); |
| 346 pageList.className = 'list pages'; | 358 pageList.className = 'list pages'; |
| 347 browserSection.appendChild(pageList); | 359 browserSection.appendChild(pageList); |
| 348 } | 360 } |
| 349 | 361 |
| 350 if (incompatibleVersion || alreadyDisplayed(browserSection, browser)) | 362 if (incompatibleVersion || alreadyDisplayed(browserSection, browser)) |
| 351 continue; | 363 continue; |
| 352 | 364 |
| 353 pageList.textContent = ''; | 365 pageList.textContent = ''; |
| 354 for (var p = 0; p < browser.pages.length; p++) { | 366 for (var p = 0; p < browser.pages.length; p++) { |
| (...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 926 deviceSection.querySelector('.device-ports').textContent = ''; | 938 deviceSection.querySelector('.device-ports').textContent = ''; |
| 927 } | 939 } |
| 928 | 940 |
| 929 Array.prototype.forEach.call( | 941 Array.prototype.forEach.call( |
| 930 document.querySelectorAll('.device'), clearPorts); | 942 document.querySelectorAll('.device'), clearPorts); |
| 931 } | 943 } |
| 932 | 944 |
| 933 document.addEventListener('DOMContentLoaded', onload); | 945 document.addEventListener('DOMContentLoaded', onload); |
| 934 | 946 |
| 935 window.addEventListener('hashchange', onHashChange); | 947 window.addEventListener('hashchange', onHashChange); |
| OLD | NEW |