| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/plugin/webplugin_proxy.h" | 5 #include "chrome/plugin/webplugin_proxy.h" |
| 6 | 6 |
| 7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
| 8 | 8 |
| 9 #include "app/gfx/canvas.h" | 9 #include "app/gfx/canvas.h" |
| 10 #if defined(OS_WIN) | 10 #if defined(OS_WIN) |
| (...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 434 CGContextClipToRect(windowless_context_, rect.ToCGRect()); | 434 CGContextClipToRect(windowless_context_, rect.ToCGRect()); |
| 435 delegate_->Paint(windowless_context_, rect); | 435 delegate_->Paint(windowless_context_, rect); |
| 436 CGContextRestoreGState(windowless_context_); | 436 CGContextRestoreGState(windowless_context_); |
| 437 #endif | 437 #endif |
| 438 } | 438 } |
| 439 | 439 |
| 440 void WebPluginProxy::UpdateGeometry( | 440 void WebPluginProxy::UpdateGeometry( |
| 441 const gfx::Rect& window_rect, | 441 const gfx::Rect& window_rect, |
| 442 const gfx::Rect& clip_rect, | 442 const gfx::Rect& clip_rect, |
| 443 const TransportDIB::Handle& windowless_buffer, | 443 const TransportDIB::Handle& windowless_buffer, |
| 444 const TransportDIB::Handle& background_buffer) { | 444 const TransportDIB::Handle& background_buffer |
| 445 #if defined(OS_MACOSX) |
| 446 , |
| 447 int ack_key |
| 448 #endif |
| 449 ) { |
| 445 gfx::Rect old = delegate_->GetRect(); | 450 gfx::Rect old = delegate_->GetRect(); |
| 446 gfx::Rect old_clip_rect = delegate_->GetClipRect(); | 451 gfx::Rect old_clip_rect = delegate_->GetClipRect(); |
| 447 | 452 |
| 448 delegate_->UpdateGeometry(window_rect, clip_rect); | 453 delegate_->UpdateGeometry(window_rect, clip_rect); |
| 449 if (TransportDIB::is_valid(windowless_buffer)) { | 454 if (TransportDIB::is_valid(windowless_buffer)) { |
| 450 // The plugin's rect changed, so now we have a new buffer to draw into. | 455 // The plugin's rect changed, so now we have a new buffer to draw into. |
| 451 SetWindowlessBuffer(windowless_buffer, background_buffer); | 456 SetWindowlessBuffer(windowless_buffer, background_buffer); |
| 452 } | 457 } |
| 453 | 458 |
| 454 // Send over any pending invalidates which occured when the plugin was | 459 // Send over any pending invalidates which occured when the plugin was |
| 455 // off screen. | 460 // off screen. |
| 456 if (delegate_->IsWindowless() && !clip_rect.IsEmpty() && | 461 if (delegate_->IsWindowless() && !clip_rect.IsEmpty() && |
| 457 old_clip_rect.IsEmpty() && !damaged_rect_.IsEmpty()) { | 462 old_clip_rect.IsEmpty() && !damaged_rect_.IsEmpty()) { |
| 458 InvalidateRect(damaged_rect_); | 463 InvalidateRect(damaged_rect_); |
| 459 } | 464 } |
| 465 |
| 466 #if defined(OS_MACOSX) |
| 467 // The renderer is expecting an ACK message if ack_key is not -1. |
| 468 if (ack_key != -1) { |
| 469 Send(new PluginHostMsg_UpdateGeometry_ACK(route_id_, ack_key)); |
| 470 } |
| 471 #endif |
| 460 } | 472 } |
| 461 | 473 |
| 462 #if defined(OS_WIN) | 474 #if defined(OS_WIN) |
| 463 void WebPluginProxy::SetWindowlessBuffer( | 475 void WebPluginProxy::SetWindowlessBuffer( |
| 464 const TransportDIB::Handle& windowless_buffer, | 476 const TransportDIB::Handle& windowless_buffer, |
| 465 const TransportDIB::Handle& background_buffer) { | 477 const TransportDIB::Handle& background_buffer) { |
| 466 // Create a canvas that will reference the shared bits. We have to handle | 478 // Create a canvas that will reference the shared bits. We have to handle |
| 467 // errors here since we're mapping a large amount of memory that may not fit | 479 // errors here since we're mapping a large amount of memory that may not fit |
| 468 // in our address space, or go wrong in some other way. | 480 // in our address space, or go wrong in some other way. |
| 469 windowless_canvas_.reset(new skia::PlatformCanvas); | 481 windowless_canvas_.reset(new skia::PlatformCanvas); |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 591 while (index != resource_clients_.end()) { | 603 while (index != resource_clients_.end()) { |
| 592 WebPluginResourceClient* client = (*index).second; | 604 WebPluginResourceClient* client = (*index).second; |
| 593 | 605 |
| 594 if (client == resource_client) { | 606 if (client == resource_client) { |
| 595 resource_clients_.erase(index++); | 607 resource_clients_.erase(index++); |
| 596 } else { | 608 } else { |
| 597 index++; | 609 index++; |
| 598 } | 610 } |
| 599 } | 611 } |
| 600 } | 612 } |
| OLD | NEW |