| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 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 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| 11 * documentation and/or other materials provided with the distribution. | 11 * documentation and/or other materials provided with the distribution. |
| 12 * | 12 * |
| 13 * THIS SOFTWARE IS PROVIDED BY GOOGLE INC. ``AS IS'' AND ANY | 13 * THIS SOFTWARE IS PROVIDED BY GOOGLE INC. ``AS IS'' AND ANY |
| 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
| 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GOOGLE INC. OR | 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GOOGLE INC. OR |
| 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
| 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
| 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
| 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 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. | 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 24 */ | 24 */ |
| 25 | 25 |
| 26 #include "config.h" | 26 #include "config.h" |
| 27 #include "modules/mediastream/SourceInfo.h" |
| 27 | 28 |
| 28 #include "core/platform/mediastream/chromium/RTCDTMFSenderHandlerChromium.h" | 29 #include "wtf/text/WTFString.h" |
| 29 | |
| 30 #include "core/platform/mediastream/RTCDTMFSenderHandlerClient.h" | |
| 31 #include <public/WebRTCDTMFSenderHandler.h> | |
| 32 #include <wtf/PassOwnPtr.h> | |
| 33 | |
| 34 using namespace WebKit; | |
| 35 | 30 |
| 36 namespace WebCore { | 31 namespace WebCore { |
| 37 | 32 |
| 38 PassOwnPtr<RTCDTMFSenderHandler> RTCDTMFSenderHandlerChromium::create(WebRTCDTMF
SenderHandler* webHandler) | 33 PassRefPtr<SourceInfo> SourceInfo::create(const WebKit::WebSourceInfo& webSource
Info) |
| 39 { | 34 { |
| 40 return adoptPtr(new RTCDTMFSenderHandlerChromium(webHandler)); | 35 ASSERT(!webSourceInfo.isNull()); |
| 36 return adoptRef(new SourceInfo(webSourceInfo)); |
| 41 } | 37 } |
| 42 | 38 |
| 43 RTCDTMFSenderHandlerChromium::RTCDTMFSenderHandlerChromium(WebRTCDTMFSenderHandl
er* webHandler) | 39 SourceInfo::SourceInfo(const WebKit::WebSourceInfo& webSourceInfo) |
| 44 : m_webHandler(adoptPtr(webHandler)) | 40 : m_webSourceInfo(webSourceInfo) |
| 45 , m_client(0) | |
| 46 { | 41 { |
| 47 } | 42 } |
| 48 | 43 |
| 49 RTCDTMFSenderHandlerChromium::~RTCDTMFSenderHandlerChromium() | 44 String SourceInfo::id() const |
| 50 { | 45 { |
| 46 return m_webSourceInfo.id(); |
| 51 } | 47 } |
| 52 | 48 |
| 53 void RTCDTMFSenderHandlerChromium::setClient(RTCDTMFSenderHandlerClient* client) | 49 String SourceInfo::kind() const |
| 54 { | 50 { |
| 55 m_client = client; | 51 switch (m_webSourceInfo.kind()) { |
| 56 m_webHandler->setClient(m_client ? this : 0); | 52 case WebKit::WebSourceInfo::SourceKindAudio: |
| 53 return ASCIILiteral("audio"); |
| 54 case WebKit::WebSourceInfo::SourceKindVideo: |
| 55 return ASCIILiteral("video"); |
| 56 case WebKit::WebSourceInfo::SourceKindNone: |
| 57 return ASCIILiteral("none"); |
| 58 } |
| 59 |
| 60 ASSERT_NOT_REACHED(); |
| 61 return String(); |
| 57 } | 62 } |
| 58 | 63 |
| 59 String RTCDTMFSenderHandlerChromium::currentToneBuffer() | 64 String SourceInfo::label() const |
| 60 { | 65 { |
| 61 return m_webHandler->currentToneBuffer(); | 66 return m_webSourceInfo.label(); |
| 62 } | 67 } |
| 63 | 68 |
| 64 bool RTCDTMFSenderHandlerChromium::canInsertDTMF() | 69 String SourceInfo::facing() const |
| 65 { | 70 { |
| 66 return m_webHandler->canInsertDTMF(); | 71 switch (m_webSourceInfo.facing()) { |
| 67 } | 72 case WebKit::WebSourceInfo::VideoFacingModeNone: |
| 73 return String(); |
| 74 case WebKit::WebSourceInfo::VideoFacingModeUser: |
| 75 return ASCIILiteral("user"); |
| 76 case WebKit::WebSourceInfo::VideoFacingModeEnvironment: |
| 77 return ASCIILiteral("environment"); |
| 78 } |
| 68 | 79 |
| 69 bool RTCDTMFSenderHandlerChromium::insertDTMF(const String& tones, long duration
, long interToneGap) | 80 ASSERT_NOT_REACHED(); |
| 70 { | 81 return String(); |
| 71 return m_webHandler->insertDTMF(tones, duration, interToneGap); | |
| 72 } | |
| 73 | |
| 74 void RTCDTMFSenderHandlerChromium::didPlayTone(const WebString& tone) const | |
| 75 { | |
| 76 if (m_client) | |
| 77 m_client->didPlayTone(tone); | |
| 78 } | 82 } |
| 79 | 83 |
| 80 } // namespace WebCore | 84 } // namespace WebCore |
| OLD | NEW |