| Index: Source/modules/speech/SpeechSynthesisErrorEvent.cpp
|
| diff --git a/Source/modules/speech/SpeechSynthesisErrorEvent.cpp b/Source/modules/speech/SpeechSynthesisErrorEvent.cpp
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..a0c1e5023757f99c67b86ca84d23ac0fbc6ae6da
|
| --- /dev/null
|
| +++ b/Source/modules/speech/SpeechSynthesisErrorEvent.cpp
|
| @@ -0,0 +1,101 @@
|
| +/*
|
| + * Copyright (C) 2015 Google 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:
|
| + * * Redistributions of source code must retain the above copyright
|
| + * notice, this list of conditions and the following disclaimer.
|
| + * * 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 THE COPYRIGHT HOLDERS ``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 THE COPYRIGHT OWNER 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 "modules/speech/SpeechSynthesisErrorEvent.h"
|
| +
|
| +namespace blink {
|
| +
|
| +static String ErrorCodeToString(SpeechSynthesisErrorEvent::ErrorCode code)
|
| +{
|
| + switch (code) {
|
| + case SpeechSynthesisErrorEvent::ErrorCodeNone:
|
| + return "none";
|
| + case SpeechSynthesisErrorEvent::ErrorCodeCanceled:
|
| + return "canceled";
|
| + case SpeechSynthesisErrorEvent::ErrorCodeInterrupted:
|
| + return "interrupted";
|
| + case SpeechSynthesisErrorEvent::ErrorCodeAudioBusy:
|
| + return "audio-busy";
|
| + case SpeechSynthesisErrorEvent::ErrorCodeAudioHardware:
|
| + return "audio-hardware";
|
| + case SpeechSynthesisErrorEvent::ErrorCodeNetwork:
|
| + return "network";
|
| + case SpeechSynthesisErrorEvent::ErrorCodeSynthesisUnavailable:
|
| + return "synthesis-unavailable";
|
| + case SpeechSynthesisErrorEvent::ErrorCodeSynthesisFailed:
|
| + return "synthesis-failed";
|
| + case SpeechSynthesisErrorEvent::ErrorCodeLanguageUnavailable:
|
| + return "language-unavailable";
|
| + case SpeechSynthesisErrorEvent::ErrorCodeVoiceUnavailable:
|
| + return "voice-unavailable";
|
| + case SpeechSynthesisErrorEvent::ErrorCodeTextTooLong:
|
| + return "text-too-long";
|
| + case SpeechSynthesisErrorEvent::ErrorCodeInvalidArgument:
|
| + return "invalid-argument";
|
| + }
|
| +
|
| + ASSERT_NOT_REACHED();
|
| + return String();
|
| +}
|
| +
|
| +PassRefPtrWillBeRawPtr<SpeechSynthesisErrorEvent> SpeechSynthesisErrorEvent::create()
|
| +{
|
| + return adoptRefWillBeNoop(new SpeechSynthesisErrorEvent(emptyString()));
|
| +}
|
| +
|
| +PassRefPtrWillBeRawPtr<SpeechSynthesisErrorEvent> SpeechSynthesisErrorEvent::create(ErrorCode code)
|
| +{
|
| + return adoptRefWillBeNoop(new SpeechSynthesisErrorEvent(ErrorCodeToString(code)));
|
| +}
|
| +
|
| +#if 0
|
| +PassRefPtrWillBeRawPtr<SpeechSynthesisErrorEvent> SpeechSynthesisErrorEvent::create(const AtomicString& eventName)
|
| +{
|
| + return adoptRefWillBeNoop(new SpeechSynthesisErrorEvent(eventName));
|
| +}
|
| +#endif
|
| +
|
| +SpeechSynthesisErrorEvent::SpeechSynthesisErrorEvent(const String& error)
|
| + : Event(EventTypeNames::error, /*canBubble=*/false, /*cancelable=*/false)
|
| + , m_error(error)
|
| +{
|
| +}
|
| +
|
| +#if 0
|
| +SpeechSynthesisErrorEvent::SpeechSynthesisErrorEvent(const AtomicString& eventName)
|
| + : Event(eventName, /*canBubble=*/false, /*cancelable=*/false)
|
| + , m_error(error)
|
| +{
|
| +}
|
| +
|
| +const AtomicString& SpeechSynthesisErrorEvent::interfaceName() const
|
| +{
|
| + return EventNames::SpeechSynthesisErrorEvent;
|
| +}
|
| +#endif
|
| +
|
| +} // namespace blink
|
|
|