| 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 "webkit/plugins/ppapi/ppb_websocket_impl.h" | 5 #include "webkit/plugins/ppapi/ppb_websocket_impl.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 418 switch (binary_type) { | 418 switch (binary_type) { |
| 419 case PP_WEBSOCKETBINARYTYPE_BLOB_DEV: | 419 case PP_WEBSOCKETBINARYTYPE_BLOB_DEV: |
| 420 binary_type_ = WebSocket::BinaryTypeBlob; | 420 binary_type_ = WebSocket::BinaryTypeBlob; |
| 421 break; | 421 break; |
| 422 case PP_WEBSOCKETBINARYTYPE_ARRAYBUFFER_DEV: | 422 case PP_WEBSOCKETBINARYTYPE_ARRAYBUFFER_DEV: |
| 423 binary_type_ = WebSocket::BinaryTypeArrayBuffer; | 423 binary_type_ = WebSocket::BinaryTypeArrayBuffer; |
| 424 break; | 424 break; |
| 425 default: | 425 default: |
| 426 return PP_FALSE; | 426 return PP_FALSE; |
| 427 } | 427 } |
| 428 if (!websocket_.get()) | 428 // WebKit API setBinaryType() is called when Connect() is called. |
| 429 return PP_FALSE; | 429 // If the websocket_ contains an object; it means Connect() is already |
| 430 websocket_->setBinaryType(binary_type_); | 430 // called, call WebKit API here to reflect the setting as soon as possible. |
| 431 if (websocket_.get()) |
| 432 websocket_->setBinaryType(binary_type_); |
| 431 return PP_TRUE; | 433 return PP_TRUE; |
| 432 } | 434 } |
| 433 | 435 |
| 434 PP_WebSocketBinaryType_Dev PPB_WebSocket_Impl::GetBinaryType() { | 436 PP_WebSocketBinaryType_Dev PPB_WebSocket_Impl::GetBinaryType() { |
| 435 switch (binary_type_) { | 437 switch (binary_type_) { |
| 436 case WebSocket::BinaryTypeBlob: | 438 case WebSocket::BinaryTypeBlob: |
| 437 return PP_WEBSOCKETBINARYTYPE_BLOB_DEV; | 439 return PP_WEBSOCKETBINARYTYPE_BLOB_DEV; |
| 438 case WebSocket::BinaryTypeArrayBuffer: | 440 case WebSocket::BinaryTypeArrayBuffer: |
| 439 return PP_WEBSOCKETBINARYTYPE_ARRAYBUFFER_DEV; | 441 return PP_WEBSOCKETBINARYTYPE_ARRAYBUFFER_DEV; |
| 440 default: | 442 default: |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 557 | 559 |
| 558 *receive_callback_var_ = received_messages_.front()->GetPPVar(); | 560 *receive_callback_var_ = received_messages_.front()->GetPPVar(); |
| 559 received_messages_.pop(); | 561 received_messages_.pop(); |
| 560 receive_callback_var_ = NULL; | 562 receive_callback_var_ = NULL; |
| 561 wait_for_receive_ = false; | 563 wait_for_receive_ = false; |
| 562 return PP_OK; | 564 return PP_OK; |
| 563 } | 565 } |
| 564 | 566 |
| 565 } // namespace ppapi | 567 } // namespace ppapi |
| 566 } // namespace webkit | 568 } // namespace webkit |
| OLD | NEW |