| 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 #define PEPPER_APIS_ENABLED 1 | 5 #define PEPPER_APIS_ENABLED 1 |
| 6 | 6 |
| 7 #include "chrome/renderer/webplugin_delegate_pepper.h" | 7 #include "chrome/renderer/webplugin_delegate_pepper.h" |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 | 122 |
| 123 window_.window = NULL; | 123 window_.window = NULL; |
| 124 instance_->NPP_SetWindow(&window_); | 124 instance_->NPP_SetWindow(&window_); |
| 125 | 125 |
| 126 instance_->NPP_Destroy(); | 126 instance_->NPP_Destroy(); |
| 127 | 127 |
| 128 instance_->set_web_plugin(NULL); | 128 instance_->set_web_plugin(NULL); |
| 129 | 129 |
| 130 instance_ = 0; | 130 instance_ = 0; |
| 131 } | 131 } |
| 132 |
| 133 // Destroy the nested GPU plugin only after first destroying the underlying |
| 134 // Pepper plugin. This is so the Pepper plugin does not attempt to issue |
| 135 // rendering commands after the GPU plugin has stopped processing them and |
| 136 // responding to them. |
| 137 if (nested_delegate_) { |
| 138 nested_delegate_->PluginDestroyed(); |
| 139 nested_delegate_ = NULL; |
| 140 } |
| 132 } | 141 } |
| 133 | 142 |
| 134 void WebPluginDelegatePepper::UpdateGeometry( | 143 void WebPluginDelegatePepper::UpdateGeometry( |
| 135 const gfx::Rect& window_rect, | 144 const gfx::Rect& window_rect, |
| 136 const gfx::Rect& clip_rect) { | 145 const gfx::Rect& clip_rect) { |
| 137 // Only resend to the instance if the geometry has changed. | 146 // Only resend to the instance if the geometry has changed. |
| 138 if (window_rect == window_rect_ && clip_rect == clip_rect_) | 147 if (window_rect == window_rect_ && clip_rect == clip_rect_) |
| 139 return; | 148 return; |
| 140 | 149 |
| 141 clip_rect_ = clip_rect; | 150 clip_rect_ = clip_rect; |
| (...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 572 // TODO(sehr): disable resetting these NPPVs by plugins. | 581 // TODO(sehr): disable resetting these NPPVs by plugins. |
| 573 instance->set_windowless(true); | 582 instance->set_windowless(true); |
| 574 instance->set_transparent(true); | 583 instance->set_transparent(true); |
| 575 } | 584 } |
| 576 | 585 |
| 577 WebPluginDelegatePepper::~WebPluginDelegatePepper() { | 586 WebPluginDelegatePepper::~WebPluginDelegatePepper() { |
| 578 DestroyInstance(); | 587 DestroyInstance(); |
| 579 } | 588 } |
| 580 | 589 |
| 581 void WebPluginDelegatePepper::PluginDestroyed() { | 590 void WebPluginDelegatePepper::PluginDestroyed() { |
| 582 if (nested_delegate_) { | |
| 583 nested_delegate_->PluginDestroyed(); | |
| 584 nested_delegate_ = NULL; | |
| 585 } | |
| 586 delete this; | 591 delete this; |
| 587 } | 592 } |
| 588 | 593 |
| 589 void WebPluginDelegatePepper::Paint(WebKit::WebCanvas* canvas, | 594 void WebPluginDelegatePepper::Paint(WebKit::WebCanvas* canvas, |
| 590 const gfx::Rect& rect) { | 595 const gfx::Rect& rect) { |
| 591 #if defined(OS_WIN) | 596 #if defined(OS_WIN) |
| 592 if (nested_delegate_) { | 597 if (nested_delegate_) { |
| 593 // TODO(apatrick): The GPU plugin will render to an offscreen render target. | 598 // TODO(apatrick): The GPU plugin will render to an offscreen render target. |
| 594 // Need to copy it to the screen here. | 599 // Need to copy it to the screen here. |
| 595 } else { | 600 } else { |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 726 BuildCharEvent(&event, &npevent); | 731 BuildCharEvent(&event, &npevent); |
| 727 break; | 732 break; |
| 728 case NPEventType_Minimize: | 733 case NPEventType_Minimize: |
| 729 case NPEventType_Focus: | 734 case NPEventType_Focus: |
| 730 case NPEventType_Device: | 735 case NPEventType_Device: |
| 731 // NOTIMPLEMENTED(); | 736 // NOTIMPLEMENTED(); |
| 732 break; | 737 break; |
| 733 } | 738 } |
| 734 return instance()->NPP_HandleEvent(&npevent) != 0; | 739 return instance()->NPP_HandleEvent(&npevent) != 0; |
| 735 } | 740 } |
| OLD | NEW |