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" | |
Mike West
2014/09/17 10:20:27
I think you can forward-declare this here, and onl
burnik
2014/09/17 11:17:20
Yes, actually in SpeechRecognitionClientProxy.cpp
| |
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; |
41 class SpeechRecognitionController; | 42 class SpeechRecognitionController; |
42 class SpeechRecognitionError; | 43 class SpeechRecognitionError; |
43 | 44 |
44 class SpeechRecognition FINAL : public RefCountedGarbageCollectedWillBeGarbageCo llectedFinalized<SpeechRecognition>, public ActiveDOMObject, public EventTargetW ithInlineData { | 45 class SpeechRecognition FINAL : public RefCountedGarbageCollectedWillBeGarbageCo llectedFinalized<SpeechRecognition>, public ActiveDOMObject, public EventTargetW ithInlineData { |
45 DEFINE_EVENT_TARGET_REFCOUNTING_WILL_BE_REMOVED(RefCountedGarbageCollected<S peechRecognition>); | 46 DEFINE_EVENT_TARGET_REFCOUNTING_WILL_BE_REMOVED(RefCountedGarbageCollected<S peechRecognition>); |
46 DEFINE_WRAPPERTYPEINFO(); | 47 DEFINE_WRAPPERTYPEINFO(); |
47 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(SpeechRecognition); | 48 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(SpeechRecognition); |
48 public: | 49 public: |
49 static SpeechRecognition* create(ExecutionContext*); | 50 static SpeechRecognition* create(ExecutionContext*); |
50 virtual ~SpeechRecognition(); | 51 virtual ~SpeechRecognition(); |
51 | 52 |
52 // Attributes. | 53 // Attributes. |
Mike West
2014/09/17 10:20:27
Nit: Can you change this to note that these are pu
burnik
2014/09/17 11:17:20
Not a bad idea. Although this affects other parts
| |
53 SpeechGrammarList* grammars() { return m_grammars; } | 54 SpeechGrammarList* grammars() { return m_grammars; } |
54 void setGrammars(SpeechGrammarList* grammars) { m_grammars = grammars; } | 55 void setGrammars(SpeechGrammarList* grammars) { m_grammars = grammars; } |
55 String lang() { return m_lang; } | 56 String lang() { return m_lang; } |
56 void setLang(const String& lang) { m_lang = lang; } | 57 void setLang(const String& lang) { m_lang = lang; } |
57 bool continuous() { return m_continuous; } | 58 bool continuous() { return m_continuous; } |
58 void setContinuous(bool continuous) { m_continuous = continuous; } | 59 void setContinuous(bool continuous) { m_continuous = continuous; } |
59 bool interimResults() { return m_interimResults; } | 60 bool interimResults() { return m_interimResults; } |
60 void setInterimResults(bool interimResults) { m_interimResults = interimResu lts; } | 61 void setInterimResults(bool interimResults) { m_interimResults = interimResu lts; } |
61 unsigned long maxAlternatives() { return m_maxAlternatives; } | 62 unsigned long maxAlternatives() { return m_maxAlternatives; } |
62 void setMaxAlternatives(unsigned long maxAlternatives) { m_maxAlternatives = maxAlternatives; } | 63 void setMaxAlternatives(unsigned long maxAlternatives) { m_maxAlternatives = maxAlternatives; } |
64 MediaStreamTrack* audioTrack() { return m_audioTrack; } | |
65 void setAudioTrack(MediaStreamTrack* audioTrack) { m_audioTrack = audioTrack ; } | |
63 | 66 |
64 // Callable by the user. | 67 // Callable by the user. |
65 void start(ExceptionState&); | 68 void start(ExceptionState&); |
66 void stopFunction(); | 69 void stopFunction(); |
67 void abort(); | 70 void abort(); |
68 | 71 |
69 // Called by the SpeechRecognitionClient. | 72 // Called by the SpeechRecognitionClient. |
70 void didStartAudio(); | 73 void didStartAudio(); |
71 void didStartSound(); | 74 void didStartSound(); |
72 void didStartSpeech(); | 75 void didStartSpeech(); |
(...skipping 25 matching lines...) Expand all Loading... | |
98 DEFINE_ATTRIBUTE_EVENT_LISTENER(error); | 101 DEFINE_ATTRIBUTE_EVENT_LISTENER(error); |
99 DEFINE_ATTRIBUTE_EVENT_LISTENER(start); | 102 DEFINE_ATTRIBUTE_EVENT_LISTENER(start); |
100 DEFINE_ATTRIBUTE_EVENT_LISTENER(end); | 103 DEFINE_ATTRIBUTE_EVENT_LISTENER(end); |
101 | 104 |
102 virtual void trace(Visitor*) OVERRIDE; | 105 virtual void trace(Visitor*) OVERRIDE; |
103 | 106 |
104 private: | 107 private: |
105 explicit SpeechRecognition(ExecutionContext*); | 108 explicit SpeechRecognition(ExecutionContext*); |
106 | 109 |
107 Member<SpeechGrammarList> m_grammars; | 110 Member<SpeechGrammarList> m_grammars; |
111 Member<MediaStreamTrack> m_audioTrack; | |
108 String m_lang; | 112 String m_lang; |
109 bool m_continuous; | 113 bool m_continuous; |
110 bool m_interimResults; | 114 bool m_interimResults; |
111 unsigned long m_maxAlternatives; | 115 unsigned long m_maxAlternatives; |
112 | 116 |
113 RawPtrWillBeMember<SpeechRecognitionController> m_controller; | 117 RawPtrWillBeMember<SpeechRecognitionController> m_controller; |
114 bool m_stoppedByActiveDOMObject; | 118 bool m_stoppedByActiveDOMObject; |
115 bool m_started; | 119 bool m_started; |
116 bool m_stopping; | 120 bool m_stopping; |
117 HeapVector<Member<SpeechRecognitionResult> > m_finalResults; | 121 HeapVector<Member<SpeechRecognitionResult> > m_finalResults; |
118 }; | 122 }; |
119 | 123 |
120 } // namespace blink | 124 } // namespace blink |
121 | 125 |
122 #endif // SpeechRecognition_h | 126 #endif // SpeechRecognition_h |
OLD | NEW |