a9a4fc235e32b2311a59e2c54d6f85fff7915da4
[platform/framework/web/crosswalk.git] / src / chrome / common / extensions / api / hotword_private.idl
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 // The <code>chrome.hotwordPrivate</code> API allows extensions to access and
6 // mutate the preference for enabling hotword search. It also provides
7 // information on whether the hotword search is available. This API provides an
8 // event interface to transmit to the extension a signal that the preference fo
9 // hotword search has change.
10 //
11 // For an FYI, visit http://goo.gl/AyHbkH
12
13 [nodoc] namespace hotwordPrivate {
14
15   dictionary StatusDetails {
16     // Whether the hotword preference has been set.
17     boolean enabledSet;
18
19     // If the hotword extension is enabled. Will always be false if |available|
20     // is false.
21     boolean enabled;
22
23     // Whether the hotword extension is available to be enabled
24     boolean available;
25
26     // Whether the sound of "Ok, Google" plus a few seconds before is sent
27     // back to Google.
28     boolean audioLoggingEnabled;
29
30     // Whether experimental hotwording functionality is enabled. Mirrors the
31     // "enable-experimental-hotwording" flag.
32     boolean experimentalHotwordEnabled;
33   };
34
35   // The type of the recognized hotword. Right now it only has 'search' but
36   // could be expanded to other types of actions in the future.
37   enum HotwordType { search };
38
39   callback GenericDoneCallback = void ();
40   callback StatusDetailsCallback = void(StatusDetails result);
41
42   interface Functions {
43     // Sets the current enabled state of hotword search.
44     // True: enable hotword search. False: disable hotword search.
45     static void setEnabled(boolean state,
46                            optional GenericDoneCallback callback);
47
48     // Retrieves the current state of hotword search.
49     // The result is put into a StatusDetails object.
50     static void getStatus(StatusDetailsCallback callback);
51
52     // Sets the current enabled state of audio logging in the extension.
53     // True: logging enabled. False: no logging.
54     static void setAudioLoggingEnabled(boolean state,
55                                        optional GenericDoneCallback callback);
56
57     // Sets the current state of the browser-requested hotword session.
58     static void setHotwordSessionState(boolean started,
59                                        optional GenericDoneCallback callback);
60
61     // Notifies that a hotword has been recognized in the browser-requested
62     // hotword session.
63     static void notifyHotwordRecognition(HotwordType type,
64                                          optional GenericDoneCallback callback);
65   };
66
67   interface Events {
68     // Fired when the hotword search enabled preference is changed.
69     static void onEnabledChanged();
70
71     // Fired when the browser wants to start a hotword session.
72     static void onHotwordSessionRequested();
73
74     // Fired when the browser wants to stop the requested hotword session.
75     static void onHotwordSessionStopped();
76   };
77 };