Index: content/child/websocket_bridge.cc |
diff --git a/content/child/websocket_bridge.cc b/content/child/websocket_bridge.cc |
index 7cfff1ad50a942960024e79ac8d98377e363642d..e0eac5ab01ac9bac05eb1adaddbd4044b115b29f 100644 |
--- a/content/child/websocket_bridge.cc |
+++ b/content/child/websocket_bridge.cc |
@@ -41,6 +41,21 @@ namespace { |
const unsigned short kAbnormalShutdownOpCode = 1006; |
+WebSocketBinaryType BlinkBinaryTypeToContentWebSocketBinaryType( |
+ WebSocketHandle::BinaryType binary_type) { |
+ static_assert( |
+ static_cast<WebSocketBinaryType>(WebSocketHandle::BinaryTypeBlob) == |
+ WebSocketBinaryType::BLOB, |
+ "enum types must match"); |
+ static_assert(static_cast<WebSocketBinaryType>( |
+ WebSocketHandle::BinaryTypeArrayBuffer) == |
+ WebSocketBinaryType::ARRAY_BUFFER, |
+ "enum types must match"); |
+ DCHECK(binary_type == WebSocketHandle::BinaryTypeBlob || |
+ binary_type == WebSocketHandle::BinaryTypeArrayBuffer); |
+ return static_cast<WebSocketBinaryType>(binary_type); |
+} |
+ |
} // namespace |
WebSocketBridge::WebSocketBridge() |
@@ -71,6 +86,7 @@ bool WebSocketBridge::OnMessageReceived(const IPC::Message& msg) { |
DidFinishOpeningHandshake) |
IPC_MESSAGE_HANDLER(WebSocketMsg_NotifyFailure, DidFail) |
IPC_MESSAGE_HANDLER(WebSocketMsg_SendFrame, DidReceiveData) |
+ IPC_MESSAGE_HANDLER(WebSocketMsg_BlobReceived, DidReceiveBlob) |
IPC_MESSAGE_HANDLER(WebSocketMsg_FlowControl, DidReceiveFlowControl) |
IPC_MESSAGE_HANDLER(WebSocketMsg_DropChannel, DidClose) |
IPC_MESSAGE_HANDLER(WebSocketMsg_NotifyClosing, |
@@ -168,6 +184,12 @@ void WebSocketBridge::DidReceiveData(bool fin, |
// |this| can be deleted here. |
} |
+void WebSocketBridge::DidReceiveBlob(const std::string& uuid, uint64_t size) { |
+ DVLOG(1) << "WebSocketBridge::DidReceiveBlob(" << uuid << "," << size << ")"; |
+ |
+ client_->didReceiveBlob(this, WebString::fromLatin1(uuid), size); |
+} |
+ |
void WebSocketBridge::DidReceiveFlowControl(int64_t quota) { |
DVLOG(1) << "WebSocketBridge::DidReceiveFlowControl(" << quota << ")"; |
if (!client_) |
@@ -279,6 +301,26 @@ void WebSocketBridge::close(unsigned short code, |
new WebSocketMsg_DropChannel(channel_id_, true, code, reason_to_pass)); |
} |
+void WebSocketBridge::changeBinaryType(BinaryType new_binary_type) { |
+ if (channel_id_ == kInvalidChannelId) |
+ return; |
+ |
+ DVLOG(1) << "Bridge #" << channel_id_ << " ChangeBinaryType(" |
+ << new_binary_type << ")"; |
+ ChildThreadImpl::current()->Send(new WebSocketHostMsg_BinaryTypeChanged( |
+ channel_id_, |
+ BlinkBinaryTypeToContentWebSocketBinaryType(new_binary_type))); |
+} |
+ |
+void WebSocketBridge::confirmBlob() { |
+ if (channel_id_ == kInvalidChannelId) |
+ return; |
+ |
+ DVLOG(1) << "Bridge #" << channel_id_ << " ConfirmBlob()"; |
+ ChildThreadImpl::current()->Send( |
+ new WebSocketHostMsg_BlobConfirmed(channel_id_)); |
+} |
+ |
void WebSocketBridge::Disconnect() { |
if (channel_id_ == kInvalidChannelId) |
return; |