OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/bind.h" | 9 #include "base/bind.h" |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 WebPluginProxy::~WebPluginProxy() { | 95 WebPluginProxy::~WebPluginProxy() { |
96 #if defined(USE_X11) | 96 #if defined(USE_X11) |
97 if (windowless_shm_pixmaps_[0] != None) | 97 if (windowless_shm_pixmaps_[0] != None) |
98 XFreePixmap(ui::GetXDisplay(), windowless_shm_pixmaps_[0]); | 98 XFreePixmap(ui::GetXDisplay(), windowless_shm_pixmaps_[0]); |
99 if (windowless_shm_pixmaps_[1] != None) | 99 if (windowless_shm_pixmaps_[1] != None) |
100 XFreePixmap(ui::GetXDisplay(), windowless_shm_pixmaps_[1]); | 100 XFreePixmap(ui::GetXDisplay(), windowless_shm_pixmaps_[1]); |
101 #endif | 101 #endif |
102 | 102 |
103 #if defined(OS_MACOSX) | 103 #if defined(OS_MACOSX) |
104 // Destroy the surface early, since it may send messages during cleanup. | 104 // Destroy the surface early, since it may send messages during cleanup. |
105 if (accelerated_surface_.get()) | 105 if (accelerated_surface_) |
106 accelerated_surface_.reset(); | 106 accelerated_surface_.reset(); |
107 #endif | 107 #endif |
108 | 108 |
109 if (plugin_element_) | 109 if (plugin_element_) |
110 WebBindings::releaseObject(plugin_element_); | 110 WebBindings::releaseObject(plugin_element_); |
111 if (window_npobject_) | 111 if (window_npobject_) |
112 WebBindings::releaseObject(window_npobject_); | 112 WebBindings::releaseObject(window_npobject_); |
113 } | 113 } |
114 | 114 |
115 bool WebPluginProxy::Send(IPC::Message* msg) { | 115 bool WebPluginProxy::Send(IPC::Message* msg) { |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 // now possible to receive stream messages from the renderer for streams | 268 // now possible to receive stream messages from the renderer for streams |
269 // which may have been cancelled by the plugin. | 269 // which may have been cancelled by the plugin. |
270 if (iterator == resource_clients_.end()) { | 270 if (iterator == resource_clients_.end()) { |
271 return NULL; | 271 return NULL; |
272 } | 272 } |
273 | 273 |
274 return iterator->second; | 274 return iterator->second; |
275 } | 275 } |
276 | 276 |
277 int WebPluginProxy::GetRendererId() { | 277 int WebPluginProxy::GetRendererId() { |
278 if (channel_.get()) | 278 if (channel_) |
279 return channel_->renderer_id(); | 279 return channel_->renderer_id(); |
280 return -1; | 280 return -1; |
281 } | 281 } |
282 | 282 |
283 void WebPluginProxy::DidPaint() { | 283 void WebPluginProxy::DidPaint() { |
284 // If we have an accumulated damaged rect, then check to see if we need to | 284 // If we have an accumulated damaged rect, then check to see if we need to |
285 // send out another InvalidateRect message. | 285 // send out another InvalidateRect message. |
286 waiting_for_paint_ = false; | 286 waiting_for_paint_ = false; |
287 if (!damaged_rect_.IsEmpty()) | 287 if (!damaged_rect_.IsEmpty()) |
288 InvalidateRect(damaged_rect_); | 288 InvalidateRect(damaged_rect_); |
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
622 void WebPluginProxy::StartIme() { | 622 void WebPluginProxy::StartIme() { |
623 IPC::Message* msg = new PluginHostMsg_StartIme(route_id_); | 623 IPC::Message* msg = new PluginHostMsg_StartIme(route_id_); |
624 // This message can be sent during event-handling, and needs to be delivered | 624 // This message can be sent during event-handling, and needs to be delivered |
625 // within that context. | 625 // within that context. |
626 msg->set_unblock(true); | 626 msg->set_unblock(true); |
627 Send(msg); | 627 Send(msg); |
628 } | 628 } |
629 | 629 |
630 WebPluginAcceleratedSurface* WebPluginProxy::GetAcceleratedSurface( | 630 WebPluginAcceleratedSurface* WebPluginProxy::GetAcceleratedSurface( |
631 gfx::GpuPreference gpu_preference) { | 631 gfx::GpuPreference gpu_preference) { |
632 if (!accelerated_surface_.get()) | 632 if (!accelerated_surface_) |
633 accelerated_surface_.reset( | 633 accelerated_surface_.reset( |
634 WebPluginAcceleratedSurfaceProxy::Create(this, gpu_preference)); | 634 WebPluginAcceleratedSurfaceProxy::Create(this, gpu_preference)); |
635 return accelerated_surface_.get(); | 635 return accelerated_surface_.get(); |
636 } | 636 } |
637 | 637 |
638 void WebPluginProxy::AcceleratedPluginEnabledRendering() { | 638 void WebPluginProxy::AcceleratedPluginEnabledRendering() { |
639 Send(new PluginHostMsg_AcceleratedPluginEnabledRendering(route_id_)); | 639 Send(new PluginHostMsg_AcceleratedPluginEnabledRendering(route_id_)); |
640 } | 640 } |
641 | 641 |
642 void WebPluginProxy::AcceleratedPluginAllocatedIOSurface(int32 width, | 642 void WebPluginProxy::AcceleratedPluginAllocatedIOSurface(int32 width, |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
688 int input_type; | 688 int input_type; |
689 gfx::Rect caret_rect; | 689 gfx::Rect caret_rect; |
690 if (!delegate_->GetIMEStatus(&input_type, &caret_rect)) | 690 if (!delegate_->GetIMEStatus(&input_type, &caret_rect)) |
691 return; | 691 return; |
692 | 692 |
693 Send(new PluginHostMsg_NotifyIMEStatus(route_id_, input_type, caret_rect)); | 693 Send(new PluginHostMsg_NotifyIMEStatus(route_id_, input_type, caret_rect)); |
694 } | 694 } |
695 #endif | 695 #endif |
696 | 696 |
697 } // namespace content | 697 } // namespace content |
OLD | NEW |