OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/renderer/webplugin_delegate_proxy.h" | 5 #include "chrome/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 #endif | 9 #endif |
10 | 10 |
(...skipping 1037 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1048 void WebPluginDelegateProxy::OnSetWindow(gfx::PluginWindowHandle window) { | 1048 void WebPluginDelegateProxy::OnSetWindow(gfx::PluginWindowHandle window) { |
1049 uses_shared_bitmaps_ = !window; | 1049 uses_shared_bitmaps_ = !window; |
1050 window_ = window; | 1050 window_ = window; |
1051 if (plugin_) | 1051 if (plugin_) |
1052 plugin_->SetWindow(window); | 1052 plugin_->SetWindow(window); |
1053 } | 1053 } |
1054 | 1054 |
1055 void WebPluginDelegateProxy::WillDestroyWindow() { | 1055 void WebPluginDelegateProxy::WillDestroyWindow() { |
1056 DCHECK(window_); | 1056 DCHECK(window_); |
1057 plugin_->WillDestroyWindow(window_); | 1057 plugin_->WillDestroyWindow(window_); |
1058 #if defined(OS_MACOSX) | |
1059 if (window_) { | |
1060 // This is actually a "fake" window handle only for the GPU | |
1061 // plugin. Deallocate it on the browser side. | |
1062 if (render_view_) | |
1063 render_view_->DestroyFakePluginWindowHandle(window_); | |
1064 } | |
1065 #endif | |
1066 window_ = gfx::kNullPluginWindow; | 1058 window_ = gfx::kNullPluginWindow; |
1067 } | 1059 } |
1068 | 1060 |
1069 #if defined(OS_WIN) | 1061 #if defined(OS_WIN) |
1070 void WebPluginDelegateProxy::OnSetWindowlessPumpEvent( | 1062 void WebPluginDelegateProxy::OnSetWindowlessPumpEvent( |
1071 HANDLE modal_loop_pump_messages_event) { | 1063 HANDLE modal_loop_pump_messages_event) { |
1072 DCHECK(modal_loop_pump_messages_event_ == NULL); | 1064 DCHECK(modal_loop_pump_messages_event_ == NULL); |
1073 | 1065 |
1074 // Bug 25583: this can be null because some "virus scanners" block the | 1066 // Bug 25583: this can be null because some "virus scanners" block the |
1075 // DuplicateHandle call in the plugin process. | 1067 // DuplicateHandle call in the plugin process. |
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1437 // dispatched (for a plugin on an otherwise static page). | 1429 // dispatched (for a plugin on an otherwise static page). |
1438 render_view_->didInvalidateRect(WebKit::WebRect(plugin_rect_.x(), | 1430 render_view_->didInvalidateRect(WebKit::WebRect(plugin_rect_.x(), |
1439 plugin_rect_.y(), | 1431 plugin_rect_.y(), |
1440 plugin_rect_.width(), | 1432 plugin_rect_.width(), |
1441 plugin_rect_.height())); | 1433 plugin_rect_.height())); |
1442 | 1434 |
1443 return true; | 1435 return true; |
1444 } | 1436 } |
1445 #endif | 1437 #endif |
1446 | 1438 |
1447 CommandBufferProxy* WebPluginDelegateProxy::CreateCommandBuffer() { | |
1448 #if defined(ENABLE_GPU) | |
1449 #if defined(OS_MACOSX) | |
1450 if (!BindFakePluginWindowHandle(true)) | |
1451 return NULL; | |
1452 #endif | |
1453 int command_buffer_id; | |
1454 if (!Send(new PluginMsg_CreateCommandBuffer(instance_id_, | |
1455 &command_buffer_id))) { | |
1456 return NULL; | |
1457 } | |
1458 | |
1459 CommandBufferProxy* command_buffer = | |
1460 new CommandBufferProxy(channel_host_, command_buffer_id); | |
1461 channel_host_->AddRoute(command_buffer_id, command_buffer, NULL); | |
1462 return command_buffer; | |
1463 #else | |
1464 return NULL; | |
1465 #endif // ENABLE_GPU | |
1466 } | |
1467 | |
1468 void WebPluginDelegateProxy::DestroyCommandBuffer( | |
1469 CommandBufferProxy* command_buffer) { | |
1470 DCHECK(command_buffer); | |
1471 #if defined(ENABLE_GPU) | |
1472 Send(new PluginMsg_DestroyCommandBuffer(instance_id_)); | |
1473 channel_host_->RemoveRoute(command_buffer->route_id()); | |
1474 delete command_buffer; | |
1475 #endif | |
1476 } | |
1477 | |
1478 gfx::PluginWindowHandle WebPluginDelegateProxy::GetPluginWindowHandle() { | 1439 gfx::PluginWindowHandle WebPluginDelegateProxy::GetPluginWindowHandle() { |
1479 return window_; | 1440 return window_; |
1480 } | 1441 } |
1481 | 1442 |
1482 void WebPluginDelegateProxy::OnCancelDocumentLoad() { | 1443 void WebPluginDelegateProxy::OnCancelDocumentLoad() { |
1483 plugin_->CancelDocumentLoad(); | 1444 plugin_->CancelDocumentLoad(); |
1484 } | 1445 } |
1485 | 1446 |
1486 void WebPluginDelegateProxy::OnInitiateHTTPRangeRequest( | 1447 void WebPluginDelegateProxy::OnInitiateHTTPRangeRequest( |
1487 const std::string& url, | 1448 const std::string& url, |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1579 } | 1540 } |
1580 #endif | 1541 #endif |
1581 | 1542 |
1582 void WebPluginDelegateProxy::OnURLRedirectResponse(bool allow, | 1543 void WebPluginDelegateProxy::OnURLRedirectResponse(bool allow, |
1583 int resource_id) { | 1544 int resource_id) { |
1584 if (!plugin_) | 1545 if (!plugin_) |
1585 return; | 1546 return; |
1586 | 1547 |
1587 plugin_->URLRedirectResponse(allow, resource_id); | 1548 plugin_->URLRedirectResponse(allow, resource_id); |
1588 } | 1549 } |
OLD | NEW |