Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / chrome / common / extensions / api / copresence_private.idl
blob6db3420a9fc97e5441f205fe305e6e223ec25fd4
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.
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;
13 dictionary TokenParameters {
14 long length;
15 boolean crc;
16 boolean parity;
19 dictionary DecodeSamplesParameters {
20 ArrayBuffer samples;
22 boolean decodeAudible;
23 boolean decodeInaudible;
25 TokenParameters audibleTokenParams;
26 TokenParameters inaudibleTokenParams;
29 dictionary EncodeTokenParameters {
30 Token token;
31 long repetitions;
32 TokenParameters tokenParams;
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;
42 interface Functions {
43 // Send a boolean indicating whether our initialization was successful.
44 static void sendInitialized(boolean success);
46 // Sends an array of found tokens to Chrome.
47 static void sendFound(DOMString clientId, Token[] tokens);
49 // Send an array buffer of samples encoded for the specified token.
50 static void sendSamples(DOMString clientId,
51 Token token,
52 ArrayBuffer samples);
55 interface Events {
56 // Fired to request audio configuration of the whisper.net library.
57 static void onConfigAudio(DOMString clientId, AudioParameters audioParams);
59 // Fired to request encoding of the given token.
60 static void onEncodeTokenRequest(DOMString clientId,
61 EncodeTokenParameters encodeParams);
63 // Fired when we have new samples to decode.
64 static void onDecodeSamplesRequest(DOMString clientId,
65 DecodeSamplesParameters decodeParams);