Chromium Code Reviews| 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/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 86 default: | 86 default: |
| 87 NOTREACHED(); | 87 NOTREACHED(); |
| 88 break; | 88 break; |
| 89 } | 89 } |
| 90 } | 90 } |
| 91 | 91 |
| 92 void RtcDataChannelHandler::OnMessage(const webrtc::DataBuffer& buffer) { | 92 void RtcDataChannelHandler::OnMessage(const webrtc::DataBuffer& buffer) { |
| 93 if (!webkit_client_) { | 93 if (!webkit_client_) { |
| 94 LOG(ERROR) << "WebRTCDataChannelHandlerClient not set."; | 94 LOG(ERROR) << "WebRTCDataChannelHandlerClient not set."; |
| 95 return; | 95 return; |
| 96 } | 96 } |
|
phoglund_chromium
2013/01/09 12:40:36
Intentional?
perkj_chrome
2013/01/09 13:56:21
nope
perkj_chrome
2013/01/09 13:56:21
nope
| |
| 97 | 97 DVLOG(1) << "OnMessage"; |
| 98 if (buffer.binary) { | 98 if (buffer.binary) { |
| 99 webkit_client_->didReceiveRawData(buffer.data.data(), buffer.data.length()); | 99 webkit_client_->didReceiveRawData(buffer.data.data(), buffer.data.length()); |
| 100 } else { | 100 } else { |
| 101 string16 utf16; | 101 string16 utf16; |
| 102 if (!UTF8ToUTF16(buffer.data.data(), buffer.data.length(), &utf16)) { | 102 if (!UTF8ToUTF16(buffer.data.data(), buffer.data.length(), &utf16)) { |
| 103 LOG(ERROR) << "Failed convert received data to UTF16"; | 103 LOG(ERROR) << "Failed convert received data to UTF16"; |
| 104 return; | 104 return; |
| 105 } | 105 } |
| 106 webkit_client_->didReceiveStringData(utf16); | 106 webkit_client_->didReceiveStringData(utf16); |
| 107 } | 107 } |
| 108 } | 108 } |
| 109 | 109 |
| 110 } // namespace content | 110 } // namespace content |
| OLD | NEW |