| 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({ |
| (...skipping 26 matching lines...) Expand all Loading... |
| 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) { |
| 41 if (type != this.type) | 41 if (type != this.type) |
| 42 return; | 42 return; |
| 43 | 43 |
| 44 this.$.picker.hidden = devices.length == 0; | 44 this.$.picker.hidden = devices.length == 0; |
| 45 if (devices.length > 0) { | 45 if (devices.length > 0) { |
| 46 this.devices = devices; | 46 this.devices = devices; |
| 47 this.$.mediaPicker.selected = defaultDevice; | 47 |
| 48 // Wait for <select> to be populated. |
| 49 this.async(function() { |
| 50 this.$.mediaPicker.value = defaultDevice; |
| 51 }.bind(this)); |
| 48 } | 52 } |
| 49 }, | 53 }, |
| 50 | 54 |
| 51 /** | 55 /** |
| 52 * 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 |
| 53 */ | 58 */ |
| 54 onMediaPickerActivate_: function(event) { | 59 onChange_: function() { |
| 55 this.browserProxy.setDefaultCaptureDevice(this.type, event.detail.selected); | 60 this.browserProxy.setDefaultCaptureDevice( |
| 61 this.type, this.$.mediaPicker.value); |
| 56 }, | 62 }, |
| 57 }); | 63 }); |
| OLD | NEW |