| 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/plugin/webplugin_proxy.h" | 5 #include "content/plugin/webplugin_proxy.h" |
| 6 | 6 |
| 7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
| 8 | 8 |
| 9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
| 10 #include "base/memory/scoped_handle.h" | 10 #include "base/memory/scoped_handle.h" |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 #if defined(USE_X11) | 86 #if defined(USE_X11) |
| 87 if (windowless_shm_pixmap_ != None) | 87 if (windowless_shm_pixmap_ != None) |
| 88 XFreePixmap(ui::GetXDisplay(), windowless_shm_pixmap_); | 88 XFreePixmap(ui::GetXDisplay(), windowless_shm_pixmap_); |
| 89 #endif | 89 #endif |
| 90 | 90 |
| 91 #if defined(OS_MACOSX) | 91 #if defined(OS_MACOSX) |
| 92 // Destroy the surface early, since it may send messages during cleanup. | 92 // Destroy the surface early, since it may send messages during cleanup. |
| 93 if (accelerated_surface_.get()) | 93 if (accelerated_surface_.get()) |
| 94 accelerated_surface_.reset(); | 94 accelerated_surface_.reset(); |
| 95 #endif | 95 #endif |
| 96 |
| 97 if (plugin_element_) |
| 98 WebBindings::releaseObject(plugin_element_); |
| 99 if (window_npobject_) |
| 100 WebBindings::releaseObject(window_npobject_); |
| 96 } | 101 } |
| 97 | 102 |
| 98 bool WebPluginProxy::Send(IPC::Message* msg) { | 103 bool WebPluginProxy::Send(IPC::Message* msg) { |
| 99 return channel_->Send(msg); | 104 return channel_->Send(msg); |
| 100 } | 105 } |
| 101 | 106 |
| 102 void WebPluginProxy::SetWindow(gfx::PluginWindowHandle window) { | 107 void WebPluginProxy::SetWindow(gfx::PluginWindowHandle window) { |
| 103 Send(new PluginHostMsg_SetWindow(route_id_, window)); | 108 Send(new PluginHostMsg_SetWindow(route_id_, window)); |
| 104 } | 109 } |
| 105 | 110 |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 // need to be painted asynchronously as per the NPAPI spec. | 188 // need to be painted asynchronously as per the NPAPI spec. |
| 184 MessageLoop::current()->PostTask(FROM_HERE, | 189 MessageLoop::current()->PostTask(FROM_HERE, |
| 185 runnable_method_factory_.NewRunnableMethod( | 190 runnable_method_factory_.NewRunnableMethod( |
| 186 &WebPluginProxy::OnPaint, damaged_rect_)); | 191 &WebPluginProxy::OnPaint, damaged_rect_)); |
| 187 damaged_rect_ = gfx::Rect(); | 192 damaged_rect_ = gfx::Rect(); |
| 188 } | 193 } |
| 189 } | 194 } |
| 190 | 195 |
| 191 NPObject* WebPluginProxy::GetWindowScriptNPObject() { | 196 NPObject* WebPluginProxy::GetWindowScriptNPObject() { |
| 192 if (window_npobject_) | 197 if (window_npobject_) |
| 193 return WebBindings::retainObject(window_npobject_); | 198 return window_npobject_; |
| 194 | 199 |
| 195 int npobject_route_id = channel_->GenerateRouteID(); | 200 int npobject_route_id = channel_->GenerateRouteID(); |
| 196 bool success = false; | 201 bool success = false; |
| 197 Send(new PluginHostMsg_GetWindowScriptNPObject( | 202 Send(new PluginHostMsg_GetWindowScriptNPObject( |
| 198 route_id_, npobject_route_id, &success)); | 203 route_id_, npobject_route_id, &success)); |
| 199 if (!success) | 204 if (!success) |
| 200 return NULL; | 205 return NULL; |
| 201 | 206 |
| 202 window_npobject_ = NPObjectProxy::Create( | 207 window_npobject_ = NPObjectProxy::Create( |
| 203 channel_, npobject_route_id, containing_window_, page_url_); | 208 channel_, npobject_route_id, containing_window_, page_url_); |
| 204 | 209 |
| 205 return window_npobject_; | 210 return window_npobject_; |
| 206 } | 211 } |
| 207 | 212 |
| 208 NPObject* WebPluginProxy::GetPluginElement() { | 213 NPObject* WebPluginProxy::GetPluginElement() { |
| 209 if (plugin_element_) | 214 if (plugin_element_) |
| 210 return WebBindings::retainObject(plugin_element_); | 215 return plugin_element_; |
| 211 | 216 |
| 212 int npobject_route_id = channel_->GenerateRouteID(); | 217 int npobject_route_id = channel_->GenerateRouteID(); |
| 213 bool success = false; | 218 bool success = false; |
| 214 Send(new PluginHostMsg_GetPluginElement(route_id_, npobject_route_id, | 219 Send(new PluginHostMsg_GetPluginElement(route_id_, npobject_route_id, |
| 215 &success)); | 220 &success)); |
| 216 if (!success) | 221 if (!success) |
| 217 return NULL; | 222 return NULL; |
| 218 | 223 |
| 219 plugin_element_ = NPObjectProxy::Create( | 224 plugin_element_ = NPObjectProxy::Create( |
| 220 channel_, npobject_route_id, containing_window_, page_url_); | 225 channel_, npobject_route_id, containing_window_, page_url_); |
| (...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 647 resource_clients_.erase(index++); | 652 resource_clients_.erase(index++); |
| 648 } else { | 653 } else { |
| 649 index++; | 654 index++; |
| 650 } | 655 } |
| 651 } | 656 } |
| 652 } | 657 } |
| 653 | 658 |
| 654 void WebPluginProxy::URLRedirectResponse(bool allow, int resource_id) { | 659 void WebPluginProxy::URLRedirectResponse(bool allow, int resource_id) { |
| 655 Send(new PluginHostMsg_URLRedirectResponse(route_id_, allow, resource_id)); | 660 Send(new PluginHostMsg_URLRedirectResponse(route_id_, allow, resource_id)); |
| 656 } | 661 } |
| OLD | NEW |