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 12 matching lines...) Expand all Loading... |
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 SpeechRecognitionEvent_h | 26 #ifndef SpeechRecognitionEvent_h |
27 #define SpeechRecognitionEvent_h | 27 #define SpeechRecognitionEvent_h |
28 | 28 |
29 #include "modules/EventModules.h" | 29 #include "modules/EventModules.h" |
30 #include "modules/speech/SpeechRecognitionResult.h" | 30 #include "modules/speech/SpeechRecognitionResult.h" |
31 #include "modules/speech/SpeechRecognitionResultList.h" | 31 #include "modules/speech/SpeechRecognitionResultList.h" |
32 #include "platform/heap/Handle.h" | 32 #include "platform/heap/Handle.h" |
33 #include "wtf/RefPtr.h" | |
34 | 33 |
35 namespace WebCore { | 34 namespace WebCore { |
36 | 35 |
37 class Document; | 36 class Document; |
38 | 37 |
39 class SpeechRecognitionEventInit : public EventInit { | 38 class SpeechRecognitionEventInit : public EventInit { |
40 public: | 39 public: |
41 SpeechRecognitionEventInit(); | 40 SpeechRecognitionEventInit(); |
42 | 41 |
43 unsigned long resultIndex; | 42 unsigned long resultIndex; |
44 RefPtrWillBeMember<SpeechRecognitionResultList> results; | 43 Member<SpeechRecognitionResultList> results; |
45 }; | 44 }; |
46 | 45 |
47 class SpeechRecognitionEvent FINAL : public Event { | 46 class SpeechRecognitionEvent FINAL : public Event { |
48 public: | 47 public: |
49 static PassRefPtrWillBeRawPtr<SpeechRecognitionEvent> create(); | 48 static PassRefPtrWillBeRawPtr<SpeechRecognitionEvent> create(); |
50 static PassRefPtrWillBeRawPtr<SpeechRecognitionEvent> create(const AtomicStr
ing&, const SpeechRecognitionEventInit&); | 49 static PassRefPtrWillBeRawPtr<SpeechRecognitionEvent> create(const AtomicStr
ing&, const SpeechRecognitionEventInit&); |
51 virtual ~SpeechRecognitionEvent(); | 50 virtual ~SpeechRecognitionEvent(); |
52 | 51 |
53 static PassRefPtrWillBeRawPtr<SpeechRecognitionEvent> createResult(unsigned
long resultIndex, const WillBeHeapVector<RefPtrWillBeMember<SpeechRecognitionRes
ult> >& results); | 52 static PassRefPtrWillBeRawPtr<SpeechRecognitionEvent> createResult(unsigned
long resultIndex, const HeapVector<Member<SpeechRecognitionResult> >& results); |
54 static PassRefPtrWillBeRawPtr<SpeechRecognitionEvent> createNoMatch(PassRefP
trWillBeRawPtr<SpeechRecognitionResult>); | 53 static PassRefPtrWillBeRawPtr<SpeechRecognitionEvent> createNoMatch(SpeechRe
cognitionResult*); |
55 | 54 |
56 unsigned long resultIndex() const { return m_resultIndex; } | 55 unsigned long resultIndex() const { return m_resultIndex; } |
57 SpeechRecognitionResultList* results() const { return m_results.get(); } | 56 SpeechRecognitionResultList* results() const { return m_results.get(); } |
58 | 57 |
59 // These two methods are here to satisfy the specification which requires th
ese attrubutes to exist. | 58 // These two methods are here to satisfy the specification which requires th
ese attrubutes to exist. |
60 Document* interpretation() { return 0; } | 59 Document* interpretation() { return 0; } |
61 Document* emma() { return 0; } | 60 Document* emma() { return 0; } |
62 | 61 |
63 // Event | 62 // Event |
64 virtual const AtomicString& interfaceName() const OVERRIDE; | 63 virtual const AtomicString& interfaceName() const OVERRIDE; |
65 | 64 |
66 virtual void trace(Visitor*) OVERRIDE; | 65 virtual void trace(Visitor*) OVERRIDE; |
67 | 66 |
68 private: | 67 private: |
69 SpeechRecognitionEvent(); | 68 SpeechRecognitionEvent(); |
70 SpeechRecognitionEvent(const AtomicString&, const SpeechRecognitionEventInit
&); | 69 SpeechRecognitionEvent(const AtomicString&, const SpeechRecognitionEventInit
&); |
71 SpeechRecognitionEvent(const AtomicString& eventName, unsigned long resultIn
dex, PassRefPtrWillBeRawPtr<SpeechRecognitionResultList> results); | 70 SpeechRecognitionEvent(const AtomicString& eventName, unsigned long resultIn
dex, SpeechRecognitionResultList* results); |
72 | 71 |
73 unsigned long m_resultIndex; | 72 unsigned long m_resultIndex; |
74 RefPtrWillBeMember<SpeechRecognitionResultList> m_results; | 73 PersistentWillBeMember<SpeechRecognitionResultList> m_results; |
75 }; | 74 }; |
76 | 75 |
77 } // namespace WebCore | 76 } // namespace WebCore |
78 | 77 |
79 #endif // SpeechRecognitionEvent_h | 78 #endif // SpeechRecognitionEvent_h |
OLD | NEW |