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

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

Issue 2600683002: Run tools/clang-format-js on some of chrome/browser/resources/ (Closed)
Patch Set: hackhackhack Created 3 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
Index: chrome/browser/resources/inspect/inspect.js
diff --git a/chrome/browser/resources/inspect/inspect.js b/chrome/browser/resources/inspect/inspect.js
index 5d11f63e748fb0a04230689baa0c9b63eaffd8a9..8d2ac747fa0f170b341f05ad2a9d3e232a687214 100644
--- a/chrome/browser/resources/inspect/inspect.js
+++ b/chrome/browser/resources/inspect/inspect.js
@@ -13,22 +13,22 @@ var browserInspector;
var browserInspectorTitle;
(function() {
-var queryParams = window.location.search;
-if (!queryParams)
+ var queryParams = window.location.search;
+ if (!queryParams)
return;
-var params = queryParams.substring(1).split('&');
-for (var i = 0; i < params.length; ++i) {
+ var params = queryParams.substring(1).split('&');
+ for (var i = 0; i < params.length; ++i) {
var pair = params[i].split('=');
queryParamsObject[pair[0]] = pair[1];
-}
+ }
-if ('trace' in queryParamsObject || 'tracing' in queryParamsObject) {
- browserInspector = 'chrome://tracing';
- browserInspectorTitle = 'trace';
-} else {
- browserInspector = queryParamsObject['browser-inspector'];
- browserInspectorTitle = 'inspect';
-}
+ if ('trace' in queryParamsObject || 'tracing' in queryParamsObject) {
+ browserInspector = 'chrome://tracing';
+ browserInspectorTitle = 'trace';
+ } else {
+ browserInspector = queryParamsObject['browser-inspector'];
+ browserInspectorTitle = 'inspect';
+ }
})();
function sendCommand(command, args) {
@@ -55,7 +55,7 @@ function removeChildrenExceptAdditional(element_id) {
var element = $(element_id);
var elements = element.querySelectorAll('.row:not(.additional)');
for (var i = 0; i != elements.length; i++)
- element.removeChild(elements[i]);
+ element.removeChild(elements[i]);
}
function onload() {
@@ -163,9 +163,8 @@ function alreadyDisplayed(element, data) {
function updateBrowserVisibility(browserSection) {
var icon = browserSection.querySelector('.used-for-port-forwarding');
browserSection.hidden = !browserSection.querySelector('.open') &&
- !browserSection.querySelector('.row') &&
- !browserInspector &&
- (!icon || icon.hidden);
+ !browserSection.querySelector('.row') && !browserInspector &&
+ (!icon || icon.hidden);
}
function updateUsernameVisibility(deviceSection) {
@@ -207,7 +206,7 @@ function populateRemoteTargets(devices) {
function insertBrowser(browserList, browser) {
for (var sibling = browserList.firstElementChild; sibling;
- sibling = sibling.nextElementSibling) {
+ sibling = sibling.nextElementSibling) {
if (browserCompare(browser, sibling)) {
browserList.insertBefore(browser, sibling);
return;
@@ -225,7 +224,9 @@ function populateRemoteTargets(devices) {
section.remove();
}
- var newDeviceIds = devices.map(function(d) { return d.id });
+ var newDeviceIds = devices.map(function(d) {
+ return d.id
+ });
Array.prototype.forEach.call(
deviceList.querySelectorAll('.device'),
removeObsolete.bind(null, newDeviceIds));
@@ -277,12 +278,14 @@ function populateRemoteTargets(devices) {
deviceSection.querySelector('.device-name').textContent = device.adbModel;
deviceSection.querySelector('.device-auth').textContent =
- device.adbConnected ? '' : 'Pending authentication: please accept ' +
- 'debugging session on the device.';
+ device.adbConnected ? '' :
+ 'Pending authentication: please accept ' +
+ 'debugging session on the device.';
var browserList = deviceSection.querySelector('.browsers');
- var newBrowserIds =
- device.browsers.map(function(b) { return b.id });
+ var newBrowserIds = device.browsers.map(function(b) {
+ return b.id
+ });
Array.prototype.forEach.call(
browserList.querySelectorAll('.browser'),
removeObsolete.bind(null, newBrowserIds));
@@ -358,9 +361,10 @@ function populateRemoteTargets(devices) {
link.textContent = browserInspectorTitle;
browserHeader.appendChild(link);
link.addEventListener(
- 'click',
- sendCommand.bind(null, 'inspect-browser', browser.source,
- browser.id, browserInspector), false);
+ 'click', sendCommand.bind(
+ null, 'inspect-browser', browser.source, browser.id,
+ browserInspector),
+ false);
}
pageList = document.createElement('div');
@@ -374,24 +378,27 @@ function populateRemoteTargets(devices) {
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;
+ 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',
+ addActionLink(
+ row, 'focus tab',
sendTargetCommand.bind(null, 'activate', page), false);
}
if (majorChromeVersion) {
- addActionLink(row, 'reload',
- sendTargetCommand.bind(null, 'reload', page), page.attached);
+ 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);
+ addActionLink(
+ row, 'close', sendTargetCommand.bind(null, 'close', page),
+ false);
}
}
}
@@ -433,15 +440,15 @@ function addGuestViews(row, guests) {
function addToWorkersList(data) {
var row =
addTargetToList(data, $('workers-list'), ['name', 'description', 'url']);
- addActionLink(row, 'terminate',
- sendTargetCommand.bind(null, 'close', data), false);
+ addActionLink(
+ row, 'terminate', sendTargetCommand.bind(null, 'close', data), false);
}
function addToServiceWorkersList(data) {
- var row = addTargetToList(
- data, $('service-workers-list'), ['name', 'description', 'url']);
- addActionLink(row, 'terminate',
- sendTargetCommand.bind(null, 'close', data), false);
+ var row = addTargetToList(
+ data, $('service-workers-list'), ['name', 'description', 'url']);
+ addActionLink(
+ row, 'terminate', sendTargetCommand.bind(null, 'close', data), false);
}
function addToOthersList(data) {
@@ -491,7 +498,7 @@ function addWebViewDetails(row, data) {
}
function addWebViewDescription(row, webview) {
- var viewStatus = { visibility: '', position: '', size: '' };
+ var viewStatus = {visibility: '', position: '', size: ''};
if (!webview.empty) {
if (webview.attached && !webview.visible)
viewStatus.visibility = 'hidden';
@@ -502,7 +509,7 @@ function addWebViewDescription(row, webview) {
viewStatus.visibility = 'empty';
}
if (webview.attached) {
- viewStatus.position =
+ viewStatus.position =
'at (' + webview.screenX + ', ' + webview.screenY + ')';
}
@@ -592,11 +599,13 @@ function addTargetToList(data, list, properties) {
subrowBox.appendChild(actionBox);
if (data.isAdditional) {
- addActionLink(row, 'inspect',
- sendCommand.bind(null, 'inspect-additional', data.url), false);
+ addActionLink(
+ row, 'inspect', sendCommand.bind(null, 'inspect-additional', data.url),
+ false);
row.classList.add('additional');
} else if (!data.hasCustomInspectAction) {
- addActionLink(row, 'inspect', sendTargetCommand.bind(null, 'inspect', data),
+ addActionLink(
+ row, 'inspect', sendTargetCommand.bind(null, 'inspect', data),
data.hasNoUniqueId || data.adbAttachedForeign);
}
@@ -626,16 +635,15 @@ function addActionLink(row, text, handler, opt_disabled) {
}
function initSettings() {
- checkboxSendsCommand('discover-usb-devices-enable',
- 'set-discover-usb-devices-enabled');
+ checkboxSendsCommand(
+ 'discover-usb-devices-enable', 'set-discover-usb-devices-enabled');
checkboxSendsCommand('port-forwarding-enable', 'set-port-forwarding-enabled');
- checkboxSendsCommand('discover-tcp-devices-enable',
- 'set-discover-tcp-targets-enabled');
+ checkboxSendsCommand(
+ 'discover-tcp-devices-enable', 'set-discover-tcp-targets-enabled');
- $('port-forwarding-config-open').addEventListener(
- 'click', openPortForwardingConfig);
- $('tcp-discovery-config-open').addEventListener(
- 'click', openTargetsConfig);
+ $('port-forwarding-config-open')
+ .addEventListener('click', openPortForwardingConfig);
+ $('tcp-discovery-config-open').addEventListener('click', openTargetsConfig);
$('config-dialog-close').addEventListener('click', function() {
$('config-dialog').commit(true);
});
@@ -711,7 +719,6 @@ function openConfigDialog(dialogClass, commitHandler, lineFactory, data) {
defaultFocus.focus();
else
doneButton.focus();
-
}
function openPortForwardingConfig() {
@@ -719,8 +726,8 @@ function openPortForwardingConfig() {
var line = document.createElement('div');
line.className = 'port-forwarding-pair config-list-row';
- var portInput = createConfigField(port, 'port preselected',
- 'Port', validatePort);
+ var portInput =
+ createConfigField(port, 'port preselected', 'Port', validatePort);
line.appendChild(portInput);
var locationInput = createConfigField(
@@ -738,10 +745,9 @@ function openPortForwardingConfig() {
sendCommand('set-port-forwarding-config', config);
}
- openConfigDialog('port-forwarding',
- commitPortForwardingConfig,
- createPortForwardingConfigLine,
- window.portForwardingConfig);
+ openConfigDialog(
+ 'port-forwarding', commitPortForwardingConfig,
+ createPortForwardingConfigLine, window.portForwardingConfig);
}
function openTargetsConfig() {
@@ -765,10 +771,9 @@ function openTargetsConfig() {
sendCommand('set-tcp-discovery-config', entries);
}
- openConfigDialog('target-discovery',
- commitTargetDiscoveryConfig,
- createTargetDiscoveryConfigLine,
- window.targetDiscoveryConfig);
+ openConfigDialog(
+ 'target-discovery', commitTargetDiscoveryConfig,
+ createTargetDiscoveryConfigLine, window.targetDiscoveryConfig);
}
function filterList(fieldSelectors, callback) {
@@ -778,9 +783,8 @@ function filterList(fieldSelectors, callback) {
var values = [];
for (var selector of fieldSelectors) {
var input = line.querySelector(selector);
- var value = input.classList.contains('invalid') ?
- input.lastValidValue :
- input.value;
+ var value = input.classList.contains('invalid') ? input.lastValidValue :
+ input.value;
if (!value)
break;
values.push(value);
@@ -823,10 +827,8 @@ function updateTCPDiscoveryConfig(config) {
function appendRow(list, lineFactory, key, value) {
var line = lineFactory(key, value);
line.lastElementChild.addEventListener('keydown', function(e) {
- if (e.key == 'Tab' &&
- !hasKeyModifiers(e) &&
- line.classList.contains('fresh') &&
- !line.classList.contains('empty')) {
+ if (e.key == 'Tab' && !hasKeyModifiers(e) &&
+ line.classList.contains('fresh') && !line.classList.contains('empty')) {
// Tabbing forward on the fresh line, try create a new empty one.
if (commitFreshLineIfValid(true))
e.preventDefault();
@@ -843,10 +845,8 @@ function appendRow(list, lineFactory, key, value) {
});
line.appendChild(lineDelete);
- line.addEventListener(
- 'click', selectLine.bind(null, line, true));
- line.addEventListener(
- 'focus', selectLine.bind(null, line, true));
+ line.addEventListener('click', selectLine.bind(null, line, true));
+ line.addEventListener('focus', selectLine.bind(null, line, true));
checkEmptyLine(line);
if (!key && !value)

Powered by Google App Engine
This is Rietveld 408576698