OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/renderer/media/rtc_dtmf_sender_handler.h" | 5 #include "content/renderer/media/rtc_dtmf_sender_handler.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 // Release |observer| before |weak_factory_| is destroyed. | 62 // Release |observer| before |weak_factory_| is destroyed. |
63 observer_ = NULL; | 63 observer_ = NULL; |
64 } | 64 } |
65 | 65 |
66 void RtcDtmfSenderHandler::setClient( | 66 void RtcDtmfSenderHandler::setClient( |
67 blink::WebRTCDTMFSenderHandlerClient* client) { | 67 blink::WebRTCDTMFSenderHandlerClient* client) { |
68 webkit_client_ = client; | 68 webkit_client_ = client; |
69 } | 69 } |
70 | 70 |
71 blink::WebString RtcDtmfSenderHandler::currentToneBuffer() { | 71 blink::WebString RtcDtmfSenderHandler::currentToneBuffer() { |
72 return base::UTF8ToUTF16(dtmf_sender_->tones()); | 72 return blink::WebString::fromUTF8(dtmf_sender_->tones()); |
73 } | 73 } |
74 | 74 |
75 bool RtcDtmfSenderHandler::canInsertDTMF() { | 75 bool RtcDtmfSenderHandler::canInsertDTMF() { |
76 return dtmf_sender_->CanInsertDtmf(); | 76 return dtmf_sender_->CanInsertDtmf(); |
77 } | 77 } |
78 | 78 |
79 bool RtcDtmfSenderHandler::insertDTMF(const blink::WebString& tones, | 79 bool RtcDtmfSenderHandler::insertDTMF(const blink::WebString& tones, |
80 long duration, | 80 long duration, |
81 long interToneGap) { | 81 long interToneGap) { |
82 std::string utf8_tones = base::UTF16ToUTF8(base::StringPiece16(tones)); | 82 std::string utf8_tones = tones.utf8(); |
83 return dtmf_sender_->InsertDtmf(utf8_tones, static_cast<int>(duration), | 83 return dtmf_sender_->InsertDtmf(utf8_tones, static_cast<int>(duration), |
84 static_cast<int>(interToneGap)); | 84 static_cast<int>(interToneGap)); |
85 } | 85 } |
86 | 86 |
87 void RtcDtmfSenderHandler::OnToneChange(const std::string& tone) { | 87 void RtcDtmfSenderHandler::OnToneChange(const std::string& tone) { |
88 if (!webkit_client_) { | 88 if (!webkit_client_) { |
89 LOG(ERROR) << "WebRTCDTMFSenderHandlerClient not set."; | 89 LOG(ERROR) << "WebRTCDTMFSenderHandlerClient not set."; |
90 return; | 90 return; |
91 } | 91 } |
92 webkit_client_->didPlayTone(base::UTF8ToUTF16(tone)); | 92 webkit_client_->didPlayTone(blink::WebString::fromUTF8(tone)); |
93 } | 93 } |
94 | 94 |
95 } // namespace content | 95 } // namespace content |
96 | |
OLD | NEW |