OLD | NEW |
---|---|
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 Loading... | |
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 Loading... | |
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 } |
OLD | NEW |