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" |
11 #include "base/logging.h" | |
12 #include "googleurl/src/gurl.h" | 11 #include "googleurl/src/gurl.h" |
13 #include "net/base/net_util.h" | 12 #include "net/base/net_util.h" |
14 #include "ppapi/c/pp_completion_callback.h" | 13 #include "ppapi/c/pp_completion_callback.h" |
15 #include "ppapi/c/pp_errors.h" | 14 #include "ppapi/c/pp_errors.h" |
16 #include "ppapi/c/pp_var.h" | 15 #include "ppapi/c/pp_var.h" |
17 #include "ppapi/c/ppb_var.h" | 16 #include "ppapi/c/ppb_var.h" |
18 #include "ppapi/c/ppb_var_array_buffer.h" | 17 #include "ppapi/c/ppb_var_array_buffer.h" |
19 #include "ppapi/shared_impl/var.h" | 18 #include "ppapi/shared_impl/var.h" |
20 #include "ppapi/shared_impl/var_tracker.h" | 19 #include "ppapi/shared_impl/var_tracker.h" |
21 #include "third_party/WebKit/Source/WebKit/chromium/public/WebArrayBuffer.h" | 20 #include "third_party/WebKit/Source/WebKit/chromium/public/WebArrayBuffer.h" |
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 if (!close_reason_) | 378 if (!close_reason_) |
380 return empty_string_->GetPPVar(); | 379 return empty_string_->GetPPVar(); |
381 return close_reason_->GetPPVar(); | 380 return close_reason_->GetPPVar(); |
382 } | 381 } |
383 | 382 |
384 PP_Bool PPB_WebSocket_Impl::GetCloseWasClean() { | 383 PP_Bool PPB_WebSocket_Impl::GetCloseWasClean() { |
385 return close_was_clean_; | 384 return close_was_clean_; |
386 } | 385 } |
387 | 386 |
388 PP_Var PPB_WebSocket_Impl::GetExtensions() { | 387 PP_Var PPB_WebSocket_Impl::GetExtensions() { |
389 // TODO(toyoshim): For now, always returns empty string because WebKit side | 388 // Check mandatory interfaces. |
390 // doesn't support it yet. | 389 if (!websocket_.get()) |
391 if (!extensions_) | |
392 return empty_string_->GetPPVar(); | 390 return empty_string_->GetPPVar(); |
393 return extensions_->GetPPVar(); | 391 |
| 392 std::string extensions = websocket_->extensions().utf8(); |
| 393 return StringVar::StringToPPVar(extensions); |
394 } | 394 } |
395 | 395 |
396 PP_Var PPB_WebSocket_Impl::GetProtocol() { | 396 PP_Var PPB_WebSocket_Impl::GetProtocol() { |
397 // Check mandatory interfaces. | 397 // Check mandatory interfaces. |
398 if (!websocket_.get()) | 398 if (!websocket_.get()) |
399 return empty_string_->GetPPVar(); | 399 return empty_string_->GetPPVar(); |
400 | 400 |
401 std::string protocol = websocket_->subprotocol().utf8(); | 401 std::string protocol = websocket_->subprotocol().utf8(); |
402 return StringVar::StringToPPVar(protocol); | 402 return StringVar::StringToPPVar(protocol); |
403 } | 403 } |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
526 | 526 |
527 *receive_callback_var_ = received_messages_.front()->GetPPVar(); | 527 *receive_callback_var_ = received_messages_.front()->GetPPVar(); |
528 received_messages_.pop(); | 528 received_messages_.pop(); |
529 receive_callback_var_ = NULL; | 529 receive_callback_var_ = NULL; |
530 wait_for_receive_ = false; | 530 wait_for_receive_ = false; |
531 return PP_OK; | 531 return PP_OK; |
532 } | 532 } |
533 | 533 |
534 } // namespace ppapi | 534 } // namespace ppapi |
535 } // namespace webkit | 535 } // namespace webkit |
OLD | NEW |