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

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

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.h
diff --git a/Source/modules/speech/SpeechSynthesis.h b/Source/modules/speech/SpeechSynthesis.h
index f1fba776b396545b3ea490e01bf634dd63fb0f7f..20b70b9510cc89180a8be073547d4abe7c3dc7b2 100644
--- a/Source/modules/speech/SpeechSynthesis.h
+++ b/Source/modules/speech/SpeechSynthesis.h
@@ -27,6 +27,8 @@
#define SpeechSynthesis_h
#include "bindings/v8/ScriptWrappable.h"
+#include "core/dom/ContextLifecycleObserver.h"
+#include "core/events/EventTarget.h"
#include "core/platform/PlatformSpeechSynthesisUtterance.h"
#include "core/platform/PlatformSpeechSynthesizer.h"
#include "modules/speech/SpeechSynthesisUtterance.h"
@@ -41,9 +43,9 @@ namespace WebCore {
class PlatformSpeechSynthesizerClient;
class SpeechSynthesisVoice;
-class SpeechSynthesis : public PlatformSpeechSynthesizerClient, public ScriptWrappable, public RefCounted<SpeechSynthesis> {
+class SpeechSynthesis : public PlatformSpeechSynthesizerClient, public ScriptWrappable, public RefCounted<SpeechSynthesis>, public ContextLifecycleObserver, public EventTargetWithInlineData {
public:
- static PassRefPtr<SpeechSynthesis> create();
+ static PassRefPtr<SpeechSynthesis> create(ExecutionContext*);
bool pending() const;
bool speaking() const;
@@ -59,8 +61,15 @@ public:
// Used in testing to use a mock platform synthesizer
void setPlatformSynthesizer(PassOwnPtr<PlatformSpeechSynthesizer>);
+ DEFINE_ATTRIBUTE_EVENT_LISTENER(voiceschanged);
+
+ using RefCounted<SpeechSynthesis>::ref;
+ using RefCounted<SpeechSynthesis>::deref;
abarth-chromium 2013/10/16 19:25:06 There's a macro that does this work now, I believe
dmazzoni 2013/10/16 22:09:06 I can't seem to find it from a code search and a s
abarth-chromium 2013/10/17 02:00:53 http://src.chromium.org/viewvc/blink?view=revision
dmazzoni 2013/10/17 15:28:59 Thanks. No wonder I missed it, it hadn't even roll
+
+ virtual ExecutionContext* executionContext() const;
+
private:
- SpeechSynthesis();
+ SpeechSynthesis(ExecutionContext*);
abarth-chromium 2013/10/16 19:25:06 Please mark one-argument constructors explicit.
dmazzoni 2013/10/16 22:09:06 Done.
// PlatformSpeechSynthesizerClient override methods.
virtual void voicesDidChange() OVERRIDE;
@@ -80,6 +89,11 @@ private:
SpeechSynthesisUtterance* m_currentSpeechUtterance;
Deque<RefPtr<SpeechSynthesisUtterance> > m_utteranceQueue;
bool m_isPaused;
+
+ // EventTarget
+ virtual const AtomicString& interfaceName() const OVERRIDE;
+ virtual void refEventTarget() OVERRIDE { ref(); }
+ virtual void derefEventTarget() OVERRIDE { deref(); }
};
} // namespace WebCore

Powered by Google App Engine
This is Rietveld 408576698