Chromium Code Reviews| Index: chrome/browser/resources/inspect/inspect.js |
| diff --git a/chrome/browser/resources/inspect/inspect.js b/chrome/browser/resources/inspect/inspect.js |
| index 660eeace31a25ad7a7fdd22fde2029f7b8316175..556b5ae81b87d73ca7bbbf34427e6e64f2a13a37 100644 |
| --- a/chrome/browser/resources/inspect/inspect.js |
| +++ b/chrome/browser/resources/inspect/inspect.js |
| @@ -9,6 +9,8 @@ var MIN_VERSION_TAB_ACTIVATE = 30; |
| var WEBRTC_SERIAL = 'WEBRTC'; |
| var queryParamsObject = {}; |
| +var browserInspector; |
| +var browserInspectorTitle; |
| (function() { |
| var queryParams = window.location.search; |
| @@ -20,6 +22,13 @@ for (var i = 0; i < params.length; ++i) { |
| queryParamsObject[pair[0]] = pair[1]; |
| } |
| +if ('trace' in queryParamsObject || 'tracing' in queryParamsObject) { |
| + browserInspector = 'chrome://tracing'; |
| + browserInspectorTitle = 'trace'; |
| +} else { |
| + browserInspector = queryParamsObject['browser-inspector']; |
| + browserInspectorTitle = 'inspect'; |
| +} |
| })(); |
| function sendCommand(command, args) { |
| @@ -133,6 +142,14 @@ function alreadyDisplayed(element, data) { |
| return false; |
| } |
| +function updateBrowserVisibility(browserSection) { |
| + var icon = browserSection.querySelector('.used-for-port-forwarding'); |
| + browserSection.hidden = !browserSection.querySelector('.open') && |
| + !browserSection.querySelector('.row') && |
| + !browserInspector && |
| + icon.hidden; |
|
dgozman
2015/01/14 15:17:40
(!icon || icon.hidden)
vkuzkokov
2015/01/14 15:19:42
Done.
|
| +} |
| + |
| function populateRemoteTargets(devices) { |
| if (!devices) |
| return; |
| @@ -296,15 +313,6 @@ function populateRemoteTargets(devices) { |
| browserSection.appendChild(warningSection); |
| } |
| - var browserInspector; |
| - var browserInspectorTitle; |
| - if ('trace' in queryParamsObject || 'tracing' in queryParamsObject) { |
| - browserInspector = 'chrome://tracing'; |
| - browserInspectorTitle = 'trace'; |
| - } else { |
| - browserInspector = queryParamsObject['browser-inspector']; |
| - browserInspectorTitle = 'inspect'; |
| - } |
| if (browserInspector) { |
| var link = document.createElement('span'); |
| link.classList.add('action'); |
| @@ -322,34 +330,34 @@ function populateRemoteTargets(devices) { |
| browserSection.appendChild(pageList); |
| } |
| - if (incompatibleVersion || alreadyDisplayed(browserSection, browser)) |
| - continue; |
| - |
| - pageList.textContent = ''; |
| - for (var p = 0; p < browser.pages.length; p++) { |
| - var page = browser.pages[p]; |
| - // Attached targets have no unique id until Chrome 26. For such targets |
| - // it is impossible to activate existing DevTools window. |
| - page.hasNoUniqueId = page.attached && |
| - (majorChromeVersion && majorChromeVersion < MIN_VERSION_TARGET_ID); |
| - var row = addTargetToList(page, pageList, ['name', 'url']); |
| - if (page['description']) |
| - addWebViewDetails(row, page); |
| - else |
| - addFavicon(row, page); |
| - if (majorChromeVersion >= MIN_VERSION_TAB_ACTIVATE) { |
| - addActionLink(row, 'focus tab', |
| - sendTargetCommand.bind(null, 'activate', page), false); |
| - } |
| - if (majorChromeVersion) { |
| - addActionLink(row, 'reload', |
| - sendTargetCommand.bind(null, 'reload', page), page.attached); |
| - } |
| - if (majorChromeVersion >= MIN_VERSION_TAB_CLOSE) { |
| - addActionLink(row, 'close', |
| - sendTargetCommand.bind(null, 'close', page), false); |
| + if (!incompatibleVersion && !alreadyDisplayed(browserSection, browser)) { |
| + pageList.textContent = ''; |
| + for (var p = 0; p < browser.pages.length; p++) { |
| + var page = browser.pages[p]; |
| + // Attached targets have no unique id until Chrome 26. For such |
| + // targets it is impossible to activate existing DevTools window. |
| + page.hasNoUniqueId = page.attached && |
| + majorChromeVersion && majorChromeVersion < MIN_VERSION_TARGET_ID; |
| + var row = addTargetToList(page, pageList, ['name', 'url']); |
| + if (page['description']) |
| + addWebViewDetails(row, page); |
| + else |
| + addFavicon(row, page); |
| + if (majorChromeVersion >= MIN_VERSION_TAB_ACTIVATE) { |
| + addActionLink(row, 'focus tab', |
| + sendTargetCommand.bind(null, 'activate', page), false); |
| + } |
| + if (majorChromeVersion) { |
| + addActionLink(row, 'reload', |
| + sendTargetCommand.bind(null, 'reload', page), page.attached); |
| + } |
| + if (majorChromeVersion >= MIN_VERSION_TAB_CLOSE) { |
| + addActionLink(row, 'close', |
| + sendTargetCommand.bind(null, 'close', page), false); |
| + } |
| } |
| } |
| + updateBrowserVisibility(browserSection); |
| } |
| } |
| } |
| @@ -910,6 +918,7 @@ function populatePortStatus(devicesStatusMap) { |
| var icon = browserSection.querySelector('.used-for-port-forwarding'); |
| if (icon) |
| icon.hidden = (browserSection.id !== deviceStatus.browserId); |
| + updateBrowserVisibility(browserSection); |
| } |
| Array.prototype.forEach.call( |