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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 class MediaStreamTrack; | 44 class MediaStreamTrack; |
45 class SpeechRecognitionController; | 45 class SpeechRecognitionController; |
46 class SpeechRecognitionError; | 46 class SpeechRecognitionError; |
47 | 47 |
48 class MODULES_EXPORT SpeechRecognition final : public RefCountedGarbageCollected
EventTargetWithInlineData<SpeechRecognition>, public PageLifecycleObserver, publ
ic ActiveDOMObject { | 48 class MODULES_EXPORT SpeechRecognition final : public RefCountedGarbageCollected
EventTargetWithInlineData<SpeechRecognition>, public PageLifecycleObserver, publ
ic ActiveDOMObject { |
49 REFCOUNTED_GARBAGE_COLLECTED_EVENT_TARGET(SpeechRecognition); | 49 REFCOUNTED_GARBAGE_COLLECTED_EVENT_TARGET(SpeechRecognition); |
50 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(SpeechRecognition); | 50 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(SpeechRecognition); |
51 DEFINE_WRAPPERTYPEINFO(); | 51 DEFINE_WRAPPERTYPEINFO(); |
52 public: | 52 public: |
53 static SpeechRecognition* create(ExecutionContext*); | 53 static SpeechRecognition* create(ExecutionContext*); |
54 virtual ~SpeechRecognition(); | 54 ~SpeechRecognition() override; |
55 | 55 |
56 // SpeechRecognition.idl implemementation. | 56 // SpeechRecognition.idl implemementation. |
57 // Attributes. | 57 // Attributes. |
58 SpeechGrammarList* grammars() { return m_grammars; } | 58 SpeechGrammarList* grammars() { return m_grammars; } |
59 void setGrammars(SpeechGrammarList* grammars) { m_grammars = grammars; } | 59 void setGrammars(SpeechGrammarList* grammars) { m_grammars = grammars; } |
60 String lang() { return m_lang; } | 60 String lang() { return m_lang; } |
61 void setLang(const String& lang) { m_lang = lang; } | 61 void setLang(const String& lang) { m_lang = lang; } |
62 String serviceURI() { return m_serviceURI; } | 62 String serviceURI() { return m_serviceURI; } |
63 void setServiceURI(const String& serviceURI) { m_serviceURI = serviceURI; } | 63 void setServiceURI(const String& serviceURI) { m_serviceURI = serviceURI; } |
64 bool continuous() { return m_continuous; } | 64 bool continuous() { return m_continuous; } |
(...skipping 17 matching lines...) Expand all Loading... |
82 void didEndSpeech(); | 82 void didEndSpeech(); |
83 void didEndSound(); | 83 void didEndSound(); |
84 void didEndAudio(); | 84 void didEndAudio(); |
85 void didReceiveResults(const HeapVector<Member<SpeechRecognitionResult>>& ne
wFinalResults, const HeapVector<Member<SpeechRecognitionResult>>& currentInterim
Results); | 85 void didReceiveResults(const HeapVector<Member<SpeechRecognitionResult>>& ne
wFinalResults, const HeapVector<Member<SpeechRecognitionResult>>& currentInterim
Results); |
86 void didReceiveNoMatch(SpeechRecognitionResult*); | 86 void didReceiveNoMatch(SpeechRecognitionResult*); |
87 void didReceiveError(PassRefPtrWillBeRawPtr<SpeechRecognitionError>); | 87 void didReceiveError(PassRefPtrWillBeRawPtr<SpeechRecognitionError>); |
88 void didStart(); | 88 void didStart(); |
89 void didEnd(); | 89 void didEnd(); |
90 | 90 |
91 // EventTarget. | 91 // EventTarget. |
92 virtual const AtomicString& interfaceName() const override; | 92 const AtomicString& interfaceName() const override; |
93 virtual ExecutionContext* executionContext() const override; | 93 ExecutionContext* executionContext() const override; |
94 | 94 |
95 // ActiveDOMObject. | 95 // ActiveDOMObject. |
96 virtual bool hasPendingActivity() const override; | 96 bool hasPendingActivity() const override; |
97 virtual void stop() override; | 97 void stop() override; |
98 | 98 |
99 DEFINE_ATTRIBUTE_EVENT_LISTENER(audiostart); | 99 DEFINE_ATTRIBUTE_EVENT_LISTENER(audiostart); |
100 DEFINE_ATTRIBUTE_EVENT_LISTENER(soundstart); | 100 DEFINE_ATTRIBUTE_EVENT_LISTENER(soundstart); |
101 DEFINE_ATTRIBUTE_EVENT_LISTENER(speechstart); | 101 DEFINE_ATTRIBUTE_EVENT_LISTENER(speechstart); |
102 DEFINE_ATTRIBUTE_EVENT_LISTENER(speechend); | 102 DEFINE_ATTRIBUTE_EVENT_LISTENER(speechend); |
103 DEFINE_ATTRIBUTE_EVENT_LISTENER(soundend); | 103 DEFINE_ATTRIBUTE_EVENT_LISTENER(soundend); |
104 DEFINE_ATTRIBUTE_EVENT_LISTENER(audioend); | 104 DEFINE_ATTRIBUTE_EVENT_LISTENER(audioend); |
105 DEFINE_ATTRIBUTE_EVENT_LISTENER(result); | 105 DEFINE_ATTRIBUTE_EVENT_LISTENER(result); |
106 DEFINE_ATTRIBUTE_EVENT_LISTENER(nomatch); | 106 DEFINE_ATTRIBUTE_EVENT_LISTENER(nomatch); |
107 DEFINE_ATTRIBUTE_EVENT_LISTENER(error); | 107 DEFINE_ATTRIBUTE_EVENT_LISTENER(error); |
108 DEFINE_ATTRIBUTE_EVENT_LISTENER(start); | 108 DEFINE_ATTRIBUTE_EVENT_LISTENER(start); |
109 DEFINE_ATTRIBUTE_EVENT_LISTENER(end); | 109 DEFINE_ATTRIBUTE_EVENT_LISTENER(end); |
110 | 110 |
111 DECLARE_VIRTUAL_TRACE(); | 111 DECLARE_VIRTUAL_TRACE(); |
112 | 112 |
113 // PageLifecycleObserver | 113 // PageLifecycleObserver |
114 virtual void contextDestroyed() override; | 114 void contextDestroyed() override; |
115 | 115 |
116 private: | 116 private: |
117 SpeechRecognition(Page*, ExecutionContext*); | 117 SpeechRecognition(Page*, ExecutionContext*); |
118 | 118 |
119 Member<SpeechGrammarList> m_grammars; | 119 Member<SpeechGrammarList> m_grammars; |
120 Member<MediaStreamTrack> m_audioTrack; | 120 Member<MediaStreamTrack> m_audioTrack; |
121 String m_lang; | 121 String m_lang; |
122 String m_serviceURI; | 122 String m_serviceURI; |
123 bool m_continuous; | 123 bool m_continuous; |
124 bool m_interimResults; | 124 bool m_interimResults; |
125 unsigned long m_maxAlternatives; | 125 unsigned long m_maxAlternatives; |
126 | 126 |
127 RawPtrWillBeMember<SpeechRecognitionController> m_controller; | 127 RawPtrWillBeMember<SpeechRecognitionController> m_controller; |
128 bool m_stoppedByActiveDOMObject; | 128 bool m_stoppedByActiveDOMObject; |
129 bool m_started; | 129 bool m_started; |
130 bool m_stopping; | 130 bool m_stopping; |
131 HeapVector<Member<SpeechRecognitionResult>> m_finalResults; | 131 HeapVector<Member<SpeechRecognitionResult>> m_finalResults; |
132 }; | 132 }; |
133 | 133 |
134 } // namespace blink | 134 } // namespace blink |
135 | 135 |
136 #endif // SpeechRecognition_h | 136 #endif // SpeechRecognition_h |
OLD | NEW |