Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1528)

Unified Diff: Source/modules/speech/SpeechSynthesis.cpp

Issue 27477002: Add support for onvoiceschanged event. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@platform_speech_chromium
Patch Set: Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/modules/speech/SpeechSynthesis.cpp
diff --git a/Source/modules/speech/SpeechSynthesis.cpp b/Source/modules/speech/SpeechSynthesis.cpp
index fb7ee0e39025f474d06301f4d402610f4d04ae66..e4f7c2980f656a36fa3dbc256956314f8735b896 100644
--- a/Source/modules/speech/SpeechSynthesis.cpp
+++ b/Source/modules/speech/SpeechSynthesis.cpp
@@ -34,13 +34,14 @@
namespace WebCore {
-PassRefPtr<SpeechSynthesis> SpeechSynthesis::create()
+PassRefPtr<SpeechSynthesis> SpeechSynthesis::create(ExecutionContext* context)
{
- return adoptRef(new SpeechSynthesis());
+ return adoptRef(new SpeechSynthesis(context));
}
-SpeechSynthesis::SpeechSynthesis()
- : m_platformSpeechSynthesizer(PlatformSpeechSynthesizer::create(this))
+SpeechSynthesis::SpeechSynthesis(ExecutionContext* context)
+ : ContextLifecycleObserver(context)
+ , m_platformSpeechSynthesizer(PlatformSpeechSynthesizer::create(this))
, m_currentSpeechUtterance(0)
, m_isPaused(false)
{
@@ -52,9 +53,15 @@ void SpeechSynthesis::setPlatformSynthesizer(PassOwnPtr<PlatformSpeechSynthesize
m_platformSpeechSynthesizer = synthesizer;
}
+ExecutionContext* SpeechSynthesis::executionContext() const
+{
+ return ContextLifecycleObserver::executionContext();
+}
+
void SpeechSynthesis::voicesDidChange()
abarth-chromium 2013/10/16 19:25:06 When can this function be called? Why don't we ne
dmazzoni 2013/10/16 22:09:06 Good question. This function is only called from
abarth-chromium 2013/10/17 02:00:53 I should write a design doc that explains how all
dmazzoni 2013/10/17 15:28:59 Got it, that makes sense. I made the same change
{
m_voiceList.clear();
+ dispatchEvent(Event::create(EventTypeNames::voiceschanged));
eseidel 2013/10/16 06:44:53 This will cause synchronous event dispatch, right?
dmazzoni 2013/10/16 07:08:00 That's only a problem if the user is triggering th
}
const Vector<RefPtr<SpeechSynthesisVoice> >& SpeechSynthesis::getVoices()
@@ -208,4 +215,9 @@ void SpeechSynthesis::speakingErrorOccurred(PassRefPtr<PlatformSpeechSynthesisUt
handleSpeakingCompleted(static_cast<SpeechSynthesisUtterance*>(utterance->client()), true);
}
+const AtomicString& SpeechSynthesis::interfaceName() const
+{
+ return EventTargetNames::SpeechSynthesisUtterance;
+}
+
} // namespace WebCore

Powered by Google App Engine
This is Rietveld 408576698