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
3 // found in the LICENSE file.
5 #include "content/plugin/webplugin_proxy.h"
7 #include "build/build_config.h"
10 #include "base/lazy_instance.h"
11 #include "base/memory/scoped_handle.h"
12 #include "base/shared_memory.h"
13 #include "build/build_config.h"
14 #include "content/common/npobject_proxy.h"
15 #include "content/common/npobject_util.h"
16 #include "content/common/plugin_messages.h"
17 #include "content/plugin/plugin_channel.h"
18 #include "content/plugin/plugin_thread.h"
19 #include "content/public/common/content_client.h"
20 #include "content/public/common/url_constants.h"
21 #include "skia/ext/platform_canvas.h"
22 #include "skia/ext/platform_device.h"
23 #include "third_party/WebKit/Source/WebKit/chromium/public/WebBindings.h"
24 #include "ui/gfx/blit.h"
25 #include "ui/gfx/canvas.h"
26 #include "webkit/plugins/npapi/webplugin_delegate_impl.h"
28 #if defined(OS_MACOSX)
29 #include "base/mac/mac_util.h"
30 #include "base/mac/scoped_cftyperef.h"
31 #include "content/plugin/webplugin_accelerated_surface_proxy_mac.h"
35 #include "ui/base/x/x11_util_internal.h"
39 #include "content/public/common/sandbox_init.h"
42 using WebKit::WebBindings
;
44 using webkit::npapi::WebPluginResourceClient
;
45 #if defined(OS_MACOSX)
46 using webkit::npapi::WebPluginAcceleratedSurface
;
51 WebPluginProxy::SharedTransportDIB::SharedTransportDIB(TransportDIB
* dib
)
55 WebPluginProxy::SharedTransportDIB::~SharedTransportDIB() {
58 WebPluginProxy::WebPluginProxy(
59 PluginChannel
* channel
,
62 int host_render_view_routing_id
)
65 window_npobject_(NULL
),
66 plugin_element_(NULL
),
68 waiting_for_paint_(false),
70 windowless_buffer_index_(0),
71 host_render_view_routing_id_(host_render_view_routing_id
),
72 ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) {
74 windowless_shm_pixmaps_
[0] = None
;
75 windowless_shm_pixmaps_
[1] = None
;
76 use_shm_pixmap_
= false;
78 // If the X server supports SHM pixmaps
79 // and the color depth and masks match,
80 // then consider using SHM pixmaps for windowless plugin painting.
81 Display
* display
= ui::GetXDisplay();
82 if (ui::QuerySharedMemorySupport(display
) == ui::SHARED_MEMORY_PIXMAP
&&
83 ui::BitsPerPixelForPixmapDepth(
84 display
, DefaultDepth(display
, DefaultScreen(display
))) == 32) {
85 Visual
* vis
= DefaultVisual(display
, DefaultScreen(display
));
87 if (vis
->red_mask
== 0xff0000 &&
88 vis
->green_mask
== 0xff00 &&
89 vis
->blue_mask
== 0xff)
90 use_shm_pixmap_
= true;
95 WebPluginProxy::~WebPluginProxy() {
97 if (windowless_shm_pixmaps_
[0] != None
)
98 XFreePixmap(ui::GetXDisplay(), windowless_shm_pixmaps_
[0]);
99 if (windowless_shm_pixmaps_
[1] != None
)
100 XFreePixmap(ui::GetXDisplay(), windowless_shm_pixmaps_
[1]);
103 #if defined(OS_MACOSX)
104 // Destroy the surface early, since it may send messages during cleanup.
105 if (accelerated_surface_
.get())
106 accelerated_surface_
.reset();
110 WebBindings::releaseObject(plugin_element_
);
111 if (window_npobject_
)
112 WebBindings::releaseObject(window_npobject_
);
115 bool WebPluginProxy::Send(IPC::Message
* msg
) {
116 return channel_
->Send(msg
);
119 void WebPluginProxy::SetWindow(gfx::PluginWindowHandle window
) {
120 Send(new PluginHostMsg_SetWindow(route_id_
, window
));
123 void WebPluginProxy::SetAcceptsInputEvents(bool accepts
) {
127 void WebPluginProxy::WillDestroyWindow(gfx::PluginWindowHandle window
) {
129 PluginThread::current()->Send(
130 new PluginProcessHostMsg_PluginWindowDestroyed(
131 window
, ::GetParent(window
)));
132 #elif defined(USE_X11)
140 void WebPluginProxy::SetWindowlessData(
141 HANDLE pump_messages_event
, gfx::NativeViewId dummy_activation_window
) {
142 HANDLE pump_messages_event_for_renderer
= NULL
;
143 BrokerDuplicateHandle(pump_messages_event
, channel_
->peer_pid(),
144 &pump_messages_event_for_renderer
,
145 SYNCHRONIZE
| EVENT_MODIFY_STATE
, 0);
146 DCHECK(pump_messages_event_for_renderer
);
147 Send(new PluginHostMsg_SetWindowlessData(
148 route_id_
, pump_messages_event_for_renderer
, dummy_activation_window
));
152 void WebPluginProxy::CancelResource(unsigned long id
) {
153 Send(new PluginHostMsg_CancelResource(route_id_
, id
));
154 resource_clients_
.erase(id
);
157 void WebPluginProxy::Invalidate() {
159 delegate_
->GetRect().width(),
160 delegate_
->GetRect().height());
161 InvalidateRect(rect
);
164 void WebPluginProxy::InvalidateRect(const gfx::Rect
& rect
) {
165 #if defined(OS_MACOSX)
166 // If this is a Core Animation plugin, all we need to do is inform the
168 if (!windowless_context()) {
169 delegate_
->PluginDidInvalidate();
173 // Some plugins will send invalidates larger than their own rect when
174 // offscreen, so constrain invalidates to the plugin rect.
175 gfx::Rect plugin_rect
= delegate_
->GetRect();
176 plugin_rect
.set_origin(gfx::Point(0, 0));
177 plugin_rect
.Intersect(rect
);
178 const gfx::Rect
invalidate_rect(plugin_rect
);
180 const gfx::Rect
invalidate_rect(rect
);
182 damaged_rect_
.Union(invalidate_rect
);
183 // Ignore NPN_InvalidateRect calls with empty rects. Also don't send an
184 // invalidate if it's outside the clipping region, since if we did it won't
185 // lead to a paint and we'll be stuck waiting forever for a DidPaint response.
187 // TODO(piman): There is a race condition here, because this test assumes
188 // that when the paint actually occurs, the clip rect will not have changed.
189 // This is not true because scrolling (or window resize) could occur and be
190 // handled by the renderer before it receives the InvalidateRect message,
191 // changing the clip rect and then not painting.
192 if (damaged_rect_
.IsEmpty() ||
193 !delegate_
->GetClipRect().Intersects(damaged_rect_
))
196 // Only send a single InvalidateRect message at a time. From DidPaint we
197 // will dispatch an additional InvalidateRect message if necessary.
198 if (!waiting_for_paint_
) {
199 waiting_for_paint_
= true;
200 // Invalidates caused by calls to NPN_InvalidateRect/NPN_InvalidateRgn
201 // need to be painted asynchronously as per the NPAPI spec.
202 MessageLoop::current()->PostTask(FROM_HERE
,
203 base::Bind(&WebPluginProxy::OnPaint
, weak_factory_
.GetWeakPtr(),
205 damaged_rect_
= gfx::Rect();
209 NPObject
* WebPluginProxy::GetWindowScriptNPObject() {
210 if (window_npobject_
)
211 return window_npobject_
;
213 int npobject_route_id
= channel_
->GenerateRouteID();
214 bool success
= false;
215 Send(new PluginHostMsg_GetWindowScriptNPObject(
216 route_id_
, npobject_route_id
, &success
));
220 window_npobject_
= NPObjectProxy::Create(
221 channel_
, npobject_route_id
, host_render_view_routing_id_
, page_url_
);
223 return window_npobject_
;
226 NPObject
* WebPluginProxy::GetPluginElement() {
228 return plugin_element_
;
230 int npobject_route_id
= channel_
->GenerateRouteID();
231 bool success
= false;
232 Send(new PluginHostMsg_GetPluginElement(route_id_
, npobject_route_id
,
237 plugin_element_
= NPObjectProxy::Create(
238 channel_
, npobject_route_id
, host_render_view_routing_id_
, page_url_
);
240 return plugin_element_
;
243 bool WebPluginProxy::FindProxyForUrl(const GURL
& url
, std::string
* proxy_list
) {
245 Send(new PluginHostMsg_ResolveProxy(route_id_
, url
, &result
, proxy_list
));
249 void WebPluginProxy::SetCookie(const GURL
& url
,
250 const GURL
& first_party_for_cookies
,
251 const std::string
& cookie
) {
252 Send(new PluginHostMsg_SetCookie(route_id_
, url
,
253 first_party_for_cookies
, cookie
));
256 std::string
WebPluginProxy::GetCookies(const GURL
& url
,
257 const GURL
& first_party_for_cookies
) {
259 Send(new PluginHostMsg_GetCookies(route_id_
, url
,
260 first_party_for_cookies
, &cookies
));
265 WebPluginResourceClient
* WebPluginProxy::GetResourceClient(int id
) {
266 ResourceClientMap::iterator iterator
= resource_clients_
.find(id
);
267 // The IPC messages which deal with streams are now asynchronous. It is
268 // now possible to receive stream messages from the renderer for streams
269 // which may have been cancelled by the plugin.
270 if (iterator
== resource_clients_
.end()) {
274 return iterator
->second
;
277 int WebPluginProxy::GetRendererId() {
279 return channel_
->renderer_id();
283 void WebPluginProxy::DidPaint() {
284 // If we have an accumulated damaged rect, then check to see if we need to
285 // send out another InvalidateRect message.
286 waiting_for_paint_
= false;
287 if (!damaged_rect_
.IsEmpty())
288 InvalidateRect(damaged_rect_
);
291 void WebPluginProxy::OnResourceCreated(int resource_id
,
292 WebPluginResourceClient
* client
) {
293 DCHECK(resource_clients_
.find(resource_id
) == resource_clients_
.end());
294 resource_clients_
[resource_id
] = client
;
297 void WebPluginProxy::HandleURLRequest(const char* url
,
304 bool notify_redirects
) {
305 if (!target
&& (0 == base::strcasecmp(method
, "GET"))) {
306 // Please refer to https://bugzilla.mozilla.org/show_bug.cgi?id=366082
307 // for more details on this.
308 if (delegate_
->GetQuirks() &
309 webkit::npapi::WebPluginDelegateImpl::
310 PLUGIN_QUIRK_BLOCK_NONSTANDARD_GETURL_REQUESTS
) {
311 GURL
request_url(url
);
312 if (!request_url
.SchemeIs(chrome::kHttpScheme
) &&
313 !request_url
.SchemeIs(chrome::kHttpsScheme
) &&
314 !request_url
.SchemeIs(chrome::kFtpScheme
)) {
320 PluginHostMsg_URLRequest_Params params
;
322 params
.method
= method
;
324 params
.target
= std::string(target
);
327 params
.buffer
.resize(len
);
328 memcpy(¶ms
.buffer
.front(), buf
, len
);
331 params
.notify_id
= notify_id
;
332 params
.popups_allowed
= popups_allowed
;
333 params
.notify_redirects
= notify_redirects
;
335 Send(new PluginHostMsg_URLRequest(route_id_
, params
));
338 void WebPluginProxy::Paint(const gfx::Rect
& rect
) {
339 #if defined(OS_MACOSX)
340 if (!windowless_context())
343 if (!windowless_canvas() || !windowless_canvas()->getDevice())
347 // Clear the damaged area so that if the plugin doesn't paint there we won't
348 // end up with the old values.
349 gfx::Rect offset_rect
= rect
;
350 offset_rect
.Offset(delegate_
->GetRect().OffsetFromOrigin());
351 #if defined(OS_MACOSX)
352 CGContextSaveGState(windowless_context());
353 // It is possible for windowless_contexts_ to change during plugin painting
354 // (since the plugin can make a synchronous call during paint event handling),
355 // in which case we don't want to try to restore later. Not an owning ref
356 // since owning the ref without owning the shared backing memory doesn't make
357 // sense, so this should only be used for pointer comparisons.
358 CGContextRef saved_context_weak
= windowless_context();
359 // We also save the buffer index for the comparison because if we flip buffers
360 // but haven't reallocated them then we do need to restore the context because
361 // it is going to continue to be used.
362 int saved_index
= windowless_buffer_index_
;
364 CGContextClipToRect(windowless_context(), rect
.ToCGRect());
365 // TODO(caryclark): This is a temporary workaround to allow the Darwin / Skia
366 // port to share code with the Darwin / CG port. All ports will eventually use
367 // the common code below.
368 delegate_
->CGPaint(windowless_context(), rect
);
369 if (windowless_contexts_
[saved_index
].get() == saved_context_weak
)
370 CGContextRestoreGState(windowless_contexts_
[saved_index
]);
372 // See above comment about windowless_context_ changing.
373 // http::/crbug.com/139462
374 skia::RefPtr
<skia::PlatformCanvas
> saved_canvas
= windowless_canvas();
376 scoped_refptr
<SharedTransportDIB
> local_dib_ref(
377 windowless_dibs_
[windowless_buffer_index_
]);
380 saved_canvas
->save();
382 // The given clip rect is relative to the plugin coordinate system.
383 SkRect sk_rect
= { SkIntToScalar(rect
.x()),
384 SkIntToScalar(rect
.y()),
385 SkIntToScalar(rect
.right()),
386 SkIntToScalar(rect
.bottom()) };
387 saved_canvas
->clipRect(sk_rect
);
389 // Fill a transparent value so that if the plugin supports transparency that
391 saved_canvas
->drawColor(SkColorSetARGB(0, 0, 0, 0), SkXfermode::kSrc_Mode
);
393 // Bring the windowless canvas into the window coordinate system, which is
394 // how the plugin expects to draw (since the windowless API was originally
395 // designed just for scribbling over the web page).
396 saved_canvas
->translate(SkIntToScalar(-delegate_
->GetRect().x()),
397 SkIntToScalar(-delegate_
->GetRect().y()));
399 // Before we send the invalidate, paint so that renderer uses the updated
401 delegate_
->Paint(saved_canvas
.get(), offset_rect
);
403 saved_canvas
->restore();
407 void WebPluginProxy::UpdateGeometry(
408 const gfx::Rect
& window_rect
,
409 const gfx::Rect
& clip_rect
,
410 const TransportDIB::Handle
& windowless_buffer0
,
411 const TransportDIB::Handle
& windowless_buffer1
,
412 int windowless_buffer_index
) {
413 gfx::Rect old
= delegate_
->GetRect();
414 gfx::Rect old_clip_rect
= delegate_
->GetClipRect();
416 // Update the buffers before doing anything that could call into plugin code,
417 // so that we don't process buffer changes out of order if plugins make
418 // synchronous calls that lead to nested UpdateGeometry calls.
419 if (TransportDIB::is_valid_handle(windowless_buffer0
)) {
420 // The plugin's rect changed, so now we have new buffers to draw into.
421 SetWindowlessBuffers(windowless_buffer0
,
426 DCHECK(0 <= windowless_buffer_index
&& windowless_buffer_index
<= 1);
427 windowless_buffer_index_
= windowless_buffer_index
;
429 delegate_
->SetWindowlessShmPixmap(windowless_shm_pixmap());
432 #if defined(OS_MACOSX)
433 delegate_
->UpdateGeometryAndContext(
434 window_rect
, clip_rect
, windowless_context());
436 delegate_
->UpdateGeometry(window_rect
, clip_rect
);
439 // Send over any pending invalidates which occured when the plugin was
441 if (delegate_
->IsWindowless() && !clip_rect
.IsEmpty() &&
442 !damaged_rect_
.IsEmpty()) {
443 InvalidateRect(damaged_rect_
);
449 void WebPluginProxy::CreateCanvasFromHandle(
450 const TransportDIB::Handle
& dib_handle
,
451 const gfx::Rect
& window_rect
,
452 skia::RefPtr
<skia::PlatformCanvas
>* canvas
) {
453 *canvas
= skia::AdoptRef(
454 skia::CreatePlatformCanvas(window_rect
.width(),
455 window_rect
.height(),
458 skia::RETURN_NULL_ON_FAILURE
));
459 // The canvas does not own the section so we need to close it now.
460 CloseHandle(dib_handle
);
463 void WebPluginProxy::SetWindowlessBuffers(
464 const TransportDIB::Handle
& windowless_buffer0
,
465 const TransportDIB::Handle
& windowless_buffer1
,
466 const gfx::Rect
& window_rect
) {
467 CreateCanvasFromHandle(windowless_buffer0
,
469 &windowless_canvases_
[0]);
470 if (!windowless_canvases_
[0]) {
471 windowless_canvases_
[1].clear();
474 CreateCanvasFromHandle(windowless_buffer1
,
476 &windowless_canvases_
[1]);
477 if (!windowless_canvases_
[1]) {
478 windowless_canvases_
[0].clear();
483 #elif defined(OS_MACOSX)
485 void WebPluginProxy::CreateDIBAndCGContextFromHandle(
486 const TransportDIB::Handle
& dib_handle
,
487 const gfx::Rect
& window_rect
,
488 scoped_ptr
<TransportDIB
>* dib_out
,
489 base::mac::ScopedCFTypeRef
<CGContextRef
>* cg_context_out
) {
490 // Convert the shared memory handle to a handle that works in our process,
491 // and then use that to create a CGContextRef.
492 TransportDIB
* dib
= TransportDIB::Map(dib_handle
);
493 CGContextRef cg_context
= NULL
;
495 cg_context
= CGBitmapContextCreate(
498 window_rect
.height(),
500 4 * window_rect
.width(),
501 base::mac::GetSystemColorSpace(),
502 kCGImageAlphaPremultipliedFirst
| kCGBitmapByteOrder32Host
);
503 CGContextTranslateCTM(cg_context
, 0, window_rect
.height());
504 CGContextScaleCTM(cg_context
, 1, -1);
507 cg_context_out
->reset(cg_context
);
510 void WebPluginProxy::SetWindowlessBuffers(
511 const TransportDIB::Handle
& windowless_buffer0
,
512 const TransportDIB::Handle
& windowless_buffer1
,
513 const gfx::Rect
& window_rect
) {
514 CreateDIBAndCGContextFromHandle(windowless_buffer0
,
516 &windowless_dibs_
[0],
517 &windowless_contexts_
[0]);
518 CreateDIBAndCGContextFromHandle(windowless_buffer1
,
520 &windowless_dibs_
[1],
521 &windowless_contexts_
[1]);
524 #elif defined(USE_X11)
526 void WebPluginProxy::CreateDIBAndCanvasFromHandle(
527 const TransportDIB::Handle
& dib_handle
,
528 const gfx::Rect
& window_rect
,
529 scoped_refptr
<SharedTransportDIB
>* dib_out
,
530 skia::RefPtr
<skia::PlatformCanvas
>* canvas
) {
531 TransportDIB
* dib
= TransportDIB::Map(dib_handle
);
532 // dib may be NULL if the renderer has already destroyed the TransportDIB by
533 // the time we receive the handle, e.g. in case of multiple resizes.
535 *canvas
= skia::AdoptRef(
536 dib
->GetPlatformCanvas(window_rect
.width(), window_rect
.height()));
540 *dib_out
= new SharedTransportDIB(dib
);
543 void WebPluginProxy::CreateShmPixmapFromDIB(
545 const gfx::Rect
& window_rect
,
548 Display
* display
= ui::GetXDisplay();
549 XID root_window
= ui::GetX11RootWindow();
550 XShmSegmentInfo shminfo
= {0};
552 if (*pixmap_out
!= None
)
553 XFreePixmap(display
, *pixmap_out
);
555 shminfo
.shmseg
= dib
->MapToX(display
);
556 // Create a shared memory pixmap based on the image buffer.
557 *pixmap_out
= XShmCreatePixmap(display
, root_window
,
559 window_rect
.width(), window_rect
.height(),
560 DefaultDepth(display
,
561 DefaultScreen(display
)));
565 void WebPluginProxy::SetWindowlessBuffers(
566 const TransportDIB::Handle
& windowless_buffer0
,
567 const TransportDIB::Handle
& windowless_buffer1
,
568 const gfx::Rect
& window_rect
) {
569 CreateDIBAndCanvasFromHandle(windowless_buffer0
,
571 &windowless_dibs_
[0],
572 &windowless_canvases_
[0]);
573 CreateDIBAndCanvasFromHandle(windowless_buffer1
,
575 &windowless_dibs_
[1],
576 &windowless_canvases_
[1]);
578 // If SHM pixmaps support is available, create SHM pixmaps to pass to the
579 // delegate for windowless plugin painting.
580 if (delegate_
->IsWindowless() && use_shm_pixmap_
) {
581 CreateShmPixmapFromDIB(windowless_dibs_
[0]->dib(),
583 &windowless_shm_pixmaps_
[0]);
584 CreateShmPixmapFromDIB(windowless_dibs_
[1]->dib(),
586 &windowless_shm_pixmaps_
[1]);
590 #elif defined(OS_ANDROID)
592 void WebPluginProxy::SetWindowlessBuffers(
593 const TransportDIB::Handle
& windowless_buffer0
,
594 const TransportDIB::Handle
& windowless_buffer1
,
595 const gfx::Rect
& window_rect
) {
601 void WebPluginProxy::CancelDocumentLoad() {
602 Send(new PluginHostMsg_CancelDocumentLoad(route_id_
));
605 void WebPluginProxy::InitiateHTTPRangeRequest(
606 const char* url
, const char* range_info
, int range_request_id
) {
607 Send(new PluginHostMsg_InitiateHTTPRangeRequest(
608 route_id_
, url
, range_info
, range_request_id
));
611 void WebPluginProxy::SetDeferResourceLoading(unsigned long resource_id
,
613 Send(new PluginHostMsg_DeferResourceLoading(route_id_
, resource_id
, defer
));
616 #if defined(OS_MACOSX)
617 void WebPluginProxy::FocusChanged(bool focused
) {
618 IPC::Message
* msg
= new PluginHostMsg_FocusChanged(route_id_
, focused
);
622 void WebPluginProxy::StartIme() {
623 IPC::Message
* msg
= new PluginHostMsg_StartIme(route_id_
);
624 // This message can be sent during event-handling, and needs to be delivered
625 // within that context.
626 msg
->set_unblock(true);
630 void WebPluginProxy::BindFakePluginWindowHandle(bool opaque
) {
631 Send(new PluginHostMsg_BindFakePluginWindowHandle(route_id_
, opaque
));
634 WebPluginAcceleratedSurface
* WebPluginProxy::GetAcceleratedSurface(
635 gfx::GpuPreference gpu_preference
) {
636 if (!accelerated_surface_
.get())
637 accelerated_surface_
.reset(
638 WebPluginAcceleratedSurfaceProxy::Create(this, gpu_preference
));
639 return accelerated_surface_
.get();
642 void WebPluginProxy::AcceleratedFrameBuffersDidSwap(
643 gfx::PluginWindowHandle window
, uint64 surface_handle
) {
644 Send(new PluginHostMsg_AcceleratedSurfaceBuffersSwapped(
645 route_id_
, window
, surface_handle
));
648 void WebPluginProxy::SetAcceleratedSurface(
649 gfx::PluginWindowHandle window
,
650 const gfx::Size
& size
,
651 uint64 accelerated_surface_identifier
) {
652 Send(new PluginHostMsg_AcceleratedSurfaceSetIOSurface(
653 route_id_
, window
, size
.width(), size
.height(),
654 accelerated_surface_identifier
));
657 void WebPluginProxy::SetAcceleratedDIB(
658 gfx::PluginWindowHandle window
,
659 const gfx::Size
& size
,
660 const TransportDIB::Handle
& dib_handle
) {
661 Send(new PluginHostMsg_AcceleratedSurfaceSetTransportDIB(
662 route_id_
, window
, size
.width(), size
.height(), dib_handle
));
665 void WebPluginProxy::AllocSurfaceDIB(const size_t size
,
666 TransportDIB::Handle
* dib_handle
) {
667 Send(new PluginHostMsg_AllocTransportDIB(route_id_
, size
, dib_handle
));
670 void WebPluginProxy::FreeSurfaceDIB(TransportDIB::Id dib_id
) {
671 Send(new PluginHostMsg_FreeTransportDIB(route_id_
, dib_id
));
674 void WebPluginProxy::AcceleratedPluginEnabledRendering() {
675 Send(new PluginHostMsg_AcceleratedPluginEnabledRendering(route_id_
));
678 void WebPluginProxy::AcceleratedPluginAllocatedIOSurface(int32 width
,
681 Send(new PluginHostMsg_AcceleratedPluginAllocatedIOSurface(
682 route_id_
, width
, height
, surface_id
));
685 void WebPluginProxy::AcceleratedPluginSwappedIOSurface() {
686 Send(new PluginHostMsg_AcceleratedPluginSwappedIOSurface(
691 void WebPluginProxy::OnPaint(const gfx::Rect
& damaged_rect
) {
692 GetContentClient()->SetActiveURL(page_url_
);
695 Send(new PluginHostMsg_InvalidateRect(route_id_
, damaged_rect
));
698 bool WebPluginProxy::IsOffTheRecord() {
699 return channel_
->incognito();
702 void WebPluginProxy::ResourceClientDeleted(
703 WebPluginResourceClient
* resource_client
) {
704 ResourceClientMap::iterator index
= resource_clients_
.begin();
705 while (index
!= resource_clients_
.end()) {
706 WebPluginResourceClient
* client
= (*index
).second
;
708 if (client
== resource_client
) {
709 resource_clients_
.erase(index
++);
716 void WebPluginProxy::URLRedirectResponse(bool allow
, int resource_id
) {
717 Send(new PluginHostMsg_URLRedirectResponse(route_id_
, allow
, resource_id
));
720 #if defined(OS_WIN) && !defined(USE_AURA)
721 void WebPluginProxy::UpdateIMEStatus() {
722 // Retrieve the IME status from a plug-in and send it to a renderer process
723 // when the plug-in has updated it.
725 gfx::Rect caret_rect
;
726 if (!delegate_
->GetIMEStatus(&input_type
, &caret_rect
))
729 Send(new PluginHostMsg_NotifyIMEStatus(route_id_
, input_type
, caret_rect
));
733 } // namespace content