Refactor platform-specific code in SpeechSynthesis
authorcfleizach@apple.com <cfleizach@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 8 Feb 2013 21:45:07 +0000 (21:45 +0000)
committercfleizach@apple.com <cfleizach@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 8 Feb 2013 21:45:07 +0000 (21:45 +0000)
https://bugs.webkit.org/show_bug.cgi?id=107414

Reviewed by Sam Weinig.

Refactor WebSpeech code to use a platform mechanism to provide access to platform resources.

* Modules/speech/DOMWindowSpeechSynthesis.cpp:
(WebCore::DOMWindowSpeechSynthesis::from):
* Modules/speech/SpeechSynthesis.cpp:
(WebCore::SpeechSynthesis::SpeechSynthesis):
(WebCore):
(WebCore::SpeechSynthesis::voicesDidChange):
(WebCore::SpeechSynthesis::getVoices):
(WebCore::SpeechSynthesis::pending):
(WebCore::SpeechSynthesis::speaking):
(WebCore::SpeechSynthesis::paused):
(WebCore::SpeechSynthesis::speak):
(WebCore::SpeechSynthesis::cancel):
(WebCore::SpeechSynthesis::pause):
(WebCore::SpeechSynthesis::resume):
* Modules/speech/SpeechSynthesis.h:
(WebCore):
(SpeechSynthesis):
(WebCore::SpeechSynthesis::didStartSpeaking):
(WebCore::SpeechSynthesis::didFinishSpeaking):
(WebCore::SpeechSynthesis::speakingErrorOccurred):
* Modules/speech/SpeechSynthesisUtterance.cpp:
(WebCore::SpeechSynthesisUtterance::SpeechSynthesisUtterance):
* Modules/speech/SpeechSynthesisUtterance.h:
(WebCore::SpeechSynthesisUtterance::text):
(WebCore::SpeechSynthesisUtterance::setText):
(WebCore::SpeechSynthesisUtterance::lang):
(WebCore::SpeechSynthesisUtterance::setLang):
(WebCore::SpeechSynthesisUtterance::voiceURI):
(WebCore::SpeechSynthesisUtterance::setVoiceURI):
(WebCore::SpeechSynthesisUtterance::volume):
(WebCore::SpeechSynthesisUtterance::setVolume):
(WebCore::SpeechSynthesisUtterance::rate):
(WebCore::SpeechSynthesisUtterance::setRate):
(WebCore::SpeechSynthesisUtterance::pitch):
(WebCore::SpeechSynthesisUtterance::setPitch):
(SpeechSynthesisUtterance):
(WebCore::SpeechSynthesisUtterance::platformUtterance):
* Modules/speech/SpeechSynthesisVoice.cpp:
(WebCore::SpeechSynthesisVoice::create):
(WebCore::SpeechSynthesisVoice::SpeechSynthesisVoice):
* Modules/speech/SpeechSynthesisVoice.h:
(SpeechSynthesisVoice):
(WebCore::SpeechSynthesisVoice::voiceURI):
(WebCore::SpeechSynthesisVoice::name):
(WebCore::SpeechSynthesisVoice::lang):
(WebCore::SpeechSynthesisVoice::localService):
(WebCore::SpeechSynthesisVoice::isDefault):
* Modules/speech/mac/SpeechSynthesisMac.mm:
* WebCore.xcodeproj/project.pbxproj:
* platform/PlatformSpeechSynthesis.h: Added.
(WebCore):
(PlatformSpeechSynthesis):
* platform/PlatformSpeechSynthesisUtterance.cpp: Added.
(WebCore):
(WebCore::PlatformSpeechSynthesisUtterance::PlatformSpeechSynthesisUtterance):
* platform/PlatformSpeechSynthesisUtterance.h: Added.
(WebCore):
(PlatformSpeechSynthesisUtteranceClient):
(WebCore::PlatformSpeechSynthesisUtteranceClient::~PlatformSpeechSynthesisUtteranceClient):
(PlatformSpeechSynthesisUtterance):
(WebCore::PlatformSpeechSynthesisUtterance::text):
(WebCore::PlatformSpeechSynthesisUtterance::setText):
(WebCore::PlatformSpeechSynthesisUtterance::lang):
(WebCore::PlatformSpeechSynthesisUtterance::setLang):
(WebCore::PlatformSpeechSynthesisUtterance::voiceURI):
(WebCore::PlatformSpeechSynthesisUtterance::setVoiceURI):
(WebCore::PlatformSpeechSynthesisUtterance::volume):
(WebCore::PlatformSpeechSynthesisUtterance::setVolume):
(WebCore::PlatformSpeechSynthesisUtterance::rate):
(WebCore::PlatformSpeechSynthesisUtterance::setRate):
(WebCore::PlatformSpeechSynthesisUtterance::pitch):
(WebCore::PlatformSpeechSynthesisUtterance::setPitch):
* platform/PlatformSpeechSynthesisVoice.cpp: Added.
(WebCore):
(WebCore::PlatformSpeechSynthesisVoice::create):
(WebCore::PlatformSpeechSynthesisVoice::PlatformSpeechSynthesisVoice):
* platform/PlatformSpeechSynthesisVoice.h: Added.
(WebCore):
(PlatformSpeechSynthesisVoice):
(WebCore::PlatformSpeechSynthesisVoice::voiceURI):
(WebCore::PlatformSpeechSynthesisVoice::name):
(WebCore::PlatformSpeechSynthesisVoice::lang):
(WebCore::PlatformSpeechSynthesisVoice::localService):
(WebCore::PlatformSpeechSynthesisVoice::isDefault):
* platform/PlatformSpeechSynthesizer.cpp: Added.
(WebCore):
(WebCore::PlatformSpeechSynthesizer::PlatformSpeechSynthesizer):
* platform/PlatformSpeechSynthesizer.h: Added.
(WebCore):
(PlatformSpeechSynthesizerClient):
(WebCore::PlatformSpeechSynthesizerClient::~PlatformSpeechSynthesizerClient):
(PlatformSpeechSynthesizer):
(WebCore::PlatformSpeechSynthesizer::voiceList):
* platform/mac/PlatformSpeechSynthesisMac.mm: Added.
(WebCore):
(WebCore::PlatformSpeechSynthesis::create):
(WebCore::PlatformSpeechSynthesis::PlatformSpeechSynthesis):
(WebCore::PlatformSpeechSynthesis::platformSpeak):
* platform/mac/PlatformSpeechSynthesizerMac.mm: Added.
(WebCore):
(WebCore::PlatformSpeechSynthesizer::initializeVoiceList):
(WebCore::PlatformSpeechSynthesizer::speak):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@142320 268f45cc-cd09-0410-ab3c-d52691b4dbfc

18 files changed:
Source/WebCore/ChangeLog
Source/WebCore/Modules/speech/DOMWindowSpeechSynthesis.cpp
Source/WebCore/Modules/speech/SpeechSynthesis.cpp
Source/WebCore/Modules/speech/SpeechSynthesis.h
Source/WebCore/Modules/speech/SpeechSynthesisUtterance.cpp
Source/WebCore/Modules/speech/SpeechSynthesisUtterance.h
Source/WebCore/Modules/speech/SpeechSynthesisVoice.cpp
Source/WebCore/Modules/speech/SpeechSynthesisVoice.h
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/platform/PlatformSpeechSynthesis.h [new file with mode: 0644]
Source/WebCore/platform/PlatformSpeechSynthesisUtterance.cpp [new file with mode: 0644]
Source/WebCore/platform/PlatformSpeechSynthesisUtterance.h [new file with mode: 0644]
Source/WebCore/platform/PlatformSpeechSynthesisVoice.cpp [new file with mode: 0644]
Source/WebCore/platform/PlatformSpeechSynthesisVoice.h [new file with mode: 0644]
Source/WebCore/platform/PlatformSpeechSynthesizer.cpp [new file with mode: 0644]
Source/WebCore/platform/PlatformSpeechSynthesizer.h [new file with mode: 0644]
Source/WebCore/platform/mac/PlatformSpeechSynthesisMac.mm [moved from Source/WebCore/Modules/speech/mac/SpeechSynthesisMac.mm with 78% similarity]
Source/WebCore/platform/mac/PlatformSpeechSynthesizerMac.mm [new file with mode: 0644]

index a3539a6..173f9c6 100644 (file)
@@ -1,3 +1,115 @@
+2013-02-08  Chris Fleizach  <cfleizach@apple.com>
+
+        Refactor platform-specific code in SpeechSynthesis
+        https://bugs.webkit.org/show_bug.cgi?id=107414
+
+        Reviewed by Sam Weinig.
+
+        Refactor WebSpeech code to use a platform mechanism to provide access to platform resources.
+
+        * Modules/speech/DOMWindowSpeechSynthesis.cpp:
+        (WebCore::DOMWindowSpeechSynthesis::from):
+        * Modules/speech/SpeechSynthesis.cpp:
+        (WebCore::SpeechSynthesis::SpeechSynthesis):
+        (WebCore):
+        (WebCore::SpeechSynthesis::voicesDidChange):
+        (WebCore::SpeechSynthesis::getVoices):
+        (WebCore::SpeechSynthesis::pending):
+        (WebCore::SpeechSynthesis::speaking):
+        (WebCore::SpeechSynthesis::paused):
+        (WebCore::SpeechSynthesis::speak):
+        (WebCore::SpeechSynthesis::cancel):
+        (WebCore::SpeechSynthesis::pause):
+        (WebCore::SpeechSynthesis::resume):
+        * Modules/speech/SpeechSynthesis.h:
+        (WebCore):
+        (SpeechSynthesis):
+        (WebCore::SpeechSynthesis::didStartSpeaking):
+        (WebCore::SpeechSynthesis::didFinishSpeaking):
+        (WebCore::SpeechSynthesis::speakingErrorOccurred):
+        * Modules/speech/SpeechSynthesisUtterance.cpp:
+        (WebCore::SpeechSynthesisUtterance::SpeechSynthesisUtterance):
+        * Modules/speech/SpeechSynthesisUtterance.h:
+        (WebCore::SpeechSynthesisUtterance::text):
+        (WebCore::SpeechSynthesisUtterance::setText):
+        (WebCore::SpeechSynthesisUtterance::lang):
+        (WebCore::SpeechSynthesisUtterance::setLang):
+        (WebCore::SpeechSynthesisUtterance::voiceURI):
+        (WebCore::SpeechSynthesisUtterance::setVoiceURI):
+        (WebCore::SpeechSynthesisUtterance::volume):
+        (WebCore::SpeechSynthesisUtterance::setVolume):
+        (WebCore::SpeechSynthesisUtterance::rate):
+        (WebCore::SpeechSynthesisUtterance::setRate):
+        (WebCore::SpeechSynthesisUtterance::pitch):
+        (WebCore::SpeechSynthesisUtterance::setPitch):
+        (SpeechSynthesisUtterance):
+        (WebCore::SpeechSynthesisUtterance::platformUtterance):
+        * Modules/speech/SpeechSynthesisVoice.cpp:
+        (WebCore::SpeechSynthesisVoice::create):
+        (WebCore::SpeechSynthesisVoice::SpeechSynthesisVoice):
+        * Modules/speech/SpeechSynthesisVoice.h:
+        (SpeechSynthesisVoice):
+        (WebCore::SpeechSynthesisVoice::voiceURI):
+        (WebCore::SpeechSynthesisVoice::name):
+        (WebCore::SpeechSynthesisVoice::lang):
+        (WebCore::SpeechSynthesisVoice::localService):
+        (WebCore::SpeechSynthesisVoice::isDefault):
+        * Modules/speech/mac/SpeechSynthesisMac.mm:
+        * WebCore.xcodeproj/project.pbxproj:
+        * platform/PlatformSpeechSynthesis.h: Added.
+        (WebCore):
+        (PlatformSpeechSynthesis):
+        * platform/PlatformSpeechSynthesisUtterance.cpp: Added.
+        (WebCore):
+        (WebCore::PlatformSpeechSynthesisUtterance::PlatformSpeechSynthesisUtterance):
+        * platform/PlatformSpeechSynthesisUtterance.h: Added.
+        (WebCore):
+        (PlatformSpeechSynthesisUtteranceClient):
+        (WebCore::PlatformSpeechSynthesisUtteranceClient::~PlatformSpeechSynthesisUtteranceClient):
+        (PlatformSpeechSynthesisUtterance):
+        (WebCore::PlatformSpeechSynthesisUtterance::text):
+        (WebCore::PlatformSpeechSynthesisUtterance::setText):
+        (WebCore::PlatformSpeechSynthesisUtterance::lang):
+        (WebCore::PlatformSpeechSynthesisUtterance::setLang):
+        (WebCore::PlatformSpeechSynthesisUtterance::voiceURI):
+        (WebCore::PlatformSpeechSynthesisUtterance::setVoiceURI):
+        (WebCore::PlatformSpeechSynthesisUtterance::volume):
+        (WebCore::PlatformSpeechSynthesisUtterance::setVolume):
+        (WebCore::PlatformSpeechSynthesisUtterance::rate):
+        (WebCore::PlatformSpeechSynthesisUtterance::setRate):
+        (WebCore::PlatformSpeechSynthesisUtterance::pitch):
+        (WebCore::PlatformSpeechSynthesisUtterance::setPitch):
+        * platform/PlatformSpeechSynthesisVoice.cpp: Added.
+        (WebCore):
+        (WebCore::PlatformSpeechSynthesisVoice::create):
+        (WebCore::PlatformSpeechSynthesisVoice::PlatformSpeechSynthesisVoice):
+        * platform/PlatformSpeechSynthesisVoice.h: Added.
+        (WebCore):
+        (PlatformSpeechSynthesisVoice):
+        (WebCore::PlatformSpeechSynthesisVoice::voiceURI):
+        (WebCore::PlatformSpeechSynthesisVoice::name):
+        (WebCore::PlatformSpeechSynthesisVoice::lang):
+        (WebCore::PlatformSpeechSynthesisVoice::localService):
+        (WebCore::PlatformSpeechSynthesisVoice::isDefault):
+        * platform/PlatformSpeechSynthesizer.cpp: Added.
+        (WebCore):
+        (WebCore::PlatformSpeechSynthesizer::PlatformSpeechSynthesizer):
+        * platform/PlatformSpeechSynthesizer.h: Added.
+        (WebCore):
+        (PlatformSpeechSynthesizerClient):
+        (WebCore::PlatformSpeechSynthesizerClient::~PlatformSpeechSynthesizerClient):
+        (PlatformSpeechSynthesizer):
+        (WebCore::PlatformSpeechSynthesizer::voiceList):
+        * platform/mac/PlatformSpeechSynthesisMac.mm: Added.
+        (WebCore):
+        (WebCore::PlatformSpeechSynthesis::create):
+        (WebCore::PlatformSpeechSynthesis::PlatformSpeechSynthesis):
+        (WebCore::PlatformSpeechSynthesis::platformSpeak):
+        * platform/mac/PlatformSpeechSynthesizerMac.mm: Added.
+        (WebCore):
+        (WebCore::PlatformSpeechSynthesizer::initializeVoiceList):
+        (WebCore::PlatformSpeechSynthesizer::speak):
+
 2013-02-08  Dean Jackson  <dino@apple.com>
 
         Put snapshotting label text into localizable strings
index 57f2253..ccc9593 100644 (file)
@@ -55,7 +55,7 @@ const char* DOMWindowSpeechSynthesis::supplementName()
 // static
 DOMWindowSpeechSynthesis* DOMWindowSpeechSynthesis::from(DOMWindow* window)
 {
-    DOMWindowSpeechSynthesis* supplement = static_cast<DOMWindowSpeechSynthesis*>(Supplement<DOMWindow>::from(window, upplementName()));
+    DOMWindowSpeechSynthesis* supplement = static_cast<DOMWindowSpeechSynthesis*>(Supplement<DOMWindow>::from(window, supplementName()));
     if (!supplement) {
         supplement = new DOMWindowSpeechSynthesis(window);
         provideTo(window, supplementName(), adoptPtr(supplement));
index 2adb095..7cd1c03 100644 (file)
 
 #if ENABLE(SPEECH_SYNTHESIS)
 
+#include "PlatformSpeechSynthesis.h"
+#include "PlatformSpeechSynthesisVoice.h"
+#include "SpeechSynthesisUtterance.h"
+
 namespace WebCore {
     
 PassRefPtr<SpeechSynthesis> SpeechSynthesis::create()
@@ -36,10 +40,61 @@ PassRefPtr<SpeechSynthesis> SpeechSynthesis::create()
 }
     
 SpeechSynthesis::SpeechSynthesis()
+    : m_platformSpeechSynthesizer(PlatformSpeechSynthesizer(this))
+{
+}
+    
+void SpeechSynthesis::voicesDidChange()
+{
+    m_voiceList.clear();
+}
+    
+const Vector<RefPtr<SpeechSynthesisVoice> >& SpeechSynthesis::getVoices()
+{
+    if (m_voiceList.size())
+        return m_voiceList;
+    
+    // If the voiceList is empty, that's the cue to get the voices from the platform again.
+    const Vector<RefPtr<PlatformSpeechSynthesisVoice> >& platformVoices = m_platformSpeechSynthesizer.voiceList();
+    size_t voiceCount = platformVoices.size();
+    for (size_t k = 0; k < voiceCount; k++)
+        m_voiceList.append(SpeechSynthesisVoice::create(platformVoices[k]));
+
+    return m_voiceList;
+}
+
+bool SpeechSynthesis::pending() const
+{
+    return false;
+}
+
+bool SpeechSynthesis::speaking() const
 {
-    initializeVoiceList();
+    return false;
 }
 
+bool SpeechSynthesis::paused() const
+{
+    return false;
+}
+
+void SpeechSynthesis::speak(SpeechSynthesisUtterance* utterance)
+{
+    m_platformSpeechSynthesizer.speak(utterance->platformUtterance());
+}
+
+void SpeechSynthesis::cancel()
+{
+}
+
+void SpeechSynthesis::pause()
+{
+}
+
+void SpeechSynthesis::resume()
+{
+}
+    
 } // namespace WebCore
 
 #endif // ENABLE(INPUT_SPEECH)
index c6cbbb7..6cee1d0 100644 (file)
 
 #if ENABLE(SPEECH_SYNTHESIS)
 
+#include "PlatformSpeechSynthesisUtterance.h"
+#include "PlatformSpeechSynthesizer.h"
 #include "SpeechSynthesisVoice.h"
-
 #include <wtf/PassRefPtr.h>
 #include <wtf/RefCounted.h>
 #include <wtf/RefPtr.h>
 
 namespace WebCore {
     
+class PlatformSpeechSynthesizerClient;
 class SpeechSynthesisUtterance;
 class SpeechSynthesisVoice;
     
-class SpeechSynthesis : public RefCounted<SpeechSynthesis> {
+class SpeechSynthesis : public PlatformSpeechSynthesizerClient, public RefCounted<SpeechSynthesis> {
 public:
     static PassRefPtr<SpeechSynthesis> create();
     
@@ -52,12 +54,17 @@ public:
     void pause();
     void resume();
     
-    const Vector<RefPtr<SpeechSynthesisVoice> >& getVoices() { return m_voiceList; };
+    const Vector<RefPtr<SpeechSynthesisVoice> >& getVoices();
     
 private:
     SpeechSynthesis();
     
-    void initializeVoiceList();
+    virtual void voicesDidChange();
+    virtual void didStartSpeaking(PlatformSpeechSynthesisUtterance*) { };
+    virtual void didFinishSpeaking(PlatformSpeechSynthesisUtterance*) { };
+    virtual void speakingErrorOccurred(PlatformSpeechSynthesisUtterance*) { };
+
+    PlatformSpeechSynthesizer m_platformSpeechSynthesizer;
     Vector<RefPtr<SpeechSynthesisVoice> > m_voiceList;
 };
     
index 1eed8c2..2857d86 100644 (file)
@@ -37,8 +37,9 @@ PassRefPtr<SpeechSynthesisUtterance> SpeechSynthesisUtterance::create(ScriptExec
 
 SpeechSynthesisUtterance::SpeechSynthesisUtterance(ScriptExecutionContext* context, const String& text)
     : ContextDestructionObserver(context)
-    , m_text(text)
+    , m_platformUtterance(PlatformSpeechSynthesisUtterance(this))
 {
+    m_platformUtterance.setText(text);
 }
     
 ScriptExecutionContext* SpeechSynthesisUtterance::scriptExecutionContext() const
index 16ce8fa..42d8bab 100644 (file)
 
 #include "ContextDestructionObserver.h"
 #include "EventTarget.h"
+#include "PlatformSpeechSynthesisUtterance.h"
 #include <wtf/PassRefPtr.h>
 #include <wtf/RefCounted.h>
 
 namespace WebCore {
     
-class SpeechSynthesisUtterance : public RefCounted<SpeechSynthesisUtterance>, public ContextDestructionObserver, public EventTarget {
+class SpeechSynthesisUtterance : public PlatformSpeechSynthesisUtteranceClient, public RefCounted<SpeechSynthesisUtterance>, public ContextDestructionObserver, public EventTarget {
 public:
     static PassRefPtr<SpeechSynthesisUtterance> create(ScriptExecutionContext*, const String&);
     
-    const String& text() const { return m_text; }
-    void setText(const String& text) { m_text = text; }
+    const String& text() const { return m_platformUtterance.text(); }
+    void setText(const String& text) { m_platformUtterance.setText(text); }
 
-    const String& lang() const { return m_lang; }
-    void setLang(const String& lang) { m_lang = lang; }
+    const String& lang() const { return m_platformUtterance.lang(); }
+    void setLang(const String& lang) { m_platformUtterance.setLang(lang); }
 
-    const String& voiceURI() const { return m_voiceURI; }
-    void setVoiceURI(const String& voiceURI) { m_voiceURI = voiceURI; }
+    const String& voiceURI() const { return m_platformUtterance.voiceURI(); }
+    void setVoiceURI(const String& voiceURI) { m_platformUtterance.setVoiceURI(voiceURI); }
 
-    float volume() const { return m_volume; }
-    void setVolume(float volume) { m_volume = volume; }
+    float volume() const { return m_platformUtterance.volume(); }
+    void setVolume(float volume) { m_platformUtterance.setVolume(volume); }
 
-    float rate() const { return m_rate; }
-    void setRate(float rate) { m_rate = rate; }
+    float rate() const { return m_platformUtterance.rate(); }
+    void setRate(float rate) { m_platformUtterance.setRate(rate); }
 
-    float pitch() const { return m_pitch; }
-    void setPitch(float pitch) { m_pitch = pitch; }
+    float pitch() const { return m_platformUtterance.pitch(); }
+    void setPitch(float pitch) { m_platformUtterance.setPitch(pitch); }
 
     DEFINE_ATTRIBUTE_EVENT_LISTENER(start);
     DEFINE_ATTRIBUTE_EVENT_LISTENER(end);
@@ -70,15 +71,11 @@ public:
 
     virtual ScriptExecutionContext* scriptExecutionContext() const;
 
+    const PlatformSpeechSynthesisUtterance& platformUtterance() const { return m_platformUtterance; }
+
 private:
     SpeechSynthesisUtterance(ScriptExecutionContext*, const String&);
-
-    String m_text;
-    String m_lang;
-    String m_voiceURI;
-    float m_volume;
-    float m_rate;
-    float m_pitch;
+    PlatformSpeechSynthesisUtterance m_platformUtterance;
     
     // EventTarget
     EventTargetData m_eventTargetData;
index 91a9292..36ee5e4 100644 (file)
 
 namespace WebCore {
     
-PassRefPtr<SpeechSynthesisVoice> SpeechSynthesisVoice::create(const String& voiceURI, const String& name, const String& lang, bool localService, bool isDefault)
+PassRefPtr<SpeechSynthesisVoice> SpeechSynthesisVoice::create(PassRefPtr<PlatformSpeechSynthesisVoice> voice)
 {
-    return adoptRef(new SpeechSynthesisVoice(voiceURI, name, lang, localService, isDefault));
+    return adoptRef(new SpeechSynthesisVoice(voice));
 }
 
-SpeechSynthesisVoice::SpeechSynthesisVoice(const String& voiceURI, const String& name, const String& lang, bool localService, bool isDefault)
-    : m_voiceURI(voiceURI)
-    , m_name(name)
-    , m_lang(lang)
-    , m_localService(localService)
-    , m_default(isDefault)
+SpeechSynthesisVoice::SpeechSynthesisVoice(PassRefPtr<PlatformSpeechSynthesisVoice> voice)
+    : m_platformVoice(voice)
 {
 }
     
index 63cca20..59f4331 100644 (file)
@@ -28,6 +28,7 @@
 
 #if ENABLE(SPEECH_SYNTHESIS)
 
+#include "PlatformSpeechSynthesisVoice.h"
 #include <wtf/PassRefPtr.h>
 #include <wtf/RefCounted.h>
 #include <wtf/text/WTFString.h>
@@ -36,22 +37,18 @@ namespace WebCore {
 
 class SpeechSynthesisVoice : public RefCounted<SpeechSynthesisVoice> {
 public:
-    static PassRefPtr<SpeechSynthesisVoice> create(const String& voiceURI, const String& name, const String& lang, bool localService, bool isDefault);
+    static PassRefPtr<SpeechSynthesisVoice> create(PassRefPtr<PlatformSpeechSynthesisVoice>);
     
-    const String& voiceURI() const { return m_voiceURI; }
-    const String& name() const { return m_name; }
-    const String& lang() const { return m_lang; }
-    bool localService() const { return m_localService; }
-    bool isDefault() const { return m_default; }
+    const String& voiceURI() const { return m_platformVoice->voiceURI(); }
+    const String& name() const { return m_platformVoice->name(); }
+    const String& lang() const { return m_platformVoice->lang(); }
+    bool localService() const { return m_platformVoice->localService(); }
+    bool isDefault() const { return m_platformVoice->isDefault(); }
     
 private:
-    SpeechSynthesisVoice(const String& voiceURI, const String& name, const String& lang, bool localService, bool isDefault);
+    explicit SpeechSynthesisVoice(PassRefPtr<PlatformSpeechSynthesisVoice>);
     
-    String m_voiceURI;
-    String m_name;
-    String m_lang;
-    bool m_localService;
-    bool m_default;
+    RefPtr<PlatformSpeechSynthesisVoice> m_platformVoice;
 };
 
 } // namespace WebCore
index 540e8d3..40f986f 100644 (file)
                2917B566147349950052C9D0 /* LayerFlushSchedulerMac.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2917B565147349950052C9D0 /* LayerFlushSchedulerMac.cpp */; };
                2919A1E916B3376600787213 /* ContentFilter.h in Headers */ = {isa = PBXBuildFile; fileRef = 2919A1E816B3376600787213 /* ContentFilter.h */; settings = {ATTRIBUTES = (Private, ); }; };
                2919A1EB16B3378900787213 /* ContentFilterMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2919A1EA16B3378900787213 /* ContentFilterMac.mm */; };
+               2934940A16C02C0700901318 /* PlatformSpeechSynthesisVoice.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2527CC9316BF92EC009DDAC0 /* PlatformSpeechSynthesisVoice.cpp */; };
+               2934940B16C02C0A00901318 /* PlatformSpeechSynthesisUtterance.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2527CC9516BF95DD009DDAC0 /* PlatformSpeechSynthesisUtterance.cpp */; };
                293EAE1F1356B2FE0067ACF9 /* RuntimeApplicationChecks.h in Headers */ = {isa = PBXBuildFile; fileRef = 293EAE1E1356B2FE0067ACF9 /* RuntimeApplicationChecks.h */; settings = {ATTRIBUTES = (Private, ); }; };
                293EAE211356B32E0067ACF9 /* RuntimeApplicationChecks.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 293EAE201356B32E0067ACF9 /* RuntimeApplicationChecks.cpp */; };
                29489FC712C00F0300D83F0F /* AccessibilityScrollView.h in Headers */ = {isa = PBXBuildFile; fileRef = 29489FC512C00F0300D83F0F /* AccessibilityScrollView.h */; };
+               297BE3D516C03C08003316BD /* PlatformSpeechSynthesisUtterance.h in Headers */ = {isa = PBXBuildFile; fileRef = 2527CC9116BF8BA1009DDAC0 /* PlatformSpeechSynthesisUtterance.h */; };
+               297BE3D616C03C0B003316BD /* PlatformSpeechSynthesisVoice.h in Headers */ = {isa = PBXBuildFile; fileRef = 2527CC9216BF90B4009DDAC0 /* PlatformSpeechSynthesisVoice.h */; };
+               297BE3D716C03C0E003316BD /* PlatformSpeechSynthesizer.h in Headers */ = {isa = PBXBuildFile; fileRef = 29E4D8DF16B0940F00C84704 /* PlatformSpeechSynthesizer.h */; };
+               297BE3D816C03CCE003316BD /* PlatformSpeechSynthesizerMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 29E4D8E016B0959800C84704 /* PlatformSpeechSynthesizerMac.mm */; };
+               297BE3DA16C043D8003316BD /* PlatformSpeechSynthesizer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 297BE3D916C043D8003316BD /* PlatformSpeechSynthesizer.cpp */; };
                29A309AC1561C99B00BBD8E5 /* RunLoopCF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 29A309AB1561C99B00BBD8E5 /* RunLoopCF.cpp */; };
                29A309B01561CAC400BBD8E5 /* VisitedLinks.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 29A309AE1561CAC400BBD8E5 /* VisitedLinks.cpp */; };
                29A309B11561CAC400BBD8E5 /* VisitedLinks.h in Headers */ = {isa = PBXBuildFile; fileRef = 29A309AF1561CAC400BBD8E5 /* VisitedLinks.h */; };
                AA2A5AD516A4861400975A25 /* SpeechSynthesis.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AA2A5ABD16A485D500975A25 /* SpeechSynthesis.cpp */; };
                AA2A5AD616A4861600975A25 /* DOMWindowSpeechSynthesis.h in Headers */ = {isa = PBXBuildFile; fileRef = AA2A5AB916A485D500975A25 /* DOMWindowSpeechSynthesis.h */; };
                AA2A5AD716A4861A00975A25 /* DOMWindowSpeechSynthesis.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AA2A5AB816A485D500975A25 /* DOMWindowSpeechSynthesis.cpp */; };
-               AA2A5AD816A4861D00975A25 /* SpeechSynthesisMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = AA2A5ABC16A485D500975A25 /* SpeechSynthesisMac.mm */; };
                AA4C3A760B2B1679002334A2 /* StyleElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AA4C3A740B2B1679002334A2 /* StyleElement.cpp */; };
                AA4C3A770B2B1679002334A2 /* StyleElement.h in Headers */ = {isa = PBXBuildFile; fileRef = AA4C3A750B2B1679002334A2 /* StyleElement.h */; };
                AA73183E159255B900A93E6E /* InjectedScriptCanvasModule.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AA73183C159255B900A93E6E /* InjectedScriptCanvasModule.cpp */; };
                24D912BC13CA9A9700D21915 /* SVGGlyphRefElement.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = SVGGlyphRefElement.idl; sourceTree = "<group>"; };
                24F54EAA101FE914000AE741 /* ApplicationCacheHost.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ApplicationCacheHost.cpp; sourceTree = "<group>"; };
                24F54EAB101FE914000AE741 /* ApplicationCacheHost.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ApplicationCacheHost.h; sourceTree = "<group>"; };
+               2527CC9116BF8BA1009DDAC0 /* PlatformSpeechSynthesisUtterance.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PlatformSpeechSynthesisUtterance.h; sourceTree = "<group>"; };
+               2527CC9216BF90B4009DDAC0 /* PlatformSpeechSynthesisVoice.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PlatformSpeechSynthesisVoice.h; sourceTree = "<group>"; };
+               2527CC9316BF92EC009DDAC0 /* PlatformSpeechSynthesisVoice.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PlatformSpeechSynthesisVoice.cpp; sourceTree = "<group>"; };
+               2527CC9516BF95DD009DDAC0 /* PlatformSpeechSynthesisUtterance.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PlatformSpeechSynthesisUtterance.cpp; sourceTree = "<group>"; };
                2542F4D81166C25A00E89A86 /* UserGestureIndicator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UserGestureIndicator.cpp; sourceTree = "<group>"; };
                2542F4D91166C25A00E89A86 /* UserGestureIndicator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UserGestureIndicator.h; sourceTree = "<group>"; };
                265541371489811C000DFC5D /* KeyEventCodesIOS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = KeyEventCodesIOS.h; path = ios/KeyEventCodesIOS.h; sourceTree = "<group>"; };
                293EAE1E1356B2FE0067ACF9 /* RuntimeApplicationChecks.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RuntimeApplicationChecks.h; sourceTree = "<group>"; };
                293EAE201356B32E0067ACF9 /* RuntimeApplicationChecks.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RuntimeApplicationChecks.cpp; sourceTree = "<group>"; };
                29489FC512C00F0300D83F0F /* AccessibilityScrollView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AccessibilityScrollView.h; sourceTree = "<group>"; };
+               297BE3D916C043D8003316BD /* PlatformSpeechSynthesizer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PlatformSpeechSynthesizer.cpp; sourceTree = "<group>"; };
                2981CA9D131822EC00D12F2A /* AccessibilityARIAGrid.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = AccessibilityARIAGrid.cpp; sourceTree = "<group>"; };
                2981CA9E131822EC00D12F2A /* AccessibilityARIAGridCell.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = AccessibilityARIAGridCell.cpp; sourceTree = "<group>"; };
                2981CA9F131822EC00D12F2A /* AccessibilityARIAGridRow.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = AccessibilityARIAGridRow.cpp; sourceTree = "<group>"; };
                29ACB213143E7498006BCA5F /* AccessibilityMockObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AccessibilityMockObject.cpp; sourceTree = "<group>"; };
                29D7BCF51444AF580070619C /* AccessibilitySpinButton.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = AccessibilitySpinButton.cpp; path = accessibility/AccessibilitySpinButton.cpp; sourceTree = SOURCE_ROOT; };
                29D7BCF91444AF7D0070619C /* AccessibilitySpinButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AccessibilitySpinButton.h; sourceTree = "<group>"; };
+               29E4D8DF16B0940F00C84704 /* PlatformSpeechSynthesizer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PlatformSpeechSynthesizer.h; sourceTree = "<group>"; };
+               29E4D8E016B0959800C84704 /* PlatformSpeechSynthesizerMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PlatformSpeechSynthesizerMac.mm; sourceTree = "<group>"; };
                2B42359F15250F6000DBBCD8 /* RenderSVGEllipse.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderSVGEllipse.cpp; sourceTree = "<group>"; };
                2B4235A015250F6000DBBCD8 /* RenderSVGEllipse.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderSVGEllipse.h; sourceTree = "<group>"; };
                2BE8E2C612A589EC00FAD550 /* HTMLMetaCharsetParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = HTMLMetaCharsetParser.h; path = parser/HTMLMetaCharsetParser.h; sourceTree = "<group>"; };
                AA2A5AB816A485D500975A25 /* DOMWindowSpeechSynthesis.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = DOMWindowSpeechSynthesis.cpp; path = Modules/speech/DOMWindowSpeechSynthesis.cpp; sourceTree = "<group>"; };
                AA2A5AB916A485D500975A25 /* DOMWindowSpeechSynthesis.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = DOMWindowSpeechSynthesis.h; path = Modules/speech/DOMWindowSpeechSynthesis.h; sourceTree = "<group>"; };
                AA2A5ABA16A485D500975A25 /* DOMWindowSpeechSynthesis.idl */ = {isa = PBXFileReference; lastKnownFileType = text; name = DOMWindowSpeechSynthesis.idl; path = Modules/speech/DOMWindowSpeechSynthesis.idl; sourceTree = "<group>"; };
-               AA2A5ABC16A485D500975A25 /* SpeechSynthesisMac.mm */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; path = SpeechSynthesisMac.mm; sourceTree = "<group>"; };
                AA2A5ABD16A485D500975A25 /* SpeechSynthesis.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = SpeechSynthesis.cpp; path = Modules/speech/SpeechSynthesis.cpp; sourceTree = "<group>"; };
                AA2A5ABE16A485D500975A25 /* SpeechSynthesis.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SpeechSynthesis.h; path = Modules/speech/SpeechSynthesis.h; sourceTree = "<group>"; };
                AA2A5ABF16A485D500975A25 /* SpeechSynthesis.idl */ = {isa = PBXFileReference; lastKnownFileType = text; name = SpeechSynthesis.idl; path = Modules/speech/SpeechSynthesis.idl; sourceTree = "<group>"; };
                                BCAA486D14A052530088FAC4 /* PlatformEventFactoryMac.mm */,
                                C5F765BA14E1ECF4006C899B /* PlatformPasteboardMac.mm */,
                                BC94D1070C274F88006BC617 /* PlatformScreenMac.mm */,
+                               29E4D8E016B0959800C84704 /* PlatformSpeechSynthesizerMac.mm */,
                                D39D006C11F8E308006041F2 /* PopupMenuMac.h */,
                                0668E18E0ADD9640004128E0 /* PopupMenuMac.mm */,
                                E4D687760ED7AE3D006EA978 /* PurgeableBufferMac.cpp */,
                AA2A5AB716A485A400975A25 /* speech */ = {
                        isa = PBXGroup;
                        children = (
-                               AA2A5ABB16A485D500975A25 /* mac */,
                                AA2A5AB816A485D500975A25 /* DOMWindowSpeechSynthesis.cpp */,
                                AA2A5AB916A485D500975A25 /* DOMWindowSpeechSynthesis.h */,
                                AA2A5ABA16A485D500975A25 /* DOMWindowSpeechSynthesis.idl */,
                        name = speech;
                        sourceTree = "<group>";
                };
-               AA2A5ABB16A485D500975A25 /* mac */ = {
-                       isa = PBXGroup;
-                       children = (
-                               AA2A5ABC16A485D500975A25 /* SpeechSynthesisMac.mm */,
-                       );
-                       name = mac;
-                       path = Modules/speech/mac;
-                       sourceTree = "<group>";
-               };
                AA7FEE9B16A491A1004C0C33 /* Speech */ = {
                        isa = PBXGroup;
                        children = (
                                935C476709AC4D4300A6AAB4 /* PlatformMouseEvent.h */,
                                C5BAC16F14E30E4700008837 /* PlatformPasteboard.h */,
                                BCEC01D60C274EB4009F4EC9 /* PlatformScreen.h */,
+                               297BE3D916C043D8003316BD /* PlatformSpeechSynthesizer.cpp */,
+                               29E4D8DF16B0940F00C84704 /* PlatformSpeechSynthesizer.h */,
+                               2527CC9316BF92EC009DDAC0 /* PlatformSpeechSynthesisVoice.cpp */,
+                               2527CC9216BF90B4009DDAC0 /* PlatformSpeechSynthesisVoice.h */,
+                               2527CC9516BF95DD009DDAC0 /* PlatformSpeechSynthesisUtterance.cpp */,
+                               2527CC9116BF8BA1009DDAC0 /* PlatformSpeechSynthesisUtterance.h */,
                                1AD8F81A11CAB9E900E93E54 /* PlatformStrategies.cpp */,
                                1AD8F81911CAB9E900E93E54 /* PlatformStrategies.h */,
                                935C476A09AC4D4F00A6AAB4 /* PlatformWheelEvent.h */,
                                935C476909AC4D4300A6AAB4 /* PlatformMouseEvent.h in Headers */,
                                C598905814E9C29900E8D18B /* PlatformPasteboard.h in Headers */,
                                BCEC01D70C274EB4009F4EC9 /* PlatformScreen.h in Headers */,
+                               297BE3D516C03C08003316BD /* PlatformSpeechSynthesisUtterance.h in Headers */,
+                               297BE3D616C03C0B003316BD /* PlatformSpeechSynthesisVoice.h in Headers */,
+                               297BE3D716C03C0E003316BD /* PlatformSpeechSynthesizer.h in Headers */,
                                1AD8F81B11CAB9E900E93E54 /* PlatformStrategies.h in Headers */,
                                935C476B09AC4D4F00A6AAB4 /* PlatformWheelEvent.h in Headers */,
                                31D591B316697A6C00E6BF02 /* PlugInClient.h in Headers */,
                                41BF700F0FE86F61005E8DEC /* PlatformMessagePortChannel.cpp in Sources */,
                                C598902E14E9B0F800E8D18B /* PlatformPasteboardMac.mm in Sources */,
                                BC94D1080C274F88006BC617 /* PlatformScreenMac.mm in Sources */,
+                               2934940A16C02C0700901318 /* PlatformSpeechSynthesisVoice.cpp in Sources */,
+                               2934940B16C02C0A00901318 /* PlatformSpeechSynthesisUtterance.cpp in Sources */,
+                               297BE3D816C03CCE003316BD /* PlatformSpeechSynthesizerMac.mm in Sources */,
+                               297BE3DA16C043D8003316BD /* PlatformSpeechSynthesizer.cpp in Sources */,
                                1AD8F81C11CAB9E900E93E54 /* PlatformStrategies.cpp in Sources */,
                                A9C6E4F30D745E48006442E9 /* PluginData.cpp in Sources */,
                                97205ABB1239292700B17380 /* PluginDocument.cpp in Sources */,
                                75415C29129A9920003AD669 /* SpeechInputResultList.cpp in Sources */,
                                AA2A5AD516A4861400975A25 /* SpeechSynthesis.cpp in Sources */,
                                AA2A5AD316A4860D00975A25 /* SpeechSynthesisEvent.cpp in Sources */,
-                               AA2A5AD816A4861D00975A25 /* SpeechSynthesisMac.mm in Sources */,
                                AA2A5AD116A4860700975A25 /* SpeechSynthesisUtterance.cpp in Sources */,
                                AA2A5ACD16A485FA00975A25 /* SpeechSynthesisVoice.cpp in Sources */,
                                A78FE13B12366B1000ACE8D0 /* SpellChecker.cpp in Sources */,
diff --git a/Source/WebCore/platform/PlatformSpeechSynthesis.h b/Source/WebCore/platform/PlatformSpeechSynthesis.h
new file mode 100644 (file)
index 0000000..21b8bc9
--- /dev/null
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2013 Apple Computer, Inc.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef PlatformSpeechSynthesis_h
+#define PlatformSpeechSynthesis_h
+
+#if ENABLE(SPEECH_SYNTHESIS)
+
+#include <wtf/RefCounted.h>
+
+namespace WebCore {
+    
+class SpeechSynthesis;
+class SpeechSynthesisUtterance;
+class SpeechSynthesisVoice;
+    
+class PlatformSpeechSynthesis : public RefCounted<PlatformSpeechSynthesis> {
+public:
+    static PassRefPtr<PlatformSpeechSynthesis> create(SpeechSynthesis*);
+    
+    void platformInitializeVoiceList(Vector<RefPtr<SpeechSynthesisVoice> >&);
+    void platformSpeak(SpeechSynthesisUtterance*);
+    
+private:
+    PlatformSpeechSynthesis(SpeechSynthesis*);
+
+    SpeechSynthesis* m_speechSynthsis;
+};
+    
+} // namespace WebCore
+
+#endif // ENABLE(SPEECH_SYNTHESIS)
+
+#endif // PlatformSpeechSynthesis_h
diff --git a/Source/WebCore/platform/PlatformSpeechSynthesisUtterance.cpp b/Source/WebCore/platform/PlatformSpeechSynthesisUtterance.cpp
new file mode 100644 (file)
index 0000000..5a2f950
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2013 Apple Computer, Inc.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "PlatformSpeechSynthesisUtterance.h"
+
+#if ENABLE(SPEECH_SYNTHESIS)
+
+namespace WebCore {
+    
+PlatformSpeechSynthesisUtterance::PlatformSpeechSynthesisUtterance(PlatformSpeechSynthesisUtteranceClient* client)
+    : m_client(client)
+{
+}
+    
+} // namespace WebCore
+
+#endif // ENABLE(SPEECH_SYNTHESIS)
diff --git a/Source/WebCore/platform/PlatformSpeechSynthesisUtterance.h b/Source/WebCore/platform/PlatformSpeechSynthesisUtterance.h
new file mode 100644 (file)
index 0000000..5195190
--- /dev/null
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2013 Apple Computer, Inc.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef PlatformSpeechSynthesisUtterance_h
+#define PlatformSpeechSynthesisUtterance_h
+
+#if ENABLE(SPEECH_SYNTHESIS)
+
+#include <wtf/text/WTFString.h>
+
+namespace WebCore {
+    
+class PlatformSpeechSynthesisUtteranceClient {
+public:
+    // Implement methods as needed.
+protected:
+    virtual ~PlatformSpeechSynthesisUtteranceClient() { }
+};
+    
+class PlatformSpeechSynthesisUtterance {
+public:
+    explicit PlatformSpeechSynthesisUtterance(PlatformSpeechSynthesisUtteranceClient*);
+    
+    const String& text() const { return m_text; }
+    void setText(const String& text) { m_text = text; }
+    
+    const String& lang() const { return m_lang; }
+    void setLang(const String& lang) { m_lang = lang; }
+    
+    const String& voiceURI() const { return m_voiceURI; }
+    void setVoiceURI(const String& voiceURI) { m_voiceURI = voiceURI; }
+    
+    float volume() const { return m_volume; }
+    void setVolume(float volume) { m_volume = volume; }
+    
+    float rate() const { return m_rate; }
+    void setRate(float rate) { m_rate = rate; }
+    
+    float pitch() const { return m_pitch; }
+    void setPitch(float pitch) { m_pitch = pitch; }
+
+private:
+    PlatformSpeechSynthesisUtteranceClient* m_client;
+    String m_text;
+    String m_lang;
+    String m_voiceURI;
+    float m_volume;
+    float m_rate;
+    float m_pitch;
+};
+    
+} // namespace WebCore
+
+#endif // ENABLE(SPEECH_SYNTHESIS)
+
+#endif // PlatformSpeechSynthesisUtterance_h
diff --git a/Source/WebCore/platform/PlatformSpeechSynthesisVoice.cpp b/Source/WebCore/platform/PlatformSpeechSynthesisVoice.cpp
new file mode 100644 (file)
index 0000000..82eef2e
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2013 Apple Computer, Inc.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "PlatformSpeechSynthesisVoice.h"
+
+#if ENABLE(SPEECH_SYNTHESIS)
+
+namespace WebCore {
+
+PassRefPtr<PlatformSpeechSynthesisVoice> PlatformSpeechSynthesisVoice::create(const String& voiceURI, const String& name, const String& lang, bool localService, bool isDefault)
+{
+    return adoptRef(new PlatformSpeechSynthesisVoice(voiceURI, name, lang, localService, isDefault));
+}
+    
+PlatformSpeechSynthesisVoice::PlatformSpeechSynthesisVoice(const String& voiceURI, const String& name, const String& lang, bool localService, bool isDefault)
+    : m_voiceURI(voiceURI)
+    , m_name(name)
+    , m_lang(lang)
+    , m_localService(localService)
+    , m_default(isDefault)
+{
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(SPEECH_SYNTHESIS)
diff --git a/Source/WebCore/platform/PlatformSpeechSynthesisVoice.h b/Source/WebCore/platform/PlatformSpeechSynthesisVoice.h
new file mode 100644 (file)
index 0000000..774e2d6
--- /dev/null
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2013 Apple Computer, Inc.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef PlatformSpeechSynthesisVoice_h
+#define PlatformSpeechSynthesisVoice_h
+
+#if ENABLE(SPEECH_SYNTHESIS)
+
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
+#include <wtf/text/WTFString.h>
+
+namespace WebCore {
+
+class PlatformSpeechSynthesisVoice : public RefCounted<PlatformSpeechSynthesisVoice> {
+public:
+    static PassRefPtr<PlatformSpeechSynthesisVoice> create(const String& voiceURI, const String& name, const String& lang, bool localService, bool isDefault);
+    
+    const String& voiceURI() const { return m_voiceURI; }
+    const String& name() const { return m_name; }
+    const String& lang() const { return m_lang; }
+    bool localService() const { return m_localService; }
+    bool isDefault() const { return m_default; }
+    
+private:
+    PlatformSpeechSynthesisVoice(const String& voiceURI, const String& name, const String& lang, bool localService, bool isDefault);
+
+    String m_voiceURI;
+    String m_name;
+    String m_lang;
+    bool m_localService;
+    bool m_default;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(SPEECH_SYNTHESIS)
+
+#endif // PlatformSpeechSynthesisVoice_h
diff --git a/Source/WebCore/platform/PlatformSpeechSynthesizer.cpp b/Source/WebCore/platform/PlatformSpeechSynthesizer.cpp
new file mode 100644 (file)
index 0000000..19b0aef
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2013 Apple Computer, Inc.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "PlatformSpeechSynthesizer.h"
+
+#if ENABLE(SPEECH_SYNTHESIS)
+
+namespace WebCore {
+    
+PlatformSpeechSynthesizer::PlatformSpeechSynthesizer(PlatformSpeechSynthesizerClient* client)
+    : m_speechSynthesizerClient(client)
+{
+}
+    
+} // namespace WebCore
+
+#endif // ENABLE(SPEECH_SYNTHESIS)
diff --git a/Source/WebCore/platform/PlatformSpeechSynthesizer.h b/Source/WebCore/platform/PlatformSpeechSynthesizer.h
new file mode 100644 (file)
index 0000000..d2ee26d
--- /dev/null
@@ -0,0 +1,67 @@
+/*
+ * Copyright (C) 2013 Apple Computer, Inc.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef PlatformSpeechSynthesizer_h
+#define PlatformSpeechSynthesizer_h
+
+#include "PlatformSpeechSynthesisVoice.h"
+#include <wtf/Vector.h>
+
+#if ENABLE(SPEECH_SYNTHESIS)
+
+namespace WebCore {
+    
+class PlatformSpeechSynthesisUtterance;
+
+class PlatformSpeechSynthesizerClient {
+public:
+    virtual void didStartSpeaking(PlatformSpeechSynthesisUtterance*) = 0;
+    virtual void didFinishSpeaking(PlatformSpeechSynthesisUtterance*) = 0;
+    virtual void speakingErrorOccurred(PlatformSpeechSynthesisUtterance*) = 0;
+    
+    virtual void voicesDidChange() = 0;
+protected:
+    virtual ~PlatformSpeechSynthesizerClient() { }
+};
+    
+class PlatformSpeechSynthesizer {
+public:
+    explicit PlatformSpeechSynthesizer(PlatformSpeechSynthesizerClient*);
+    
+    const Vector<RefPtr<PlatformSpeechSynthesisVoice> >& voiceList() const { return m_voiceList; }
+    void speak(const PlatformSpeechSynthesisUtterance&);
+    
+private:
+    PlatformSpeechSynthesizerClient* m_speechSynthesizerClient;
+    Vector<RefPtr<PlatformSpeechSynthesisVoice> > m_voiceList;
+    
+    void initializeVoiceList();
+};
+    
+} // namespace WebCore
+
+#endif // ENABLE(SPEECH_SYNTHESIS)
+
+#endif // PlatformSpeechSynthesizer_h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2013 Apple Computer, Inc.  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  */
 
 #include "config.h"
-#include "SpeechSynthesis.h"
-
-#if ENABLE(SPEECH_SYNTHESIS)
+#include "PlatformSpeechSynthesis.h"
 
 #include "SpeechSynthesisVoice.h"
 #include "SpeechSynthesisUtterance.h"
 #include <AppKit/NSSpeechSynthesizer.h>
 
+#if ENABLE(SPEECH_SYNTHESIS)
+
 namespace WebCore {
+
+PassRefPtr<PlatformSpeechSynthesis> PlatformSpeechSynthesis::create(SpeechSynthesis* synthesis)
+{
+    return adoptRef(new PlatformSpeechSynthesis(synthesis));
+}
+
+PlatformSpeechSynthesis::PlatformSpeechSynthesis(SpeechSynthesis* synthesis)
+    : m_speechSynthesis(synthesis)
+{
+}
     
-void SpeechSynthesis::initializeVoiceList()
+void PlatformSpeechSynthesis::platformSpeak(SpeechSynthesisUtterance*)
+{
+}
+    
+void PlatformSpeechSynthesis::platformInitializeVoiceList(Vector<RefPtr<SpeechSynthesisVoice> >& voices);
 {
     NSString *defaultVoiceURI = [NSSpeechSynthesizer defaultVoice];
     NSArray *availableVoices = [NSSpeechSynthesizer availableVoices];
@@ -46,47 +60,16 @@ void SpeechSynthesis::initializeVoiceList()
         NSString *voiceURI = [attributes objectForKey:NSVoiceIdentifier];
         NSString *name = [attributes objectForKey:NSVoiceName];
         NSString *language = [attributes objectForKey:NSVoiceLocaleIdentifier];
-
+        
         // Change to BCP-47 format as defined by spec.
         language = [language stringByReplacingOccurrencesOfString:@"_" withString:@"-"];
         
         bool isDefault = [defaultVoiceURI isEqualToString:voiceURI];
         
-        m_voiceList.append(SpeechSynthesisVoice::create(voiceURI, name, language, true, isDefault));
+        voices.append(SpeechSynthesisVoice::create(voiceURI, name, language, true, isDefault));
     }
 }
 
-bool SpeechSynthesis::pending() const
-{
-    return false;
-}
-
-bool SpeechSynthesis::speaking() const
-{
-    return false;
-}
-
-bool SpeechSynthesis::paused() const
-{
-    return false;
-}
-
-void SpeechSynthesis::speak(SpeechSynthesisUtterance*)
-{
-}
-
-void SpeechSynthesis::cancel()
-{
-}
-
-void SpeechSynthesis::pause()
-{
-}
-
-void SpeechSynthesis::resume()
-{
-}
-
 } // namespace WebCore
 
 #endif // ENABLE(SPEECH_SYNTHESIS)
diff --git a/Source/WebCore/platform/mac/PlatformSpeechSynthesizerMac.mm b/Source/WebCore/platform/mac/PlatformSpeechSynthesizerMac.mm
new file mode 100644 (file)
index 0000000..c194433
--- /dev/null
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2013 Apple Computer, Inc.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "PlatformSpeechSynthesizer.h"
+
+#include "PlatformSpeechSynthesisVoice.h"
+#include "PlatformSpeechSynthesisUtterance.h"
+#include <AppKit/NSSpeechSynthesizer.h>
+
+#if ENABLE(SPEECH_SYNTHESIS)
+
+namespace WebCore {
+
+void PlatformSpeechSynthesizer::initializeVoiceList()
+{
+    NSString *defaultVoiceURI = [NSSpeechSynthesizer defaultVoice];
+    NSArray *availableVoices = [NSSpeechSynthesizer availableVoices];
+    NSUInteger count = [availableVoices count];
+    for (NSUInteger k = 0; k < count; k++) {
+        NSString *voiceName = [availableVoices objectAtIndex:k];
+        NSDictionary *attributes = [NSSpeechSynthesizer attributesForVoice:voiceName];
+        
+        NSString *voiceURI = [attributes objectForKey:NSVoiceIdentifier];
+        NSString *name = [attributes objectForKey:NSVoiceName];
+        NSString *language = [attributes objectForKey:NSVoiceLocaleIdentifier];
+        
+        // Change to BCP-47 format as defined by spec.
+        language = [language stringByReplacingOccurrencesOfString:@"_" withString:@"-"];
+        
+        bool isDefault = [defaultVoiceURI isEqualToString:voiceURI];
+        
+        m_voiceList.append(PlatformSpeechSynthesisVoice::create(voiceURI, name, language, true, isDefault));
+    }
+}
+    
+void PlatformSpeechSynthesizer::speak(const PlatformSpeechSynthesisUtterance&)
+{
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(SPEECH_SYNTHESIS)