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

Side by Side Diff: chrome/common/extensions/docs/examples/api/processes/process_monitor/popup.html

Issue 3801008: Expands the chrome.experimental.processes extension API. ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 2 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 unified diff | Download patch | Annotate | Revision Log
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 <html>
2 <head>
3 <script>
4 // Shows an updating list of process statistics.
5 function init() {
6 chrome.experimental.processes.onUpdated.addListener(function(processes) {
7 var table = "<table>\n" +
8 "<tr><td><b>Process</b></td>" +
9 "<td>Type</td>" +
10 "<td>CPU</td>" +
11 "<td>Network</td>" +
12 "<td>Shared Memory</td>" +
13 "<td>Private Memory</td>" +
14 "</tr>\n";
15 for (pid in processes) {
16 table = displayProcessInfo(processes[pid], table);
17 }
18 table += "</table>\n";
19 var div = document.getElementById("process-list");
20 div.innerHTML = table;
21 });
22 }
23
24 function displayProcessInfo(process, table) {
25 // Format network string like task manager
26 var network = process.network;
27 if (network > 1024) {
28 network = (network / 1024).toFixed(1) + " kB/s";
29 } else if (network > 0) {
30 network += " B/s";
31 } else if (network == -1) {
32 network = "N/A";
33 }
34
35 table +=
36 "<tr><td>" + process.id + "</td>" +
37 "<td>" + process.type + "</td>" +
38 "<td>" + process.cpu + "</td>" +
39 "<td>" + network + "</td>" +
40 "<td>" + (process.sharedMemory / 1024) + "K</td>" +
41 "<td>" + (process.privateMemory / 1024) + "K</td>" +
42 "</tr>\n";
43 return table;
44 }
45 </script>
46 <style>
47 body {
48 overflow: hidden;
49 margin: 0px;
50 padding: 0px;
51 background: white;
52 }
53
54 div:first-child {
55 margin-top: 0px;
56 }
57
58 div, td {
59 padding: 1px 3px;
60 font-family: sans-serif;
61 font-size: 10pt;
62 margin-top: 1px;
63 }
64 </style>
65 </head>
66 <body onload="init()">
67 <div id="title"><b>Process Monitor</b></div>
68 <div id="process-list"><i>Loading...</i></div>
69 </body>
70 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698