| 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 // The <code>chrome.webrtcAudioPrivate</code> API allows enumeration | 5 // The <code>chrome.webrtcAudioPrivate</code> API allows enumeration |
| 6 // of audio output (sink) devices as well as getting and setting the | 6 // of audio output (sink) devices as well as getting and setting the |
| 7 // active device for a given tab. | 7 // active device for a given requesting process. |
| 8 // | 8 // |
| 9 // Note that device IDs as used in this API are opaque (i.e. they are | 9 // Note that device IDs as used in this API are opaque (i.e. they are |
| 10 // not the hardware identifier of the device) and while they are | 10 // not the hardware identifier of the device) and while they are |
| 11 // unique and persistent across sessions, they are valid only to the | 11 // unique and persistent across sessions, they are valid only to the |
| 12 // extension calling this API (i.e. they cannot be shared between | 12 // extension calling this API (i.e. they cannot be shared between |
| 13 // extensions). | 13 // extensions). |
| 14 // | 14 // |
| 15 // See http://goo.gl/8rOmgk for further documentation of this API. | 15 // See http://goo.gl/8rOmgk for further documentation of this API. |
| 16 | 16 |
| 17 namespace webrtcAudioPrivate { | 17 namespace webrtcAudioPrivate { |
| (...skipping 16 matching lines...) Expand all Loading... |
| 34 boolean isReady; | 34 boolean isReady; |
| 35 // True if this device is the default audio sink device on the | 35 // True if this device is the default audio sink device on the |
| 36 // machine. | 36 // machine. |
| 37 boolean isDefault; | 37 boolean isDefault; |
| 38 }; | 38 }; |
| 39 | 39 |
| 40 callback GetSinksCallback = void(SinkInfo[] sinkInfo); | 40 callback GetSinksCallback = void(SinkInfo[] sinkInfo); |
| 41 callback SinkIdCallback = void(DOMString sinkId); | 41 callback SinkIdCallback = void(DOMString sinkId); |
| 42 callback CompletionCallback = void(); | 42 callback CompletionCallback = void(); |
| 43 | 43 |
| 44 dictionary RequestInfo { |
| 45 // The tab identifier from the chrome.tabs API, if the request is from a |
| 46 // tab. |
| 47 long? tabId; |
| 48 // The guest process id for the requester, if the request is from a |
| 49 // webview. |
| 50 long? guestProcessId; |
| 51 }; |
| 52 |
| 44 interface Functions { | 53 interface Functions { |
| 45 // Retrieves a list of available audio sink devices. | 54 // Retrieves a list of available audio sink devices. |
| 46 static void getSinks(GetSinksCallback callback); | 55 static void getSinks(GetSinksCallback callback); |
| 47 | 56 |
| 48 // Retrieves the currently active audio sink for the given tab. | 57 // Retrieves the currently active audio sink for the given requesting |
| 49 static void getActiveSink(long tabId, | 58 // process. |
| 59 static void getActiveSink(RequestInfo request, |
| 50 SinkIdCallback callback); | 60 SinkIdCallback callback); |
| 51 | 61 |
| 52 // Sets the active audio sink device for the specified tab. | 62 // Sets the active audio sink device for the specified requesting process. |
| 53 static void setActiveSink(long tabId, | 63 static void setActiveSink(RequestInfo request, |
| 54 DOMString sinkId, | 64 DOMString sinkId, |
| 55 optional CompletionCallback callback); | 65 optional CompletionCallback callback); |
| 56 | 66 |
| 57 // Given a security origin and an input device ID valid for that | 67 // Given a security origin and an input device ID valid for that |
| 58 // security origin, retrieve an audio sink ID valid for the | 68 // security origin, retrieve an audio sink ID valid for the |
| 59 // extension, or the empty string if there is no associated audio | 69 // extension, or the empty string if there is no associated audio |
| 60 // sink. | 70 // sink. |
| 61 // | 71 // |
| 62 // The associated sink ID can be used as a sink ID for | 72 // The associated sink ID can be used as a sink ID for |
| 63 // setActiveSink. It is valid irrespective of which tab you are | 73 // setActiveSink. It is valid irrespective of which process you are |
| 64 // setting the active sink for. | 74 // setting the active sink for. |
| 65 static void getAssociatedSink(DOMString securityOrigin, | 75 static void getAssociatedSink(DOMString securityOrigin, |
| 66 DOMString sourceIdInOrigin, | 76 DOMString sourceIdInOrigin, |
| 67 SinkIdCallback cb); | 77 SinkIdCallback cb); |
| 68 }; | 78 }; |
| 69 | 79 |
| 70 interface Events { | 80 interface Events { |
| 71 // Fired when audio sink devices are added or removed. | 81 // Fired when audio sink devices are added or removed. |
| 72 static void onSinksChanged(); | 82 static void onSinksChanged(); |
| 73 }; | 83 }; |
| 74 }; | 84 }; |
| OLD | NEW |