OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 chrome.runtime.onMessageExternal.addListener( | 5 chrome.runtime.onMessageExternal.addListener( |
6 function(message, sender, sendResponse) { | 6 function(message, sender, sendResponse) { |
7 function doSendResponse(value, errorString) { | 7 function doSendResponse(value, errorString) { |
8 var error = null; | 8 var error = null; |
9 if (errorString) { | 9 if (errorString) { |
10 error = {}; | 10 error = {}; |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
195 return true; | 195 return true; |
196 } else if (method == 'logging.startWebRtcEventLogging') { | 196 } else if (method == 'logging.startWebRtcEventLogging') { |
197 var seconds = message['seconds'] || 0; | 197 var seconds = message['seconds'] || 0; |
198 chrome.webrtcLoggingPrivate.startWebRtcEventLogging( | 198 chrome.webrtcLoggingPrivate.startWebRtcEventLogging( |
199 requestInfo, origin, seconds, doSendResponse); | 199 requestInfo, origin, seconds, doSendResponse); |
200 return true; | 200 return true; |
201 } else if (method == 'logging.stopWebRtcEventLogging') { | 201 } else if (method == 'logging.stopWebRtcEventLogging') { |
202 chrome.webrtcLoggingPrivate.stopWebRtcEventLogging( | 202 chrome.webrtcLoggingPrivate.stopWebRtcEventLogging( |
203 requestInfo, origin, doSendResponse); | 203 requestInfo, origin, doSendResponse); |
204 return true; | 204 return true; |
205 } else if (method == 'setAudioExperiments') { | |
206 var experiments = message['experiments']; | |
207 chrome.webrtcAudioPrivate.setAudioExperiments( | |
208 requestInfo, origin, experiments); | |
mnilsson
2017/04/10 19:15:45
Why not embed the doSendResponse as a callback met
Henrik Grunell
2017/04/11 06:49:39
If the application needs to know exactly when it h
| |
209 doSendResponse(); | |
210 return false; | |
205 } | 211 } |
206 | 212 |
207 throw new Error('Unknown method: ' + method); | 213 throw new Error('Unknown method: ' + method); |
208 } catch (e) { | 214 } catch (e) { |
209 doSendResponse(null, e.name + ': ' + e.message); | 215 doSendResponse(null, e.name + ': ' + e.message); |
210 } | 216 } |
211 } | 217 } |
212 ); | 218 ); |
213 | 219 |
214 // If Hangouts connects with a port named 'onSinksChangedListener', we | 220 // If Hangouts connects with a port named 'onSinksChangedListener', we |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
320 onSinksChangedPort(port); | 326 onSinksChangedPort(port); |
321 } else if (port.name == 'chooseDesktopMedia') { | 327 } else if (port.name == 'chooseDesktopMedia') { |
322 onChooseDesktopMediaPort(port); | 328 onChooseDesktopMediaPort(port); |
323 } else if (port.name == 'processCpu') { | 329 } else if (port.name == 'processCpu') { |
324 onProcessCpu(port); | 330 onProcessCpu(port); |
325 } else { | 331 } else { |
326 // Unknown port type. | 332 // Unknown port type. |
327 port.disconnect(); | 333 port.disconnect(); |
328 } | 334 } |
329 }); | 335 }); |
OLD | NEW |