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

Side by Side Diff: chrome/renderer/pepper/pepper_extensions_common_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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "chrome/renderer/pepper/pepper_extensions_common_host.h" 5 #include "chrome/renderer/pepper/pepper_extensions_common_host.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "chrome/renderer/extensions/chrome_v8_context.h" 10 #include "chrome/renderer/extensions/chrome_v8_context.h"
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 if (!context) 71 if (!context)
72 return NULL; 72 return NULL;
73 73
74 return new PepperExtensionsCommonHost( 74 return new PepperExtensionsCommonHost(
75 host, instance, resource, context->pepper_request_proxy()); 75 host, instance, resource, context->pepper_request_proxy());
76 } 76 }
77 77
78 int32_t PepperExtensionsCommonHost::OnResourceMessageReceived( 78 int32_t PepperExtensionsCommonHost::OnResourceMessageReceived(
79 const IPC::Message& msg, 79 const IPC::Message& msg,
80 ppapi::host::HostMessageContext* context) { 80 ppapi::host::HostMessageContext* context) {
81 IPC_BEGIN_MESSAGE_MAP(PepperExtensionsCommonHost, msg) 81 PPAPI_BEGIN_MESSAGE_MAP(PepperExtensionsCommonHost, msg)
Tom Sepez 2014/05/13 18:48:40 Could we split this PPAPI_ cleanup into a separate
jam 2014/05/13 20:31:40 Done: https://codereview.chromium.org/281803003/
82 PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_ExtensionsCommon_Post, OnPost) 82 PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_ExtensionsCommon_Post,
83 PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_ExtensionsCommon_Call, OnCall) 83 OnPost)
84 IPC_END_MESSAGE_MAP() 84 PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_ExtensionsCommon_Call,
85 OnCall)
86 PPAPI_END_MESSAGE_MAP()
85 return PP_ERROR_FAILED; 87 return PP_ERROR_FAILED;
86 } 88 }
87 89
88 void PepperExtensionsCommonHost::OnResponseReceived( 90 void PepperExtensionsCommonHost::OnResponseReceived(
89 ppapi::host::ReplyMessageContext reply_context, 91 ppapi::host::ReplyMessageContext reply_context,
90 bool success, 92 bool success,
91 const base::ListValue& response, 93 const base::ListValue& response,
92 const std::string& /* error */) { 94 const std::string& /* error */) {
93 reply_context.params.set_result(success ? PP_OK : PP_ERROR_FAILED); 95 reply_context.params.set_result(success ? PP_OK : PP_ERROR_FAILED);
94 SendReply(reply_context, PpapiPluginMsg_ExtensionsCommon_CallReply(response)); 96 SendReply(reply_context, PpapiPluginMsg_ExtensionsCommon_CallReply(response));
(...skipping 16 matching lines...) Expand all
111 std::string error; 113 std::string error;
112 bool success = pepper_request_proxy_->StartRequest( 114 bool success = pepper_request_proxy_->StartRequest(
113 base::Bind(&PepperExtensionsCommonHost::OnResponseReceived, 115 base::Bind(&PepperExtensionsCommonHost::OnResponseReceived,
114 weak_factory_.GetWeakPtr(), 116 weak_factory_.GetWeakPtr(),
115 context->MakeReplyMessageContext()), 117 context->MakeReplyMessageContext()),
116 request_name, 118 request_name,
117 args, 119 args,
118 &error); 120 &error);
119 return success ? PP_OK_COMPLETIONPENDING : PP_ERROR_FAILED; 121 return success ? PP_OK_COMPLETIONPENDING : PP_ERROR_FAILED;
120 } 122 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698