OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * * Redistributions of source code must retain the above copyright | 7 * * Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * * Redistributions in binary form must reproduce the above copyright | 9 * * Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 10 matching lines...) Expand all Loading... |
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
24 */ | 24 */ |
25 | 25 |
26 #ifndef SpeechRecognition_h | 26 #ifndef SpeechRecognition_h |
27 #define SpeechRecognition_h | 27 #define SpeechRecognition_h |
28 | 28 |
29 #include "core/dom/ActiveDOMObject.h" | 29 #include "core/dom/ActiveDOMObject.h" |
30 #include "modules/EventTargetModules.h" | 30 #include "modules/EventTargetModules.h" |
| 31 #include "modules/mediastream/MediaStreamTrack.h" |
31 #include "modules/speech/SpeechGrammarList.h" | 32 #include "modules/speech/SpeechGrammarList.h" |
32 #include "modules/speech/SpeechRecognitionResult.h" | 33 #include "modules/speech/SpeechRecognitionResult.h" |
33 #include "platform/heap/Handle.h" | 34 #include "platform/heap/Handle.h" |
34 #include "wtf/Compiler.h" | 35 #include "wtf/Compiler.h" |
35 #include "wtf/text/WTFString.h" | 36 #include "wtf/text/WTFString.h" |
36 | 37 |
37 namespace blink { | 38 namespace blink { |
38 | 39 |
39 class ExceptionState; | 40 class ExceptionState; |
40 class ExecutionContext; | 41 class ExecutionContext; |
(...skipping 11 matching lines...) Expand all Loading... |
52 SpeechGrammarList* grammars() { return m_grammars; } | 53 SpeechGrammarList* grammars() { return m_grammars; } |
53 void setGrammars(SpeechGrammarList* grammars) { m_grammars = grammars; } | 54 void setGrammars(SpeechGrammarList* grammars) { m_grammars = grammars; } |
54 String lang() { return m_lang; } | 55 String lang() { return m_lang; } |
55 void setLang(const String& lang) { m_lang = lang; } | 56 void setLang(const String& lang) { m_lang = lang; } |
56 bool continuous() { return m_continuous; } | 57 bool continuous() { return m_continuous; } |
57 void setContinuous(bool continuous) { m_continuous = continuous; } | 58 void setContinuous(bool continuous) { m_continuous = continuous; } |
58 bool interimResults() { return m_interimResults; } | 59 bool interimResults() { return m_interimResults; } |
59 void setInterimResults(bool interimResults) { m_interimResults = interimResu
lts; } | 60 void setInterimResults(bool interimResults) { m_interimResults = interimResu
lts; } |
60 unsigned long maxAlternatives() { return m_maxAlternatives; } | 61 unsigned long maxAlternatives() { return m_maxAlternatives; } |
61 void setMaxAlternatives(unsigned long maxAlternatives) { m_maxAlternatives =
maxAlternatives; } | 62 void setMaxAlternatives(unsigned long maxAlternatives) { m_maxAlternatives =
maxAlternatives; } |
| 63 MediaStreamTrack* audioTrack() { return m_audioTrack; } |
| 64 void setAudioTrack(MediaStreamTrack* audioTrack) { m_audioTrack = audioTrack
; } |
62 | 65 |
63 // Callable by the user. | 66 // Callable by the user. |
64 void start(ExceptionState&); | 67 void start(ExceptionState&); |
65 void stopFunction(); | 68 void stopFunction(); |
66 void abort(); | 69 void abort(); |
67 | 70 |
68 // Called by the SpeechRecognitionClient. | 71 // Called by the SpeechRecognitionClient. |
69 void didStartAudio(); | 72 void didStartAudio(); |
70 void didStartSound(); | 73 void didStartSound(); |
71 void didStartSpeech(); | 74 void didStartSpeech(); |
(...skipping 25 matching lines...) Expand all Loading... |
97 DEFINE_ATTRIBUTE_EVENT_LISTENER(error); | 100 DEFINE_ATTRIBUTE_EVENT_LISTENER(error); |
98 DEFINE_ATTRIBUTE_EVENT_LISTENER(start); | 101 DEFINE_ATTRIBUTE_EVENT_LISTENER(start); |
99 DEFINE_ATTRIBUTE_EVENT_LISTENER(end); | 102 DEFINE_ATTRIBUTE_EVENT_LISTENER(end); |
100 | 103 |
101 virtual void trace(Visitor*) OVERRIDE; | 104 virtual void trace(Visitor*) OVERRIDE; |
102 | 105 |
103 private: | 106 private: |
104 explicit SpeechRecognition(ExecutionContext*); | 107 explicit SpeechRecognition(ExecutionContext*); |
105 | 108 |
106 Member<SpeechGrammarList> m_grammars; | 109 Member<SpeechGrammarList> m_grammars; |
| 110 Member<MediaStreamTrack> m_audioTrack; |
107 String m_lang; | 111 String m_lang; |
108 bool m_continuous; | 112 bool m_continuous; |
109 bool m_interimResults; | 113 bool m_interimResults; |
110 unsigned long m_maxAlternatives; | 114 unsigned long m_maxAlternatives; |
111 | 115 |
112 RawPtrWillBeMember<SpeechRecognitionController> m_controller; | 116 RawPtrWillBeMember<SpeechRecognitionController> m_controller; |
113 bool m_stoppedByActiveDOMObject; | 117 bool m_stoppedByActiveDOMObject; |
114 bool m_started; | 118 bool m_started; |
115 bool m_stopping; | 119 bool m_stopping; |
116 HeapVector<Member<SpeechRecognitionResult> > m_finalResults; | 120 HeapVector<Member<SpeechRecognitionResult> > m_finalResults; |
117 }; | 121 }; |
118 | 122 |
119 } // namespace blink | 123 } // namespace blink |
120 | 124 |
121 #endif // SpeechRecognition_h | 125 #endif // SpeechRecognition_h |
OLD | NEW |