| 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 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 static bool verifyType(const String& type) | 42 static bool verifyType(const String& type) |
| 43 { | 43 { |
| 44 return type == "offer" || type == "pranswer" || type == "answer"; | 44 return type == "offer" || type == "pranswer" || type == "answer"; |
| 45 } | 45 } |
| 46 | 46 |
| 47 PassRefPtr<RTCSessionDescription> RTCSessionDescription::create(const Dictionary
& dictionary, ExceptionState& es) | 47 PassRefPtr<RTCSessionDescription> RTCSessionDescription::create(const Dictionary
& dictionary, ExceptionState& es) |
| 48 { | 48 { |
| 49 String type; | 49 String type; |
| 50 bool ok = dictionary.get("type", type); | 50 bool ok = dictionary.get("type", type); |
| 51 if (!ok || !verifyType(type)) { | 51 if (!ok || !verifyType(type)) { |
| 52 es.throwDOMException(TypeMismatchError); | 52 es.throwUninformativeAndGenericDOMException(TypeMismatchError); |
| 53 return 0; | 53 return 0; |
| 54 } | 54 } |
| 55 | 55 |
| 56 String sdp; | 56 String sdp; |
| 57 ok = dictionary.get("sdp", sdp); | 57 ok = dictionary.get("sdp", sdp); |
| 58 if (!ok || sdp.isEmpty()) { | 58 if (!ok || sdp.isEmpty()) { |
| 59 es.throwDOMException(TypeMismatchError); | 59 es.throwUninformativeAndGenericDOMException(TypeMismatchError); |
| 60 return 0; | 60 return 0; |
| 61 } | 61 } |
| 62 | 62 |
| 63 return adoptRef(new RTCSessionDescription(WebKit::WebRTCSessionDescription(t
ype, sdp))); | 63 return adoptRef(new RTCSessionDescription(WebKit::WebRTCSessionDescription(t
ype, sdp))); |
| 64 } | 64 } |
| 65 | 65 |
| 66 PassRefPtr<RTCSessionDescription> RTCSessionDescription::create(WebKit::WebRTCSe
ssionDescription webSessionDescription) | 66 PassRefPtr<RTCSessionDescription> RTCSessionDescription::create(WebKit::WebRTCSe
ssionDescription webSessionDescription) |
| 67 { | 67 { |
| 68 return adoptRef(new RTCSessionDescription(webSessionDescription)); | 68 return adoptRef(new RTCSessionDescription(webSessionDescription)); |
| 69 } | 69 } |
| (...skipping 11 matching lines...) Expand all Loading... |
| 81 String RTCSessionDescription::type() | 81 String RTCSessionDescription::type() |
| 82 { | 82 { |
| 83 return m_webSessionDescription.type(); | 83 return m_webSessionDescription.type(); |
| 84 } | 84 } |
| 85 | 85 |
| 86 void RTCSessionDescription::setType(const String& type, ExceptionState& es) | 86 void RTCSessionDescription::setType(const String& type, ExceptionState& es) |
| 87 { | 87 { |
| 88 if (verifyType(type)) | 88 if (verifyType(type)) |
| 89 m_webSessionDescription.setType(type); | 89 m_webSessionDescription.setType(type); |
| 90 else | 90 else |
| 91 es.throwDOMException(TypeMismatchError); | 91 es.throwUninformativeAndGenericDOMException(TypeMismatchError); |
| 92 } | 92 } |
| 93 | 93 |
| 94 String RTCSessionDescription::sdp() | 94 String RTCSessionDescription::sdp() |
| 95 { | 95 { |
| 96 return m_webSessionDescription.sdp(); | 96 return m_webSessionDescription.sdp(); |
| 97 } | 97 } |
| 98 | 98 |
| 99 void RTCSessionDescription::setSdp(const String& sdp, ExceptionState& es) | 99 void RTCSessionDescription::setSdp(const String& sdp, ExceptionState& es) |
| 100 { | 100 { |
| 101 m_webSessionDescription.setSDP(sdp); | 101 m_webSessionDescription.setSDP(sdp); |
| 102 } | 102 } |
| 103 | 103 |
| 104 WebKit::WebRTCSessionDescription RTCSessionDescription::webSessionDescription() | 104 WebKit::WebRTCSessionDescription RTCSessionDescription::webSessionDescription() |
| 105 { | 105 { |
| 106 return m_webSessionDescription; | 106 return m_webSessionDescription; |
| 107 } | 107 } |
| 108 | 108 |
| 109 } // namespace WebCore | 109 } // namespace WebCore |
| OLD | NEW |