| 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/bind.h" |
| 9 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| 10 #include "base/memory/scoped_handle.h" | 11 #include "base/memory/scoped_handle.h" |
| 11 #include "base/shared_memory.h" | 12 #include "base/shared_memory.h" |
| 12 #include "build/build_config.h" | 13 #include "build/build_config.h" |
| 13 #include "content/common/npobject_proxy.h" | 14 #include "content/common/npobject_proxy.h" |
| 14 #include "content/common/npobject_util.h" | 15 #include "content/common/npobject_util.h" |
| 15 #include "content/common/plugin_messages.h" | 16 #include "content/common/plugin_messages.h" |
| 16 #include "content/plugin/plugin_channel.h" | 17 #include "content/plugin/plugin_channel.h" |
| 17 #include "content/plugin/plugin_thread.h" | 18 #include "content/plugin/plugin_thread.h" |
| 18 #include "content/public/common/content_client.h" | 19 #include "content/public/common/content_client.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 route_id_(route_id), | 57 route_id_(route_id), |
| 57 window_npobject_(NULL), | 58 window_npobject_(NULL), |
| 58 plugin_element_(NULL), | 59 plugin_element_(NULL), |
| 59 delegate_(NULL), | 60 delegate_(NULL), |
| 60 waiting_for_paint_(false), | 61 waiting_for_paint_(false), |
| 61 containing_window_(containing_window), | 62 containing_window_(containing_window), |
| 62 page_url_(page_url), | 63 page_url_(page_url), |
| 63 transparent_(false), | 64 transparent_(false), |
| 64 windowless_buffer_index_(0), | 65 windowless_buffer_index_(0), |
| 65 host_render_view_routing_id_(host_render_view_routing_id), | 66 host_render_view_routing_id_(host_render_view_routing_id), |
| 66 ALLOW_THIS_IN_INITIALIZER_LIST(runnable_method_factory_(this)) { | 67 ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) { |
| 67 #if defined(USE_X11) | 68 #if defined(USE_X11) |
| 68 windowless_shm_pixmaps_[0] = None; | 69 windowless_shm_pixmaps_[0] = None; |
| 69 windowless_shm_pixmaps_[1] = None; | 70 windowless_shm_pixmaps_[1] = None; |
| 70 use_shm_pixmap_ = false; | 71 use_shm_pixmap_ = false; |
| 71 | 72 |
| 72 // If the X server supports SHM pixmaps | 73 // If the X server supports SHM pixmaps |
| 73 // and the color depth and masks match, | 74 // and the color depth and masks match, |
| 74 // then consider using SHM pixmaps for windowless plugin painting. | 75 // then consider using SHM pixmaps for windowless plugin painting. |
| 75 Display* display = ui::GetXDisplay(); | 76 Display* display = ui::GetXDisplay(); |
| 76 if (ui::QuerySharedMemorySupport(display) == ui::SHARED_MEMORY_PIXMAP && | 77 if (ui::QuerySharedMemorySupport(display) == ui::SHARED_MEMORY_PIXMAP && |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 !delegate_->GetClipRect().Intersects(damaged_rect_)) | 192 !delegate_->GetClipRect().Intersects(damaged_rect_)) |
| 192 return; | 193 return; |
| 193 | 194 |
| 194 // Only send a single InvalidateRect message at a time. From DidPaint we | 195 // Only send a single InvalidateRect message at a time. From DidPaint we |
| 195 // will dispatch an additional InvalidateRect message if necessary. | 196 // will dispatch an additional InvalidateRect message if necessary. |
| 196 if (!waiting_for_paint_) { | 197 if (!waiting_for_paint_) { |
| 197 waiting_for_paint_ = true; | 198 waiting_for_paint_ = true; |
| 198 // Invalidates caused by calls to NPN_InvalidateRect/NPN_InvalidateRgn | 199 // Invalidates caused by calls to NPN_InvalidateRect/NPN_InvalidateRgn |
| 199 // need to be painted asynchronously as per the NPAPI spec. | 200 // need to be painted asynchronously as per the NPAPI spec. |
| 200 MessageLoop::current()->PostTask(FROM_HERE, | 201 MessageLoop::current()->PostTask(FROM_HERE, |
| 201 runnable_method_factory_.NewRunnableMethod( | 202 base::Bind(&WebPluginProxy::OnPaint, weak_factory_.GetWeakPtr(), |
| 202 &WebPluginProxy::OnPaint, damaged_rect_)); | 203 damaged_rect_)); |
| 203 damaged_rect_ = gfx::Rect(); | 204 damaged_rect_ = gfx::Rect(); |
| 204 } | 205 } |
| 205 } | 206 } |
| 206 | 207 |
| 207 NPObject* WebPluginProxy::GetWindowScriptNPObject() { | 208 NPObject* WebPluginProxy::GetWindowScriptNPObject() { |
| 208 if (window_npobject_) | 209 if (window_npobject_) |
| 209 return window_npobject_; | 210 return window_npobject_; |
| 210 | 211 |
| 211 int npobject_route_id = channel_->GenerateRouteID(); | 212 int npobject_route_id = channel_->GenerateRouteID(); |
| 212 bool success = false; | 213 bool success = false; |
| (...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 756 // Retrieve the IME status from a plug-in and send it to a renderer process | 757 // Retrieve the IME status from a plug-in and send it to a renderer process |
| 757 // when the plug-in has updated it. | 758 // when the plug-in has updated it. |
| 758 int input_type; | 759 int input_type; |
| 759 gfx::Rect caret_rect; | 760 gfx::Rect caret_rect; |
| 760 if (!delegate_->GetIMEStatus(&input_type, &caret_rect)) | 761 if (!delegate_->GetIMEStatus(&input_type, &caret_rect)) |
| 761 return; | 762 return; |
| 762 | 763 |
| 763 Send(new PluginHostMsg_NotifyIMEStatus(route_id_, input_type, caret_rect)); | 764 Send(new PluginHostMsg_NotifyIMEStatus(route_id_, input_type, caret_rect)); |
| 764 } | 765 } |
| 765 #endif | 766 #endif |
| OLD | NEW |