OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google 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 * * Redistributions of source code must retain the above copyright | 7 * * 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 * * Redistributions in binary form must reproduce the above copyright | 9 * * 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 13 matching lines...) Expand all Loading... |
24 */ | 24 */ |
25 | 25 |
26 #include "config.h" | 26 #include "config.h" |
27 #include "core/platform/chromium/support/WebSpeechSynthesizerClientImpl.h" | 27 #include "core/platform/chromium/support/WebSpeechSynthesizerClientImpl.h" |
28 | 28 |
29 #include "core/platform/PlatformSpeechSynthesisUtterance.h" | 29 #include "core/platform/PlatformSpeechSynthesisUtterance.h" |
30 | 30 |
31 namespace WebCore { | 31 namespace WebCore { |
32 | 32 |
33 WebSpeechSynthesizerClientImpl::WebSpeechSynthesizerClientImpl(PlatformSpeechSyn
thesizer* synthesizer, PlatformSpeechSynthesizerClient* client) | 33 WebSpeechSynthesizerClientImpl::WebSpeechSynthesizerClientImpl(PlatformSpeechSyn
thesizer* synthesizer, PlatformSpeechSynthesizerClient* client) |
34 #if ENABLE(SPEECH_SYNTHESIS) | |
35 : m_synthesizer(synthesizer) | 34 : m_synthesizer(synthesizer) |
36 , m_client(client) | 35 , m_client(client) |
37 #endif | |
38 { | 36 { |
39 } | 37 } |
40 | 38 |
41 WebSpeechSynthesizerClientImpl::~WebSpeechSynthesizerClientImpl() | 39 WebSpeechSynthesizerClientImpl::~WebSpeechSynthesizerClientImpl() |
42 { | 40 { |
43 } | 41 } |
44 | 42 |
45 void WebSpeechSynthesizerClientImpl::setVoiceList(const WebKit::WebVector<WebKit
::WebSpeechSynthesisVoice>& voices) | 43 void WebSpeechSynthesizerClientImpl::setVoiceList(const WebKit::WebVector<WebKit
::WebSpeechSynthesisVoice>& voices) |
46 { | 44 { |
47 #if ENABLE(SPEECH_SYNTHESIS) | |
48 Vector<RefPtr<PlatformSpeechSynthesisVoice> > outVoices; | 45 Vector<RefPtr<PlatformSpeechSynthesisVoice> > outVoices; |
49 for (size_t i = 0; i < voices.size(); i++) | 46 for (size_t i = 0; i < voices.size(); i++) |
50 outVoices.append(PassRefPtr<PlatformSpeechSynthesisVoice>(voices[i])); | 47 outVoices.append(PassRefPtr<PlatformSpeechSynthesisVoice>(voices[i])); |
51 m_synthesizer->setVoiceList(outVoices); | 48 m_synthesizer->setVoiceList(outVoices); |
52 m_client->voicesDidChange(); | 49 m_client->voicesDidChange(); |
53 #endif | |
54 } | 50 } |
55 | 51 |
56 void WebSpeechSynthesizerClientImpl::didStartSpeaking(const WebKit::WebSpeechSyn
thesisUtterance& utterance) | 52 void WebSpeechSynthesizerClientImpl::didStartSpeaking(const WebKit::WebSpeechSyn
thesisUtterance& utterance) |
57 { | 53 { |
58 #if ENABLE(SPEECH_SYNTHESIS) | |
59 m_client->didStartSpeaking(utterance); | 54 m_client->didStartSpeaking(utterance); |
60 #endif | |
61 } | 55 } |
62 | 56 |
63 void WebSpeechSynthesizerClientImpl::didFinishSpeaking(const WebKit::WebSpeechSy
nthesisUtterance& utterance) | 57 void WebSpeechSynthesizerClientImpl::didFinishSpeaking(const WebKit::WebSpeechSy
nthesisUtterance& utterance) |
64 { | 58 { |
65 #if ENABLE(SPEECH_SYNTHESIS) | |
66 m_client->didFinishSpeaking(utterance); | 59 m_client->didFinishSpeaking(utterance); |
67 #endif | |
68 } | 60 } |
69 | 61 |
70 void WebSpeechSynthesizerClientImpl::didPauseSpeaking(const WebKit::WebSpeechSyn
thesisUtterance& utterance) | 62 void WebSpeechSynthesizerClientImpl::didPauseSpeaking(const WebKit::WebSpeechSyn
thesisUtterance& utterance) |
71 { | 63 { |
72 #if ENABLE(SPEECH_SYNTHESIS) | |
73 m_client->didPauseSpeaking(utterance); | 64 m_client->didPauseSpeaking(utterance); |
74 #endif | |
75 } | 65 } |
76 | 66 |
77 void WebSpeechSynthesizerClientImpl::didResumeSpeaking(const WebKit::WebSpeechSy
nthesisUtterance& utterance) | 67 void WebSpeechSynthesizerClientImpl::didResumeSpeaking(const WebKit::WebSpeechSy
nthesisUtterance& utterance) |
78 { | 68 { |
79 #if ENABLE(SPEECH_SYNTHESIS) | |
80 m_client->didResumeSpeaking(utterance); | 69 m_client->didResumeSpeaking(utterance); |
81 #endif | |
82 } | 70 } |
83 | 71 |
84 void WebSpeechSynthesizerClientImpl::speakingErrorOccurred(const WebKit::WebSpee
chSynthesisUtterance& utterance) | 72 void WebSpeechSynthesizerClientImpl::speakingErrorOccurred(const WebKit::WebSpee
chSynthesisUtterance& utterance) |
85 { | 73 { |
86 #if ENABLE(SPEECH_SYNTHESIS) | |
87 m_client->speakingErrorOccurred(utterance); | 74 m_client->speakingErrorOccurred(utterance); |
88 #endif | |
89 } | 75 } |
90 | 76 |
91 void WebSpeechSynthesizerClientImpl::wordBoundaryEventOccurred(const WebKit::Web
SpeechSynthesisUtterance& utterance, unsigned charIndex) | 77 void WebSpeechSynthesizerClientImpl::wordBoundaryEventOccurred(const WebKit::Web
SpeechSynthesisUtterance& utterance, unsigned charIndex) |
92 { | 78 { |
93 #if ENABLE(SPEECH_SYNTHESIS) | |
94 m_client->boundaryEventOccurred(utterance, SpeechWordBoundary, charIndex); | 79 m_client->boundaryEventOccurred(utterance, SpeechWordBoundary, charIndex); |
95 #endif | |
96 } | 80 } |
97 | 81 |
98 void WebSpeechSynthesizerClientImpl::sentenceBoundaryEventOccurred(const WebKit:
:WebSpeechSynthesisUtterance& utterance, unsigned charIndex) | 82 void WebSpeechSynthesizerClientImpl::sentenceBoundaryEventOccurred(const WebKit:
:WebSpeechSynthesisUtterance& utterance, unsigned charIndex) |
99 { | 83 { |
100 #if ENABLE(SPEECH_SYNTHESIS) | |
101 m_client->boundaryEventOccurred(utterance, SpeechSentenceBoundary, charIndex
); | 84 m_client->boundaryEventOccurred(utterance, SpeechSentenceBoundary, charIndex
); |
102 #endif | |
103 } | 85 } |
104 | 86 |
105 } // namespace WebCore | 87 } // namespace WebCore |
OLD | NEW |