| 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 "content/renderer/pepper_plugin_delegate_impl.h" | 5 #include "content/renderer/pepper_plugin_delegate_impl.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 #include <queue> | 8 #include <queue> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 #include "content/common/file_system_messages.h" | 25 #include "content/common/file_system_messages.h" |
| 26 #include "content/common/gpu/client/content_gl_context.h" | 26 #include "content/common/gpu/client/content_gl_context.h" |
| 27 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" | 27 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" |
| 28 #include "content/common/media/audio_messages.h" | 28 #include "content/common/media/audio_messages.h" |
| 29 #include "content/common/pepper_file_messages.h" | 29 #include "content/common/pepper_file_messages.h" |
| 30 #include "content/common/pepper_plugin_registry.h" | 30 #include "content/common/pepper_plugin_registry.h" |
| 31 #include "content/common/pepper_messages.h" | 31 #include "content/common/pepper_messages.h" |
| 32 #include "content/common/quota_dispatcher.h" | 32 #include "content/common/quota_dispatcher.h" |
| 33 #include "content/common/view_messages.h" | 33 #include "content/common/view_messages.h" |
| 34 #include "content/public/common/content_switches.h" | 34 #include "content/public/common/content_switches.h" |
| 35 #include "content/public/common/context_menu_params.h" |
| 35 #include "content/public/renderer/content_renderer_client.h" | 36 #include "content/public/renderer/content_renderer_client.h" |
| 36 #include "content/renderer/gamepad_shared_memory_reader.h" | 37 #include "content/renderer/gamepad_shared_memory_reader.h" |
| 37 #include "content/renderer/media/audio_input_message_filter.h" | 38 #include "content/renderer/media/audio_input_message_filter.h" |
| 38 #include "content/renderer/media/audio_message_filter.h" | 39 #include "content/renderer/media/audio_message_filter.h" |
| 39 #include "content/renderer/media/pepper_platform_video_decoder_impl.h" | 40 #include "content/renderer/media/pepper_platform_video_decoder_impl.h" |
| 40 #include "content/renderer/media/video_capture_impl_manager.h" | 41 #include "content/renderer/media/video_capture_impl_manager.h" |
| 41 #include "content/renderer/p2p/p2p_transport_impl.h" | 42 #include "content/renderer/p2p/p2p_transport_impl.h" |
| 42 #include "content/renderer/pepper_platform_context_3d_impl.h" | 43 #include "content/renderer/pepper_platform_context_3d_impl.h" |
| 43 #include "content/renderer/render_thread_impl.h" | 44 #include "content/renderer/render_thread_impl.h" |
| 44 #include "content/renderer/render_view_impl.h" | 45 #include "content/renderer/render_view_impl.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 60 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFileChooserComplet
ion.h" | 61 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFileChooserComplet
ion.h" |
| 61 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFileChooserParams.
h" | 62 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFileChooserParams.
h" |
| 62 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" | 63 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" |
| 63 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" | 64 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" |
| 64 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginContainer.h" | 65 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginContainer.h" |
| 65 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScreenInfo.h" | 66 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScreenInfo.h" |
| 66 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" | 67 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" |
| 67 #include "ui/gfx/size.h" | 68 #include "ui/gfx/size.h" |
| 68 #include "ui/gfx/surface/transport_dib.h" | 69 #include "ui/gfx/surface/transport_dib.h" |
| 69 #include "webkit/fileapi/file_system_callback_dispatcher.h" | 70 #include "webkit/fileapi/file_system_callback_dispatcher.h" |
| 70 #include "webkit/glue/context_menu.h" | |
| 71 #include "webkit/plugins/npapi/webplugin.h" | 71 #include "webkit/plugins/npapi/webplugin.h" |
| 72 #include "webkit/plugins/ppapi/file_path.h" | 72 #include "webkit/plugins/ppapi/file_path.h" |
| 73 #include "webkit/plugins/ppapi/ppb_file_io_impl.h" | 73 #include "webkit/plugins/ppapi/ppb_file_io_impl.h" |
| 74 #include "webkit/plugins/ppapi/plugin_module.h" | 74 #include "webkit/plugins/ppapi/plugin_module.h" |
| 75 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" | 75 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" |
| 76 #include "webkit/plugins/ppapi/ppb_broker_impl.h" | 76 #include "webkit/plugins/ppapi/ppb_broker_impl.h" |
| 77 #include "webkit/plugins/ppapi/ppb_flash_impl.h" | 77 #include "webkit/plugins/ppapi/ppb_flash_impl.h" |
| 78 #include "webkit/plugins/ppapi/ppb_flash_net_connector_impl.h" | 78 #include "webkit/plugins/ppapi/ppb_flash_net_connector_impl.h" |
| 79 #include "webkit/plugins/ppapi/ppb_tcp_socket_private_impl.h" | 79 #include "webkit/plugins/ppapi/ppb_tcp_socket_private_impl.h" |
| 80 #include "webkit/plugins/ppapi/ppb_udp_socket_private_impl.h" | 80 #include "webkit/plugins/ppapi/ppb_udp_socket_private_impl.h" |
| (...skipping 1676 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1757 webkit::ppapi::FullscreenContainer* container = | 1757 webkit::ppapi::FullscreenContainer* container = |
| 1758 instance->fullscreen_container(); | 1758 instance->fullscreen_container(); |
| 1759 DCHECK(container); | 1759 DCHECK(container); |
| 1760 render_widget_id = | 1760 render_widget_id = |
| 1761 static_cast<RenderWidgetFullscreenPepper*>(container)->routing_id(); | 1761 static_cast<RenderWidgetFullscreenPepper*>(container)->routing_id(); |
| 1762 } | 1762 } |
| 1763 | 1763 |
| 1764 int request_id = pending_context_menus_.Add( | 1764 int request_id = pending_context_menus_.Add( |
| 1765 new scoped_refptr<webkit::ppapi::PPB_Flash_Menu_Impl>(menu)); | 1765 new scoped_refptr<webkit::ppapi::PPB_Flash_Menu_Impl>(menu)); |
| 1766 | 1766 |
| 1767 ContextMenuParams params; | 1767 content::ContextMenuParams params; |
| 1768 params.x = position.x(); | 1768 params.x = position.x(); |
| 1769 params.y = position.y(); | 1769 params.y = position.y(); |
| 1770 params.custom_context.is_pepper_menu = true; | 1770 params.custom_context.is_pepper_menu = true; |
| 1771 params.custom_context.request_id = request_id; | 1771 params.custom_context.request_id = request_id; |
| 1772 params.custom_context.render_widget_id = render_widget_id; | 1772 params.custom_context.render_widget_id = render_widget_id; |
| 1773 params.custom_items = menu->menu_data(); | 1773 params.custom_items = menu->menu_data(); |
| 1774 | 1774 |
| 1775 // Transform the position to be in render view's coordinates. | 1775 // Transform the position to be in render view's coordinates. |
| 1776 if (instance->view_data().is_fullscreen || | 1776 if (instance->view_data().is_fullscreen || |
| 1777 instance->FlashIsFullscreen(instance->pp_instance())) { | 1777 instance->FlashIsFullscreen(instance->pp_instance())) { |
| 1778 WebKit::WebRect rect = render_view_->windowRect(); | 1778 WebKit::WebRect rect = render_view_->windowRect(); |
| 1779 params.x -= rect.x; | 1779 params.x -= rect.x; |
| 1780 params.y -= rect.y; | 1780 params.y -= rect.y; |
| 1781 } else { | 1781 } else { |
| 1782 params.x += instance->view_data().rect.point.x; | 1782 params.x += instance->view_data().rect.point.x; |
| 1783 params.y += instance->view_data().rect.point.y; | 1783 params.y += instance->view_data().rect.point.y; |
| 1784 } | 1784 } |
| 1785 | 1785 |
| 1786 IPC::Message* msg = new ViewHostMsg_ContextMenu(render_view_->routing_id(), | 1786 IPC::Message* msg = new ViewHostMsg_ContextMenu(render_view_->routing_id(), |
| 1787 params); | 1787 params); |
| 1788 if (!render_view_->Send(msg)) { | 1788 if (!render_view_->Send(msg)) { |
| 1789 pending_context_menus_.Remove(request_id); | 1789 pending_context_menus_.Remove(request_id); |
| 1790 return PP_ERROR_FAILED; | 1790 return PP_ERROR_FAILED; |
| 1791 } | 1791 } |
| 1792 | 1792 |
| 1793 return PP_OK_COMPLETIONPENDING; | 1793 return PP_OK_COMPLETIONPENDING; |
| 1794 } | 1794 } |
| 1795 | 1795 |
| 1796 void PepperPluginDelegateImpl::OnContextMenuClosed( | 1796 void PepperPluginDelegateImpl::OnContextMenuClosed( |
| 1797 const webkit_glue::CustomContextMenuContext& custom_context) { | 1797 const content::CustomContextMenuContext& custom_context) { |
| 1798 int request_id = custom_context.request_id; | 1798 int request_id = custom_context.request_id; |
| 1799 scoped_refptr<webkit::ppapi::PPB_Flash_Menu_Impl>* menu_ptr = | 1799 scoped_refptr<webkit::ppapi::PPB_Flash_Menu_Impl>* menu_ptr = |
| 1800 pending_context_menus_.Lookup(request_id); | 1800 pending_context_menus_.Lookup(request_id); |
| 1801 if (!menu_ptr) { | 1801 if (!menu_ptr) { |
| 1802 NOTREACHED() << "CompleteShowContextMenu() called twice for the same menu."; | 1802 NOTREACHED() << "CompleteShowContextMenu() called twice for the same menu."; |
| 1803 return; | 1803 return; |
| 1804 } | 1804 } |
| 1805 scoped_refptr<webkit::ppapi::PPB_Flash_Menu_Impl> menu = *menu_ptr; | 1805 scoped_refptr<webkit::ppapi::PPB_Flash_Menu_Impl> menu = *menu_ptr; |
| 1806 DCHECK(menu.get()); | 1806 DCHECK(menu.get()); |
| 1807 pending_context_menus_.Remove(request_id); | 1807 pending_context_menus_.Remove(request_id); |
| 1808 | 1808 |
| 1809 if (has_saved_context_menu_action_) { | 1809 if (has_saved_context_menu_action_) { |
| 1810 menu->CompleteShow(PP_OK, saved_context_menu_action_); | 1810 menu->CompleteShow(PP_OK, saved_context_menu_action_); |
| 1811 has_saved_context_menu_action_ = false; | 1811 has_saved_context_menu_action_ = false; |
| 1812 saved_context_menu_action_ = 0; | 1812 saved_context_menu_action_ = 0; |
| 1813 } else { | 1813 } else { |
| 1814 menu->CompleteShow(PP_ERROR_USERCANCEL, 0); | 1814 menu->CompleteShow(PP_ERROR_USERCANCEL, 0); |
| 1815 } | 1815 } |
| 1816 } | 1816 } |
| 1817 | 1817 |
| 1818 void PepperPluginDelegateImpl::OnCustomContextMenuAction( | 1818 void PepperPluginDelegateImpl::OnCustomContextMenuAction( |
| 1819 const webkit_glue::CustomContextMenuContext& custom_context, | 1819 const content::CustomContextMenuContext& custom_context, |
| 1820 unsigned action) { | 1820 unsigned action) { |
| 1821 // Just save the action. | 1821 // Just save the action. |
| 1822 DCHECK(!has_saved_context_menu_action_); | 1822 DCHECK(!has_saved_context_menu_action_); |
| 1823 has_saved_context_menu_action_ = true; | 1823 has_saved_context_menu_action_ = true; |
| 1824 saved_context_menu_action_ = action; | 1824 saved_context_menu_action_ = action; |
| 1825 } | 1825 } |
| 1826 | 1826 |
| 1827 webkit::ppapi::FullscreenContainer* | 1827 webkit::ppapi::FullscreenContainer* |
| 1828 PepperPluginDelegateImpl::CreateFullscreenContainer( | 1828 PepperPluginDelegateImpl::CreateFullscreenContainer( |
| 1829 webkit::ppapi::PluginInstance* instance) { | 1829 webkit::ppapi::PluginInstance* instance) { |
| (...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2106 void PepperPluginDelegateImpl::UnSetAndDeleteLockTargetAdapter( | 2106 void PepperPluginDelegateImpl::UnSetAndDeleteLockTargetAdapter( |
| 2107 webkit::ppapi::PluginInstance* instance) { | 2107 webkit::ppapi::PluginInstance* instance) { |
| 2108 LockTargetMap::iterator it = mouse_lock_instances_.find(instance); | 2108 LockTargetMap::iterator it = mouse_lock_instances_.find(instance); |
| 2109 if (it != mouse_lock_instances_.end()) { | 2109 if (it != mouse_lock_instances_.end()) { |
| 2110 MouseLockDispatcher::LockTarget* target = it->second; | 2110 MouseLockDispatcher::LockTarget* target = it->second; |
| 2111 render_view_->mouse_lock_dispatcher()->OnLockTargetDestroyed(target); | 2111 render_view_->mouse_lock_dispatcher()->OnLockTargetDestroyed(target); |
| 2112 delete target; | 2112 delete target; |
| 2113 mouse_lock_instances_.erase(it); | 2113 mouse_lock_instances_.erase(it); |
| 2114 } | 2114 } |
| 2115 } | 2115 } |
| OLD | NEW |