OLD | NEW |
| (Empty) |
1 // Copyright 2014 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 // Use the <code>chrome.copresencePrivate</code> API to interface with Chrome | |
6 // from the whispernet_proxy extension. | |
7 namespace copresencePrivate { | |
8 dictionary Token { | |
9 DOMString token; | |
10 boolean audible; | |
11 }; | |
12 | |
13 dictionary TokenParameters { | |
14 long length; | |
15 boolean crc; | |
16 boolean parity; | |
17 }; | |
18 | |
19 dictionary DecodeSamplesParameters { | |
20 ArrayBuffer samples; | |
21 | |
22 boolean decodeAudible; | |
23 boolean decodeInaudible; | |
24 | |
25 TokenParameters audibleTokenParams; | |
26 TokenParameters inaudibleTokenParams; | |
27 }; | |
28 | |
29 dictionary EncodeTokenParameters { | |
30 Token token; | |
31 long repetitions; | |
32 TokenParameters tokenParams; | |
33 }; | |
34 | |
35 dictionary AudioParameters { | |
36 // This string contains marshalling of a custom parameters structure | |
37 // that Chrome and the Whispernet wrapper both know about. These are | |
38 // based off //components/copresence/proto/config_data.proto. | |
39 ArrayBuffer paramData; | |
40 }; | |
41 | |
42 interface Functions { | |
43 // Send a boolean indicating whether our initialization was successful. | |
44 static void sendInitialized(boolean success); | |
45 | |
46 // Sends an array of found tokens to Chrome. | |
47 static void sendFound(DOMString clientId, Token[] tokens); | |
48 | |
49 // Send an array buffer of samples encoded for the specified token. | |
50 static void sendSamples(DOMString clientId, | |
51 Token token, | |
52 ArrayBuffer samples); | |
53 }; | |
54 | |
55 interface Events { | |
56 // Fired to request audio configuration of the whisper.net library. | |
57 static void onConfigAudio(DOMString clientId, AudioParameters audioParams); | |
58 | |
59 // Fired to request encoding of the given token. | |
60 static void onEncodeTokenRequest(DOMString clientId, | |
61 EncodeTokenParameters encodeParams); | |
62 | |
63 // Fired when we have new samples to decode. | |
64 static void onDecodeSamplesRequest(DOMString clientId, | |
65 DecodeSamplesParameters decodeParams); | |
66 }; | |
67 }; | |
OLD | NEW |