OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright (C) 2015 Google Inc. All rights reserved. |
| 3 * |
| 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions |
| 6 * are met: |
| 7 * * Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. |
| 9 * * Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the |
| 11 * documentation and/or other materials provided with the distribution. |
| 12 * |
| 13 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY |
| 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
| 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR |
| 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
| 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
| 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
| 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 24 */ |
| 25 |
| 26 #include "config.h" |
| 27 |
| 28 #include "modules/speech/SpeechSynthesisErrorEvent.h" |
| 29 |
| 30 namespace blink { |
| 31 |
| 32 static String ErrorCodeToString(SpeechSynthesisErrorEvent::ErrorCode code) |
| 33 { |
| 34 switch (code) { |
| 35 case SpeechSynthesisErrorEvent::ErrorCodeNone: |
| 36 return "none"; |
| 37 case SpeechSynthesisErrorEvent::ErrorCodeCanceled: |
| 38 return "canceled"; |
| 39 case SpeechSynthesisErrorEvent::ErrorCodeInterrupted: |
| 40 return "interrupted"; |
| 41 case SpeechSynthesisErrorEvent::ErrorCodeAudioBusy: |
| 42 return "audio-busy"; |
| 43 case SpeechSynthesisErrorEvent::ErrorCodeAudioHardware: |
| 44 return "audio-hardware"; |
| 45 case SpeechSynthesisErrorEvent::ErrorCodeNetwork: |
| 46 return "network"; |
| 47 case SpeechSynthesisErrorEvent::ErrorCodeSynthesisUnavailable: |
| 48 return "synthesis-unavailable"; |
| 49 case SpeechSynthesisErrorEvent::ErrorCodeSynthesisFailed: |
| 50 return "synthesis-failed"; |
| 51 case SpeechSynthesisErrorEvent::ErrorCodeLanguageUnavailable: |
| 52 return "language-unavailable"; |
| 53 case SpeechSynthesisErrorEvent::ErrorCodeVoiceUnavailable: |
| 54 return "voice-unavailable"; |
| 55 case SpeechSynthesisErrorEvent::ErrorCodeTextTooLong: |
| 56 return "text-too-long"; |
| 57 case SpeechSynthesisErrorEvent::ErrorCodeInvalidArgument: |
| 58 return "invalid-argument"; |
| 59 } |
| 60 |
| 61 ASSERT_NOT_REACHED(); |
| 62 return String(); |
| 63 } |
| 64 |
| 65 PassRefPtrWillBeRawPtr<SpeechSynthesisErrorEvent> SpeechSynthesisErrorEvent::cre
ate() |
| 66 { |
| 67 return adoptRefWillBeNoop(new SpeechSynthesisErrorEvent(emptyString())); |
| 68 } |
| 69 |
| 70 PassRefPtrWillBeRawPtr<SpeechSynthesisErrorEvent> SpeechSynthesisErrorEvent::cre
ate(ErrorCode code) |
| 71 { |
| 72 return adoptRefWillBeNoop(new SpeechSynthesisErrorEvent(ErrorCodeToString(co
de))); |
| 73 } |
| 74 |
| 75 #if 0 |
| 76 PassRefPtrWillBeRawPtr<SpeechSynthesisErrorEvent> SpeechSynthesisErrorEvent::cre
ate(const AtomicString& eventName) |
| 77 { |
| 78 return adoptRefWillBeNoop(new SpeechSynthesisErrorEvent(eventName)); |
| 79 } |
| 80 #endif |
| 81 |
| 82 SpeechSynthesisErrorEvent::SpeechSynthesisErrorEvent(const String& error) |
| 83 : Event(EventTypeNames::error, /*canBubble=*/false, /*cancelable=*/false) |
| 84 , m_error(error) |
| 85 { |
| 86 } |
| 87 |
| 88 #if 0 |
| 89 SpeechSynthesisErrorEvent::SpeechSynthesisErrorEvent(const AtomicString& eventNa
me) |
| 90 : Event(eventName, /*canBubble=*/false, /*cancelable=*/false) |
| 91 , m_error(error) |
| 92 { |
| 93 } |
| 94 |
| 95 const AtomicString& SpeechSynthesisErrorEvent::interfaceName() const |
| 96 { |
| 97 return EventNames::SpeechSynthesisErrorEvent; |
| 98 } |
| 99 #endif |
| 100 |
| 101 } // namespace blink |
OLD | NEW |