| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "ppapi/proxy/ppb_flash_menu_proxy.h" | 5 #include "ppapi/proxy/ppb_flash_menu_proxy.h" |
| 6 | 6 |
| 7 #include "ppapi/c/pp_errors.h" | 7 #include "ppapi/c/pp_errors.h" |
| 8 #include "ppapi/c/private/ppb_flash_menu.h" | 8 #include "ppapi/c/private/ppb_flash_menu.h" |
| 9 #include "ppapi/proxy/enter_proxy.h" | 9 #include "ppapi/proxy/enter_proxy.h" |
| 10 #include "ppapi/proxy/ppapi_messages.h" | 10 #include "ppapi/proxy/ppapi_messages.h" |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 // There was some error, so we won't get a callback. We need to now issue | 176 // There was some error, so we won't get a callback. We need to now issue |
| 177 // the ACK to the plugin so that it hears about the error. This will also | 177 // the ACK to the plugin so that it hears about the error. This will also |
| 178 // clean up the data associated with the callback. | 178 // clean up the data associated with the callback. |
| 179 callback.Run(result); | 179 callback.Run(result); |
| 180 } | 180 } |
| 181 } | 181 } |
| 182 | 182 |
| 183 void PPB_Flash_Menu_Proxy::OnMsgShowACK(const HostResource& menu, | 183 void PPB_Flash_Menu_Proxy::OnMsgShowACK(const HostResource& menu, |
| 184 int32_t selected_id, | 184 int32_t selected_id, |
| 185 int32_t result) { | 185 int32_t result) { |
| 186 PP_Resource plugin_resource = | 186 EnterPluginFromHostResource<PPB_Flash_Menu_API> enter(menu); |
| 187 PluginResourceTracker::GetInstance()->PluginResourceForHostResource(menu); | 187 if (enter.failed()) |
| 188 if (!plugin_resource) | |
| 189 return; | 188 return; |
| 190 FlashMenu* object = PluginResource::GetAs<FlashMenu>(plugin_resource); | 189 static_cast<FlashMenu*>(enter.object())->ShowACK(selected_id, result); |
| 191 if (!object) { | |
| 192 // The plugin has released the FlashMenu object so don't issue the | |
| 193 // callback. | |
| 194 return; | |
| 195 } | |
| 196 | |
| 197 object->ShowACK(selected_id, result); | |
| 198 } | 190 } |
| 199 | 191 |
| 200 void PPB_Flash_Menu_Proxy::SendShowACKToPlugin( | 192 void PPB_Flash_Menu_Proxy::SendShowACKToPlugin( |
| 201 int32_t result, | 193 int32_t result, |
| 202 ShowRequest* request) { | 194 ShowRequest* request) { |
| 203 dispatcher()->Send(new PpapiMsg_PPBFlashMenu_ShowACK( | 195 dispatcher()->Send(new PpapiMsg_PPBFlashMenu_ShowACK( |
| 204 INTERFACE_ID_PPB_FLASH_MENU, | 196 INTERFACE_ID_PPB_FLASH_MENU, |
| 205 request->menu, | 197 request->menu, |
| 206 request->selected_id, | 198 request->selected_id, |
| 207 result)); | 199 result)); |
| 208 delete request; | 200 delete request; |
| 209 } | 201 } |
| 210 | 202 |
| 211 } // namespace proxy | 203 } // namespace proxy |
| 212 } // namespace pp | 204 } // namespace pp |
| OLD | NEW |