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 "config.h" |
| 27 |
| 28 #include <public/WebSourceInfo.h> |
| 29 |
| 30 #include "wtf/PassRefPtr.h" |
| 31 #include "wtf/RefCounted.h" |
| 32 #include <public/WebString.h> |
| 33 |
| 34 namespace WebKit { |
| 35 |
| 36 class WebSourceInfoPrivate : public RefCounted<WebSourceInfoPrivate> { |
| 37 public: |
| 38 static PassRefPtr<WebSourceInfoPrivate> create(const WebString& id, WebSourc
eInfo::SourceKind, const WebString& label, WebSourceInfo::VideoFacingMode); |
| 39 virtual ~WebSourceInfoPrivate(); |
| 40 |
| 41 WebString id() const { return m_id; } |
| 42 WebSourceInfo::SourceKind kind() const { return m_kind; } |
| 43 WebString label() const { return m_label; } |
| 44 WebSourceInfo::VideoFacingMode facing() const { return m_facing; } |
| 45 |
| 46 private: |
| 47 WebSourceInfoPrivate(const WebString& id, WebSourceInfo::SourceKind, const W
ebString& label, WebSourceInfo::VideoFacingMode); |
| 48 |
| 49 WebString m_id; |
| 50 WebSourceInfo::SourceKind m_kind; |
| 51 WebString m_label; |
| 52 WebSourceInfo::VideoFacingMode m_facing; |
| 53 }; |
| 54 |
| 55 PassRefPtr<WebSourceInfoPrivate> WebSourceInfoPrivate::create(const WebString& i
d, WebSourceInfo::SourceKind kind, const WebString& label, WebSourceInfo::VideoF
acingMode facing) |
| 56 { |
| 57 return adoptRef(new WebSourceInfoPrivate(id, kind, label, facing)); |
| 58 } |
| 59 |
| 60 WebSourceInfoPrivate::WebSourceInfoPrivate(const WebString& id, WebSourceInfo::S
ourceKind kind, const WebString& label, WebSourceInfo::VideoFacingMode facing) |
| 61 : m_id(id) |
| 62 , m_kind(kind) |
| 63 , m_label(label) |
| 64 , m_facing(facing) |
| 65 { |
| 66 } |
| 67 |
| 68 WebSourceInfoPrivate::~WebSourceInfoPrivate() |
| 69 { |
| 70 } |
| 71 |
| 72 void WebSourceInfo::assign(const WebSourceInfo& other) |
| 73 { |
| 74 m_private = other.m_private; |
| 75 } |
| 76 |
| 77 void WebSourceInfo::reset() |
| 78 { |
| 79 m_private.reset(); |
| 80 } |
| 81 |
| 82 void WebSourceInfo::initialize(const WebString& id, WebSourceInfo::SourceKind ki
nd, const WebString& label, WebSourceInfo::VideoFacingMode facing) |
| 83 { |
| 84 m_private = WebSourceInfoPrivate::create(id, kind, label, facing); |
| 85 } |
| 86 |
| 87 WebString WebSourceInfo::id() const |
| 88 { |
| 89 ASSERT(!m_private.isNull()); |
| 90 return m_private->id(); |
| 91 } |
| 92 |
| 93 WebSourceInfo::SourceKind WebSourceInfo::kind() const |
| 94 { |
| 95 ASSERT(!m_private.isNull()); |
| 96 return m_private->kind(); |
| 97 } |
| 98 |
| 99 WebString WebSourceInfo::label() const |
| 100 { |
| 101 ASSERT(!m_private.isNull()); |
| 102 return m_private->label(); |
| 103 } |
| 104 |
| 105 WebSourceInfo::VideoFacingMode WebSourceInfo::facing() const |
| 106 { |
| 107 ASSERT(!m_private.isNull()); |
| 108 return m_private->facing(); |
| 109 } |
| 110 |
| 111 } // namespace WebKit |
| 112 |
OLD | NEW |