| 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 "content/renderer/pepper/pepper_websocket_host.h" | 5 #include "content/renderer/pepper/pepper_websocket_host.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "content/public/renderer/renderer_ppapi_host.h" | 9 #include "content/public/renderer/renderer_ppapi_host.h" |
| 10 #include "net/base/port_util.h" | 10 #include "net/base/port_util.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 | 24 |
| 25 using blink::WebArrayBuffer; | 25 using blink::WebArrayBuffer; |
| 26 using blink::WebDocument; | 26 using blink::WebDocument; |
| 27 using blink::WebString; | 27 using blink::WebString; |
| 28 using blink::WebSocket; | 28 using blink::WebSocket; |
| 29 using blink::WebURL; | 29 using blink::WebURL; |
| 30 | 30 |
| 31 namespace content { | 31 namespace content { |
| 32 | 32 |
| 33 #define COMPILE_ASSERT_MATCHING_ENUM(webkit_name, np_name) \ | 33 #define COMPILE_ASSERT_MATCHING_ENUM(webkit_name, np_name) \ |
| 34 COMPILE_ASSERT( \ | 34 static_assert( \ |
| 35 static_cast<int>(WebSocket::webkit_name) == static_cast<int>(np_name), \ | 35 static_cast<int>(WebSocket::webkit_name) == static_cast<int>(np_name), \ |
| 36 mismatching_enums) | 36 "mismatching_enums") |
| 37 | 37 |
| 38 COMPILE_ASSERT_MATCHING_ENUM(CloseEventCodeNormalClosure, | 38 COMPILE_ASSERT_MATCHING_ENUM(CloseEventCodeNormalClosure, |
| 39 PP_WEBSOCKETSTATUSCODE_NORMAL_CLOSURE); | 39 PP_WEBSOCKETSTATUSCODE_NORMAL_CLOSURE); |
| 40 COMPILE_ASSERT_MATCHING_ENUM(CloseEventCodeGoingAway, | 40 COMPILE_ASSERT_MATCHING_ENUM(CloseEventCodeGoingAway, |
| 41 PP_WEBSOCKETSTATUSCODE_GOING_AWAY); | 41 PP_WEBSOCKETSTATUSCODE_GOING_AWAY); |
| 42 COMPILE_ASSERT_MATCHING_ENUM(CloseEventCodeProtocolError, | 42 COMPILE_ASSERT_MATCHING_ENUM(CloseEventCodeProtocolError, |
| 43 PP_WEBSOCKETSTATUSCODE_PROTOCOL_ERROR); | 43 PP_WEBSOCKETSTATUSCODE_PROTOCOL_ERROR); |
| 44 COMPILE_ASSERT_MATCHING_ENUM(CloseEventCodeUnsupportedData, | 44 COMPILE_ASSERT_MATCHING_ENUM(CloseEventCodeUnsupportedData, |
| 45 PP_WEBSOCKETSTATUSCODE_UNSUPPORTED_DATA); | 45 PP_WEBSOCKETSTATUSCODE_UNSUPPORTED_DATA); |
| 46 COMPILE_ASSERT_MATCHING_ENUM(CloseEventCodeNoStatusRcvd, | 46 COMPILE_ASSERT_MATCHING_ENUM(CloseEventCodeNoStatusRcvd, |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 319 | 319 |
| 320 int32_t PepperWebSocketHost::OnHostMsgFail( | 320 int32_t PepperWebSocketHost::OnHostMsgFail( |
| 321 ppapi::host::HostMessageContext* context, | 321 ppapi::host::HostMessageContext* context, |
| 322 const std::string& message) { | 322 const std::string& message) { |
| 323 if (websocket_) | 323 if (websocket_) |
| 324 websocket_->fail(WebString::fromUTF8(message)); | 324 websocket_->fail(WebString::fromUTF8(message)); |
| 325 return PP_OK; | 325 return PP_OK; |
| 326 } | 326 } |
| 327 | 327 |
| 328 } // namespace content | 328 } // namespace content |
| OLD | NEW |