| Index: chrome/renderer/pepper_plugin_delegate_impl.cc
|
| diff --git a/chrome/renderer/pepper_plugin_delegate_impl.cc b/chrome/renderer/pepper_plugin_delegate_impl.cc
|
| index e6d7124fe863ca16fce21643723ee08869236586..196e2d56e929e781a31e6e093fa9a0c6881bd423 100644
|
| --- a/chrome/renderer/pepper_plugin_delegate_impl.cc
|
| +++ b/chrome/renderer/pepper_plugin_delegate_impl.cc
|
| @@ -35,6 +35,7 @@
|
| #include "grit/locale_settings.h"
|
| #include "ipc/ipc_channel_handle.h"
|
| #include "ppapi/c/dev/pp_video_dev.h"
|
| +#include "ppapi/c/pp_errors.h"
|
| #include "ppapi/c/private/ppb_flash.h"
|
| #include "ppapi/proxy/host_dispatcher.h"
|
| #include "third_party/WebKit/Source/WebKit/chromium/public/WebFileChooserCompletion.h"
|
| @@ -43,6 +44,7 @@
|
| #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h"
|
| #include "ui/base/l10n/l10n_util.h"
|
| #include "webkit/fileapi/file_system_callback_dispatcher.h"
|
| +#include "webkit/glue/context_menu.h"
|
| #include "webkit/plugins/npapi/webplugin.h"
|
| #include "webkit/plugins/ppapi/ppb_file_io_impl.h"
|
| #include "webkit/plugins/ppapi/plugin_module.h"
|
| @@ -818,8 +820,10 @@ int32_t PepperPluginDelegateImpl::ConnectTcp(
|
| request_id,
|
| std::string(host),
|
| port);
|
| - if (!render_view_->Send(msg))
|
| + if (!render_view_->Send(msg)) {
|
| + pending_connect_tcps_.Remove(request_id);
|
| return PP_ERROR_FAILED;
|
| + }
|
|
|
| return PP_ERROR_WOULDBLOCK;
|
| }
|
| @@ -833,8 +837,10 @@ int32_t PepperPluginDelegateImpl::ConnectTcpAddress(
|
| new PepperMsg_ConnectTcpAddress(render_view_->routing_id(),
|
| request_id,
|
| *addr);
|
| - if (!render_view_->Send(msg))
|
| + if (!render_view_->Send(msg)) {
|
| + pending_connect_tcps_.Remove(request_id);
|
| return PP_ERROR_FAILED;
|
| + }
|
|
|
| return PP_ERROR_WOULDBLOCK;
|
| }
|
| @@ -851,6 +857,48 @@ void PepperPluginDelegateImpl::OnConnectTcpACK(
|
| connector->CompleteConnectTcp(socket, local_addr, remote_addr);
|
| }
|
|
|
| +int32_t PepperPluginDelegateImpl::ShowContextMenu(
|
| + webkit::ppapi::PPB_Flash_Menu_Impl* menu,
|
| + const gfx::Point& position) {
|
| + int request_id = pending_context_menus_.Add(
|
| + new scoped_refptr<webkit::ppapi::PPB_Flash_Menu_Impl>(menu));
|
| +
|
| + ContextMenuParams params;
|
| + params.x = position.x();
|
| + params.y = position.y();
|
| + params.custom_context.is_pepper_menu = true;
|
| + params.custom_context.request_id = request_id;
|
| + params.custom_items = menu->menu_data();
|
| +
|
| + IPC::Message* msg = new ViewHostMsg_ContextMenu(render_view_->routing_id(),
|
| + params);
|
| + if (!render_view_->Send(msg)) {
|
| + pending_context_menus_.Remove(request_id);
|
| + return PP_ERROR_FAILED;
|
| + }
|
| +
|
| + return PP_ERROR_WOULDBLOCK;
|
| +}
|
| +
|
| +void PepperPluginDelegateImpl::CompleteShowContextMenu(
|
| + int request_id,
|
| + bool did_select,
|
| + unsigned action) {
|
| + scoped_refptr<webkit::ppapi::PPB_Flash_Menu_Impl> menu =
|
| + *pending_context_menus_.Lookup(request_id);
|
| + if (!menu) {
|
| + NOTREACHED() << "CompleteShowContextMenu() called twice for the same menu.";
|
| + return;
|
| + }
|
| + pending_context_menus_.Remove(request_id);
|
| +
|
| + // TODO(viettrungluu): "user cancel" for everything else is not right....
|
| + if (did_select)
|
| + menu->CompleteShow(PP_OK, action);
|
| + else
|
| + menu->CompleteShow(PP_ERROR_USERCANCEL, 0);
|
| +}
|
| +
|
| webkit::ppapi::FullscreenContainer*
|
| PepperPluginDelegateImpl::CreateFullscreenContainer(
|
| webkit::ppapi::PluginInstance* instance) {
|
|
|