OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 /** | 5 /** |
6 * @constructor | 6 * @constructor |
7 * @extends {WebInspector.VBox} | 7 * @extends {WebInspector.VBox} |
8 */ | 8 */ |
9 WebInspector.DevicesView = function() | 9 WebInspector.DevicesView = function() |
10 { | 10 { |
(...skipping 28 matching lines...) Expand all Loading... |
39 discoveryFooter.createChild("span").textContent = WebInspector.UIString(" fo
r more information."); | 39 discoveryFooter.createChild("span").textContent = WebInspector.UIString(" fo
r more information."); |
40 this._updateFooter(); | 40 this._updateFooter(); |
41 this._selectSidebarListItem(this._discoveryListItem, this._discoveryView); | 41 this._selectSidebarListItem(this._discoveryListItem, this._discoveryView); |
42 | 42 |
43 InspectorFrontendHost.events.addEventListener(InspectorFrontendHostAPI.Event
s.DevicesUpdated, this._devicesUpdated, this); | 43 InspectorFrontendHost.events.addEventListener(InspectorFrontendHostAPI.Event
s.DevicesUpdated, this._devicesUpdated, this); |
44 InspectorFrontendHost.events.addEventListener(InspectorFrontendHostAPI.Event
s.DevicesDiscoveryConfigChanged, this._devicesDiscoveryConfigChanged, this); | 44 InspectorFrontendHost.events.addEventListener(InspectorFrontendHostAPI.Event
s.DevicesDiscoveryConfigChanged, this._devicesDiscoveryConfigChanged, this); |
45 InspectorFrontendHost.events.addEventListener(InspectorFrontendHostAPI.Event
s.DevicesPortForwardingStatusChanged, this._devicesPortForwardingStatusChanged,
this); | 45 InspectorFrontendHost.events.addEventListener(InspectorFrontendHostAPI.Event
s.DevicesPortForwardingStatusChanged, this._devicesPortForwardingStatusChanged,
this); |
46 | 46 |
47 this.contentElement.tabIndex = 0; | 47 this.contentElement.tabIndex = 0; |
48 this.setDefaultFocusedElement(this.contentElement); | 48 this.setDefaultFocusedElement(this.contentElement); |
49 } | 49 }; |
50 | 50 |
51 WebInspector.DevicesView.prototype = { | 51 WebInspector.DevicesView.prototype = { |
52 /** | 52 /** |
53 * @param {!Element} listItem | 53 * @param {!Element} listItem |
54 * @param {!WebInspector.Widget} view | 54 * @param {!WebInspector.Widget} view |
55 */ | 55 */ |
56 _selectSidebarListItem: function(listItem, view) | 56 _selectSidebarListItem: function(listItem, view) |
57 { | 57 { |
58 if (this._selectedListItem === listItem) | 58 if (this._selectedListItem === listItem) |
59 return; | 59 return; |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 /** | 181 /** |
182 * @override | 182 * @override |
183 */ | 183 */ |
184 willHide: function() | 184 willHide: function() |
185 { | 185 { |
186 WebInspector.PanelWithSidebar.prototype.wasShown.call(this); | 186 WebInspector.PanelWithSidebar.prototype.wasShown.call(this); |
187 InspectorFrontendHost.setDevicesUpdatesEnabled(false); | 187 InspectorFrontendHost.setDevicesUpdatesEnabled(false); |
188 }, | 188 }, |
189 | 189 |
190 __proto__: WebInspector.VBox.prototype | 190 __proto__: WebInspector.VBox.prototype |
191 } | 191 }; |
192 | 192 |
193 /** | 193 /** |
194 * @return {!WebInspector.DevicesView} | 194 * @return {!WebInspector.DevicesView} |
195 */ | 195 */ |
196 WebInspector.DevicesView._instance = function() | 196 WebInspector.DevicesView._instance = function() |
197 { | 197 { |
198 if (!WebInspector.DevicesView._instanceObject) | 198 if (!WebInspector.DevicesView._instanceObject) |
199 WebInspector.DevicesView._instanceObject = new WebInspector.DevicesView(
); | 199 WebInspector.DevicesView._instanceObject = new WebInspector.DevicesView(
); |
200 return WebInspector.DevicesView._instanceObject; | 200 return WebInspector.DevicesView._instanceObject; |
201 } | 201 }; |
202 | 202 |
203 | 203 |
204 /** | 204 /** |
205 * @constructor | 205 * @constructor |
206 * @extends {WebInspector.VBox} | 206 * @extends {WebInspector.VBox} |
207 * @implements {WebInspector.ListWidget.Delegate} | 207 * @implements {WebInspector.ListWidget.Delegate} |
208 */ | 208 */ |
209 WebInspector.DevicesView.DiscoveryView = function() | 209 WebInspector.DevicesView.DiscoveryView = function() |
210 { | 210 { |
211 WebInspector.VBox.call(this); | 211 WebInspector.VBox.call(this); |
(...skipping 28 matching lines...) Expand all Loading... |
240 this._list.element.classList.add("port-forwarding-list"); | 240 this._list.element.classList.add("port-forwarding-list"); |
241 var placeholder = createElementWithClass("div", "port-forwarding-list-empty"
); | 241 var placeholder = createElementWithClass("div", "port-forwarding-list-empty"
); |
242 placeholder.textContent = WebInspector.UIString("No rules"); | 242 placeholder.textContent = WebInspector.UIString("No rules"); |
243 this._list.setEmptyPlaceholder(placeholder); | 243 this._list.setEmptyPlaceholder(placeholder); |
244 this._list.show(this.element); | 244 this._list.show(this.element); |
245 | 245 |
246 this.element.appendChild(createTextButton(WebInspector.UIString("Add rule"),
this._addRuleButtonClicked.bind(this), "add-rule-button")); | 246 this.element.appendChild(createTextButton(WebInspector.UIString("Add rule"),
this._addRuleButtonClicked.bind(this), "add-rule-button")); |
247 | 247 |
248 /** @type {!Array<!Adb.PortForwardingRule>} */ | 248 /** @type {!Array<!Adb.PortForwardingRule>} */ |
249 this._portForwardingConfig = []; | 249 this._portForwardingConfig = []; |
250 } | 250 }; |
251 | 251 |
252 WebInspector.DevicesView.DiscoveryView.prototype = { | 252 WebInspector.DevicesView.DiscoveryView.prototype = { |
253 _addRuleButtonClicked: function() | 253 _addRuleButtonClicked: function() |
254 { | 254 { |
255 this._list.addNewItem(this._portForwardingConfig.length, {port: "", addr
ess: ""}); | 255 this._list.addNewItem(this._portForwardingConfig.length, {port: "", addr
ess: ""}); |
256 }, | 256 }, |
257 | 257 |
258 /** | 258 /** |
259 * @param {boolean} discoverUsbDevices | 259 * @param {boolean} discoverUsbDevices |
260 * @param {boolean} portForwardingEnabled | 260 * @param {boolean} portForwardingEnabled |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
392 | 392 |
393 _updateDiscoveryConfig: function() | 393 _updateDiscoveryConfig: function() |
394 { | 394 { |
395 var configMap = /** @type {!Adb.PortForwardingConfig} */ ({}); | 395 var configMap = /** @type {!Adb.PortForwardingConfig} */ ({}); |
396 for (var rule of this._portForwardingConfig) | 396 for (var rule of this._portForwardingConfig) |
397 configMap[rule.port] = rule.address; | 397 configMap[rule.port] = rule.address; |
398 InspectorFrontendHost.setDevicesDiscoveryConfig(this._discoverUsbDevices
Checkbox.checked, this._portForwardingEnabledCheckbox.checked, configMap); | 398 InspectorFrontendHost.setDevicesDiscoveryConfig(this._discoverUsbDevices
Checkbox.checked, this._portForwardingEnabledCheckbox.checked, configMap); |
399 }, | 399 }, |
400 | 400 |
401 __proto__: WebInspector.VBox.prototype | 401 __proto__: WebInspector.VBox.prototype |
402 } | 402 }; |
403 | 403 |
404 | 404 |
405 /** | 405 /** |
406 * @constructor | 406 * @constructor |
407 * @extends {WebInspector.VBox} | 407 * @extends {WebInspector.VBox} |
408 */ | 408 */ |
409 WebInspector.DevicesView.DeviceView = function() | 409 WebInspector.DevicesView.DeviceView = function() |
410 { | 410 { |
411 WebInspector.VBox.call(this); | 411 WebInspector.VBox.call(this); |
412 this.setMinimumSize(100, 100); | 412 this.setMinimumSize(100, 100); |
413 this.contentElement.classList.add("device-view"); | 413 this.contentElement.classList.add("device-view"); |
414 | 414 |
415 var topRow = this.contentElement.createChild("div", "hbox device-text-row"); | 415 var topRow = this.contentElement.createChild("div", "hbox device-text-row"); |
416 this._deviceTitle = topRow.createChild("div", "view-title"); | 416 this._deviceTitle = topRow.createChild("div", "view-title"); |
417 this._deviceSerial = topRow.createChild("div", "device-serial"); | 417 this._deviceSerial = topRow.createChild("div", "device-serial"); |
418 this._portStatus = this.contentElement.createChild("div", "device-port-statu
s hidden"); | 418 this._portStatus = this.contentElement.createChild("div", "device-port-statu
s hidden"); |
419 | 419 |
420 this._deviceOffline = this.contentElement.createChild("div"); | 420 this._deviceOffline = this.contentElement.createChild("div"); |
421 this._deviceOffline.textContent = WebInspector.UIString("Pending authenticat
ion: please accept debugging session on the device."); | 421 this._deviceOffline.textContent = WebInspector.UIString("Pending authenticat
ion: please accept debugging session on the device."); |
422 | 422 |
423 this._noBrowsers = this.contentElement.createChild("div"); | 423 this._noBrowsers = this.contentElement.createChild("div"); |
424 this._noBrowsers.textContent = WebInspector.UIString("No browsers detected."
); | 424 this._noBrowsers.textContent = WebInspector.UIString("No browsers detected."
); |
425 | 425 |
426 this._browsers = this.contentElement.createChild("div", "device-browser-list
vbox"); | 426 this._browsers = this.contentElement.createChild("div", "device-browser-list
vbox"); |
427 | 427 |
428 /** @type {!Map<string, !WebInspector.DevicesView.BrowserSection>} */ | 428 /** @type {!Map<string, !WebInspector.DevicesView.BrowserSection>} */ |
429 this._browserById = new Map(); | 429 this._browserById = new Map(); |
430 | 430 |
431 this._device = null; | 431 this._device = null; |
432 } | 432 }; |
433 | 433 |
434 /** @typedef {!{browser: ?Adb.Browser, element: !Element, title: !Element, pages
: !Element, viewMore: !Element, newTab: !Element, pageSections: !Map<string, !We
bInspector.DevicesView.PageSection>}} */ | 434 /** @typedef {!{browser: ?Adb.Browser, element: !Element, title: !Element, pages
: !Element, viewMore: !Element, newTab: !Element, pageSections: !Map<string, !We
bInspector.DevicesView.PageSection>}} */ |
435 WebInspector.DevicesView.BrowserSection; | 435 WebInspector.DevicesView.BrowserSection; |
436 | 436 |
437 /** @typedef {!{page: ?Adb.Page, element: !Element, title: !Element, url: !Eleme
nt, inspect: !Element}} */ | 437 /** @typedef {!{page: ?Adb.Page, element: !Element, title: !Element, url: !Eleme
nt, inspect: !Element}} */ |
438 WebInspector.DevicesView.PageSection; | 438 WebInspector.DevicesView.PageSection; |
439 | 439 |
440 WebInspector.DevicesView.DeviceView.prototype = { | 440 WebInspector.DevicesView.DeviceView.prototype = { |
441 /** | 441 /** |
442 * @param {!Adb.Device} device | 442 * @param {!Adb.Device} device |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
686 title.push(WebInspector.UIString("Connected: %s", connected.join(",
"))); | 686 title.push(WebInspector.UIString("Connected: %s", connected.join(",
"))); |
687 if (transient.length) | 687 if (transient.length) |
688 title.push(WebInspector.UIString("Transient: %s", transient.join(",
"))); | 688 title.push(WebInspector.UIString("Transient: %s", transient.join(",
"))); |
689 if (error.length) | 689 if (error.length) |
690 title.push(WebInspector.UIString("Error: %s", error.join(", "))); | 690 title.push(WebInspector.UIString("Error: %s", error.join(", "))); |
691 this._portStatus.title = title.join("; "); | 691 this._portStatus.title = title.join("; "); |
692 this._portStatus.classList.toggle("hidden", empty); | 692 this._portStatus.classList.toggle("hidden", empty); |
693 }, | 693 }, |
694 | 694 |
695 __proto__: WebInspector.VBox.prototype | 695 __proto__: WebInspector.VBox.prototype |
696 } | 696 }; |
OLD | NEW |