| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 case SpeechRecognitionError::ErrorCodeBadGrammar: | 47 case SpeechRecognitionError::ErrorCodeBadGrammar: |
| 48 return "bad-grammar"; | 48 return "bad-grammar"; |
| 49 case SpeechRecognitionError::ErrorCodeLanguageNotSupported: | 49 case SpeechRecognitionError::ErrorCodeLanguageNotSupported: |
| 50 return "language-not-supported"; | 50 return "language-not-supported"; |
| 51 } | 51 } |
| 52 | 52 |
| 53 ASSERT_NOT_REACHED(); | 53 ASSERT_NOT_REACHED(); |
| 54 return String(); | 54 return String(); |
| 55 } | 55 } |
| 56 | 56 |
| 57 RawPtr<SpeechRecognitionError> SpeechRecognitionError::create(ErrorCode code, co
nst String& message) | 57 SpeechRecognitionError* SpeechRecognitionError::create(ErrorCode code, const Str
ing& message) |
| 58 { | 58 { |
| 59 return new SpeechRecognitionError(ErrorCodeToString(code), message); | 59 return new SpeechRecognitionError(ErrorCodeToString(code), message); |
| 60 } | 60 } |
| 61 | 61 |
| 62 RawPtr<SpeechRecognitionError> SpeechRecognitionError::create() | 62 SpeechRecognitionError* SpeechRecognitionError::create() |
| 63 { | 63 { |
| 64 return new SpeechRecognitionError(emptyString(), emptyString()); | 64 return new SpeechRecognitionError(emptyString(), emptyString()); |
| 65 } | 65 } |
| 66 | 66 |
| 67 RawPtr<SpeechRecognitionError> SpeechRecognitionError::create(const AtomicString
& eventName, const SpeechRecognitionErrorInit& initializer) | 67 SpeechRecognitionError* SpeechRecognitionError::create(const AtomicString& event
Name, const SpeechRecognitionErrorInit& initializer) |
| 68 { | 68 { |
| 69 return new SpeechRecognitionError(eventName, initializer); | 69 return new SpeechRecognitionError(eventName, initializer); |
| 70 } | 70 } |
| 71 | 71 |
| 72 SpeechRecognitionError::SpeechRecognitionError(const String& error, const String
& message) | 72 SpeechRecognitionError::SpeechRecognitionError(const String& error, const String
& message) |
| 73 : Event(EventTypeNames::error, /*canBubble=*/false, /*cancelable=*/false) | 73 : Event(EventTypeNames::error, /*canBubble=*/false, /*cancelable=*/false) |
| 74 , m_error(error) | 74 , m_error(error) |
| 75 , m_message(message) | 75 , m_message(message) |
| 76 { | 76 { |
| 77 } | 77 } |
| 78 | 78 |
| 79 SpeechRecognitionError::SpeechRecognitionError(const AtomicString& eventName, co
nst SpeechRecognitionErrorInit& initializer) | 79 SpeechRecognitionError::SpeechRecognitionError(const AtomicString& eventName, co
nst SpeechRecognitionErrorInit& initializer) |
| 80 : Event(eventName, initializer) | 80 : Event(eventName, initializer) |
| 81 { | 81 { |
| 82 if (initializer.hasError()) | 82 if (initializer.hasError()) |
| 83 m_error = initializer.error(); | 83 m_error = initializer.error(); |
| 84 if (initializer.hasMessage()) | 84 if (initializer.hasMessage()) |
| 85 m_message = initializer.message(); | 85 m_message = initializer.message(); |
| 86 } | 86 } |
| 87 | 87 |
| 88 const AtomicString& SpeechRecognitionError::interfaceName() const | 88 const AtomicString& SpeechRecognitionError::interfaceName() const |
| 89 { | 89 { |
| 90 return EventNames::SpeechRecognitionError; | 90 return EventNames::SpeechRecognitionError; |
| 91 } | 91 } |
| 92 | 92 |
| 93 } // namespace blink | 93 } // namespace blink |
| OLD | NEW |