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 /ppapi/thunk | |
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 'ppapi/thunk')
-rw-r--r-- | ppapi/thunk/interfaces_ppb_public_dev.h | 4 | ||||
-rw-r--r-- | ppapi/thunk/ppb_websocket_api.h | 4 | ||||
-rw-r--r-- | ppapi/thunk/ppb_websocket_thunk.cc | 41 |
3 files changed, 44 insertions, 5 deletions
diff --git a/ppapi/thunk/interfaces_ppb_public_dev.h b/ppapi/thunk/interfaces_ppb_public_dev.h index de3b62b..e405a60 100644 --- a/ppapi/thunk/interfaces_ppb_public_dev.h +++ b/ppapi/thunk/interfaces_ppb_public_dev.h @@ -63,8 +63,8 @@ PROXIED_IFACE(PPB_VideoDecoder, PPB_VIDEODECODER_DEV_INTERFACE_0_16, PPB_VideoDecoder_Dev_0_16) UNPROXIED_IFACE(PPB_VideoLayer, PPB_VIDEOLAYER_DEV_INTERFACE_0_1, PPB_VideoLayer_Dev_0_1) -UNPROXIED_IFACE(PPB_WebSocket, PPB_WEBSOCKET_DEV_INTERFACE_0_1, - PPB_WebSocket_Dev_0_1) +UNPROXIED_IFACE(PPB_WebSocket, PPB_WEBSOCKET_DEV_INTERFACE_0_9, + PPB_WebSocket_Dev_0_9) UNPROXIED_IFACE(PPB_Widget, PPB_WIDGET_DEV_INTERFACE_0_3, PPB_Widget_Dev_0_3) #include "ppapi/thunk/interfaces_postamble.h" diff --git a/ppapi/thunk/ppb_websocket_api.h b/ppapi/thunk/ppb_websocket_api.h index ba49a0f..4012582 100644 --- a/ppapi/thunk/ppb_websocket_api.h +++ b/ppapi/thunk/ppb_websocket_api.h @@ -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. @@ -33,6 +33,8 @@ class PPB_WebSocket_API { virtual PP_Var GetProtocol() = 0; virtual PP_WebSocketReadyState_Dev GetReadyState() = 0; virtual PP_Var GetURL() = 0; + virtual PP_Bool SetBinaryType(PP_WebSocketBinaryType_Dev) = 0; + virtual PP_WebSocketBinaryType_Dev GetBinaryType() = 0; }; } // namespace thunk diff --git a/ppapi/thunk/ppb_websocket_thunk.cc b/ppapi/thunk/ppb_websocket_thunk.cc index da93901..1f49c3e 100644 --- a/ppapi/thunk/ppb_websocket_thunk.cc +++ b/ppapi/thunk/ppb_websocket_thunk.cc @@ -124,8 +124,22 @@ PP_Var GetURL(PP_Resource resource) { return enter.object()->GetURL(); } +PP_Bool SetBinaryType(PP_Resource resource, + PP_WebSocketBinaryType_Dev binary_type) { + EnterResource<PPB_WebSocket_API> enter(resource, false); + if (enter.failed()) + return PP_FALSE; + return enter.object()->SetBinaryType(binary_type); +} -const PPB_WebSocket_Dev g_ppb_websocket_thunk = { +PP_WebSocketBinaryType_Dev GetBinaryType(PP_Resource resource) { + EnterResource<PPB_WebSocket_API> enter(resource, false); + if (enter.failed()) + return PP_WEBSOCKETBINARYTYPE_INVALID; + return enter.object()->GetBinaryType(); +} + +const PPB_WebSocket_Dev_0_1 g_ppb_websocket_0_1_thunk = { &Create, &IsWebSocket, &Connect, @@ -142,10 +156,33 @@ const PPB_WebSocket_Dev g_ppb_websocket_thunk = { &GetURL }; +const PPB_WebSocket_Dev_0_9 g_ppb_websocket_0_9_thunk = { + &Create, + &IsWebSocket, + &Connect, + &Close, + &ReceiveMessage, + &SendMessage, + &GetBufferedAmount, + &GetCloseCode, + &GetCloseReason, + &GetCloseWasClean, + &GetExtensions, + &GetProtocol, + &GetReadyState, + &GetURL, + &SetBinaryType, + &GetBinaryType +}; + } // namespace const PPB_WebSocket_Dev_0_1* GetPPB_WebSocket_Dev_0_1_Thunk() { - return &g_ppb_websocket_thunk; + return &g_ppb_websocket_0_1_thunk; +} + +const PPB_WebSocket_Dev_0_9* GetPPB_WebSocket_Dev_0_9_Thunk() { + return &g_ppb_websocket_0_9_thunk; } } // namespace thunk |