| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 * @fileoverview | 6 * @fileoverview |
| 7 * 'media-picker' handles showing the dropdown allowing users to select the | 7 * 'media-picker' handles showing the dropdown allowing users to select the |
| 8 * default camera/microphone. | 8 * default camera/microphone. |
| 9 */ | 9 */ |
| 10 Polymer({ | 10 Polymer({ |
| 11 is: 'media-picker', | 11 is: 'media-picker', |
| 12 | 12 |
| 13 behaviors: [SiteSettingsBehavior, WebUIListenerBehavior], | 13 behaviors: [SiteSettingsBehavior, WebUIListenerBehavior], |
| 14 | 14 |
| 15 properties: { | 15 properties: { |
| 16 /** | 16 /** |
| 17 * The type of media picker, either 'camera' or 'mic'. | 17 * The type of media picker, either 'camera' or 'mic'. |
| 18 */ | 18 */ |
| 19 type: String, | 19 type: String, |
| 20 | 20 |
| 21 /** | 21 /** |
| 22 * The devices available to pick from. | 22 * The devices available to pick from. |
| 23 * @type {Array<MediaPickerEntry>} | 23 * @type {Array<MediaPickerEntry>} |
| 24 */ | 24 */ |
| 25 devices: Array, | 25 devices: Array, |
| 26 }, | 26 }, |
| 27 | 27 |
| 28 ready: function() { | 28 ready: function() { |
| 29 this.addWebUIListener('updateDevicesMenu', | 29 this.addWebUIListener( |
| 30 this.updateDevicesMenu_.bind(this)); | 30 'updateDevicesMenu', this.updateDevicesMenu_.bind(this)); |
| 31 this.browserProxy.getDefaultCaptureDevices(this.type); | 31 this.browserProxy.getDefaultCaptureDevices(this.type); |
| 32 }, | 32 }, |
| 33 | 33 |
| 34 /** | 34 /** |
| 35 * Updates the microphone/camera devices menu with the given entries. | 35 * Updates the microphone/camera devices menu with the given entries. |
| 36 * @param {string} type The device type. | 36 * @param {string} type The device type. |
| 37 * @param {!Array<MediaPickerEntry>} devices List of available devices. | 37 * @param {!Array<MediaPickerEntry>} devices List of available devices. |
| 38 * @param {string} defaultDevice The unique id of the current default device. | 38 * @param {string} defaultDevice The unique id of the current default device. |
| 39 */ | 39 */ |
| 40 updateDevicesMenu_: function(type, devices, defaultDevice) { | 40 updateDevicesMenu_: function(type, devices, defaultDevice) { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 54 | 54 |
| 55 /** | 55 /** |
| 56 * A handler for when an item is selected in the media picker. | 56 * A handler for when an item is selected in the media picker. |
| 57 * @private | 57 * @private |
| 58 */ | 58 */ |
| 59 onChange_: function() { | 59 onChange_: function() { |
| 60 this.browserProxy.setDefaultCaptureDevice( | 60 this.browserProxy.setDefaultCaptureDevice( |
| 61 this.type, this.$.mediaPicker.value); | 61 this.type, this.$.mediaPicker.value); |
| 62 }, | 62 }, |
| 63 }); | 63 }); |
| OLD | NEW |