| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_data_channel_handler.h" | 5 #include "content/renderer/media/rtc_data_channel_handler.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 | 113 |
| 114 void RtcDataChannelHandler::OnMessage(const webrtc::DataBuffer& buffer) { | 114 void RtcDataChannelHandler::OnMessage(const webrtc::DataBuffer& buffer) { |
| 115 if (!webkit_client_) { | 115 if (!webkit_client_) { |
| 116 LOG(ERROR) << "WebRTCDataChannelHandlerClient not set."; | 116 LOG(ERROR) << "WebRTCDataChannelHandlerClient not set."; |
| 117 return; | 117 return; |
| 118 } | 118 } |
| 119 | 119 |
| 120 if (buffer.binary) { | 120 if (buffer.binary) { |
| 121 webkit_client_->didReceiveRawData(buffer.data.data(), buffer.data.length()); | 121 webkit_client_->didReceiveRawData(buffer.data.data(), buffer.data.length()); |
| 122 } else { | 122 } else { |
| 123 string16 utf16; | 123 base::string16 utf16; |
| 124 if (!UTF8ToUTF16(buffer.data.data(), buffer.data.length(), &utf16)) { | 124 if (!UTF8ToUTF16(buffer.data.data(), buffer.data.length(), &utf16)) { |
| 125 LOG(ERROR) << "Failed convert received data to UTF16"; | 125 LOG(ERROR) << "Failed convert received data to UTF16"; |
| 126 return; | 126 return; |
| 127 } | 127 } |
| 128 webkit_client_->didReceiveStringData(utf16); | 128 webkit_client_->didReceiveStringData(utf16); |
| 129 } | 129 } |
| 130 } | 130 } |
| 131 | 131 |
| 132 } // namespace content | 132 } // namespace content |
| OLD | NEW |