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 "chrome/renderer/pepper/pepper_flash_menu_host.h" | 5 #include "chrome/renderer/pepper/pepper_flash_menu_host.h" |
6 | 6 |
7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "content/public/common/context_menu_params.h" | 8 #include "content/public/common/context_menu_params.h" |
9 #include "content/public/renderer/render_frame.h" | 9 #include "content/public/renderer/render_frame.h" |
10 #include "content/public/renderer/renderer_ppapi_host.h" | 10 #include "content/public/renderer/renderer_ppapi_host.h" |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 content::RenderFrame* render_frame = | 115 content::RenderFrame* render_frame = |
116 renderer_ppapi_host_->GetRenderFrameForInstance(pp_instance()); | 116 renderer_ppapi_host_->GetRenderFrameForInstance(pp_instance()); |
117 if (render_frame) | 117 if (render_frame) |
118 render_frame->CancelContextMenu(context_menu_request_id_); | 118 render_frame->CancelContextMenu(context_menu_request_id_); |
119 } | 119 } |
120 } | 120 } |
121 | 121 |
122 int32_t PepperFlashMenuHost::OnResourceMessageReceived( | 122 int32_t PepperFlashMenuHost::OnResourceMessageReceived( |
123 const IPC::Message& msg, | 123 const IPC::Message& msg, |
124 ppapi::host::HostMessageContext* context) { | 124 ppapi::host::HostMessageContext* context) { |
125 IPC_BEGIN_MESSAGE_MAP(PepperFlashMenuHost, msg) | 125 PPAPI_BEGIN_MESSAGE_MAP(PepperFlashMenuHost, msg) |
126 PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_FlashMenu_Show, OnHostMsgShow) | 126 PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_FlashMenu_Show, |
127 IPC_END_MESSAGE_MAP() | 127 OnHostMsgShow) |
| 128 PPAPI_END_MESSAGE_MAP() |
128 return PP_ERROR_FAILED; | 129 return PP_ERROR_FAILED; |
129 } | 130 } |
130 | 131 |
131 int32_t PepperFlashMenuHost::OnHostMsgShow( | 132 int32_t PepperFlashMenuHost::OnHostMsgShow( |
132 ppapi::host::HostMessageContext* context, | 133 ppapi::host::HostMessageContext* context, |
133 const PP_Point& location) { | 134 const PP_Point& location) { |
134 // Note that all early returns must do a SendMenuReply. The sync result for | 135 // Note that all early returns must do a SendMenuReply. The sync result for |
135 // this message isn't used, so to forward the error to the plugin, we need to | 136 // this message isn't used, so to forward the error to the plugin, we need to |
136 // additionally call SendMenuReply explicitly. | 137 // additionally call SendMenuReply explicitly. |
137 if (menu_data_.empty()) { | 138 if (menu_data_.empty()) { |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 } | 193 } |
193 | 194 |
194 void PepperFlashMenuHost::SendMenuReply(int32_t result, int action) { | 195 void PepperFlashMenuHost::SendMenuReply(int32_t result, int action) { |
195 ppapi::host::ReplyMessageContext reply_context( | 196 ppapi::host::ReplyMessageContext reply_context( |
196 ppapi::proxy::ResourceMessageReplyParams(pp_resource(), 0), | 197 ppapi::proxy::ResourceMessageReplyParams(pp_resource(), 0), |
197 NULL, | 198 NULL, |
198 MSG_ROUTING_NONE); | 199 MSG_ROUTING_NONE); |
199 reply_context.params.set_result(result); | 200 reply_context.params.set_result(result); |
200 host()->SendReply(reply_context, PpapiPluginMsg_FlashMenu_ShowReply(action)); | 201 host()->SendReply(reply_context, PpapiPluginMsg_FlashMenu_ShowReply(action)); |
201 } | 202 } |
OLD | NEW |