| 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/npapi/webplugin_delegate_proxy.h" | 5 #include "content/renderer/npapi/webplugin_delegate_proxy.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 | 10 |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 void WebPluginDelegateProxy::PluginDestroyed() { | 134 void WebPluginDelegateProxy::PluginDestroyed() { |
| 135 #if defined(OS_MACOSX) || defined(OS_WIN) | 135 #if defined(OS_MACOSX) || defined(OS_WIN) |
| 136 // Ensure that the renderer doesn't think the plugin still has focus. | 136 // Ensure that the renderer doesn't think the plugin still has focus. |
| 137 if (render_view_) | 137 if (render_view_) |
| 138 render_view_->PluginFocusChanged(false, instance_id_); | 138 render_view_->PluginFocusChanged(false, instance_id_); |
| 139 #endif | 139 #endif |
| 140 | 140 |
| 141 #if defined(OS_WIN) | 141 #if defined(OS_WIN) |
| 142 if (dummy_activation_window_ && render_view_) { | 142 if (dummy_activation_window_ && render_view_) { |
| 143 render_view_->Send(new ViewHostMsg_WindowlessPluginDummyWindowDestroyed( | 143 render_view_->Send(new ViewHostMsg_WindowlessPluginDummyWindowDestroyed( |
| 144 render_view_->GetRoutingID(), dummy_activation_window_)); | 144 render_view_->routing_id(), dummy_activation_window_)); |
| 145 } | 145 } |
| 146 dummy_activation_window_ = NULL; | 146 dummy_activation_window_ = NULL; |
| 147 #endif | 147 #endif |
| 148 | 148 |
| 149 if (window_) | 149 if (window_) |
| 150 WillDestroyWindow(); | 150 WillDestroyWindow(); |
| 151 | 151 |
| 152 if (render_view_.get()) | 152 if (render_view_.get()) |
| 153 render_view_->UnregisterPluginDelegate(this); | 153 render_view_->UnregisterPluginDelegate(this); |
| 154 | 154 |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 // Inform the channel of the mapping between our instance-Id and dummy NPP | 261 // Inform the channel of the mapping between our instance-Id and dummy NPP |
| 262 // identifier, for use in object ownership tracking. | 262 // identifier, for use in object ownership tracking. |
| 263 channel_host_->AddMappingForNPObjectOwner(instance_id_, GetPluginNPP()); | 263 channel_host_->AddMappingForNPObjectOwner(instance_id_, GetPluginNPP()); |
| 264 | 264 |
| 265 // Now tell the PluginInstance in the plugin process to initialize. | 265 // Now tell the PluginInstance in the plugin process to initialize. |
| 266 PluginMsg_Init_Params params; | 266 PluginMsg_Init_Params params; |
| 267 params.url = url; | 267 params.url = url; |
| 268 params.page_url = page_url_; | 268 params.page_url = page_url_; |
| 269 params.arg_names = arg_names; | 269 params.arg_names = arg_names; |
| 270 params.arg_values = arg_values; | 270 params.arg_values = arg_values; |
| 271 params.host_render_view_routing_id = render_view_->GetRoutingID(); | 271 params.host_render_view_routing_id = render_view_->routing_id(); |
| 272 params.load_manually = load_manually; | 272 params.load_manually = load_manually; |
| 273 | 273 |
| 274 result = false; | 274 result = false; |
| 275 Send(new PluginMsg_Init(instance_id_, params, &transparent_, &result)); | 275 Send(new PluginMsg_Init(instance_id_, params, &transparent_, &result)); |
| 276 | 276 |
| 277 if (!result) | 277 if (!result) |
| 278 LOG(WARNING) << "PluginMsg_Init returned false"; | 278 LOG(WARNING) << "PluginMsg_Init returned false"; |
| 279 | 279 |
| 280 render_view_->RegisterPluginDelegate(this); | 280 render_view_->RegisterPluginDelegate(this); |
| 281 | 281 |
| (...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 673 window_has_focus); | 673 window_has_focus); |
| 674 // Make sure focus events are delivered in the right order relative to | 674 // Make sure focus events are delivered in the right order relative to |
| 675 // sync messages they might interact with (Paint, HandleEvent, etc.). | 675 // sync messages they might interact with (Paint, HandleEvent, etc.). |
| 676 msg->set_unblock(true); | 676 msg->set_unblock(true); |
| 677 Send(msg); | 677 Send(msg); |
| 678 } | 678 } |
| 679 | 679 |
| 680 void WebPluginDelegateProxy::SetContainerVisibility(bool is_visible) { | 680 void WebPluginDelegateProxy::SetContainerVisibility(bool is_visible) { |
| 681 IPC::Message* msg; | 681 IPC::Message* msg; |
| 682 if (is_visible) { | 682 if (is_visible) { |
| 683 gfx::Rect window_frame = render_view_->GetWidget()->rootWindowRect(); | 683 gfx::Rect window_frame = render_view_->rootWindowRect(); |
| 684 gfx::Rect view_frame = render_view_->GetWidget()->windowRect(); | 684 gfx::Rect view_frame = render_view_->windowRect(); |
| 685 blink::WebView* webview = render_view_->webview(); | 685 blink::WebView* webview = render_view_->webview(); |
| 686 msg = new PluginMsg_ContainerShown(instance_id_, window_frame, view_frame, | 686 msg = new PluginMsg_ContainerShown(instance_id_, window_frame, view_frame, |
| 687 webview && webview->isActive()); | 687 webview && webview->isActive()); |
| 688 } else { | 688 } else { |
| 689 msg = new PluginMsg_ContainerHidden(instance_id_); | 689 msg = new PluginMsg_ContainerHidden(instance_id_); |
| 690 } | 690 } |
| 691 // Make sure visibility events are delivered in the right order relative to | 691 // Make sure visibility events are delivered in the right order relative to |
| 692 // sync messages they might interact with (Paint, HandleEvent, etc.). | 692 // sync messages they might interact with (Paint, HandleEvent, etc.). |
| 693 msg->set_unblock(true); | 693 msg->set_unblock(true); |
| 694 Send(msg); | 694 Send(msg); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 739 void WebPluginDelegateProxy::OnSetWindowlessData( | 739 void WebPluginDelegateProxy::OnSetWindowlessData( |
| 740 HANDLE modal_loop_pump_messages_event_handle, | 740 HANDLE modal_loop_pump_messages_event_handle, |
| 741 gfx::NativeViewId dummy_activation_window) { | 741 gfx::NativeViewId dummy_activation_window) { |
| 742 DCHECK(!modal_loop_pump_messages_event_.get()); | 742 DCHECK(!modal_loop_pump_messages_event_.get()); |
| 743 DCHECK(!dummy_activation_window_); | 743 DCHECK(!dummy_activation_window_); |
| 744 base::win::ScopedHandle modal_loop_pump_messages_event( | 744 base::win::ScopedHandle modal_loop_pump_messages_event( |
| 745 modal_loop_pump_messages_event_handle); | 745 modal_loop_pump_messages_event_handle); |
| 746 | 746 |
| 747 dummy_activation_window_ = dummy_activation_window; | 747 dummy_activation_window_ = dummy_activation_window; |
| 748 render_view_->Send(new ViewHostMsg_WindowlessPluginDummyWindowCreated( | 748 render_view_->Send(new ViewHostMsg_WindowlessPluginDummyWindowCreated( |
| 749 render_view_->GetRoutingID(), dummy_activation_window_)); | 749 render_view_->routing_id(), dummy_activation_window_)); |
| 750 | 750 |
| 751 // Bug 25583: this can be null because some "virus scanners" block the | 751 // Bug 25583: this can be null because some "virus scanners" block the |
| 752 // DuplicateHandle call in the plugin process. | 752 // DuplicateHandle call in the plugin process. |
| 753 if (!modal_loop_pump_messages_event.IsValid()) | 753 if (!modal_loop_pump_messages_event.IsValid()) |
| 754 return; | 754 return; |
| 755 | 755 |
| 756 modal_loop_pump_messages_event_.reset( | 756 modal_loop_pump_messages_event_.reset( |
| 757 new base::WaitableEvent(modal_loop_pump_messages_event.Pass())); | 757 new base::WaitableEvent(modal_loop_pump_messages_event.Pass())); |
| 758 } | 758 } |
| 759 | 759 |
| 760 void WebPluginDelegateProxy::OnNotifyIMEStatus(int input_type, | 760 void WebPluginDelegateProxy::OnNotifyIMEStatus(int input_type, |
| 761 const gfx::Rect& caret_rect) { | 761 const gfx::Rect& caret_rect) { |
| 762 if (!render_view_) | 762 if (!render_view_) |
| 763 return; | 763 return; |
| 764 | 764 |
| 765 ViewHostMsg_TextInputState_Params params; | 765 ViewHostMsg_TextInputState_Params params; |
| 766 params.type = static_cast<ui::TextInputType>(input_type); | 766 params.type = static_cast<ui::TextInputType>(input_type); |
| 767 params.mode = ui::TEXT_INPUT_MODE_DEFAULT; | 767 params.mode = ui::TEXT_INPUT_MODE_DEFAULT; |
| 768 params.can_compose_inline = true; | 768 params.can_compose_inline = true; |
| 769 render_view_->Send(new ViewHostMsg_TextInputStateChanged( | 769 render_view_->Send(new ViewHostMsg_TextInputStateChanged( |
| 770 render_view_->GetRoutingID(), params)); | 770 render_view_->routing_id(), params)); |
| 771 | 771 |
| 772 ViewHostMsg_SelectionBounds_Params bounds_params; | 772 ViewHostMsg_SelectionBounds_Params bounds_params; |
| 773 bounds_params.anchor_rect = bounds_params.focus_rect = caret_rect; | 773 bounds_params.anchor_rect = bounds_params.focus_rect = caret_rect; |
| 774 bounds_params.anchor_dir = bounds_params.focus_dir = | 774 bounds_params.anchor_dir = bounds_params.focus_dir = |
| 775 blink::WebTextDirectionLeftToRight; | 775 blink::WebTextDirectionLeftToRight; |
| 776 bounds_params.is_anchor_first = true; | 776 bounds_params.is_anchor_first = true; |
| 777 render_view_->Send(new ViewHostMsg_SelectionBoundsChanged( | 777 render_view_->Send(new ViewHostMsg_SelectionBoundsChanged( |
| 778 render_view_->GetRoutingID(), bounds_params)); | 778 render_view_->routing_id(), |
| 779 bounds_params)); |
| 779 } | 780 } |
| 780 #endif | 781 #endif |
| 781 | 782 |
| 782 void WebPluginDelegateProxy::OnInvalidateRect(const gfx::Rect& rect) { | 783 void WebPluginDelegateProxy::OnInvalidateRect(const gfx::Rect& rect) { |
| 783 if (!plugin_) | 784 if (!plugin_) |
| 784 return; | 785 return; |
| 785 | 786 |
| 786 // Clip the invalidation rect to the plugin bounds; the plugin may have been | 787 // Clip the invalidation rect to the plugin bounds; the plugin may have been |
| 787 // resized since the invalidate message was sent. | 788 // resized since the invalidate message was sent. |
| 788 gfx::Rect clipped_rect = | 789 gfx::Rect clipped_rect = |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 973 index->mime_type == "application/x-vnd.movenetworks.qm" || | 974 index->mime_type == "application/x-vnd.movenetworks.qm" || |
| 974 index->mime_type == "application/x-vnd.mnplayer.qm") { | 975 index->mime_type == "application/x-vnd.mnplayer.qm") { |
| 975 return true; | 976 return true; |
| 976 } | 977 } |
| 977 } | 978 } |
| 978 return false; | 979 return false; |
| 979 } | 980 } |
| 980 #endif | 981 #endif |
| 981 | 982 |
| 982 } // namespace content | 983 } // namespace content |
| OLD | NEW |