| OLD | NEW |
| (Empty) | |
| 1 /* |
| 2 * Copyright (C) 2013 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 |
| 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the |
| 11 * documentation and/or other materials provided with the distribution. |
| 12 * |
| 13 * THIS SOFTWARE IS PROVIDED BY GOOGLE INC. ``AS IS'' AND ANY |
| 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
| 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GOOGLE INC. OR |
| 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
| 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
| 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
| 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 24 */ |
| 25 |
| 26 #include "public/platform/WebSourceInfo.h" |
| 27 |
| 28 #include "public/platform/WebString.h" |
| 29 #include "wtf/PassRefPtr.h" |
| 30 #include "wtf/RefCounted.h" |
| 31 |
| 32 namespace blink { |
| 33 |
| 34 class WebSourceInfoPrivate final : public RefCounted<WebSourceInfoPrivate> { |
| 35 public: |
| 36 static PassRefPtr<WebSourceInfoPrivate> create( |
| 37 const WebString& id, |
| 38 WebSourceInfo::SourceKind, |
| 39 const WebString& label, |
| 40 WebSourceInfo::VideoFacingMode); |
| 41 |
| 42 const WebString& id() const { return m_id; } |
| 43 WebSourceInfo::SourceKind kind() const { return m_kind; } |
| 44 const WebString& label() const { return m_label; } |
| 45 WebSourceInfo::VideoFacingMode facing() const { return m_facing; } |
| 46 |
| 47 private: |
| 48 WebSourceInfoPrivate(const WebString& id, |
| 49 WebSourceInfo::SourceKind, |
| 50 const WebString& label, |
| 51 WebSourceInfo::VideoFacingMode); |
| 52 |
| 53 WebString m_id; |
| 54 WebSourceInfo::SourceKind m_kind; |
| 55 WebString m_label; |
| 56 WebSourceInfo::VideoFacingMode m_facing; |
| 57 }; |
| 58 |
| 59 PassRefPtr<WebSourceInfoPrivate> WebSourceInfoPrivate::create( |
| 60 const WebString& id, |
| 61 WebSourceInfo::SourceKind kind, |
| 62 const WebString& label, |
| 63 WebSourceInfo::VideoFacingMode facing) { |
| 64 return adoptRef(new WebSourceInfoPrivate(id, kind, label, facing)); |
| 65 } |
| 66 |
| 67 WebSourceInfoPrivate::WebSourceInfoPrivate( |
| 68 const WebString& id, |
| 69 WebSourceInfo::SourceKind kind, |
| 70 const WebString& label, |
| 71 WebSourceInfo::VideoFacingMode facing) |
| 72 : m_id(id), m_kind(kind), m_label(label), m_facing(facing) {} |
| 73 |
| 74 void WebSourceInfo::assign(const WebSourceInfo& other) { |
| 75 m_private = other.m_private; |
| 76 } |
| 77 |
| 78 void WebSourceInfo::reset() { |
| 79 m_private.reset(); |
| 80 } |
| 81 |
| 82 void WebSourceInfo::initialize(const WebString& id, |
| 83 WebSourceInfo::SourceKind kind, |
| 84 const WebString& label, |
| 85 WebSourceInfo::VideoFacingMode facing) { |
| 86 m_private = WebSourceInfoPrivate::create(id, kind, label, facing); |
| 87 } |
| 88 |
| 89 WebString WebSourceInfo::id() const { |
| 90 ASSERT(!m_private.isNull()); |
| 91 return m_private->id(); |
| 92 } |
| 93 |
| 94 WebSourceInfo::SourceKind WebSourceInfo::kind() const { |
| 95 ASSERT(!m_private.isNull()); |
| 96 return m_private->kind(); |
| 97 } |
| 98 |
| 99 WebString WebSourceInfo::label() const { |
| 100 ASSERT(!m_private.isNull()); |
| 101 return m_private->label(); |
| 102 } |
| 103 |
| 104 WebSourceInfo::VideoFacingMode WebSourceInfo::facing() const { |
| 105 ASSERT(!m_private.isNull()); |
| 106 return m_private->facing(); |
| 107 } |
| 108 |
| 109 } // namespace blink |
| OLD | NEW |