2 * Copyright (C) 2011 Google Inc. All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
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
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.
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.
33 #include "public/web/WebUserMediaRequest.h"
35 #include "core/dom/Document.h"
36 #include "modules/mediastream/UserMediaRequest.h"
37 #include "platform/mediastream/MediaStreamDescriptor.h"
38 #include "platform/mediastream/MediaStreamSource.h"
39 #include "platform/weborigin/SecurityOrigin.h"
40 #include "public/platform/WebMediaConstraints.h"
41 #include "public/platform/WebMediaStream.h"
42 #include "public/platform/WebMediaStreamSource.h"
43 #include "public/platform/WebSecurityOrigin.h"
44 #include "public/platform/WebString.h"
45 #include "public/web/WebDocument.h"
49 WebUserMediaRequest::WebUserMediaRequest(UserMediaRequest
* request
)
54 void WebUserMediaRequest::reset()
59 bool WebUserMediaRequest::audio() const
62 return m_private
->audio();
65 bool WebUserMediaRequest::video() const
68 return m_private
->video();
71 WebMediaConstraints
WebUserMediaRequest::audioConstraints() const
74 return m_private
->audioConstraints();
77 WebMediaConstraints
WebUserMediaRequest::videoConstraints() const
80 return m_private
->videoConstraints();
83 WebSecurityOrigin
WebUserMediaRequest::securityOrigin() const
85 ASSERT(!isNull() && m_private
->executionContext());
86 return WebSecurityOrigin(m_private
->executionContext()->securityOrigin());
89 WebDocument
WebUserMediaRequest::ownerDocument() const
92 return WebDocument(m_private
->ownerDocument());
95 void WebUserMediaRequest::requestSucceeded(const WebMediaStream
& streamDescriptor
)
97 ASSERT(!isNull() && !streamDescriptor
.isNull());
98 m_private
->succeed(streamDescriptor
);
101 void WebUserMediaRequest::requestDenied(const WebString
& description
)
104 m_private
->failPermissionDenied(description
);
107 void WebUserMediaRequest::requestFailedConstraint(const WebString
& constraintName
, const WebString
& description
)
110 m_private
->failConstraint(constraintName
, description
);
113 void WebUserMediaRequest::requestFailedUASpecific(const WebString
& name
, const WebString
& constraintName
, const WebString
& description
)
116 m_private
->failUASpecific(name
, constraintName
, description
);
119 bool WebUserMediaRequest::equals(const WebUserMediaRequest
& other
) const
121 if (isNull() || other
.isNull())
123 return m_private
.get() == other
.m_private
.get();
126 void WebUserMediaRequest::assign(const WebUserMediaRequest
& other
)
128 m_private
= other
.m_private
;
131 WebUserMediaRequest::operator UserMediaRequest
*() const
133 return m_private
.get();