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/renderer/npapi/webplugin_delegate_proxy.h" | 5 #include "content/renderer/npapi/webplugin_delegate_proxy.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
494 } | 494 } |
495 | 495 |
496 static void CopySharedMemoryHandleForMessage( | 496 static void CopySharedMemoryHandleForMessage( |
497 const base::SharedMemoryHandle& handle_in, | 497 const base::SharedMemoryHandle& handle_in, |
498 base::SharedMemoryHandle* handle_out, | 498 base::SharedMemoryHandle* handle_out, |
499 base::ProcessId peer_pid) { | 499 base::ProcessId peer_pid) { |
500 #if defined(OS_POSIX) | 500 #if defined(OS_POSIX) |
501 *handle_out = base::SharedMemory::DuplicateHandle(handle_in); | 501 *handle_out = base::SharedMemory::DuplicateHandle(handle_in); |
502 #elif defined(OS_WIN) | 502 #elif defined(OS_WIN) |
503 // On Windows we need to duplicate the handle for the plugin process. | 503 // On Windows we need to duplicate the handle for the plugin process. |
504 *handle_out = NULL; | 504 BrokerDuplicateSharedMemoryHandle(handle_in, peer_pid, handle_out); |
505 BrokerDuplicateHandle(handle_in, peer_pid, handle_out, | |
506 FILE_MAP_READ | FILE_MAP_WRITE, 0); | |
507 DCHECK(*handle_out != NULL); | |
508 #else | 505 #else |
509 #error Shared memory copy not implemented. | 506 #error Shared memory copy not implemented. |
510 #endif | 507 #endif |
511 } | 508 } |
512 | 509 |
513 void WebPluginDelegateProxy::SendUpdateGeometry( | 510 void WebPluginDelegateProxy::SendUpdateGeometry( |
514 bool bitmaps_changed) { | 511 bool bitmaps_changed) { |
515 if (!channel_host_.get()) | 512 if (!channel_host_.get()) |
516 return; | 513 return; |
517 | 514 |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
638 if (!memory->get()) | 635 if (!memory->get()) |
639 return false; | 636 return false; |
640 DCHECK((*memory)->shared_memory()); | 637 DCHECK((*memory)->shared_memory()); |
641 #if defined(OS_POSIX) | 638 #if defined(OS_POSIX) |
642 canvas->reset(skia::CreatePlatformCanvas( | 639 canvas->reset(skia::CreatePlatformCanvas( |
643 plugin_rect_.width(), plugin_rect_.height(), true, (*memory)->pixels(), | 640 plugin_rect_.width(), plugin_rect_.height(), true, (*memory)->pixels(), |
644 skia::RETURN_NULL_ON_FAILURE)); | 641 skia::RETURN_NULL_ON_FAILURE)); |
645 #else | 642 #else |
646 canvas->reset(skia::CreatePlatformCanvas( | 643 canvas->reset(skia::CreatePlatformCanvas( |
647 plugin_rect_.width(), plugin_rect_.height(), true, | 644 plugin_rect_.width(), plugin_rect_.height(), true, |
648 (*memory)->shared_memory()->handle(), skia::RETURN_NULL_ON_FAILURE)); | 645 (*memory)->shared_memory()->handle().GetHandle(), |
| 646 skia::RETURN_NULL_ON_FAILURE)); |
649 #endif | 647 #endif |
650 return !!canvas->get(); | 648 return !!canvas->get(); |
651 } | 649 } |
652 | 650 |
653 void WebPluginDelegateProxy::Paint(SkCanvas* canvas, | 651 void WebPluginDelegateProxy::Paint(SkCanvas* canvas, |
654 const gfx::Rect& damaged_rect) { | 652 const gfx::Rect& damaged_rect) { |
655 // Limit the damaged rectangle to whatever is contained inside the plugin | 653 // Limit the damaged rectangle to whatever is contained inside the plugin |
656 // rectangle, as that's the rectangle that we'll actually draw. | 654 // rectangle, as that's the rectangle that we'll actually draw. |
657 gfx::Rect rect = gfx::IntersectRects(damaged_rect, plugin_rect_); | 655 gfx::Rect rect = gfx::IntersectRects(damaged_rect, plugin_rect_); |
658 | 656 |
(...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1229 | 1227 |
1230 plugin_->URLRedirectResponse(allow, resource_id); | 1228 plugin_->URLRedirectResponse(allow, resource_id); |
1231 } | 1229 } |
1232 | 1230 |
1233 void WebPluginDelegateProxy::OnCheckIfRunInsecureContent(const GURL& url, | 1231 void WebPluginDelegateProxy::OnCheckIfRunInsecureContent(const GURL& url, |
1234 bool* result) { | 1232 bool* result) { |
1235 *result = plugin_->CheckIfRunInsecureContent(url); | 1233 *result = plugin_->CheckIfRunInsecureContent(url); |
1236 } | 1234 } |
1237 | 1235 |
1238 } // namespace content | 1236 } // namespace content |
OLD | NEW |