| 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 11 matching lines...) Expand all Loading... |
| 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 "bindings/v8/ScriptWrappable.h" | 29 #include "bindings/v8/ScriptWrappable.h" |
| 30 #include "core/dom/ActiveDOMObject.h" | 30 #include "core/dom/ActiveDOMObject.h" |
| 31 #include "core/events/EventTarget.h" | 31 #include "core/events/EventTarget.h" |
| 32 #include "heap/Handle.h" | |
| 33 #include "modules/speech/SpeechGrammarList.h" | 32 #include "modules/speech/SpeechGrammarList.h" |
| 34 #include "modules/speech/SpeechRecognitionResult.h" | |
| 35 #include "wtf/Compiler.h" | 33 #include "wtf/Compiler.h" |
| 36 #include "wtf/PassRefPtr.h" | 34 #include "wtf/PassRefPtr.h" |
| 37 #include "wtf/RefCounted.h" | 35 #include "wtf/RefCounted.h" |
| 38 #include "wtf/text/WTFString.h" | 36 #include "wtf/text/WTFString.h" |
| 39 | 37 |
| 40 namespace WebCore { | 38 namespace WebCore { |
| 41 | 39 |
| 42 class ExceptionState; | 40 class ExceptionState; |
| 43 class ExecutionContext; | 41 class ExecutionContext; |
| 44 class SpeechRecognitionController; | 42 class SpeechRecognitionController; |
| 45 class SpeechRecognitionError; | 43 class SpeechRecognitionError; |
| 44 class SpeechRecognitionResult; |
| 45 class SpeechRecognitionResultList; |
| 46 | 46 |
| 47 class SpeechRecognition FINAL : public RefCountedWillBeRefCountedGarbageCollecte
d<SpeechRecognition>, public ScriptWrappable, public ActiveDOMObject, public Eve
ntTargetWithInlineData { | 47 class SpeechRecognition FINAL : public RefCounted<SpeechRecognition>, public Scr
iptWrappable, public ActiveDOMObject, public EventTargetWithInlineData { |
| 48 DECLARE_GC_INFO; | 48 REFCOUNTED_EVENT_TARGET(SpeechRecognition); |
| 49 DEFINE_EVENT_TARGET_REFCOUNTING(RefCountedWillBeRefCountedGarbageCollected<S
peechRecognition>); | |
| 50 public: | 49 public: |
| 51 static PassRefPtrWillBeRawPtr<SpeechRecognition> create(ExecutionContext*); | 50 static PassRefPtr<SpeechRecognition> create(ExecutionContext*); |
| 52 virtual ~SpeechRecognition(); | 51 virtual ~SpeechRecognition(); |
| 53 | 52 |
| 54 // Attributes. | 53 // Attributes. |
| 55 SpeechGrammarList* grammars() { return m_grammars.get(); } | 54 PassRefPtr<SpeechGrammarList> grammars() { return m_grammars; } |
| 56 void setGrammars(PassRefPtrWillBeRawPtr<SpeechGrammarList> grammars) { m_gra
mmars = grammars; } | 55 void setGrammars(PassRefPtr<SpeechGrammarList> grammars) { m_grammars = gram
mars; } |
| 57 String lang() { return m_lang; } | 56 String lang() { return m_lang; } |
| 58 void setLang(const String& lang) { m_lang = lang; } | 57 void setLang(const String& lang) { m_lang = lang; } |
| 59 bool continuous() { return m_continuous; } | 58 bool continuous() { return m_continuous; } |
| 60 void setContinuous(bool continuous) { m_continuous = continuous; } | 59 void setContinuous(bool continuous) { m_continuous = continuous; } |
| 61 bool interimResults() { return m_interimResults; } | 60 bool interimResults() { return m_interimResults; } |
| 62 void setInterimResults(bool interimResults) { m_interimResults = interimResu
lts; } | 61 void setInterimResults(bool interimResults) { m_interimResults = interimResu
lts; } |
| 63 unsigned long maxAlternatives() { return m_maxAlternatives; } | 62 unsigned long maxAlternatives() { return m_maxAlternatives; } |
| 64 void setMaxAlternatives(unsigned long maxAlternatives) { m_maxAlternatives =
maxAlternatives; } | 63 void setMaxAlternatives(unsigned long maxAlternatives) { m_maxAlternatives =
maxAlternatives; } |
| 65 | 64 |
| 66 // Callable by the user. | 65 // Callable by the user. |
| (...skipping 26 matching lines...) Expand all Loading... |
| 93 DEFINE_ATTRIBUTE_EVENT_LISTENER(speechstart); | 92 DEFINE_ATTRIBUTE_EVENT_LISTENER(speechstart); |
| 94 DEFINE_ATTRIBUTE_EVENT_LISTENER(speechend); | 93 DEFINE_ATTRIBUTE_EVENT_LISTENER(speechend); |
| 95 DEFINE_ATTRIBUTE_EVENT_LISTENER(soundend); | 94 DEFINE_ATTRIBUTE_EVENT_LISTENER(soundend); |
| 96 DEFINE_ATTRIBUTE_EVENT_LISTENER(audioend); | 95 DEFINE_ATTRIBUTE_EVENT_LISTENER(audioend); |
| 97 DEFINE_ATTRIBUTE_EVENT_LISTENER(result); | 96 DEFINE_ATTRIBUTE_EVENT_LISTENER(result); |
| 98 DEFINE_ATTRIBUTE_EVENT_LISTENER(nomatch); | 97 DEFINE_ATTRIBUTE_EVENT_LISTENER(nomatch); |
| 99 DEFINE_ATTRIBUTE_EVENT_LISTENER(error); | 98 DEFINE_ATTRIBUTE_EVENT_LISTENER(error); |
| 100 DEFINE_ATTRIBUTE_EVENT_LISTENER(start); | 99 DEFINE_ATTRIBUTE_EVENT_LISTENER(start); |
| 101 DEFINE_ATTRIBUTE_EVENT_LISTENER(end); | 100 DEFINE_ATTRIBUTE_EVENT_LISTENER(end); |
| 102 | 101 |
| 103 void trace(Visitor*); | |
| 104 | |
| 105 private: | 102 private: |
| 106 friend class RefCounted<SpeechRecognition>; | 103 friend class RefCounted<SpeechRecognition>; |
| 107 | 104 |
| 108 explicit SpeechRecognition(ExecutionContext*); | 105 explicit SpeechRecognition(ExecutionContext*); |
| 109 | 106 |
| 110 RefPtrWillBeMember<SpeechGrammarList> m_grammars; | 107 RefPtr<SpeechGrammarList> m_grammars; |
| 111 String m_lang; | 108 String m_lang; |
| 112 bool m_continuous; | 109 bool m_continuous; |
| 113 bool m_interimResults; | 110 bool m_interimResults; |
| 114 unsigned long m_maxAlternatives; | 111 unsigned long m_maxAlternatives; |
| 115 | 112 |
| 116 SpeechRecognitionController* m_controller; | 113 SpeechRecognitionController* m_controller; |
| 117 bool m_stoppedByActiveDOMObject; | 114 bool m_stoppedByActiveDOMObject; |
| 118 bool m_started; | 115 bool m_started; |
| 119 bool m_stopping; | 116 bool m_stopping; |
| 120 Vector<RefPtr<SpeechRecognitionResult> > m_finalResults; | 117 Vector<RefPtr<SpeechRecognitionResult> > m_finalResults; |
| 121 }; | 118 }; |
| 122 | 119 |
| 123 } // namespace WebCore | 120 } // namespace WebCore |
| 124 | 121 |
| 125 #endif // SpeechRecognition_h | 122 #endif // SpeechRecognition_h |
| OLD | NEW |