| 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 30 matching lines...) Expand all Loading... |
| 41 static bool verifyType(const String& type) | 41 static bool verifyType(const String& type) |
| 42 { | 42 { |
| 43 return type == "offer" || type == "pranswer" || type == "answer"; | 43 return type == "offer" || type == "pranswer" || type == "answer"; |
| 44 } | 44 } |
| 45 | 45 |
| 46 PassRefPtr<RTCSessionDescription> RTCSessionDescription::create(const Dictionary
& dictionary, ExceptionCode& ec) | 46 PassRefPtr<RTCSessionDescription> RTCSessionDescription::create(const Dictionary
& dictionary, ExceptionCode& ec) |
| 47 { | 47 { |
| 48 String type; | 48 String type; |
| 49 bool ok = dictionary.get("type", type); | 49 bool ok = dictionary.get("type", type); |
| 50 if (!ok || !verifyType(type)) { | 50 if (!ok || !verifyType(type)) { |
| 51 ec = TYPE_MISMATCH_ERR; | 51 ec = TypeMismatchError; |
| 52 return 0; | 52 return 0; |
| 53 } | 53 } |
| 54 | 54 |
| 55 String sdp; | 55 String sdp; |
| 56 ok = dictionary.get("sdp", sdp); | 56 ok = dictionary.get("sdp", sdp); |
| 57 if (!ok || sdp.isEmpty()) { | 57 if (!ok || sdp.isEmpty()) { |
| 58 ec = TYPE_MISMATCH_ERR; | 58 ec = TypeMismatchError; |
| 59 return 0; | 59 return 0; |
| 60 } | 60 } |
| 61 | 61 |
| 62 return adoptRef(new RTCSessionDescription(WebKit::WebRTCSessionDescription(t
ype, sdp))); | 62 return adoptRef(new RTCSessionDescription(WebKit::WebRTCSessionDescription(t
ype, sdp))); |
| 63 } | 63 } |
| 64 | 64 |
| 65 PassRefPtr<RTCSessionDescription> RTCSessionDescription::create(WebKit::WebRTCSe
ssionDescription webSessionDescription) | 65 PassRefPtr<RTCSessionDescription> RTCSessionDescription::create(WebKit::WebRTCSe
ssionDescription webSessionDescription) |
| 66 { | 66 { |
| 67 return adoptRef(new RTCSessionDescription(webSessionDescription)); | 67 return adoptRef(new RTCSessionDescription(webSessionDescription)); |
| 68 } | 68 } |
| (...skipping 11 matching lines...) Expand all Loading... |
| 80 String RTCSessionDescription::type() | 80 String RTCSessionDescription::type() |
| 81 { | 81 { |
| 82 return m_webSessionDescription.type(); | 82 return m_webSessionDescription.type(); |
| 83 } | 83 } |
| 84 | 84 |
| 85 void RTCSessionDescription::setType(const String& type, ExceptionCode& ec) | 85 void RTCSessionDescription::setType(const String& type, ExceptionCode& ec) |
| 86 { | 86 { |
| 87 if (verifyType(type)) | 87 if (verifyType(type)) |
| 88 m_webSessionDescription.setType(type); | 88 m_webSessionDescription.setType(type); |
| 89 else | 89 else |
| 90 ec = TYPE_MISMATCH_ERR; | 90 ec = TypeMismatchError; |
| 91 } | 91 } |
| 92 | 92 |
| 93 String RTCSessionDescription::sdp() | 93 String RTCSessionDescription::sdp() |
| 94 { | 94 { |
| 95 return m_webSessionDescription.sdp(); | 95 return m_webSessionDescription.sdp(); |
| 96 } | 96 } |
| 97 | 97 |
| 98 void RTCSessionDescription::setSdp(const String& sdp, ExceptionCode& ec) | 98 void RTCSessionDescription::setSdp(const String& sdp, ExceptionCode& ec) |
| 99 { | 99 { |
| 100 m_webSessionDescription.setSDP(sdp); | 100 m_webSessionDescription.setSDP(sdp); |
| 101 } | 101 } |
| 102 | 102 |
| 103 WebKit::WebRTCSessionDescription RTCSessionDescription::webSessionDescription() | 103 WebKit::WebRTCSessionDescription RTCSessionDescription::webSessionDescription() |
| 104 { | 104 { |
| 105 return m_webSessionDescription; | 105 return m_webSessionDescription; |
| 106 } | 106 } |
| 107 | 107 |
| 108 } // namespace WebCore | 108 } // namespace WebCore |
| OLD | NEW |