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

Side by Side Diff: chrome/browser/resources/settings/site_settings/media_picker.js

Issue 2039833004: Site Settings Desktop: Implement media picker for camera/mic categories. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address feedback Created 4 years, 6 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 /**
6 * @fileoverview
7 * 'media-picker' handles showing the dropdown allowing users to select the
8 * default camera/microphone.
9 */
10 Polymer({
11 is: 'media-picker',
12
13 behaviors: [SiteSettingsBehavior, WebUIListenerBehavior],
14
15 properties: {
16 /**
17 * The type of media picker, either 'camera' or 'mic'.
18 */
19 type: String,
20
21 /**
22 * The devices available to pick from.
23 * @type {Array<MediaPickerEntry>}
24 */
25 devices: Array,
26 },
27
28 ready: function() {
29 this.addWebUIListener('updateDevicesMenu',
30 this.updateDevicesMenu_.bind(this));
31 this.browserProxy.getDefaultCaptureDevices(this.type);
32 },
33
34 /**
35 * Updates the microphone/camera devices menu with the given entries.
36 * @param {string} type The device type.
37 * @param {!Array<MediaPickerEntry>} devices List of available devices.
38 * @param {string} defaultDevice The unique id of the current default device.
39 */
40 updateDevicesMenu_: function(type, devices, defaultDevice) {
41 if (type != this.type)
42 return;
43
44 this.$.picker.hidden = devices.length == 0;
45 if (devices.length > 0) {
46 this.devices = devices;
47 this.$.mediaPicker.selected = defaultDevice;
48 }
49 },
50
51 /**
52 * A handler for when an item is selected in the media picker.
53 */
54 onMediaPickerActivate_: function(event) {
55 this.browserProxy.setDefaultCaptureDevice(this.type, event.detail.selected);
56 },
57 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698