OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Apple Inc. All rights reserved. | 2 * Copyright (C) 2013 Apple 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 * 1. Redistributions of source code must retain the above copyright | 7 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. 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 27 matching lines...) Expand all Loading... |
38 #include "wtf/PassRefPtr.h" | 38 #include "wtf/PassRefPtr.h" |
39 #include "wtf/RefCounted.h" | 39 #include "wtf/RefCounted.h" |
40 #include "wtf/RefPtr.h" | 40 #include "wtf/RefPtr.h" |
41 | 41 |
42 namespace WebCore { | 42 namespace WebCore { |
43 | 43 |
44 class ExceptionState; | 44 class ExceptionState; |
45 class PlatformSpeechSynthesizerClient; | 45 class PlatformSpeechSynthesizerClient; |
46 | 46 |
47 class SpeechSynthesis FINAL : public RefCountedWillBeRefCountedGarbageCollected<
SpeechSynthesis>, public PlatformSpeechSynthesizerClient, public ScriptWrappable
, public ContextLifecycleObserver, public EventTargetWithInlineData { | 47 class SpeechSynthesis FINAL : public RefCountedWillBeRefCountedGarbageCollected<
SpeechSynthesis>, public PlatformSpeechSynthesizerClient, public ScriptWrappable
, public ContextLifecycleObserver, public EventTargetWithInlineData { |
48 DEFINE_EVENT_TARGET_REFCOUNTING(RefCountedWillBeRefCountedGarbageCollected<S
peechSynthesis>); | 48 REFCOUNTED_EVENT_TARGET(SpeechSynthesis); |
| 49 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(SpeechSynthesis); |
49 public: | 50 public: |
50 static PassRefPtrWillBeRawPtr<SpeechSynthesis> create(ExecutionContext*); | 51 static PassRefPtrWillBeRawPtr<SpeechSynthesis> create(ExecutionContext*); |
51 | 52 |
52 bool pending() const; | 53 bool pending() const; |
53 bool speaking() const; | 54 bool speaking() const; |
54 bool paused() const; | 55 bool paused() const; |
55 | 56 |
56 void speak(SpeechSynthesisUtterance*, ExceptionState&); | 57 void speak(SpeechSynthesisUtterance*, ExceptionState&); |
57 void cancel(); | 58 void cancel(); |
58 void pause(); | 59 void pause(); |
59 void resume(); | 60 void resume(); |
60 | 61 |
61 const WillBeHeapVector<RefPtrWillBeMember<SpeechSynthesisVoice> >& getVoices
(); | 62 const WillBeHeapVector<RefPtrWillBeMember<SpeechSynthesisVoice> >& getVoices
(); |
62 | 63 |
63 // Used in testing to use a mock platform synthesizer | 64 // Used in testing to use a mock platform synthesizer |
64 void setPlatformSynthesizer(PassOwnPtr<PlatformSpeechSynthesizer>); | 65 void setPlatformSynthesizer(PassOwnPtr<PlatformSpeechSynthesizer>); |
65 | 66 |
66 DEFINE_ATTRIBUTE_EVENT_LISTENER(voiceschanged); | 67 DEFINE_ATTRIBUTE_EVENT_LISTENER(voiceschanged); |
67 | 68 |
68 virtual ExecutionContext* executionContext() const OVERRIDE; | 69 virtual ExecutionContext* executionContext() const OVERRIDE; |
69 | 70 |
70 void trace(Visitor*); | 71 virtual void trace(Visitor*) OVERRIDE; |
71 | 72 |
72 private: | 73 private: |
73 explicit SpeechSynthesis(ExecutionContext*); | 74 explicit SpeechSynthesis(ExecutionContext*); |
74 | 75 |
75 // PlatformSpeechSynthesizerClient override methods. | 76 // PlatformSpeechSynthesizerClient override methods. |
76 virtual void voicesDidChange() OVERRIDE; | 77 virtual void voicesDidChange() OVERRIDE; |
77 virtual void didStartSpeaking(PassRefPtr<PlatformSpeechSynthesisUtterance>)
OVERRIDE; | 78 virtual void didStartSpeaking(PassRefPtr<PlatformSpeechSynthesisUtterance>)
OVERRIDE; |
78 virtual void didPauseSpeaking(PassRefPtr<PlatformSpeechSynthesisUtterance>)
OVERRIDE; | 79 virtual void didPauseSpeaking(PassRefPtr<PlatformSpeechSynthesisUtterance>)
OVERRIDE; |
79 virtual void didResumeSpeaking(PassRefPtr<PlatformSpeechSynthesisUtterance>)
OVERRIDE; | 80 virtual void didResumeSpeaking(PassRefPtr<PlatformSpeechSynthesisUtterance>)
OVERRIDE; |
80 virtual void didFinishSpeaking(PassRefPtr<PlatformSpeechSynthesisUtterance>)
OVERRIDE; | 81 virtual void didFinishSpeaking(PassRefPtr<PlatformSpeechSynthesisUtterance>)
OVERRIDE; |
(...skipping 12 matching lines...) Expand all Loading... |
93 Deque<RefPtrWillBeMember<SpeechSynthesisUtterance> > m_utteranceQueue; | 94 Deque<RefPtrWillBeMember<SpeechSynthesisUtterance> > m_utteranceQueue; |
94 bool m_isPaused; | 95 bool m_isPaused; |
95 | 96 |
96 // EventTarget | 97 // EventTarget |
97 virtual const AtomicString& interfaceName() const OVERRIDE; | 98 virtual const AtomicString& interfaceName() const OVERRIDE; |
98 }; | 99 }; |
99 | 100 |
100 } // namespace WebCore | 101 } // namespace WebCore |
101 | 102 |
102 #endif // SpeechSynthesisEvent_h | 103 #endif // SpeechSynthesisEvent_h |
OLD | NEW |