OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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.hotwordPrivate</code> API allows extensions to access and | 5 // The <code>chrome.hotwordPrivate</code> API allows extensions to access and |
6 // mutate the preference for enabling hotword search. It also provides | 6 // mutate the preference for enabling hotword search. It also provides |
7 // information on whether the hotword search is available. This API provides an | 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 | 8 // event interface to transmit to the extension a signal that the preference fo |
9 // hotword search has change. | 9 // hotword search has change. |
10 // | 10 // |
(...skipping 17 matching lines...) Expand all Loading... |
28 boolean audioLoggingEnabled; | 28 boolean audioLoggingEnabled; |
29 | 29 |
30 // Whether experimental hotwording functionality is enabled. Mirrors the | 30 // Whether experimental hotwording functionality is enabled. Mirrors the |
31 // "enable-experimental-hotwording" flag. | 31 // "enable-experimental-hotwording" flag. |
32 boolean experimentalHotwordEnabled; | 32 boolean experimentalHotwordEnabled; |
33 | 33 |
34 // Whether always-on hotwording is enabled. | 34 // Whether always-on hotwording is enabled. |
35 boolean alwaysOnEnabled; | 35 boolean alwaysOnEnabled; |
36 }; | 36 }; |
37 | 37 |
| 38 dictionary LaunchState { |
| 39 // TODO(kcarattini): Consider adding more variables here, |
| 40 // such as the available state of the hotword service. |
| 41 |
| 42 // The mode that the Hotword Audio Verification app was launched in. |
| 43 long launchMode; |
| 44 }; |
| 45 |
| 46 |
38 // The type of the recognized hotword. Right now it only has 'search' but | 47 // The type of the recognized hotword. Right now it only has 'search' but |
39 // could be expanded to other types of actions in the future. | 48 // could be expanded to other types of actions in the future. |
40 enum HotwordType { search }; | 49 enum HotwordType { search }; |
41 | 50 |
42 callback GenericDoneCallback = void (); | 51 callback GenericDoneCallback = void (); |
| 52 callback LaunchStateCallback = void(LaunchState result); |
43 callback StatusDetailsCallback = void(StatusDetails result); | 53 callback StatusDetailsCallback = void(StatusDetails result); |
44 | 54 |
45 interface Functions { | 55 interface Functions { |
46 // Sets the current enabled state of hotword search. | 56 // Sets the current enabled state of hotword search. |
47 // True: enable hotword search. False: disable hotword search. | 57 // True: enable hotword search. False: disable hotword search. |
48 static void setEnabled(boolean state, | 58 static void setEnabled(boolean state, |
49 optional GenericDoneCallback callback); | 59 optional GenericDoneCallback callback); |
50 | 60 |
51 // Retrieves the current state of hotword search. | 61 // Retrieves the current state of hotword search. |
52 // The result is put into a StatusDetails object. | 62 // The result is put into a StatusDetails object. |
53 static void getStatus(StatusDetailsCallback callback); | 63 static void getStatus(StatusDetailsCallback callback); |
54 | 64 |
55 // Sets the current enabled state of audio logging in the extension. | 65 // Sets the current enabled state of audio logging in the extension. |
56 // True: logging enabled. False: no logging. | 66 // True: logging enabled. False: no logging. |
57 static void setAudioLoggingEnabled(boolean state, | 67 static void setAudioLoggingEnabled(boolean state, |
58 optional GenericDoneCallback callback); | 68 optional GenericDoneCallback callback); |
59 | 69 |
60 // Sets the current state of the browser-requested hotword session. | 70 // Sets the current state of the browser-requested hotword session. |
61 static void setHotwordSessionState(boolean started, | 71 static void setHotwordSessionState(boolean started, |
62 optional GenericDoneCallback callback); | 72 optional GenericDoneCallback callback); |
63 | 73 |
64 // Notifies that a hotword has been recognized in the browser-requested | 74 // Notifies that a hotword has been recognized in the browser-requested |
65 // hotword session. | 75 // hotword session. |
66 static void notifyHotwordRecognition(HotwordType type, | 76 static void notifyHotwordRecognition(HotwordType type, |
67 optional GenericDoneCallback callback); | 77 optional GenericDoneCallback callback); |
| 78 |
| 79 // Retrieves the state that the Hotword Audio Verification app was |
| 80 // launched in. The result is put into a LaunchState object. |
| 81 static void getLaunchState(LaunchStateCallback callback); |
68 }; | 82 }; |
69 | 83 |
70 interface Events { | 84 interface Events { |
71 // Fired when the hotword search enabled preference is changed. | 85 // Fired when the hotword search enabled preference is changed. |
72 static void onEnabledChanged(); | 86 static void onEnabledChanged(); |
73 | 87 |
74 // Fired when the browser wants to start a hotword session. | 88 // Fired when the browser wants to start a hotword session. |
75 static void onHotwordSessionRequested(); | 89 static void onHotwordSessionRequested(); |
76 | 90 |
77 // Fired when the browser wants to stop the requested hotword session. | 91 // Fired when the browser wants to stop the requested hotword session. |
78 static void onHotwordSessionStopped(); | 92 static void onHotwordSessionStopped(); |
79 }; | 93 }; |
80 }; | 94 }; |
OLD | NEW |