| 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/browser/plugin_process_host.h" | 5 #include "content/browser/plugin_process_host.h" |
| 6 | 6 |
| 7 #if defined(OS_WIN) && !defined(USE_AURA) | 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<> |
| 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/bind.h" | 16 #include "base/bind.h" |
| 17 #include "base/command_line.h" | 17 #include "base/command_line.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 46 #if defined(USE_X11) | 46 #if defined(USE_X11) |
| 47 #include "ui/gfx/gtk_native_view_id_manager.h" | 47 #include "ui/gfx/gtk_native_view_id_manager.h" |
| 48 #endif | 48 #endif |
| 49 | 49 |
| 50 #if defined(OS_MACOSX) | 50 #if defined(OS_MACOSX) |
| 51 #include "base/mac/mac_util.h" | 51 #include "base/mac/mac_util.h" |
| 52 #include "content/common/plugin_carbon_interpose_constants_mac.h" | 52 #include "content/common/plugin_carbon_interpose_constants_mac.h" |
| 53 #include "ui/gfx/rect.h" | 53 #include "ui/gfx/rect.h" |
| 54 #endif | 54 #endif |
| 55 | 55 |
| 56 #if defined(OS_WIN) && !defined(USE_AURA) | 56 #if defined(OS_WIN) |
| 57 #include "base/win/windows_version.h" | 57 #include "base/win/windows_version.h" |
| 58 #include "webkit/plugins/npapi/plugin_constants_win.h" | 58 #include "webkit/plugins/npapi/plugin_constants_win.h" |
| 59 #include "webkit/plugins/npapi/webplugin_delegate_impl.h" | 59 #include "webkit/plugins/npapi/webplugin_delegate_impl.h" |
| 60 | 60 |
| 61 namespace { | 61 namespace { |
| 62 | 62 |
| 63 void ReparentPluginWindowHelper(HWND window, HWND parent) { | 63 void ReparentPluginWindowHelper(HWND window, HWND parent) { |
| 64 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 64 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 65 | 65 |
| 66 int window_style = WS_CHILD; | 66 int window_style = WS_CHILD; |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 PluginProcessHost::PluginProcessHost() | 126 PluginProcessHost::PluginProcessHost() |
| 127 #if defined(OS_MACOSX) | 127 #if defined(OS_MACOSX) |
| 128 : plugin_cursor_visible_(true) | 128 : plugin_cursor_visible_(true) |
| 129 #endif | 129 #endif |
| 130 { | 130 { |
| 131 process_.reset( | 131 process_.reset( |
| 132 new BrowserChildProcessHostImpl(content::PROCESS_TYPE_PLUGIN, this)); | 132 new BrowserChildProcessHostImpl(content::PROCESS_TYPE_PLUGIN, this)); |
| 133 } | 133 } |
| 134 | 134 |
| 135 PluginProcessHost::~PluginProcessHost() { | 135 PluginProcessHost::~PluginProcessHost() { |
| 136 #if defined(OS_WIN) && !defined(USE_AURA) | 136 #if defined(OS_WIN) |
| 137 // We erase HWNDs from the plugin_parent_windows_set_ when we receive a | 137 // We erase HWNDs from the plugin_parent_windows_set_ when we receive a |
| 138 // notification that the window is being destroyed. If we don't receive this | 138 // notification that the window is being destroyed. If we don't receive this |
| 139 // notification and the PluginProcessHost instance is being destroyed, it | 139 // notification and the PluginProcessHost instance is being destroyed, it |
| 140 // means that the plugin process crashed. We paint a sad face in this case in | 140 // means that the plugin process crashed. We paint a sad face in this case in |
| 141 // the renderer process. To ensure that the sad face shows up, and we don't | 141 // the renderer process. To ensure that the sad face shows up, and we don't |
| 142 // leak HWNDs, we should destroy existing plugin parent windows. | 142 // leak HWNDs, we should destroy existing plugin parent windows. |
| 143 std::set<HWND>::iterator window_index; | 143 std::set<HWND>::iterator window_index; |
| 144 for (window_index = plugin_parent_windows_set_.begin(); | 144 for (window_index = plugin_parent_windows_set_.begin(); |
| 145 window_index != plugin_parent_windows_set_.end(); | 145 window_index != plugin_parent_windows_set_.end(); |
| 146 window_index++) { | 146 window_index++) { |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 304 } | 304 } |
| 305 | 305 |
| 306 void PluginProcessHost::AddFilter(IPC::ChannelProxy::MessageFilter* filter) { | 306 void PluginProcessHost::AddFilter(IPC::ChannelProxy::MessageFilter* filter) { |
| 307 process_->GetHost()->AddFilter(filter); | 307 process_->GetHost()->AddFilter(filter); |
| 308 } | 308 } |
| 309 | 309 |
| 310 bool PluginProcessHost::OnMessageReceived(const IPC::Message& msg) { | 310 bool PluginProcessHost::OnMessageReceived(const IPC::Message& msg) { |
| 311 bool handled = true; | 311 bool handled = true; |
| 312 IPC_BEGIN_MESSAGE_MAP(PluginProcessHost, msg) | 312 IPC_BEGIN_MESSAGE_MAP(PluginProcessHost, msg) |
| 313 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_ChannelCreated, OnChannelCreated) | 313 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_ChannelCreated, OnChannelCreated) |
| 314 #if defined(OS_WIN) && !defined(USE_AURA) | 314 #if defined(OS_WIN) |
| 315 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_PluginWindowDestroyed, | 315 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_PluginWindowDestroyed, |
| 316 OnPluginWindowDestroyed) | 316 OnPluginWindowDestroyed) |
| 317 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_ReparentPluginWindow, | 317 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_ReparentPluginWindow, |
| 318 OnReparentPluginWindow) | 318 OnReparentPluginWindow) |
| 319 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_ReportExecutableMemory, | 319 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_ReportExecutableMemory, |
| 320 OnReportExecutableMemory) | 320 OnReportExecutableMemory) |
| 321 #endif | 321 #endif |
| 322 #if defined(TOOLKIT_GTK) | 322 #if defined(TOOLKIT_GTK) |
| 323 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_MapNativeViewId, | 323 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_MapNativeViewId, |
| 324 OnMapNativeViewId) | 324 OnMapNativeViewId) |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 447 } | 447 } |
| 448 | 448 |
| 449 void PluginProcessHost::OnChannelCreated( | 449 void PluginProcessHost::OnChannelCreated( |
| 450 const IPC::ChannelHandle& channel_handle) { | 450 const IPC::ChannelHandle& channel_handle) { |
| 451 Client* client = sent_requests_.front(); | 451 Client* client = sent_requests_.front(); |
| 452 | 452 |
| 453 if (client) | 453 if (client) |
| 454 client->OnChannelOpened(channel_handle); | 454 client->OnChannelOpened(channel_handle); |
| 455 sent_requests_.pop_front(); | 455 sent_requests_.pop_front(); |
| 456 } | 456 } |
| OLD | NEW |