Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1686)

Side by Side Diff: content/renderer/pepper/pepper_websocket_host.cc

Issue 283623002: Add support for passing an arbitrary parameter to an IPC message handler. The motivation is for Web… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: sync Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/net_util.h" 10 #include "net/base/net_util.h"
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 error_was_received_(false) {} 75 error_was_received_(false) {}
76 76
77 PepperWebSocketHost::~PepperWebSocketHost() { 77 PepperWebSocketHost::~PepperWebSocketHost() {
78 if (websocket_) 78 if (websocket_)
79 websocket_->disconnect(); 79 websocket_->disconnect();
80 } 80 }
81 81
82 int32_t PepperWebSocketHost::OnResourceMessageReceived( 82 int32_t PepperWebSocketHost::OnResourceMessageReceived(
83 const IPC::Message& msg, 83 const IPC::Message& msg,
84 ppapi::host::HostMessageContext* context) { 84 ppapi::host::HostMessageContext* context) {
85 IPC_BEGIN_MESSAGE_MAP(PepperWebSocketHost, msg) 85 PPAPI_BEGIN_MESSAGE_MAP(PepperWebSocketHost, msg)
86 PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_WebSocket_Connect, 86 PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_WebSocket_Connect,
87 OnHostMsgConnect) 87 OnHostMsgConnect)
88 PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_WebSocket_Close, 88 PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_WebSocket_Close,
89 OnHostMsgClose) 89 OnHostMsgClose)
90 PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_WebSocket_SendText, 90 PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_WebSocket_SendText,
91 OnHostMsgSendText) 91 OnHostMsgSendText)
92 PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_WebSocket_SendBinary, 92 PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_WebSocket_SendBinary,
93 OnHostMsgSendBinary) 93 OnHostMsgSendBinary)
94 PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_WebSocket_Fail, OnHostMsgFail) 94 PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_WebSocket_Fail,
95 IPC_END_MESSAGE_MAP() 95 OnHostMsgFail)
96 PPAPI_END_MESSAGE_MAP()
96 return PP_ERROR_FAILED; 97 return PP_ERROR_FAILED;
97 } 98 }
98 99
99 void PepperWebSocketHost::didConnect() { 100 void PepperWebSocketHost::didConnect() {
100 std::string protocol; 101 std::string protocol;
101 if (websocket_) 102 if (websocket_)
102 protocol = websocket_->subprotocol().utf8(); 103 protocol = websocket_->subprotocol().utf8();
103 connecting_ = false; 104 connecting_ = false;
104 connect_reply_.params.set_result(PP_OK); 105 connect_reply_.params.set_result(PP_OK);
105 host()->SendReply(connect_reply_, 106 host()->SendReply(connect_reply_,
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 317
317 int32_t PepperWebSocketHost::OnHostMsgFail( 318 int32_t PepperWebSocketHost::OnHostMsgFail(
318 ppapi::host::HostMessageContext* context, 319 ppapi::host::HostMessageContext* context,
319 const std::string& message) { 320 const std::string& message) {
320 if (websocket_) 321 if (websocket_)
321 websocket_->fail(WebString::fromUTF8(message)); 322 websocket_->fail(WebString::fromUTF8(message));
322 return PP_OK; 323 return PP_OK;
323 } 324 }
324 325
325 } // namespace content 326 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698