Home | History | Annotate | Download | only in exported
      1 /*
      2  * Copyright (C) 2012 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 are
      6  * met:
      7  *
      8  *     * Redistributions of source code must retain the above copyright
      9  * notice, this list of conditions and the following disclaimer.
     10  *     * Redistributions in binary form must reproduce the above
     11  * copyright notice, this list of conditions and the following disclaimer
     12  * in the documentation and/or other materials provided with the
     13  * distribution.
     14  *     * Neither the name of Google Inc. nor the names of its
     15  * contributors may be used to endorse or promote products derived from
     16  * this software without specific prior written permission.
     17  *
     18  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     19  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     20  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
     21  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
     22  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
     23  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
     24  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     25  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     26  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     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.
     29  */
     30 
     31 #include "config.h"
     32 
     33 #include "public/platform/WebRTCSessionDescription.h"
     34 
     35 #include "public/platform/WebString.h"
     36 #include "wtf/PassRefPtr.h"
     37 #include "wtf/RefCounted.h"
     38 
     39 namespace blink {
     40 
     41 class WebRTCSessionDescriptionPrivate FINAL : public RefCounted<WebRTCSessionDescriptionPrivate> {
     42 public:
     43     static PassRefPtr<WebRTCSessionDescriptionPrivate> create(const WebString& type, const WebString& sdp);
     44 
     45     WebString type() { return m_type; }
     46     void setType(const WebString& type) { m_type = type; }
     47 
     48     WebString sdp() { return m_sdp; }
     49     void setSdp(const WebString& sdp) { m_sdp = sdp; }
     50 
     51 private:
     52     WebRTCSessionDescriptionPrivate(const WebString& type, const WebString& sdp);
     53 
     54     WebString m_type;
     55     WebString m_sdp;
     56 };
     57 
     58 PassRefPtr<WebRTCSessionDescriptionPrivate> WebRTCSessionDescriptionPrivate::create(const WebString& type, const WebString& sdp)
     59 {
     60     return adoptRef(new WebRTCSessionDescriptionPrivate(type, sdp));
     61 }
     62 
     63 WebRTCSessionDescriptionPrivate::WebRTCSessionDescriptionPrivate(const WebString& type, const WebString& sdp)
     64     : m_type(type)
     65     , m_sdp(sdp)
     66 {
     67 }
     68 
     69 void WebRTCSessionDescription::assign(const WebRTCSessionDescription& other)
     70 {
     71     m_private = other.m_private;
     72 }
     73 
     74 void WebRTCSessionDescription::reset()
     75 {
     76     m_private.reset();
     77 }
     78 
     79 void WebRTCSessionDescription::initialize(const WebString& type, const WebString& sdp)
     80 {
     81     m_private = WebRTCSessionDescriptionPrivate::create(type, sdp);
     82 }
     83 
     84 WebString WebRTCSessionDescription::type() const
     85 {
     86     ASSERT(!m_private.isNull());
     87     return m_private->type();
     88 }
     89 
     90 void WebRTCSessionDescription::setType(const WebString& type)
     91 {
     92     ASSERT(!m_private.isNull());
     93     return m_private->setType(type);
     94 }
     95 
     96 WebString WebRTCSessionDescription::sdp() const
     97 {
     98     ASSERT(!m_private.isNull());
     99     return m_private->sdp();
    100 }
    101 
    102 void WebRTCSessionDescription::setSDP(const WebString& sdp)
    103 {
    104     ASSERT(!m_private.isNull());
    105     return m_private->setSdp(sdp);
    106 }
    107 
    108 } // namespace blink
    109 
    110