| 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 | 70 |
| 71 void WebPluginProxy::SetWindow(gfx::PluginWindowHandle window) { | 71 void WebPluginProxy::SetWindow(gfx::PluginWindowHandle window) { |
| 72 Send(new PluginHostMsg_SetWindow(route_id_, window)); | 72 Send(new PluginHostMsg_SetWindow(route_id_, window)); |
| 73 } | 73 } |
| 74 | 74 |
| 75 void WebPluginProxy::WillDestroyWindow(gfx::PluginWindowHandle window) { | 75 void WebPluginProxy::WillDestroyWindow(gfx::PluginWindowHandle window) { |
| 76 #if defined(OS_WIN) | 76 #if defined(OS_WIN) |
| 77 PluginThread::current()->Send( | 77 PluginThread::current()->Send( |
| 78 new PluginProcessHostMsg_PluginWindowDestroyed( | 78 new PluginProcessHostMsg_PluginWindowDestroyed( |
| 79 window, ::GetParent(window))); | 79 window, ::GetParent(window))); |
| 80 #elif defined(OS_LINUX) | 80 #elif defined(USE_X11) |
| 81 // Nothing to do. | 81 // Nothing to do. |
| 82 #else | 82 #else |
| 83 NOTIMPLEMENTED(); | 83 NOTIMPLEMENTED(); |
| 84 #endif | 84 #endif |
| 85 } | 85 } |
| 86 | 86 |
| 87 #if defined(OS_WIN) | 87 #if defined(OS_WIN) |
| 88 void WebPluginProxy::SetWindowlessPumpEvent(HANDLE pump_messages_event) { | 88 void WebPluginProxy::SetWindowlessPumpEvent(HANDLE pump_messages_event) { |
| 89 HANDLE pump_messages_event_for_renderer = NULL; | 89 HANDLE pump_messages_event_for_renderer = NULL; |
| 90 DuplicateHandle(GetCurrentProcess(), pump_messages_event, | 90 DuplicateHandle(GetCurrentProcess(), pump_messages_event, |
| (...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 return success; | 390 return success; |
| 391 } | 391 } |
| 392 | 392 |
| 393 void WebPluginProxy::Paint(const gfx::Rect& rect) { | 393 void WebPluginProxy::Paint(const gfx::Rect& rect) { |
| 394 #if defined(OS_WIN) | 394 #if defined(OS_WIN) |
| 395 if (!windowless_hdc_) | 395 if (!windowless_hdc_) |
| 396 return; | 396 return; |
| 397 #elif defined(OS_MACOSX) | 397 #elif defined(OS_MACOSX) |
| 398 if (!windowless_context_.get()) | 398 if (!windowless_context_.get()) |
| 399 return; | 399 return; |
| 400 #elif defined(OS_LINUX) | 400 #elif defined(USE_X11) |
| 401 if (!windowless_canvas_.get()) | 401 if (!windowless_canvas_.get()) |
| 402 return; | 402 return; |
| 403 #endif | 403 #endif |
| 404 | 404 |
| 405 // Clear the damaged area so that if the plugin doesn't paint there we won't | 405 // Clear the damaged area so that if the plugin doesn't paint there we won't |
| 406 // end up with the old values. | 406 // end up with the old values. |
| 407 gfx::Rect offset_rect = rect; | 407 gfx::Rect offset_rect = rect; |
| 408 offset_rect.Offset(delegate_->GetRect().origin()); | 408 offset_rect.Offset(delegate_->GetRect().origin()); |
| 409 #if defined(OS_WIN) | 409 #if defined(OS_WIN) |
| 410 if (!background_hdc_) { | 410 if (!background_hdc_) { |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 583 kCGImageAlphaPremultipliedFirst | | 583 kCGImageAlphaPremultipliedFirst | |
| 584 kCGBitmapByteOrder32Host)); | 584 kCGBitmapByteOrder32Host)); |
| 585 CGContextTranslateCTM(background_context_, 0, | 585 CGContextTranslateCTM(background_context_, 0, |
| 586 delegate_->GetRect().height()); | 586 delegate_->GetRect().height()); |
| 587 CGContextScaleCTM(background_context_, 1, -1); | 587 CGContextScaleCTM(background_context_, 1, -1); |
| 588 } | 588 } |
| 589 | 589 |
| 590 static_cast<WebPluginDelegateImpl*>(delegate_)->UpdateContext( | 590 static_cast<WebPluginDelegateImpl*>(delegate_)->UpdateContext( |
| 591 windowless_context_); | 591 windowless_context_); |
| 592 } | 592 } |
| 593 #elif defined (OS_LINUX) | 593 #elif defined (USE_X11) |
| 594 void WebPluginProxy::UpdateTransform() { | 594 void WebPluginProxy::UpdateTransform() { |
| 595 } | 595 } |
| 596 | 596 |
| 597 void WebPluginProxy::SetWindowlessBuffer( | 597 void WebPluginProxy::SetWindowlessBuffer( |
| 598 const TransportDIB::Handle& windowless_buffer, | 598 const TransportDIB::Handle& windowless_buffer, |
| 599 const TransportDIB::Handle& background_buffer) { | 599 const TransportDIB::Handle& background_buffer) { |
| 600 int width = delegate_->GetRect().width(); | 600 int width = delegate_->GetRect().width(); |
| 601 int height = delegate_->GetRect().height(); | 601 int height = delegate_->GetRect().height(); |
| 602 windowless_dib_.reset(TransportDIB::Map(windowless_buffer)); | 602 windowless_dib_.reset(TransportDIB::Map(windowless_buffer)); |
| 603 if (windowless_dib_.get()) { | 603 if (windowless_dib_.get()) { |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 652 while (index != resource_clients_.end()) { | 652 while (index != resource_clients_.end()) { |
| 653 WebPluginResourceClient* client = (*index).second; | 653 WebPluginResourceClient* client = (*index).second; |
| 654 | 654 |
| 655 if (client == resource_client) { | 655 if (client == resource_client) { |
| 656 resource_clients_.erase(index++); | 656 resource_clients_.erase(index++); |
| 657 } else { | 657 } else { |
| 658 index++; | 658 index++; |
| 659 } | 659 } |
| 660 } | 660 } |
| 661 } | 661 } |
| OLD | NEW |