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 13 matching lines...) Expand all Loading... |
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #include "config.h" | 31 #include "config.h" |
32 #include "modules/mediastream/RTCSessionDescription.h" | 32 #include "modules/mediastream/RTCSessionDescription.h" |
33 | 33 |
| 34 #include "bindings/core/v8/ScriptValue.h" |
| 35 #include "bindings/core/v8/V8ObjectBuilder.h" |
34 #include "modules/mediastream/RTCSessionDescriptionInit.h" | 36 #include "modules/mediastream/RTCSessionDescriptionInit.h" |
35 | 37 |
36 namespace blink { | 38 namespace blink { |
37 | 39 |
38 RTCSessionDescription* RTCSessionDescription::create(const RTCSessionDescription
Init& descriptionInitDict) | 40 RTCSessionDescription* RTCSessionDescription::create(const RTCSessionDescription
Init& descriptionInitDict) |
39 { | 41 { |
40 String type; | 42 String type; |
41 if (descriptionInitDict.hasType()) | 43 if (descriptionInitDict.hasType()) |
42 type = descriptionInitDict.type(); | 44 type = descriptionInitDict.type(); |
43 | 45 |
(...skipping 27 matching lines...) Expand all Loading... |
71 String RTCSessionDescription::sdp() | 73 String RTCSessionDescription::sdp() |
72 { | 74 { |
73 return m_webSessionDescription.sdp(); | 75 return m_webSessionDescription.sdp(); |
74 } | 76 } |
75 | 77 |
76 void RTCSessionDescription::setSdp(const String& sdp) | 78 void RTCSessionDescription::setSdp(const String& sdp) |
77 { | 79 { |
78 m_webSessionDescription.setSDP(sdp); | 80 m_webSessionDescription.setSDP(sdp); |
79 } | 81 } |
80 | 82 |
| 83 ScriptValue RTCSessionDescription::toJSONForBinding(ScriptState* scriptState) |
| 84 { |
| 85 V8ObjectBuilder result(scriptState); |
| 86 if (type().isNull()) |
| 87 result.addNull("type"); |
| 88 else |
| 89 result.addString("type", type()); |
| 90 if (sdp().isNull()) |
| 91 result.addNull("sdp"); |
| 92 else |
| 93 result.addString("sdp", sdp()); |
| 94 return result.scriptValue(); |
| 95 } |
| 96 |
81 WebRTCSessionDescription RTCSessionDescription::webSessionDescription() | 97 WebRTCSessionDescription RTCSessionDescription::webSessionDescription() |
82 { | 98 { |
83 return m_webSessionDescription; | 99 return m_webSessionDescription; |
84 } | 100 } |
85 | 101 |
86 } // namespace blink | 102 } // namespace blink |
OLD | NEW |