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 #if defined(TOOLKIT_GTK) | 7 #if defined(TOOLKIT_GTK) |
8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
9 #elif defined(USE_X11) | 9 #elif defined(USE_X11) |
10 #include <cairo/cairo.h> | 10 #include <cairo/cairo.h> |
(...skipping 731 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
742 channel_host_.get(), route_id, 0, page_url_, GetPluginNPP()); | 742 channel_host_.get(), route_id, 0, page_url_, GetPluginNPP()); |
743 | 743 |
744 return WebBindings::retainObject(npobject_); | 744 return WebBindings::retainObject(npobject_); |
745 } | 745 } |
746 | 746 |
747 NPP WebPluginDelegateProxy::GetPluginNPP() { | 747 NPP WebPluginDelegateProxy::GetPluginNPP() { |
748 // Return a dummy NPP for WebKit to use to identify this plugin. | 748 // Return a dummy NPP for WebKit to use to identify this plugin. |
749 return npp_.get(); | 749 return npp_.get(); |
750 } | 750 } |
751 | 751 |
752 bool WebPluginDelegateProxy::GetFormValue(string16* value) { | 752 bool WebPluginDelegateProxy::GetFormValue(base::string16* value) { |
753 bool success = false; | 753 bool success = false; |
754 Send(new PluginMsg_GetFormValue(instance_id_, value, &success)); | 754 Send(new PluginMsg_GetFormValue(instance_id_, value, &success)); |
755 return success; | 755 return success; |
756 } | 756 } |
757 | 757 |
758 void WebPluginDelegateProxy::DidFinishLoadWithReason( | 758 void WebPluginDelegateProxy::DidFinishLoadWithReason( |
759 const GURL& url, NPReason reason, int notify_id) { | 759 const GURL& url, NPReason reason, int notify_id) { |
760 Send(new PluginMsg_DidFinishLoadWithReason( | 760 Send(new PluginMsg_DidFinishLoadWithReason( |
761 instance_id_, url, reason, notify_id)); | 761 instance_id_, url, reason, notify_id)); |
762 } | 762 } |
(...skipping 30 matching lines...) Expand all Loading... |
793 IPC::Message* msg = new PluginMsg_SetContentAreaFocus(instance_id_, | 793 IPC::Message* msg = new PluginMsg_SetContentAreaFocus(instance_id_, |
794 has_focus); | 794 has_focus); |
795 // Make sure focus events are delivered in the right order relative to | 795 // Make sure focus events are delivered in the right order relative to |
796 // sync messages they might interact with (Paint, HandleEvent, etc.). | 796 // sync messages they might interact with (Paint, HandleEvent, etc.). |
797 msg->set_unblock(true); | 797 msg->set_unblock(true); |
798 Send(msg); | 798 Send(msg); |
799 } | 799 } |
800 | 800 |
801 #if defined(OS_WIN) | 801 #if defined(OS_WIN) |
802 void WebPluginDelegateProxy::ImeCompositionUpdated( | 802 void WebPluginDelegateProxy::ImeCompositionUpdated( |
803 const string16& text, | 803 const base::string16& text, |
804 const std::vector<int>& clauses, | 804 const std::vector<int>& clauses, |
805 const std::vector<int>& target, | 805 const std::vector<int>& target, |
806 int cursor_position, | 806 int cursor_position, |
807 int plugin_id) { | 807 int plugin_id) { |
808 // Dispatch the raw IME data if this plug-in is the focused one. | 808 // Dispatch the raw IME data if this plug-in is the focused one. |
809 if (instance_id_ != plugin_id) | 809 if (instance_id_ != plugin_id) |
810 return; | 810 return; |
811 | 811 |
812 IPC::Message* msg = new PluginMsg_ImeCompositionUpdated(instance_id_, | 812 IPC::Message* msg = new PluginMsg_ImeCompositionUpdated(instance_id_, |
813 text, clauses, target, cursor_position); | 813 text, clauses, target, cursor_position); |
814 msg->set_unblock(true); | 814 msg->set_unblock(true); |
815 Send(msg); | 815 Send(msg); |
816 } | 816 } |
817 | 817 |
818 void WebPluginDelegateProxy::ImeCompositionCompleted(const string16& text, | 818 void WebPluginDelegateProxy::ImeCompositionCompleted(const base::string16& text, |
819 int plugin_id) { | 819 int plugin_id) { |
820 // Dispatch the IME text if this plug-in is the focused one. | 820 // Dispatch the IME text if this plug-in is the focused one. |
821 if (instance_id_ != plugin_id) | 821 if (instance_id_ != plugin_id) |
822 return; | 822 return; |
823 | 823 |
824 IPC::Message* msg = new PluginMsg_ImeCompositionCompleted(instance_id_, text); | 824 IPC::Message* msg = new PluginMsg_ImeCompositionCompleted(instance_id_, text); |
825 msg->set_unblock(true); | 825 msg->set_unblock(true); |
826 Send(msg); | 826 Send(msg); |
827 } | 827 } |
828 #endif | 828 #endif |
(...skipping 28 matching lines...) Expand all Loading... |
857 void WebPluginDelegateProxy::WindowFrameChanged(gfx::Rect window_frame, | 857 void WebPluginDelegateProxy::WindowFrameChanged(gfx::Rect window_frame, |
858 gfx::Rect view_frame) { | 858 gfx::Rect view_frame) { |
859 IPC::Message* msg = new PluginMsg_WindowFrameChanged(instance_id_, | 859 IPC::Message* msg = new PluginMsg_WindowFrameChanged(instance_id_, |
860 window_frame, | 860 window_frame, |
861 view_frame); | 861 view_frame); |
862 // Make sure frame events are delivered in the right order relative to | 862 // Make sure frame events are delivered in the right order relative to |
863 // sync messages they might interact with (e.g., HandleEvent). | 863 // sync messages they might interact with (e.g., HandleEvent). |
864 msg->set_unblock(true); | 864 msg->set_unblock(true); |
865 Send(msg); | 865 Send(msg); |
866 } | 866 } |
867 void WebPluginDelegateProxy::ImeCompositionCompleted(const string16& text, | 867 void WebPluginDelegateProxy::ImeCompositionCompleted(const base::string16& text, |
868 int plugin_id) { | 868 int plugin_id) { |
869 // If the message isn't intended for this plugin, there's nothing to do. | 869 // If the message isn't intended for this plugin, there's nothing to do. |
870 if (instance_id_ != plugin_id) | 870 if (instance_id_ != plugin_id) |
871 return; | 871 return; |
872 | 872 |
873 IPC::Message* msg = new PluginMsg_ImeCompositionCompleted(instance_id_, | 873 IPC::Message* msg = new PluginMsg_ImeCompositionCompleted(instance_id_, |
874 text); | 874 text); |
875 // Order relative to other key events is important. | 875 // Order relative to other key events is important. |
876 msg->set_unblock(true); | 876 msg->set_unblock(true); |
877 Send(msg); | 877 Send(msg); |
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1202 if (plugin_) | 1202 if (plugin_) |
1203 plugin_->AcceleratedPluginSwappedIOSurface(); | 1203 plugin_->AcceleratedPluginSwappedIOSurface(); |
1204 } | 1204 } |
1205 #endif | 1205 #endif |
1206 | 1206 |
1207 #if defined(OS_WIN) | 1207 #if defined(OS_WIN) |
1208 bool WebPluginDelegateProxy::UseSynchronousGeometryUpdates() { | 1208 bool WebPluginDelegateProxy::UseSynchronousGeometryUpdates() { |
1209 // Need to update geometry synchronously with WMP, otherwise if a site | 1209 // Need to update geometry synchronously with WMP, otherwise if a site |
1210 // scripts the plugin to start playing while it's in the middle of handling | 1210 // scripts the plugin to start playing while it's in the middle of handling |
1211 // an update geometry message, videos don't play. See urls in bug 20260. | 1211 // an update geometry message, videos don't play. See urls in bug 20260. |
1212 if (info_.name.find(ASCIIToUTF16("Windows Media Player")) != string16::npos) | 1212 if (info_.name.find(ASCIIToUTF16("Windows Media Player")) != |
| 1213 base::string16::npos) |
1213 return true; | 1214 return true; |
1214 | 1215 |
1215 // The move networks plugin needs to be informed of geometry updates | 1216 // The move networks plugin needs to be informed of geometry updates |
1216 // synchronously. | 1217 // synchronously. |
1217 std::vector<WebPluginMimeType>::iterator index; | 1218 std::vector<WebPluginMimeType>::iterator index; |
1218 for (index = info_.mime_types.begin(); index != info_.mime_types.end(); | 1219 for (index = info_.mime_types.begin(); index != info_.mime_types.end(); |
1219 index++) { | 1220 index++) { |
1220 if (index->mime_type == "application/x-vnd.moveplayer.qm" || | 1221 if (index->mime_type == "application/x-vnd.moveplayer.qm" || |
1221 index->mime_type == "application/x-vnd.moveplay2.qm" || | 1222 index->mime_type == "application/x-vnd.moveplay2.qm" || |
1222 index->mime_type == "application/x-vnd.movenetworks.qm" || | 1223 index->mime_type == "application/x-vnd.movenetworks.qm" || |
(...skipping 12 matching lines...) Expand all Loading... |
1235 | 1236 |
1236 plugin_->URLRedirectResponse(allow, resource_id); | 1237 plugin_->URLRedirectResponse(allow, resource_id); |
1237 } | 1238 } |
1238 | 1239 |
1239 void WebPluginDelegateProxy::OnCheckIfRunInsecureContent(const GURL& url, | 1240 void WebPluginDelegateProxy::OnCheckIfRunInsecureContent(const GURL& url, |
1240 bool* result) { | 1241 bool* result) { |
1241 *result = plugin_->CheckIfRunInsecureContent(url); | 1242 *result = plugin_->CheckIfRunInsecureContent(url); |
1242 } | 1243 } |
1243 | 1244 |
1244 } // namespace content | 1245 } // namespace content |
OLD | NEW |