diff options
author | toyoshim@chromium.org <toyoshim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-12 07:03:50 +0000 |
---|---|---|
committer | toyoshim@chromium.org <toyoshim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-12 07:03:50 +0000 |
commit | 810f8a0ac161db91a213b3f6252bd8935f7558ce (patch) | |
tree | 65fa0ac6af5664caa427abd002d6b4c27a66845b /webkit | |
parent | 196ec372733e3b223b64e38a004acf8b7f656fda (diff) | |
download | chromium_src-810f8a0ac161db91a213b3f6252bd8935f7558ce.zip chromium_src-810f8a0ac161db91a213b3f6252bd8935f7558ce.tar.gz chromium_src-810f8a0ac161db91a213b3f6252bd8935f7558ce.tar.bz2 |
WebSocket Pepper API: add interfaces to handle binaryType attribute
Add interfaces to handle binaryType attribute for various binary types supporting
in API version 0.9. Keeps the old interface as 0.1 for compatibility, and add
simple unit test just to instansiate the old interface.
Adding new interfaces are based on the WebSocket API.
BUG=87310
TEST=ui_test --gtest_filter='PPAPITest.WebSocket_*'
Review URL: http://codereview.chromium.org/8989046
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@117391 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r-- | webkit/plugins/ppapi/ppb_websocket_impl.cc | 15 | ||||
-rw-r--r-- | webkit/plugins/ppapi/ppb_websocket_impl.h | 4 |
2 files changed, 18 insertions, 1 deletions
diff --git a/webkit/plugins/ppapi/ppb_websocket_impl.cc b/webkit/plugins/ppapi/ppb_websocket_impl.cc index ef2d6dd..00dd7f5 100644 --- a/webkit/plugins/ppapi/ppb_websocket_impl.cc +++ b/webkit/plugins/ppapi/ppb_websocket_impl.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -75,9 +75,12 @@ bool InValidStateToReceive(PP_WebSocketReadyState_Dev state) { namespace webkit { namespace ppapi { +// TODO(toyoshim): Default value of binary_type_ must be +// PP_WEBSOCKETBINARYTYPE_BLOB_DEV after supporting Blob. PPB_WebSocket_Impl::PPB_WebSocket_Impl(PP_Instance instance) : Resource(instance), state_(PP_WEBSOCKETREADYSTATE_INVALID_DEV), + binary_type_(PP_WEBSOCKETBINARYTYPE_ARRAYBUFFER_DEV), error_was_received_(false), receive_callback_var_(NULL), wait_for_receive_(false), @@ -419,6 +422,16 @@ PP_Var PPB_WebSocket_Impl::GetURL() { return url_->GetPPVar(); } +PP_Bool PPB_WebSocket_Impl::SetBinaryType( + PP_WebSocketBinaryType_Dev binary_type) { + // TODO(toyoshim): Use WebKit new API to set the receiving binary type. + return PP_FALSE; +} + +PP_WebSocketBinaryType_Dev PPB_WebSocket_Impl::GetBinaryType() { + return binary_type_; +} + void PPB_WebSocket_Impl::didConnect() { DCHECK_EQ(PP_WEBSOCKETREADYSTATE_CONNECTING_DEV, state_); state_ = PP_WEBSOCKETREADYSTATE_OPEN_DEV; diff --git a/webkit/plugins/ppapi/ppb_websocket_impl.h b/webkit/plugins/ppapi/ppb_websocket_impl.h index 16544f1..3177c7b 100644 --- a/webkit/plugins/ppapi/ppb_websocket_impl.h +++ b/webkit/plugins/ppapi/ppb_websocket_impl.h @@ -57,6 +57,9 @@ class PPB_WebSocket_Impl : public ::ppapi::Resource, virtual PP_Var GetProtocol() OVERRIDE; virtual PP_WebSocketReadyState_Dev GetReadyState() OVERRIDE; virtual PP_Var GetURL() OVERRIDE; + virtual PP_Bool SetBinaryType( + PP_WebSocketBinaryType_Dev binary_type) OVERRIDE; + virtual PP_WebSocketBinaryType_Dev GetBinaryType() OVERRIDE; // WebSocketClient implementation. virtual void didConnect(); @@ -74,6 +77,7 @@ class PPB_WebSocket_Impl : public ::ppapi::Resource, scoped_ptr<WebKit::WebSocket> websocket_; PP_WebSocketReadyState_Dev state_; + PP_WebSocketBinaryType_Dev binary_type_; bool error_was_received_; scoped_refptr< ::ppapi::TrackedCallback> connect_callback_; |