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

Side by Side Diff: chrome/browser/resources/chromeos/emulator/audio_settings.js

Issue 2958193002: Device emulator: Replace usage of paper-dialog with cr-dialog. (Closed)
Patch Set: Created 3 years, 5 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
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 /** @enum {string} */ var AudioNodeType = { 5 /** @enum {string} */ var AudioNodeType = {
6 HEADPHONE: 'HEADPHONE', 6 HEADPHONE: 'HEADPHONE',
7 MIC: 'MIC', 7 MIC: 'MIC',
8 USB: 'USB', 8 USB: 'USB',
9 BLUETOOTH: 'BLUETOOTH', 9 BLUETOOTH: 'BLUETOOTH',
10 HDMI: 'HDMI', 10 HDMI: 'HDMI',
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 * This adds/modifies the audio node |nodes[currentEditIndex]| to/from the 153 * This adds/modifies the audio node |nodes[currentEditIndex]| to/from the
154 * AudioNodeList. 154 * AudioNodeList.
155 * @param {model: {index: number}} e Event with a model containing 155 * @param {model: {index: number}} e Event with a model containing
156 * the index in |nodes| to add. 156 * the index in |nodes| to add.
157 */ 157 */
158 insertEditedAudioNode: function(e) { 158 insertEditedAudioNode: function(e) {
159 // Insert a new node or update an existing node using all the properties 159 // Insert a new node or update an existing node using all the properties
160 // in |node|. 160 // in |node|.
161 var node = this.nodes[this.currentEditIndex]; 161 var node = this.nodes[this.currentEditIndex];
162 chrome.send('insertAudioNode', [node]); 162 chrome.send('insertAudioNode', [node]);
163 this.$.editDialog.close();
163 }, 164 },
164 165
165 /** 166 /**
166 * Removes the audio node with id |id|. 167 * Removes the audio node with id |id|.
167 * @param {model: {index: number}} e Event with a model containing 168 * @param {model: {index: number}} e Event with a model containing
168 * the index in |nodes| to add. 169 * the index in |nodes| to add.
169 */ 170 */
170 removeAudioNode: function(e) { 171 removeAudioNode: function(e) {
171 var info = this.nodes[e.model.index]; 172 var info = this.nodes[e.model.index];
172 chrome.send('removeAudioNode', [info.id]); 173 chrome.send('removeAudioNode', [info.id]);
(...skipping 19 matching lines...) Expand all
192 193
193 /** 194 /**
194 * Shows a dialog to edit the selected node's properties. 195 * Shows a dialog to edit the selected node's properties.
195 * @param {Event} event Contains event data. |event.model.index| is the index 196 * @param {Event} event Contains event data. |event.model.index| is the index
196 * of the item which the target is contained in. 197 * of the item which the target is contained in.
197 */ 198 */
198 showEditDialog: function(event) { 199 showEditDialog: function(event) {
199 var index = event.model.index; 200 var index = event.model.index;
200 this.currentEditIndex = index; 201 this.currentEditIndex = index;
201 this.currentEditableObject = this.nodes[index]; 202 this.currentEditableObject = this.nodes[index];
202 this.$.editDialog.toggle(); 203 this.$.editDialog.showModal();
203 }, 204 },
204 205
205 /** 206 /**
206 * Called by the WebUI which provides a list of nodes. 207 * Called by the WebUI which provides a list of nodes.
207 * @param {!Array<!AudioNode>} nodeList A list of audio nodes. 208 * @param {!Array<!AudioNode>} nodeList A list of audio nodes.
208 */ 209 */
209 updateAudioNodes: function(nodeList) { 210 updateAudioNodes: function(nodeList) {
210 /** @type {!Array<!AudioNode>} */ var newNodeList = []; 211 /** @type {!Array<!AudioNode>} */ var newNodeList = [];
211 for (var i = 0; i < nodeList.length; ++i) { 212 for (var i = 0; i < nodeList.length; ++i) {
212 // Create a new audio node and add all the properties from |nodeList[i]|. 213 // Create a new audio node and add all the properties from |nodeList[i]|.
213 var node = new AudioNode(); 214 var node = new AudioNode();
214 Object.assign(node, nodeList[i]); 215 Object.assign(node, nodeList[i]);
215 newNodeList.push(node); 216 newNodeList.push(node);
216 } 217 }
217 this.nodes = newNodeList; 218 this.nodes = newNodeList;
218 } 219 }
219 }); 220 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698