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 "content/renderer/webplugin_delegate_proxy.h" | 5 #include "content/renderer/webplugin_delegate_proxy.h" |
6 | 6 |
7 #if defined(TOOLKIT_USES_GTK) | 7 #if defined(TOOLKIT_USES_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 13 matching lines...) Expand all Loading... |
24 #include "base/version.h" | 24 #include "base/version.h" |
25 #include "content/common/child_process.h" | 25 #include "content/common/child_process.h" |
26 #include "content/common/npobject_proxy.h" | 26 #include "content/common/npobject_proxy.h" |
27 #include "content/common/npobject_stub.h" | 27 #include "content/common/npobject_stub.h" |
28 #include "content/common/npobject_util.h" | 28 #include "content/common/npobject_util.h" |
29 #include "content/common/plugin_messages.h" | 29 #include "content/common/plugin_messages.h" |
30 #include "content/common/view_messages.h" | 30 #include "content/common/view_messages.h" |
31 #include "content/public/renderer/content_renderer_client.h" | 31 #include "content/public/renderer/content_renderer_client.h" |
32 #include "content/renderer/gpu/command_buffer_proxy.h" | 32 #include "content/renderer/gpu/command_buffer_proxy.h" |
33 #include "content/renderer/plugin_channel_host.h" | 33 #include "content/renderer/plugin_channel_host.h" |
34 #include "content/renderer/render_thread.h" | 34 #include "content/renderer/render_thread_impl.h" |
35 #include "content/renderer/render_view.h" | 35 #include "content/renderer/render_view.h" |
36 #include "ipc/ipc_channel_handle.h" | 36 #include "ipc/ipc_channel_handle.h" |
37 #include "net/base/mime_util.h" | 37 #include "net/base/mime_util.h" |
38 #include "skia/ext/platform_canvas.h" | 38 #include "skia/ext/platform_canvas.h" |
39 #include "third_party/WebKit/Source/WebKit/chromium/public/WebBindings.h" | 39 #include "third_party/WebKit/Source/WebKit/chromium/public/WebBindings.h" |
40 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCursorInfo.h" | 40 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCursorInfo.h" |
41 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" | 41 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" |
42 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDragData.h" | 42 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDragData.h" |
43 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" | 43 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" |
44 #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" | 44 #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 } | 278 } |
279 #endif | 279 #endif |
280 | 280 |
281 bool WebPluginDelegateProxy::Initialize( | 281 bool WebPluginDelegateProxy::Initialize( |
282 const GURL& url, | 282 const GURL& url, |
283 const std::vector<std::string>& arg_names, | 283 const std::vector<std::string>& arg_names, |
284 const std::vector<std::string>& arg_values, | 284 const std::vector<std::string>& arg_values, |
285 webkit::npapi::WebPlugin* plugin, | 285 webkit::npapi::WebPlugin* plugin, |
286 bool load_manually) { | 286 bool load_manually) { |
287 IPC::ChannelHandle channel_handle; | 287 IPC::ChannelHandle channel_handle; |
288 if (!RenderThread::current()->Send(new ViewHostMsg_OpenChannelToPlugin( | 288 if (!RenderThreadImpl::current()->Send(new ViewHostMsg_OpenChannelToPlugin( |
289 render_view_->routing_id(), url, page_url_, mime_type_, | 289 render_view_->routing_id(), url, page_url_, mime_type_, |
290 &channel_handle, &info_))) { | 290 &channel_handle, &info_))) { |
291 return false; | 291 return false; |
292 } | 292 } |
293 | 293 |
294 if (channel_handle.name.empty()) { | 294 if (channel_handle.name.empty()) { |
295 // We got an invalid handle. Either the plugin couldn't be found (which | 295 // We got an invalid handle. Either the plugin couldn't be found (which |
296 // shouldn't happen, since if we got here the plugin should exist) or the | 296 // shouldn't happen, since if we got here the plugin should exist) or the |
297 // plugin crashed on initialization. | 297 // plugin crashed on initialization. |
298 if (!info_.path.empty()) { | 298 if (!info_.path.empty()) { |
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
645 scoped_ptr<skia::PlatformCanvas>* canvas) { | 645 scoped_ptr<skia::PlatformCanvas>* canvas) { |
646 const size_t size = BitmapSizeForPluginRect(plugin_rect_); | 646 const size_t size = BitmapSizeForPluginRect(plugin_rect_); |
647 #if defined(OS_POSIX) && !defined(OS_MACOSX) | 647 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
648 memory->reset(TransportDIB::Create(size, 0)); | 648 memory->reset(TransportDIB::Create(size, 0)); |
649 if (!memory->get()) | 649 if (!memory->get()) |
650 return false; | 650 return false; |
651 #endif | 651 #endif |
652 #if defined(OS_MACOSX) | 652 #if defined(OS_MACOSX) |
653 TransportDIB::Handle handle; | 653 TransportDIB::Handle handle; |
654 IPC::Message* msg = new ViewHostMsg_AllocTransportDIB(size, false, &handle); | 654 IPC::Message* msg = new ViewHostMsg_AllocTransportDIB(size, false, &handle); |
655 if (!RenderThread::current()->Send(msg)) | 655 if (!RenderThreadImpl::current()->Send(msg)) |
656 return false; | 656 return false; |
657 if (handle.fd < 0) | 657 if (handle.fd < 0) |
658 return false; | 658 return false; |
659 memory->reset(TransportDIB::Map(handle)); | 659 memory->reset(TransportDIB::Map(handle)); |
660 #else | 660 #else |
661 static uint32 sequence_number = 0; | 661 static uint32 sequence_number = 0; |
662 memory->reset(TransportDIB::Create(size, sequence_number++)); | 662 memory->reset(TransportDIB::Create(size, sequence_number++)); |
663 #endif | 663 #endif |
664 canvas->reset((*memory)->GetPlatformCanvas(plugin_rect_.width(), | 664 canvas->reset((*memory)->GetPlatformCanvas(plugin_rect_.width(), |
665 plugin_rect_.height())); | 665 plugin_rect_.height())); |
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1141 // otherwise when the channel is closed. | 1141 // otherwise when the channel is closed. |
1142 window_script_object_ = (new NPObjectStub( | 1142 window_script_object_ = (new NPObjectStub( |
1143 npobject, channel_host_.get(), route_id, 0, page_url_))->AsWeakPtr(); | 1143 npobject, channel_host_.get(), route_id, 0, page_url_))->AsWeakPtr(); |
1144 *success = true; | 1144 *success = true; |
1145 } | 1145 } |
1146 | 1146 |
1147 void WebPluginDelegateProxy::OnResolveProxy(const GURL& url, | 1147 void WebPluginDelegateProxy::OnResolveProxy(const GURL& url, |
1148 bool* result, | 1148 bool* result, |
1149 std::string* proxy_list) { | 1149 std::string* proxy_list) { |
1150 *result = false; | 1150 *result = false; |
1151 RenderThread::current()->Send( | 1151 RenderThreadImpl::current()->Send( |
1152 new ViewHostMsg_ResolveProxy(url, result, proxy_list)); | 1152 new ViewHostMsg_ResolveProxy(url, result, proxy_list)); |
1153 } | 1153 } |
1154 | 1154 |
1155 void WebPluginDelegateProxy::OnGetPluginElement(int route_id, bool* success) { | 1155 void WebPluginDelegateProxy::OnGetPluginElement(int route_id, bool* success) { |
1156 *success = false; | 1156 *success = false; |
1157 NPObject* npobject = NULL; | 1157 NPObject* npobject = NULL; |
1158 if (plugin_) | 1158 if (plugin_) |
1159 npobject = plugin_->GetPluginElement(); | 1159 npobject = plugin_->GetPluginElement(); |
1160 if (!npobject) | 1160 if (!npobject) |
1161 return; | 1161 return; |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1438 } | 1438 } |
1439 #endif | 1439 #endif |
1440 | 1440 |
1441 void WebPluginDelegateProxy::OnURLRedirectResponse(bool allow, | 1441 void WebPluginDelegateProxy::OnURLRedirectResponse(bool allow, |
1442 int resource_id) { | 1442 int resource_id) { |
1443 if (!plugin_) | 1443 if (!plugin_) |
1444 return; | 1444 return; |
1445 | 1445 |
1446 plugin_->URLRedirectResponse(allow, resource_id); | 1446 plugin_->URLRedirectResponse(allow, resource_id); |
1447 } | 1447 } |
OLD | NEW |