| 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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 // For e.g. response for a HTTP byte range request. | 162 // For e.g. response for a HTTP byte range request. |
| 163 bool multibyte_response_expected_; | 163 bool multibyte_response_expected_; |
| 164 }; | 164 }; |
| 165 | 165 |
| 166 WebPluginDelegateProxy::WebPluginDelegateProxy( | 166 WebPluginDelegateProxy::WebPluginDelegateProxy( |
| 167 const std::string& mime_type, | 167 const std::string& mime_type, |
| 168 const base::WeakPtr<RenderViewImpl>& render_view) | 168 const base::WeakPtr<RenderViewImpl>& render_view) |
| 169 : render_view_(render_view), | 169 : render_view_(render_view), |
| 170 plugin_(NULL), | 170 plugin_(NULL), |
| 171 uses_shared_bitmaps_(false), | 171 uses_shared_bitmaps_(false), |
| 172 #if defined(OS_MACOSX) |
| 173 uses_compositor_(false), |
| 174 #endif |
| 172 window_(gfx::kNullPluginWindow), | 175 window_(gfx::kNullPluginWindow), |
| 173 mime_type_(mime_type), | 176 mime_type_(mime_type), |
| 174 instance_id_(MSG_ROUTING_NONE), | 177 instance_id_(MSG_ROUTING_NONE), |
| 175 npobject_(NULL), | 178 npobject_(NULL), |
| 176 sad_plugin_(NULL), | 179 sad_plugin_(NULL), |
| 177 invalidate_pending_(false), | 180 invalidate_pending_(false), |
| 178 transparent_(false), | 181 transparent_(false), |
| 179 front_buffer_index_(0), | 182 front_buffer_index_(0), |
| 180 page_url_(render_view_->webview()->mainFrame()->document().url()) { | 183 page_url_(render_view_->webview()->mainFrame()->document().url()) { |
| 181 } | 184 } |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 428 OnAcceleratedSurfaceSetIOSurface) | 431 OnAcceleratedSurfaceSetIOSurface) |
| 429 // Used on 10.5 and earlier. | 432 // Used on 10.5 and earlier. |
| 430 IPC_MESSAGE_HANDLER(PluginHostMsg_AcceleratedSurfaceSetTransportDIB, | 433 IPC_MESSAGE_HANDLER(PluginHostMsg_AcceleratedSurfaceSetTransportDIB, |
| 431 OnAcceleratedSurfaceSetTransportDIB) | 434 OnAcceleratedSurfaceSetTransportDIB) |
| 432 IPC_MESSAGE_HANDLER(PluginHostMsg_AllocTransportDIB, | 435 IPC_MESSAGE_HANDLER(PluginHostMsg_AllocTransportDIB, |
| 433 OnAcceleratedSurfaceAllocTransportDIB) | 436 OnAcceleratedSurfaceAllocTransportDIB) |
| 434 IPC_MESSAGE_HANDLER(PluginHostMsg_FreeTransportDIB, | 437 IPC_MESSAGE_HANDLER(PluginHostMsg_FreeTransportDIB, |
| 435 OnAcceleratedSurfaceFreeTransportDIB) | 438 OnAcceleratedSurfaceFreeTransportDIB) |
| 436 IPC_MESSAGE_HANDLER(PluginHostMsg_AcceleratedSurfaceBuffersSwapped, | 439 IPC_MESSAGE_HANDLER(PluginHostMsg_AcceleratedSurfaceBuffersSwapped, |
| 437 OnAcceleratedSurfaceBuffersSwapped) | 440 OnAcceleratedSurfaceBuffersSwapped) |
| 441 // Used only on 10.6 and later. |
| 442 IPC_MESSAGE_HANDLER(PluginHostMsg_AcceleratedPluginEnabledRendering, |
| 443 OnAcceleratedPluginEnabledRendering) |
| 444 IPC_MESSAGE_HANDLER(PluginHostMsg_AcceleratedPluginAllocatedIOSurface, |
| 445 OnAcceleratedPluginAllocatedIOSurface) |
| 446 IPC_MESSAGE_HANDLER(PluginHostMsg_AcceleratedPluginSwappedIOSurface, |
| 447 OnAcceleratedPluginSwappedIOSurface) |
| 438 #endif | 448 #endif |
| 439 IPC_MESSAGE_HANDLER(PluginHostMsg_URLRedirectResponse, | 449 IPC_MESSAGE_HANDLER(PluginHostMsg_URLRedirectResponse, |
| 440 OnURLRedirectResponse) | 450 OnURLRedirectResponse) |
| 441 IPC_MESSAGE_UNHANDLED(handled = false) | 451 IPC_MESSAGE_UNHANDLED(handled = false) |
| 442 IPC_END_MESSAGE_MAP() | 452 IPC_END_MESSAGE_MAP() |
| 443 DCHECK(handled); | 453 DCHECK(handled); |
| 444 return handled; | 454 return handled; |
| 445 } | 455 } |
| 446 | 456 |
| 447 void WebPluginDelegateProxy::OnChannelError() { | 457 void WebPluginDelegateProxy::OnChannelError() { |
| (...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1023 | 1033 |
| 1024 IPC::Message* msg = new PluginMsg_ImeCompositionCompleted(instance_id_, | 1034 IPC::Message* msg = new PluginMsg_ImeCompositionCompleted(instance_id_, |
| 1025 text); | 1035 text); |
| 1026 // Order relative to other key events is important. | 1036 // Order relative to other key events is important. |
| 1027 msg->set_unblock(true); | 1037 msg->set_unblock(true); |
| 1028 Send(msg); | 1038 Send(msg); |
| 1029 } | 1039 } |
| 1030 #endif // OS_MACOSX | 1040 #endif // OS_MACOSX |
| 1031 | 1041 |
| 1032 void WebPluginDelegateProxy::OnSetWindow(gfx::PluginWindowHandle window) { | 1042 void WebPluginDelegateProxy::OnSetWindow(gfx::PluginWindowHandle window) { |
| 1043 #if defined(OS_MACOSX) |
| 1044 uses_shared_bitmaps_ = !window && !uses_compositor_; |
| 1045 #else |
| 1033 uses_shared_bitmaps_ = !window; | 1046 uses_shared_bitmaps_ = !window; |
| 1047 #endif |
| 1034 window_ = window; | 1048 window_ = window; |
| 1035 if (plugin_) | 1049 if (plugin_) |
| 1036 plugin_->SetWindow(window); | 1050 plugin_->SetWindow(window); |
| 1037 } | 1051 } |
| 1038 | 1052 |
| 1039 void WebPluginDelegateProxy::WillDestroyWindow() { | 1053 void WebPluginDelegateProxy::WillDestroyWindow() { |
| 1040 DCHECK(window_); | 1054 DCHECK(window_); |
| 1041 plugin_->WillDestroyWindow(window_); | 1055 plugin_->WillDestroyWindow(window_); |
| 1042 #if defined(OS_MACOSX) | 1056 #if defined(OS_MACOSX) |
| 1043 if (window_) { | 1057 if (window_) { |
| (...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1379 TransportDIB::Id dib_id) { | 1393 TransportDIB::Id dib_id) { |
| 1380 if (render_view_) | 1394 if (render_view_) |
| 1381 render_view_->AcceleratedSurfaceFreeTransportDIB(dib_id); | 1395 render_view_->AcceleratedSurfaceFreeTransportDIB(dib_id); |
| 1382 } | 1396 } |
| 1383 | 1397 |
| 1384 void WebPluginDelegateProxy::OnAcceleratedSurfaceBuffersSwapped( | 1398 void WebPluginDelegateProxy::OnAcceleratedSurfaceBuffersSwapped( |
| 1385 gfx::PluginWindowHandle window, uint64 surface_id) { | 1399 gfx::PluginWindowHandle window, uint64 surface_id) { |
| 1386 if (render_view_) | 1400 if (render_view_) |
| 1387 render_view_->AcceleratedSurfaceBuffersSwapped(window, surface_id); | 1401 render_view_->AcceleratedSurfaceBuffersSwapped(window, surface_id); |
| 1388 } | 1402 } |
| 1403 |
| 1404 void WebPluginDelegateProxy::OnAcceleratedPluginEnabledRendering() { |
| 1405 uses_compositor_ = true; |
| 1406 OnSetWindow(NULL); |
| 1407 } |
| 1408 |
| 1409 void WebPluginDelegateProxy::OnAcceleratedPluginAllocatedIOSurface( |
| 1410 int32 width, |
| 1411 int32 height, |
| 1412 uint32 surface_id) { |
| 1413 if (plugin_) |
| 1414 plugin_->AcceleratedPluginAllocatedIOSurface(width, height, surface_id); |
| 1415 } |
| 1416 |
| 1417 void WebPluginDelegateProxy::OnAcceleratedPluginSwappedIOSurface() { |
| 1418 if (plugin_) |
| 1419 plugin_->AcceleratedPluginSwappedIOSurface(); |
| 1420 } |
| 1389 #endif | 1421 #endif |
| 1390 | 1422 |
| 1391 #if defined(OS_WIN) | 1423 #if defined(OS_WIN) |
| 1392 bool WebPluginDelegateProxy::UseSynchronousGeometryUpdates() { | 1424 bool WebPluginDelegateProxy::UseSynchronousGeometryUpdates() { |
| 1393 // Need to update geometry synchronously with WMP, otherwise if a site | 1425 // Need to update geometry synchronously with WMP, otherwise if a site |
| 1394 // scripts the plugin to start playing while it's in the middle of handling | 1426 // scripts the plugin to start playing while it's in the middle of handling |
| 1395 // an update geometry message, videos don't play. See urls in bug 20260. | 1427 // an update geometry message, videos don't play. See urls in bug 20260. |
| 1396 if (info_.name.find(ASCIIToUTF16("Windows Media Player")) != string16::npos) | 1428 if (info_.name.find(ASCIIToUTF16("Windows Media Player")) != string16::npos) |
| 1397 return true; | 1429 return true; |
| 1398 | 1430 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 1412 } | 1444 } |
| 1413 #endif | 1445 #endif |
| 1414 | 1446 |
| 1415 void WebPluginDelegateProxy::OnURLRedirectResponse(bool allow, | 1447 void WebPluginDelegateProxy::OnURLRedirectResponse(bool allow, |
| 1416 int resource_id) { | 1448 int resource_id) { |
| 1417 if (!plugin_) | 1449 if (!plugin_) |
| 1418 return; | 1450 return; |
| 1419 | 1451 |
| 1420 plugin_->URLRedirectResponse(allow, resource_id); | 1452 plugin_->URLRedirectResponse(allow, resource_id); |
| 1421 } | 1453 } |
| OLD | NEW |