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 // 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.
11 // For an FYI, visit http://goo.gl/AyHbkH
13 [nodoc
] namespace hotwordPrivate
{
15 dictionary StatusDetails
{
16 // Whether the hotword preference has been set.
19 // If the hotword extension is enabled. Will always be false if |available|
23 // Whether the hotword extension is available to be enabled
26 // Whether the sound of "Ok, Google" plus a few seconds before is sent
28 boolean audioLoggingEnabled
;
31 // The type of the recognized hotword. Right now it only has 'search' but
32 // could be expanded to other types of actions in the future.
33 enum HotwordType
{ search
};
35 callback GenericDoneCallback
= void ();
36 callback StatusDetailsCallback
= void(StatusDetails result
);
39 // Sets the current enabled state of hotword search.
40 // True: enable hotword search. False: disable hotword search.
41 static
void setEnabled
(boolean state
,
42 optional GenericDoneCallback
callback);
44 // Retrieves the current state of hotword search.
45 // The result is put into a StatusDetails object.
46 static
void getStatus
(StatusDetailsCallback
callback);
48 // Sets the current enabled state of audio logging in the extension.
49 // True: logging enabled. False: no logging.
50 static
void setAudioLoggingEnabled
(boolean state
,
51 optional GenericDoneCallback
callback);
53 // Sets the current state of the browser-requested hotword session.
54 static
void setHotwordSessionState
(boolean started
,
55 optional GenericDoneCallback
callback);
57 // Notifies that a hotword has been recognized in the browser-requested
59 static
void notifyHotwordRecognition
(HotwordType type
,
60 optional GenericDoneCallback
callback);
64 // Fired when the hotword search enabled preference is changed.
65 static
void onEnabledChanged
();
67 // Fired when the browser wants to start a hotword session.
68 static
void onHotwordSessionRequested
();
70 // Fired when the browser wants to stop the requested hotword session.
71 static
void onHotwordSessionStopped
();