| 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 19 matching lines...) Expand all Loading... |
| 30 #include "core/platform/PlatformSpeechSynthesisUtterance.h" | 30 #include "core/platform/PlatformSpeechSynthesisUtterance.h" |
| 31 #include "core/platform/PlatformSpeechSynthesizer.h" | 31 #include "core/platform/PlatformSpeechSynthesizer.h" |
| 32 #include "modules/speech/SpeechSynthesisUtterance.h" | 32 #include "modules/speech/SpeechSynthesisUtterance.h" |
| 33 #include "modules/speech/SpeechSynthesisVoice.h" | 33 #include "modules/speech/SpeechSynthesisVoice.h" |
| 34 #include "wtf/Deque.h" | 34 #include "wtf/Deque.h" |
| 35 #include "wtf/PassRefPtr.h" | 35 #include "wtf/PassRefPtr.h" |
| 36 #include "wtf/RefCounted.h" | 36 #include "wtf/RefCounted.h" |
| 37 #include "wtf/RefPtr.h" | 37 #include "wtf/RefPtr.h" |
| 38 | 38 |
| 39 namespace WebCore { | 39 namespace WebCore { |
| 40 | 40 |
| 41 class PlatformSpeechSynthesizerClient; | 41 class PlatformSpeechSynthesizerClient; |
| 42 class SpeechSynthesisVoice; | 42 class SpeechSynthesisVoice; |
| 43 | 43 |
| 44 class SpeechSynthesis : public PlatformSpeechSynthesizerClient, public ScriptWra
ppable, public RefCounted<SpeechSynthesis> { | 44 class SpeechSynthesis : public PlatformSpeechSynthesizerClient, public ScriptWra
ppable, public RefCounted<SpeechSynthesis> { |
| 45 public: | 45 public: |
| 46 static PassRefPtr<SpeechSynthesis> create(); | 46 static PassRefPtr<SpeechSynthesis> create(); |
| 47 | 47 |
| 48 bool pending() const; | 48 bool pending() const; |
| 49 bool speaking() const; | 49 bool speaking() const; |
| 50 bool paused() const; | 50 bool paused() const; |
| 51 | 51 |
| 52 void speak(SpeechSynthesisUtterance*); | 52 void speak(SpeechSynthesisUtterance*); |
| 53 void cancel(); | 53 void cancel(); |
| 54 void pause(); | 54 void pause(); |
| 55 void resume(); | 55 void resume(); |
| 56 | 56 |
| 57 const Vector<RefPtr<SpeechSynthesisVoice> >& getVoices(); | 57 const Vector<RefPtr<SpeechSynthesisVoice> >& getVoices(); |
| 58 | 58 |
| 59 // Used in testing to use a mock platform synthesizer | 59 // Used in testing to use a mock platform synthesizer |
| 60 void setPlatformSynthesizer(PassOwnPtr<PlatformSpeechSynthesizer>); | 60 void setPlatformSynthesizer(PassOwnPtr<PlatformSpeechSynthesizer>); |
| 61 | 61 |
| 62 private: | 62 private: |
| 63 SpeechSynthesis(); | 63 SpeechSynthesis(); |
| 64 | 64 |
| 65 // PlatformSpeechSynthesizerClient override methods. | 65 // PlatformSpeechSynthesizerClient override methods. |
| 66 virtual void voicesDidChange() OVERRIDE; | 66 virtual void voicesDidChange() OVERRIDE; |
| 67 virtual void didStartSpeaking(PassRefPtr<PlatformSpeechSynthesisUtterance>)
OVERRIDE; | 67 virtual void didStartSpeaking(PassRefPtr<PlatformSpeechSynthesisUtterance>)
OVERRIDE; |
| 68 virtual void didPauseSpeaking(PassRefPtr<PlatformSpeechSynthesisUtterance>)
OVERRIDE; | 68 virtual void didPauseSpeaking(PassRefPtr<PlatformSpeechSynthesisUtterance>)
OVERRIDE; |
| 69 virtual void didResumeSpeaking(PassRefPtr<PlatformSpeechSynthesisUtterance>)
OVERRIDE; | 69 virtual void didResumeSpeaking(PassRefPtr<PlatformSpeechSynthesisUtterance>)
OVERRIDE; |
| 70 virtual void didFinishSpeaking(PassRefPtr<PlatformSpeechSynthesisUtterance>)
OVERRIDE; | 70 virtual void didFinishSpeaking(PassRefPtr<PlatformSpeechSynthesisUtterance>)
OVERRIDE; |
| 71 virtual void speakingErrorOccurred(PassRefPtr<PlatformSpeechSynthesisUtteran
ce>) OVERRIDE; | 71 virtual void speakingErrorOccurred(PassRefPtr<PlatformSpeechSynthesisUtteran
ce>) OVERRIDE; |
| 72 virtual void boundaryEventOccurred(PassRefPtr<PlatformSpeechSynthesisUtteran
ce>, SpeechBoundary, unsigned charIndex) OVERRIDE; | 72 virtual void boundaryEventOccurred(PassRefPtr<PlatformSpeechSynthesisUtteran
ce>, SpeechBoundary, unsigned charIndex) OVERRIDE; |
| 73 | 73 |
| 74 void startSpeakingImmediately(SpeechSynthesisUtterance*); | 74 void startSpeakingImmediately(SpeechSynthesisUtterance*); |
| 75 void handleSpeakingCompleted(SpeechSynthesisUtterance*, bool errorOccurred); | 75 void handleSpeakingCompleted(SpeechSynthesisUtterance*, bool errorOccurred); |
| 76 void fireEvent(const AtomicString& type, SpeechSynthesisUtterance*, unsigned
long charIndex, const String& name); | 76 void fireEvent(const AtomicString& type, SpeechSynthesisUtterance*, unsigned
long charIndex, const String& name); |
| 77 | 77 |
| 78 OwnPtr<PlatformSpeechSynthesizer> m_platformSpeechSynthesizer; | 78 OwnPtr<PlatformSpeechSynthesizer> m_platformSpeechSynthesizer; |
| 79 Vector<RefPtr<SpeechSynthesisVoice> > m_voiceList; | 79 Vector<RefPtr<SpeechSynthesisVoice> > m_voiceList; |
| 80 SpeechSynthesisUtterance* m_currentSpeechUtterance; | 80 SpeechSynthesisUtterance* m_currentSpeechUtterance; |
| 81 Deque<RefPtr<SpeechSynthesisUtterance> > m_utteranceQueue; | 81 Deque<RefPtr<SpeechSynthesisUtterance> > m_utteranceQueue; |
| 82 bool m_isPaused; | 82 bool m_isPaused; |
| 83 }; | 83 }; |
| 84 | 84 |
| 85 } // namespace WebCore | 85 } // namespace WebCore |
| 86 | 86 |
| 87 #endif // SpeechSynthesisEvent_h | 87 #endif // SpeechSynthesisEvent_h |
| OLD | NEW |