Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(721)

Side by Side Diff: content/plugin/webplugin_proxy.cc

Issue 9924010: Revert 129627 - Add a sandbox API for broker handle duplication (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/plugin/plugin_channel.cc ('k') | content/renderer/webplugin_delegate_proxy.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 17 matching lines...) Expand all
28 #if defined(OS_MACOSX) 28 #if defined(OS_MACOSX)
29 #include "base/mac/mac_util.h" 29 #include "base/mac/mac_util.h"
30 #include "base/mac/scoped_cftyperef.h" 30 #include "base/mac/scoped_cftyperef.h"
31 #include "content/plugin/webplugin_accelerated_surface_proxy_mac.h" 31 #include "content/plugin/webplugin_accelerated_surface_proxy_mac.h"
32 #endif 32 #endif
33 33
34 #if defined(USE_X11) 34 #if defined(USE_X11)
35 #include "ui/base/x/x11_util_internal.h" 35 #include "ui/base/x/x11_util_internal.h"
36 #endif 36 #endif
37 37
38 #if defined(OS_WIN)
39 #include "content/common/sandbox_policy.h"
40 #endif
41
42 using WebKit::WebBindings; 38 using WebKit::WebBindings;
43 39
44 using webkit::npapi::WebPluginResourceClient; 40 using webkit::npapi::WebPluginResourceClient;
45 #if defined(OS_MACOSX) 41 #if defined(OS_MACOSX)
46 using webkit::npapi::WebPluginAcceleratedSurface; 42 using webkit::npapi::WebPluginAcceleratedSurface;
47 #endif 43 #endif
48 44
49 WebPluginProxy::WebPluginProxy( 45 WebPluginProxy::WebPluginProxy(
50 PluginChannel* channel, 46 PluginChannel* channel,
51 int route_id, 47 int route_id,
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 #elif defined(USE_X11) 122 #elif defined(USE_X11)
127 // Nothing to do. 123 // Nothing to do.
128 #else 124 #else
129 NOTIMPLEMENTED(); 125 NOTIMPLEMENTED();
130 #endif 126 #endif
131 } 127 }
132 128
133 #if defined(OS_WIN) 129 #if defined(OS_WIN)
134 void WebPluginProxy::SetWindowlessPumpEvent(HANDLE pump_messages_event) { 130 void WebPluginProxy::SetWindowlessPumpEvent(HANDLE pump_messages_event) {
135 HANDLE pump_messages_event_for_renderer = NULL; 131 HANDLE pump_messages_event_for_renderer = NULL;
136 sandbox::BrokerDuplicateHandle(pump_messages_event, channel_->peer_pid(), 132 DuplicateHandle(GetCurrentProcess(), pump_messages_event,
137 &pump_messages_event_for_renderer, 133 channel_->renderer_handle(),
138 0, DUPLICATE_SAME_ACCESS); 134 &pump_messages_event_for_renderer,
135 0, FALSE, DUPLICATE_SAME_ACCESS);
139 DCHECK(pump_messages_event_for_renderer != NULL); 136 DCHECK(pump_messages_event_for_renderer != NULL);
140 Send(new PluginHostMsg_SetWindowlessPumpEvent( 137 Send(new PluginHostMsg_SetWindowlessPumpEvent(
141 route_id_, pump_messages_event_for_renderer)); 138 route_id_, pump_messages_event_for_renderer));
142 } 139 }
143 140
144 void WebPluginProxy::ReparentPluginWindow(HWND window, HWND parent) { 141 void WebPluginProxy::ReparentPluginWindow(HWND window, HWND parent) {
145 PluginThread::current()->Send( 142 PluginThread::current()->Send(
146 new PluginProcessHostMsg_ReparentPluginWindow(window, parent)); 143 new PluginProcessHostMsg_ReparentPluginWindow(window, parent));
147 } 144 }
148 145
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 InvalidateRect(damaged_rect_); 463 InvalidateRect(damaged_rect_);
467 } 464 }
468 } 465 }
469 466
470 #if defined(OS_WIN) 467 #if defined(OS_WIN)
471 468
472 void WebPluginProxy::CreateCanvasFromHandle( 469 void WebPluginProxy::CreateCanvasFromHandle(
473 const TransportDIB::Handle& dib_handle, 470 const TransportDIB::Handle& dib_handle,
474 const gfx::Rect& window_rect, 471 const gfx::Rect& window_rect,
475 scoped_ptr<skia::PlatformCanvas>* canvas_out) { 472 scoped_ptr<skia::PlatformCanvas>* canvas_out) {
473 // Create a canvas that will reference the shared bits. We have to handle
474 // errors here since we're mapping a large amount of memory that may not fit
475 // in our address space, or go wrong in some other way.
476 HANDLE section;
477 DuplicateHandle(channel_->renderer_handle(), dib_handle, GetCurrentProcess(),
478 &section,
479 STANDARD_RIGHTS_REQUIRED | FILE_MAP_READ | FILE_MAP_WRITE,
480 FALSE, 0);
476 scoped_ptr<skia::PlatformCanvas> canvas(new skia::PlatformCanvas); 481 scoped_ptr<skia::PlatformCanvas> canvas(new skia::PlatformCanvas);
477 if (!canvas->initialize( 482 if (!canvas->initialize(
478 window_rect.width(), 483 window_rect.width(),
479 window_rect.height(), 484 window_rect.height(),
480 true, 485 true,
481 dib_handle)) { 486 section)) {
482 canvas_out->reset(); 487 canvas_out->reset();
483 } 488 }
484 canvas_out->reset(canvas.release()); 489 canvas_out->reset(canvas.release());
485 // The canvas does not own the section so we need to close it now. 490 // The canvas does not own the section so we need to close it now.
486 CloseHandle(dib_handle); 491 CloseHandle(section);
487 } 492 }
488 493
489 void WebPluginProxy::SetWindowlessBuffers( 494 void WebPluginProxy::SetWindowlessBuffers(
490 const TransportDIB::Handle& windowless_buffer0, 495 const TransportDIB::Handle& windowless_buffer0,
491 const TransportDIB::Handle& windowless_buffer1, 496 const TransportDIB::Handle& windowless_buffer1,
492 const TransportDIB::Handle& background_buffer, 497 const TransportDIB::Handle& background_buffer,
493 const gfx::Rect& window_rect) { 498 const gfx::Rect& window_rect) {
494 CreateCanvasFromHandle(windowless_buffer0, 499 CreateCanvasFromHandle(windowless_buffer0,
495 window_rect, 500 window_rect,
496 &windowless_canvases_[0]); 501 &windowless_canvases_[0]);
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
770 // Retrieve the IME status from a plug-in and send it to a renderer process 775 // Retrieve the IME status from a plug-in and send it to a renderer process
771 // when the plug-in has updated it. 776 // when the plug-in has updated it.
772 int input_type; 777 int input_type;
773 gfx::Rect caret_rect; 778 gfx::Rect caret_rect;
774 if (!delegate_->GetIMEStatus(&input_type, &caret_rect)) 779 if (!delegate_->GetIMEStatus(&input_type, &caret_rect))
775 return; 780 return;
776 781
777 Send(new PluginHostMsg_NotifyIMEStatus(route_id_, input_type, caret_rect)); 782 Send(new PluginHostMsg_NotifyIMEStatus(route_id_, input_type, caret_rect));
778 } 783 }
779 #endif 784 #endif
OLDNEW
« no previous file with comments | « content/plugin/plugin_channel.cc ('k') | content/renderer/webplugin_delegate_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698