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

Side by Side Diff: content/browser/plugin_process_host.cc

Issue 7054068: Make sandboxed Flash work under UIPI (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 6 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
OLDNEW
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/browser/plugin_process_host.h" 5 #include "content/browser/plugin_process_host.h"
6 6
7 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <windows.h> 8 #include <windows.h>
9 #elif defined(OS_POSIX) 9 #elif defined(OS_POSIX)
10 #include <utility> // for pair<> 10 #include <utility> // for pair<>
(...skipping 12 matching lines...) Expand all
23 #include "chrome/common/chrome_switches.h" 23 #include "chrome/common/chrome_switches.h"
24 #include "chrome/common/logging_chrome.h" 24 #include "chrome/common/logging_chrome.h"
25 #include "content/browser/browser_thread.h" 25 #include "content/browser/browser_thread.h"
26 #include "content/browser/content_browser_client.h" 26 #include "content/browser/content_browser_client.h"
27 #include "content/browser/resolve_proxy_msg_helper.h" 27 #include "content/browser/resolve_proxy_msg_helper.h"
28 #include "content/browser/plugin_service.h" 28 #include "content/browser/plugin_service.h"
29 #include "content/browser/renderer_host/resource_dispatcher_host.h" 29 #include "content/browser/renderer_host/resource_dispatcher_host.h"
30 #include "content/browser/renderer_host/resource_message_filter.h" 30 #include "content/browser/renderer_host/resource_message_filter.h"
31 #include "content/common/plugin_messages.h" 31 #include "content/common/plugin_messages.h"
32 #include "content/common/resource_messages.h" 32 #include "content/common/resource_messages.h"
33 #include "webkit/plugins/npapi/webplugin_delegate_impl.h"
33 #include "ipc/ipc_switches.h" 34 #include "ipc/ipc_switches.h"
34 #include "ui/base/ui_base_switches.h" 35 #include "ui/base/ui_base_switches.h"
35 #include "ui/gfx/native_widget_types.h" 36 #include "ui/gfx/native_widget_types.h"
36 #include "ui/gfx/gl/gl_switches.h" 37 #include "ui/gfx/gl/gl_switches.h"
37 38
38 #if defined(USE_X11) 39 #if defined(USE_X11)
39 #include "ui/gfx/gtk_native_view_id_manager.h" 40 #include "ui/gfx/gtk_native_view_id_manager.h"
40 #endif 41 #endif
41 42
42 #if defined(OS_MACOSX) 43 #if defined(OS_MACOSX)
(...skipping 12 matching lines...) Expand all
55 return; 56 return;
56 57
57 plugin_parent_windows_set_.erase(window_index); 58 plugin_parent_windows_set_.erase(window_index);
58 PostMessage(parent, WM_CLOSE, 0, 0); 59 PostMessage(parent, WM_CLOSE, 0, 0);
59 } 60 }
60 61
61 void PluginProcessHost::AddWindow(HWND window) { 62 void PluginProcessHost::AddWindow(HWND window) {
62 plugin_parent_windows_set_.insert(window); 63 plugin_parent_windows_set_.insert(window);
63 } 64 }
64 65
66 void PluginProcessHost::OnReparentPluginWindow(HWND window, HWND parent) {
67 DWORD process_id = 0;
68
69 // Reparent only to our process.
70 ::GetWindowThreadProcessId(parent, &process_id);
71 if (process_id != ::GetCurrentProcessId())
72 return;
73
74 // Must reparent before changing style.
75 ::SetParent(window, parent);
76
77 if (webkit::npapi::WebPluginDelegateImpl::IsDummyActivationWindow(window)) {
78 ::SetWindowLongPtr(window, GWL_STYLE, WS_CHILD);
79 } else {
80 ::SetWindowLongPtr(window, GWL_STYLE, WS_CHILD | WS_CLIPCHILDREN |
81 WS_CLIPSIBLINGS);
82 }
83 }
65 #endif // defined(OS_WIN) 84 #endif // defined(OS_WIN)
66 85
67 #if defined(TOOLKIT_USES_GTK) 86 #if defined(TOOLKIT_USES_GTK)
68 void PluginProcessHost::OnMapNativeViewId(gfx::NativeViewId id, 87 void PluginProcessHost::OnMapNativeViewId(gfx::NativeViewId id,
69 gfx::PluginWindowHandle* output) { 88 gfx::PluginWindowHandle* output) {
70 *output = 0; 89 *output = 0;
71 GtkNativeViewManager::GetInstance()->GetXIDForId(output, id); 90 GtkNativeViewManager::GetInstance()->GetXIDForId(output, id);
72 } 91 }
73 #endif // defined(TOOLKIT_USES_GTK) 92 #endif // defined(TOOLKIT_USES_GTK)
74 93
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 BrowserChildProcessHost::ForceShutdown(); 257 BrowserChildProcessHost::ForceShutdown();
239 } 258 }
240 259
241 bool PluginProcessHost::OnMessageReceived(const IPC::Message& msg) { 260 bool PluginProcessHost::OnMessageReceived(const IPC::Message& msg) {
242 bool handled = true; 261 bool handled = true;
243 IPC_BEGIN_MESSAGE_MAP(PluginProcessHost, msg) 262 IPC_BEGIN_MESSAGE_MAP(PluginProcessHost, msg)
244 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_ChannelCreated, OnChannelCreated) 263 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_ChannelCreated, OnChannelCreated)
245 #if defined(OS_WIN) 264 #if defined(OS_WIN)
246 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_PluginWindowDestroyed, 265 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_PluginWindowDestroyed,
247 OnPluginWindowDestroyed) 266 OnPluginWindowDestroyed)
267 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_ReparentPluginWindow,
268 OnReparentPluginWindow)
248 #endif 269 #endif
249 #if defined(TOOLKIT_USES_GTK) 270 #if defined(TOOLKIT_USES_GTK)
250 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_MapNativeViewId, 271 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_MapNativeViewId,
251 OnMapNativeViewId) 272 OnMapNativeViewId)
252 #endif 273 #endif
253 #if defined(OS_MACOSX) 274 #if defined(OS_MACOSX)
254 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_PluginSelectWindow, 275 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_PluginSelectWindow,
255 OnPluginSelectWindow) 276 OnPluginSelectWindow)
256 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_PluginShowWindow, 277 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_PluginShowWindow,
257 OnPluginShowWindow) 278 OnPluginShowWindow)
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 } 347 }
327 } 348 }
328 349
329 void PluginProcessHost::OnChannelCreated( 350 void PluginProcessHost::OnChannelCreated(
330 const IPC::ChannelHandle& channel_handle) { 351 const IPC::ChannelHandle& channel_handle) {
331 Client* client = sent_requests_.front(); 352 Client* client = sent_requests_.front();
332 353
333 client->OnChannelOpened(channel_handle); 354 client->OnChannelOpened(channel_handle);
334 sent_requests_.pop(); 355 sent_requests_.pop();
335 } 356 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698