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 * @unrestricted | 5 * @unrestricted |
6 */ | 6 */ |
7 Devices.DevicesView = class extends UI.VBox { | 7 Devices.DevicesView = class extends UI.VBox { |
8 constructor() { | 8 constructor() { |
9 super(true); | 9 super(true); |
10 this.registerRequiredCSS('devices/devicesView.css'); | 10 this.registerRequiredCSS('devices/devicesView.css'); |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 */ | 203 */ |
204 Devices.DevicesView.DiscoveryView = class extends UI.VBox { | 204 Devices.DevicesView.DiscoveryView = class extends UI.VBox { |
205 constructor() { | 205 constructor() { |
206 super(); | 206 super(); |
207 this.setMinimumSize(100, 100); | 207 this.setMinimumSize(100, 100); |
208 this.element.classList.add('discovery-view'); | 208 this.element.classList.add('discovery-view'); |
209 | 209 |
210 this.contentElement.createChild('div', 'hbox device-text-row').createChild('
div', 'view-title').textContent = | 210 this.contentElement.createChild('div', 'hbox device-text-row').createChild('
div', 'view-title').textContent = |
211 Common.UIString('Settings'); | 211 Common.UIString('Settings'); |
212 | 212 |
213 var discoverUsbDevicesCheckbox = createCheckboxLabel(Common.UIString('Discov
er USB devices')); | 213 var discoverUsbDevicesCheckbox = UI.createCheckboxLabel(Common.UIString('Dis
cover USB devices')); |
214 discoverUsbDevicesCheckbox.classList.add('usb-checkbox'); | 214 discoverUsbDevicesCheckbox.classList.add('usb-checkbox'); |
215 this.element.appendChild(discoverUsbDevicesCheckbox); | 215 this.element.appendChild(discoverUsbDevicesCheckbox); |
216 this._discoverUsbDevicesCheckbox = discoverUsbDevicesCheckbox.checkboxElemen
t; | 216 this._discoverUsbDevicesCheckbox = discoverUsbDevicesCheckbox.checkboxElemen
t; |
217 this._discoverUsbDevicesCheckbox.addEventListener('click', this._updateDisco
veryConfig.bind(this), false); | 217 this._discoverUsbDevicesCheckbox.addEventListener('click', this._updateDisco
veryConfig.bind(this), false); |
218 | 218 |
219 var help = this.element.createChild('div', 'discovery-help'); | 219 var help = this.element.createChild('div', 'discovery-help'); |
220 help.createChild('span').textContent = Common.UIString('Need help? Read Chro
me '); | 220 help.createChild('span').textContent = Common.UIString('Need help? Read Chro
me '); |
221 help.appendChild(UI.createExternalLink( | 221 help.appendChild(UI.createExternalLink( |
222 'https://developers.google.com/chrome-developer-tools/docs/remote-debugg
ing', | 222 'https://developers.google.com/chrome-developer-tools/docs/remote-debugg
ing', |
223 Common.UIString('remote debugging documentation.'))); | 223 Common.UIString('remote debugging documentation.'))); |
224 | 224 |
225 var portForwardingHeader = this.element.createChild('div', 'port-forwarding-
header'); | 225 var portForwardingHeader = this.element.createChild('div', 'port-forwarding-
header'); |
226 var portForwardingEnabledCheckbox = createCheckboxLabel(Common.UIString('Por
t forwarding')); | 226 var portForwardingEnabledCheckbox = UI.createCheckboxLabel(Common.UIString('
Port forwarding')); |
227 portForwardingEnabledCheckbox.classList.add('port-forwarding-checkbox'); | 227 portForwardingEnabledCheckbox.classList.add('port-forwarding-checkbox'); |
228 portForwardingHeader.appendChild(portForwardingEnabledCheckbox); | 228 portForwardingHeader.appendChild(portForwardingEnabledCheckbox); |
229 this._portForwardingEnabledCheckbox = portForwardingEnabledCheckbox.checkbox
Element; | 229 this._portForwardingEnabledCheckbox = portForwardingEnabledCheckbox.checkbox
Element; |
230 this._portForwardingEnabledCheckbox.addEventListener('click', this._updateDi
scoveryConfig.bind(this), false); | 230 this._portForwardingEnabledCheckbox.addEventListener('click', this._updateDi
scoveryConfig.bind(this), false); |
231 | 231 |
232 var portForwardingFooter = this.element.createChild('div', 'port-forwarding-
footer'); | 232 var portForwardingFooter = this.element.createChild('div', 'port-forwarding-
footer'); |
233 portForwardingFooter.createChild('span').textContent = Common.UIString( | 233 portForwardingFooter.createChild('span').textContent = Common.UIString( |
234 'Define the listening port on your device that maps to a port accessible
from your development machine. '); | 234 'Define the listening port on your device that maps to a port accessible
from your development machine. '); |
235 portForwardingFooter.appendChild(UI.createExternalLink( | 235 portForwardingFooter.appendChild(UI.createExternalLink( |
236 'https://developer.chrome.com/devtools/docs/remote-debugging#port-forwar
ding', Common.UIString('Learn more'))); | 236 'https://developer.chrome.com/devtools/docs/remote-debugging#port-forwar
ding', Common.UIString('Learn more'))); |
237 | 237 |
238 this._list = new UI.ListWidget(this); | 238 this._list = new UI.ListWidget(this); |
239 this._list.registerRequiredCSS('devices/devicesView.css'); | 239 this._list.registerRequiredCSS('devices/devicesView.css'); |
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 = Common.UIString('No rules'); | 242 placeholder.textContent = Common.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( | 246 this.element.appendChild( |
247 createTextButton(Common.UIString('Add rule'), this._addRuleButtonClicked
.bind(this), 'add-rule-button')); | 247 UI.createTextButton(Common.UIString('Add rule'), this._addRuleButtonClic
ked.bind(this), 'add-rule-button')); |
248 | 248 |
249 /** @type {!Array<!Adb.PortForwardingRule>} */ | 249 /** @type {!Array<!Adb.PortForwardingRule>} */ |
250 this._portForwardingConfig = []; | 250 this._portForwardingConfig = []; |
251 } | 251 } |
252 | 252 |
253 _addRuleButtonClicked() { | 253 _addRuleButtonClicked() { |
254 this._list.addNewItem(this._portForwardingConfig.length, {port: '', address:
''}); | 254 this._list.addNewItem(this._portForwardingConfig.length, {port: '', address:
''}); |
255 } | 255 } |
256 | 256 |
257 /** | 257 /** |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
466 var element = createElementWithClass('div', 'vbox flex-none'); | 466 var element = createElementWithClass('div', 'vbox flex-none'); |
467 var topRow = element.createChild('div', ''); | 467 var topRow = element.createChild('div', ''); |
468 var title = topRow.createChild('div', 'device-browser-title'); | 468 var title = topRow.createChild('div', 'device-browser-title'); |
469 | 469 |
470 var newTabRow = element.createChild('div', 'device-browser-new-tab'); | 470 var newTabRow = element.createChild('div', 'device-browser-new-tab'); |
471 newTabRow.createChild('div', '').textContent = Common.UIString('New tab:'); | 471 newTabRow.createChild('div', '').textContent = Common.UIString('New tab:'); |
472 var newTabInput = newTabRow.createChild('input', ''); | 472 var newTabInput = newTabRow.createChild('input', ''); |
473 newTabInput.type = 'text'; | 473 newTabInput.type = 'text'; |
474 newTabInput.placeholder = Common.UIString('Enter URL'); | 474 newTabInput.placeholder = Common.UIString('Enter URL'); |
475 newTabInput.addEventListener('keydown', newTabKeyDown, false); | 475 newTabInput.addEventListener('keydown', newTabKeyDown, false); |
476 var newTabButton = createTextButton(Common.UIString('Open'), openNewTab); | 476 var newTabButton = UI.createTextButton(Common.UIString('Open'), openNewTab); |
477 newTabRow.appendChild(newTabButton); | 477 newTabRow.appendChild(newTabButton); |
478 | 478 |
479 var pages = element.createChild('div', 'device-page-list vbox'); | 479 var pages = element.createChild('div', 'device-page-list vbox'); |
480 | 480 |
481 var viewMore = element.createChild('div', 'device-view-more'); | 481 var viewMore = element.createChild('div', 'device-view-more'); |
482 viewMore.addEventListener('click', viewMoreClick, false); | 482 viewMore.addEventListener('click', viewMoreClick, false); |
483 updateViewMoreTitle(); | 483 updateViewMoreTitle(); |
484 | 484 |
485 var section = { | 485 var section = { |
486 browser: null, | 486 browser: null, |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
568 } | 568 } |
569 | 569 |
570 /** | 570 /** |
571 * @return {!Devices.DevicesView.PageSection} | 571 * @return {!Devices.DevicesView.PageSection} |
572 */ | 572 */ |
573 _createPageSection() { | 573 _createPageSection() { |
574 var element = createElementWithClass('div', 'vbox'); | 574 var element = createElementWithClass('div', 'vbox'); |
575 | 575 |
576 var titleRow = element.createChild('div', 'device-page-title-row'); | 576 var titleRow = element.createChild('div', 'device-page-title-row'); |
577 var title = titleRow.createChild('div', 'device-page-title'); | 577 var title = titleRow.createChild('div', 'device-page-title'); |
578 var inspect = createTextButton(Common.UIString('Inspect'), doAction.bind(nul
l, 'inspect'), 'device-inspect-button'); | 578 var inspect = |
| 579 UI.createTextButton(Common.UIString('Inspect'), doAction.bind(null, 'ins
pect'), 'device-inspect-button'); |
579 titleRow.appendChild(inspect); | 580 titleRow.appendChild(inspect); |
580 | 581 |
581 var toolbar = new UI.Toolbar(''); | 582 var toolbar = new UI.Toolbar(''); |
582 toolbar.appendToolbarItem(new UI.ToolbarMenuButton(appendActions)); | 583 toolbar.appendToolbarItem(new UI.ToolbarMenuButton(appendActions)); |
583 titleRow.appendChild(toolbar.element); | 584 titleRow.appendChild(toolbar.element); |
584 | 585 |
585 var url = element.createChild('div', 'device-page-url'); | 586 var url = element.createChild('div', 'device-page-url'); |
586 var section = {page: null, element: element, title: title, url: url, inspect
: inspect}; | 587 var section = {page: null, element: element, title: title, url: url, inspect
: inspect}; |
587 return section; | 588 return section; |
588 | 589 |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
673 this._portStatus.title = title.join('; '); | 674 this._portStatus.title = title.join('; '); |
674 this._portStatus.classList.toggle('hidden', empty); | 675 this._portStatus.classList.toggle('hidden', empty); |
675 } | 676 } |
676 }; | 677 }; |
677 | 678 |
678 /** @typedef {!{browser: ?Adb.Browser, element: !Element, title: !Element, pages
: !Element, viewMore: !Element, newTab: !Element, pageSections: !Map<string, !De
vices.DevicesView.PageSection>}} */ | 679 /** @typedef {!{browser: ?Adb.Browser, element: !Element, title: !Element, pages
: !Element, viewMore: !Element, newTab: !Element, pageSections: !Map<string, !De
vices.DevicesView.PageSection>}} */ |
679 Devices.DevicesView.BrowserSection; | 680 Devices.DevicesView.BrowserSection; |
680 | 681 |
681 /** @typedef {!{page: ?Adb.Page, element: !Element, title: !Element, url: !Eleme
nt, inspect: !Element}} */ | 682 /** @typedef {!{page: ?Adb.Page, element: !Element, title: !Element, url: !Eleme
nt, inspect: !Element}} */ |
682 Devices.DevicesView.PageSection; | 683 Devices.DevicesView.PageSection; |
OLD | NEW |