Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5133)

Unified Diff: chrome/browser/resources/inspect/inspect.js

Issue 818773005: [DevTools] Skip WebView instances without open pages (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..e09a4ade48bbb418a214d66fc8704dbc601dc9e5 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 || icon.hidden);
+}
+
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(
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698