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

Side by Side Diff: chrome/browser/resources/inspect/inspect.js

Issue 46523002: Fix Telemetry. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 function inspect(data) { 10 function inspect(data) {
11 chrome.send('inspect', [data]); 11 chrome.send('inspect', [data]);
12 } 12 }
13 13
14 function activate(data) { 14 function activate(data) {
15 chrome.send('activate', [data]); 15 chrome.send('activate', [data]);
16 } 16 }
17 17
18 function close(data) { 18 function terminate(data) {
19 chrome.send('close', [data]); 19 chrome.send('terminate', [data]);
20 } 20 }
21 21
22 function reload(data) { 22 function reload(data) {
23 chrome.send('reload', [data]); 23 chrome.send('reload', [data]);
24 } 24 }
25 25
26 function open(browserId, url) { 26 function open(browserId, url) {
27 chrome.send('open', [browserId, url]); 27 chrome.send('open', [browserId, url]);
28 } 28 }
29 29
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 tabContent.classList.add('selected'); 62 tabContent.classList.add('selected');
63 tabHeader.classList.add('selected'); 63 tabHeader.classList.add('selected');
64 } else { 64 } else {
65 tabContent.classList.remove('selected'); 65 tabContent.classList.remove('selected');
66 tabHeader.classList.remove('selected'); 66 tabHeader.classList.remove('selected');
67 } 67 }
68 } 68 }
69 window.location.hash = id; 69 window.location.hash = id;
70 } 70 }
71 71
72 function populateWebContentsTargets(data) { 72 function populateLists(data) {
73 removeChildren('pages-list'); 73 removeChildren('pages-list');
74 removeChildren('extensions-list'); 74 removeChildren('extensions-list');
75 removeChildren('apps-list'); 75 removeChildren('apps-list');
76 removeChildren('others-list'); 76 removeChildren('others-list');
77 77
78 for (var i = 0; i < data.length; i++) { 78 for (var i = 0; i < data.length; i++) {
79 if (data[i].type === 'page') 79 if (data[i].type === 'page')
80 addToPagesList(data[i]); 80 addToPagesList(data[i]);
81 else if (data[i].type === 'background_page') 81 else if (data[i].type === 'extension')
82 addToExtensionsList(data[i]); 82 addToExtensionsList(data[i]);
83 else if (data[i].type === 'app') 83 else if (data[i].type === 'app')
84 addToAppsList(data[i]); 84 addToAppsList(data[i]);
85 else 85 else
86 addToOthersList(data[i]); 86 addToOthersList(data[i]);
87 } 87 }
88 } 88 }
89 89
90 function populateWorkerTargets(data) { 90 function populateWorkersList(data) {
91 removeChildren('workers-list'); 91 removeChildren('workers-list');
92 92
93 for (var i = 0; i < data.length; i++) 93 for (var i = 0; i < data.length; i++)
94 addToWorkersList(data[i]); 94 addToWorkersList(data[i]);
95 } 95 }
96 96
97 function populateRemoteTargets(devices) { 97 function populateDeviceLists(devices) {
98 if (!devices) 98 if (!devices)
99 return; 99 return;
100 100
101 if (window.modal) { 101 if (window.modal) {
102 window.holdDevices = devices; 102 window.holdDevices = devices;
103 return; 103 return;
104 } 104 }
105 105
106 function alreadyDisplayed(element, data) { 106 function alreadyDisplayed(element, data) {
107 var json = JSON.stringify(data); 107 var json = JSON.stringify(data);
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 addWebViewDetails(row, page); 297 addWebViewDetails(row, page);
298 else 298 else
299 addFavicon(row, page); 299 addFavicon(row, page);
300 if (isChrome) { 300 if (isChrome) {
301 if (majorChromeVersion >= MIN_VERSION_TAB_ACTIVATE) { 301 if (majorChromeVersion >= MIN_VERSION_TAB_ACTIVATE) {
302 addActionLink(row, 'focus tab', activate.bind(null, page), false); 302 addActionLink(row, 'focus tab', activate.bind(null, page), false);
303 } 303 }
304 addActionLink(row, 'reload', reload.bind(null, page), page.attached); 304 addActionLink(row, 'reload', reload.bind(null, page), page.attached);
305 if (majorChromeVersion >= MIN_VERSION_TAB_CLOSE) { 305 if (majorChromeVersion >= MIN_VERSION_TAB_CLOSE) {
306 addActionLink( 306 addActionLink(
307 row, 'close', close.bind(null, page), page.attached); 307 row, 'close', terminate.bind(null, page), page.attached);
308 } 308 }
309 } 309 }
310 } 310 }
311 } 311 }
312 } 312 }
313 } 313 }
314 314
315 function addToPagesList(data) { 315 function addToPagesList(data) {
316 var row = addTargetToList(data, $('pages-list'), ['name', 'url']); 316 var row = addTargetToList(data, $('pages-list'), ['name', 'url']);
317 addFavicon(row, data); 317 addFavicon(row, data);
(...skipping 10 matching lines...) Expand all
328 if (data.guests) { 328 if (data.guests) {
329 Array.prototype.forEach.call(data.guests, function(guest) { 329 Array.prototype.forEach.call(data.guests, function(guest) {
330 var guestRow = addTargetToList(guest, row, ['name', 'url']); 330 var guestRow = addTargetToList(guest, row, ['name', 'url']);
331 guestRow.classList.add('guest'); 331 guestRow.classList.add('guest');
332 addFavicon(guestRow, guest); 332 addFavicon(guestRow, guest);
333 }); 333 });
334 } 334 }
335 } 335 }
336 336
337 function addToWorkersList(data) { 337 function addToWorkersList(data) {
338 var row = 338 var row = addTargetToList(data, $('workers-list'), ['pid', 'url']);
339 addTargetToList(data, $('workers-list'), ['name', 'description', 'url']); 339 addActionLink(row, 'terminate', terminate.bind(null, data), data.attached);
340 addActionLink(row, 'terminate', close.bind(null, data), data.attached);
341 } 340 }
342 341
343 function addToOthersList(data) { 342 function addToOthersList(data) {
344 addTargetToList(data, $('others-list'), ['url']); 343 addTargetToList(data, $('others-list'), ['url']);
345 } 344 }
346 345
347 function formatValue(data, property) { 346 function formatValue(data, property) {
348 var value = data[property]; 347 var value = data[property];
349 348
350 if (property == 'name' && value == '') { 349 if (property == 'name' && value == '') {
351 value = 'untitled'; 350 value = 'untitled';
352 } 351 }
353 352
354 var text = value ? String(value) : ''; 353 var text = value ? String(value) : '';
355 if (text.length > 100) 354 if (text.length > 100)
356 text = text.substring(0, 100) + '\u2026'; 355 text = text.substring(0, 100) + '\u2026';
357 356
357 if (property == 'pid')
358 text = 'Pid:' + text;
359
358 var span = document.createElement('div'); 360 var span = document.createElement('div');
359 span.textContent = text; 361 span.textContent = text;
360 span.className = property; 362 span.className = property;
361 return span; 363 return span;
362 } 364 }
363 365
364 function addFavicon(row, data) { 366 function addFavicon(row, data) {
365 var favicon = document.createElement('img'); 367 var favicon = document.createElement('img');
366 if (data['faviconUrl']) 368 if (data['faviconUrl'])
367 favicon.src = data['faviconUrl']; 369 favicon.src = data['faviconUrl'];
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after
786 if (line.querySelector('.invalid')) 788 if (line.querySelector('.invalid'))
787 return; 789 return;
788 line.classList.remove('fresh'); 790 line.classList.remove('fresh');
789 var freshLine = createEmptyConfigLine(); 791 var freshLine = createEmptyConfigLine();
790 line.parentNode.appendChild(freshLine); 792 line.parentNode.appendChild(freshLine);
791 if (opt_selectNew) 793 if (opt_selectNew)
792 freshLine.querySelector('.port').focus(); 794 freshLine.querySelector('.port').focus();
793 } 795 }
794 796
795 document.addEventListener('DOMContentLoaded', onload); 797 document.addEventListener('DOMContentLoaded', onload);
OLDNEW
« no previous file with comments | « chrome/browser/devtools/port_forwarding_controller.cc ('k') | chrome/browser/ui/webui/inspect_ui.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698