OLD | NEW |
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 function requestData() { | 5 function requestData() { |
6 var xhr = new XMLHttpRequest(); | 6 var xhr = new XMLHttpRequest(); |
7 xhr.open('GET', 'targets-data.json', false); | 7 xhr.open('GET', 'targets-data.json', false); |
8 xhr.send(null); | 8 xhr.send(null); |
9 if (xhr.status === 200) | 9 if (xhr.status === 200) |
10 return JSON.parse(xhr.responseText); | 10 return JSON.parse(xhr.responseText); |
11 return []; | 11 return []; |
12 } | 12 } |
13 | 13 |
| 14 function adbQuery(query) { |
| 15 var xhr = new XMLHttpRequest(); |
| 16 xhr.open('GET', 'adb-query/' + query, false); |
| 17 xhr.send(null); |
| 18 if (xhr.status === 200) |
| 19 return JSON.parse(xhr.responseText); |
| 20 return [String(xhr.status), '']; |
| 21 } |
| 22 |
| 23 function xhr(url) { |
| 24 var xhr = new XMLHttpRequest(); |
| 25 xhr.open('GET', 'local-xhr/' + url, false); |
| 26 xhr.send(null); |
| 27 if (xhr.status === 200) |
| 28 return JSON.parse(xhr.responseText); |
| 29 return [String(xhr.status), '']; |
| 30 } |
| 31 |
14 function inspect(data) { | 32 function inspect(data) { |
15 chrome.send('inspect', | 33 chrome.send('inspect', |
16 [String(data.processId), String(data.routeId)]); | 34 [String(data.processId), String(data.routeId)]); |
17 } | 35 } |
18 | 36 |
19 function terminate(data) { | 37 function terminate(data) { |
20 chrome.send('terminate', | 38 chrome.send('terminate', |
21 [String(data.processId), String(data.routeId)]); | 39 [String(data.processId), String(data.routeId)]); |
22 } | 40 } |
23 | 41 |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 link.setAttribute('href', '#'); | 142 link.setAttribute('href', '#'); |
125 link.textContent = ' terminate '; | 143 link.textContent = ' terminate '; |
126 link.addEventListener( | 144 link.addEventListener( |
127 'click', | 145 'click', |
128 terminate.bind(this, data), | 146 terminate.bind(this, data), |
129 true); | 147 true); |
130 return link; | 148 return link; |
131 } | 149 } |
132 | 150 |
133 document.addEventListener('DOMContentLoaded', populateLists); | 151 document.addEventListener('DOMContentLoaded', populateLists); |
OLD | NEW |