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/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) && !defined(USE_AURA) |
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<> |
11 #endif | 11 #endif |
12 | 12 |
13 #include <vector> | 13 #include <vector> |
14 | 14 |
15 #include "base/base_switches.h" | 15 #include "base/base_switches.h" |
16 #include "base/command_line.h" | 16 #include "base/command_line.h" |
17 #include "base/file_path.h" | 17 #include "base/file_path.h" |
(...skipping 18 matching lines...) Expand all Loading... |
36 #if defined(USE_X11) | 36 #if defined(USE_X11) |
37 #include "ui/gfx/gtk_native_view_id_manager.h" | 37 #include "ui/gfx/gtk_native_view_id_manager.h" |
38 #endif | 38 #endif |
39 | 39 |
40 #if defined(OS_MACOSX) | 40 #if defined(OS_MACOSX) |
41 #include "base/mac/mac_util.h" | 41 #include "base/mac/mac_util.h" |
42 #include "content/common/plugin_carbon_interpose_constants_mac.h" | 42 #include "content/common/plugin_carbon_interpose_constants_mac.h" |
43 #include "ui/gfx/rect.h" | 43 #include "ui/gfx/rect.h" |
44 #endif | 44 #endif |
45 | 45 |
46 #if defined(OS_WIN) | 46 #if defined(OS_WIN) && !defined(USE_AURA) |
47 #include "base/win/windows_version.h" | 47 #include "base/win/windows_version.h" |
48 #include "webkit/plugins/npapi/plugin_constants_win.h" | 48 #include "webkit/plugins/npapi/plugin_constants_win.h" |
49 #include "webkit/plugins/npapi/webplugin_delegate_impl.h" | 49 #include "webkit/plugins/npapi/webplugin_delegate_impl.h" |
50 | 50 |
51 namespace { | 51 namespace { |
52 | 52 |
53 void ReparentPluginWindowHelper(HWND window, HWND parent) { | 53 void ReparentPluginWindowHelper(HWND window, HWND parent) { |
54 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 54 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
55 | 55 |
56 int window_style = WS_CHILD; | 56 int window_style = WS_CHILD; |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 | 108 |
109 PluginProcessHost::PluginProcessHost() | 109 PluginProcessHost::PluginProcessHost() |
110 : BrowserChildProcessHost(PLUGIN_PROCESS) | 110 : BrowserChildProcessHost(PLUGIN_PROCESS) |
111 #if defined(OS_MACOSX) | 111 #if defined(OS_MACOSX) |
112 , plugin_cursor_visible_(true) | 112 , plugin_cursor_visible_(true) |
113 #endif | 113 #endif |
114 { | 114 { |
115 } | 115 } |
116 | 116 |
117 PluginProcessHost::~PluginProcessHost() { | 117 PluginProcessHost::~PluginProcessHost() { |
118 #if defined(OS_WIN) | 118 #if defined(OS_WIN) && !defined(USE_AURA) |
119 // We erase HWNDs from the plugin_parent_windows_set_ when we receive a | 119 // We erase HWNDs from the plugin_parent_windows_set_ when we receive a |
120 // notification that the window is being destroyed. If we don't receive this | 120 // notification that the window is being destroyed. If we don't receive this |
121 // notification and the PluginProcessHost instance is being destroyed, it | 121 // notification and the PluginProcessHost instance is being destroyed, it |
122 // means that the plugin process crashed. We paint a sad face in this case in | 122 // means that the plugin process crashed. We paint a sad face in this case in |
123 // the renderer process. To ensure that the sad face shows up, and we don't | 123 // the renderer process. To ensure that the sad face shows up, and we don't |
124 // leak HWNDs, we should destroy existing plugin parent windows. | 124 // leak HWNDs, we should destroy existing plugin parent windows. |
125 std::set<HWND>::iterator window_index; | 125 std::set<HWND>::iterator window_index; |
126 for (window_index = plugin_parent_windows_set_.begin(); | 126 for (window_index = plugin_parent_windows_set_.begin(); |
127 window_index != plugin_parent_windows_set_.end(); | 127 window_index != plugin_parent_windows_set_.end(); |
128 window_index++) { | 128 window_index++) { |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 void PluginProcessHost::ForceShutdown() { | 271 void PluginProcessHost::ForceShutdown() { |
272 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 272 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
273 Send(new PluginProcessMsg_NotifyRenderersOfPendingShutdown()); | 273 Send(new PluginProcessMsg_NotifyRenderersOfPendingShutdown()); |
274 BrowserChildProcessHost::ForceShutdown(); | 274 BrowserChildProcessHost::ForceShutdown(); |
275 } | 275 } |
276 | 276 |
277 bool PluginProcessHost::OnMessageReceived(const IPC::Message& msg) { | 277 bool PluginProcessHost::OnMessageReceived(const IPC::Message& msg) { |
278 bool handled = true; | 278 bool handled = true; |
279 IPC_BEGIN_MESSAGE_MAP(PluginProcessHost, msg) | 279 IPC_BEGIN_MESSAGE_MAP(PluginProcessHost, msg) |
280 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_ChannelCreated, OnChannelCreated) | 280 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_ChannelCreated, OnChannelCreated) |
281 #if defined(OS_WIN) | 281 #if defined(OS_WIN) && !defined(USE_AURA) |
282 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_PluginWindowDestroyed, | 282 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_PluginWindowDestroyed, |
283 OnPluginWindowDestroyed) | 283 OnPluginWindowDestroyed) |
284 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_ReparentPluginWindow, | 284 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_ReparentPluginWindow, |
285 OnReparentPluginWindow) | 285 OnReparentPluginWindow) |
286 #endif | 286 #endif |
287 #if defined(TOOLKIT_USES_GTK) | 287 #if defined(TOOLKIT_USES_GTK) |
288 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_MapNativeViewId, | 288 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_MapNativeViewId, |
289 OnMapNativeViewId) | 289 OnMapNativeViewId) |
290 #endif | 290 #endif |
291 #if defined(OS_MACOSX) | 291 #if defined(OS_MACOSX) |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 } | 365 } |
366 } | 366 } |
367 | 367 |
368 void PluginProcessHost::OnChannelCreated( | 368 void PluginProcessHost::OnChannelCreated( |
369 const IPC::ChannelHandle& channel_handle) { | 369 const IPC::ChannelHandle& channel_handle) { |
370 Client* client = sent_requests_.front(); | 370 Client* client = sent_requests_.front(); |
371 | 371 |
372 client->OnChannelOpened(channel_handle); | 372 client->OnChannelOpened(channel_handle); |
373 sent_requests_.pop(); | 373 sent_requests_.pop(); |
374 } | 374 } |
OLD | NEW |