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

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

Issue 26436003: DevTools: display 'Pending authentication' message upon raw usb debugging. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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
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) {
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 } 128 }
129 129
130 var newDeviceIds = devices.map(function(d) { return d.adbGlobalId }); 130 var newDeviceIds = devices.map(function(d) { return d.adbGlobalId });
131 Array.prototype.forEach.call( 131 Array.prototype.forEach.call(
132 deviceList.querySelectorAll('.device'), 132 deviceList.querySelectorAll('.device'),
133 removeObsolete.bind(null, newDeviceIds)); 133 removeObsolete.bind(null, newDeviceIds));
134 134
135 for (var d = 0; d < devices.length; d++) { 135 for (var d = 0; d < devices.length; d++) {
136 var device = devices[d]; 136 var device = devices[d];
137 137
138 var devicePorts;
139 var browserList;
140 var deviceSection = $(device.adbGlobalId); 138 var deviceSection = $(device.adbGlobalId);
141 if (deviceSection) { 139 if (!deviceSection) {
142 devicePorts = deviceSection.querySelector('.device-ports');
143 browserList = deviceSection.querySelector('.browsers');
144 } else {
145 deviceSection = document.createElement('div'); 140 deviceSection = document.createElement('div');
146 deviceSection.id = device.adbGlobalId; 141 deviceSection.id = device.adbGlobalId;
147 deviceSection.className = 'device'; 142 deviceSection.className = 'device';
148 deviceList.appendChild(deviceSection); 143 deviceList.appendChild(deviceSection);
149 144
150 var deviceHeader = document.createElement('div'); 145 var deviceHeader = document.createElement('div');
151 deviceHeader.className = 'device-header'; 146 deviceHeader.className = 'device-header';
152 deviceSection.appendChild(deviceHeader); 147 deviceSection.appendChild(deviceHeader);
153 148
154 var deviceName = document.createElement('div'); 149 var deviceName = document.createElement('div');
155 deviceName.className = 'device-name'; 150 deviceName.className = 'device-name';
156 deviceName.textContent = device.adbModel;
157 deviceHeader.appendChild(deviceName); 151 deviceHeader.appendChild(deviceName);
158 152
159 if (device.adbSerial) { 153 if (device.adbSerial) {
160 var deviceSerial = document.createElement('div'); 154 var deviceSerial = document.createElement('div');
161 deviceSerial.className = 'device-serial'; 155 deviceSerial.className = 'device-serial';
162 deviceSerial.textContent = '#' + device.adbSerial.toUpperCase(); 156 deviceSerial.textContent = '#' + device.adbSerial.toUpperCase();
163 deviceHeader.appendChild(deviceSerial); 157 deviceHeader.appendChild(deviceSerial);
164 } 158 }
165 159
166 devicePorts = document.createElement('div'); 160 var devicePorts = document.createElement('div');
167 devicePorts.className = 'device-ports'; 161 devicePorts.className = 'device-ports';
168 deviceHeader.appendChild(devicePorts); 162 deviceHeader.appendChild(devicePorts);
169 163
170 browserList = document.createElement('div'); 164 var browserList = document.createElement('div');
171 browserList.className = 'browsers'; 165 browserList.className = 'browsers';
172 deviceSection.appendChild(browserList); 166 deviceSection.appendChild(browserList);
167
168 var authenticating = document.createElement('div');
169 authenticating.className = 'device-auth';
170 deviceSection.appendChild(authenticating);
173 } 171 }
174 172
175 if (alreadyDisplayed(deviceSection, device)) 173 if (alreadyDisplayed(deviceSection, device))
176 continue; 174 continue;
177 175
176 deviceSection.querySelector('.device-name').textContent = device.adbModel;
177 deviceSection.querySelector('.device-auth').textContent =
178 device.adbConnected ? '' : 'Pending authentication: please accept ' +
179 'debugging session on the device.';
180
181 var devicePorts = deviceSection.querySelector('.device-ports');
178 devicePorts.textContent = ''; 182 devicePorts.textContent = '';
179 if (device.adbPortStatus) { 183 if (device.adbPortStatus) {
180 for (var port in device.adbPortStatus) { 184 for (var port in device.adbPortStatus) {
181 var status = device.adbPortStatus[port]; 185 var status = device.adbPortStatus[port];
182 var portIcon = document.createElement('div'); 186 var portIcon = document.createElement('div');
183 portIcon.className = 'port-icon'; 187 portIcon.className = 'port-icon';
184 if (status > 0) 188 if (status > 0)
185 portIcon.classList.add('connected'); 189 portIcon.classList.add('connected');
186 else if (status == -1 || status == -2) 190 else if (status == -1 || status == -2)
187 portIcon.classList.add('transient'); 191 portIcon.classList.add('transient');
188 else if (status < 0) 192 else if (status < 0)
189 portIcon.classList.add('error'); 193 portIcon.classList.add('error');
190 devicePorts.appendChild(portIcon); 194 devicePorts.appendChild(portIcon);
191 195
192 var portNumber = document.createElement('div'); 196 var portNumber = document.createElement('div');
193 portNumber.className = 'port-number'; 197 portNumber.className = 'port-number';
194 portNumber.textContent = ':' + port; 198 portNumber.textContent = ':' + port;
195 if (status > 0) 199 if (status > 0)
196 portNumber.textContent += '(' + status + ')'; 200 portNumber.textContent += '(' + status + ')';
197 devicePorts.appendChild(portNumber); 201 devicePorts.appendChild(portNumber);
198 } 202 }
199 } 203 }
200 204
205 var browserList = deviceSection.querySelector('.browsers');
201 var newBrowserIds = 206 var newBrowserIds =
202 device.browsers.map(function(b) { return b.adbGlobalId }); 207 device.browsers.map(function(b) { return b.adbGlobalId });
203 Array.prototype.forEach.call( 208 Array.prototype.forEach.call(
204 browserList.querySelectorAll('.browser'), 209 browserList.querySelectorAll('.browser'),
205 removeObsolete.bind(null, newBrowserIds)); 210 removeObsolete.bind(null, newBrowserIds));
206 211
207 for (var b = 0; b < device.browsers.length; b++) { 212 for (var b = 0; b < device.browsers.length; b++) {
208 var browser = device.browsers[b]; 213 var browser = device.browsers[b];
209 214
210 var isChrome = browser.adbBrowserProduct && 215 var isChrome = browser.adbBrowserProduct &&
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after
724 if (line.querySelector('.invalid')) 729 if (line.querySelector('.invalid'))
725 return; 730 return;
726 line.classList.remove('fresh'); 731 line.classList.remove('fresh');
727 var freshLine = createEmptyConfigLine(); 732 var freshLine = createEmptyConfigLine();
728 line.parentNode.appendChild(freshLine); 733 line.parentNode.appendChild(freshLine);
729 if (opt_selectNew) 734 if (opt_selectNew)
730 freshLine.querySelector('.port').focus(); 735 freshLine.querySelector('.port').focus();
731 } 736 }
732 737
733 document.addEventListener('DOMContentLoaded', onload); 738 document.addEventListener('DOMContentLoaded', onload);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698