| 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) | 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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 // means that the plugin process crashed. We paint a sad face in this case in | 139 // means that the plugin process crashed. We paint a sad face in this case in |
| 140 // the renderer process. To ensure that the sad face shows up, and we don't | 140 // the renderer process. To ensure that the sad face shows up, and we don't |
| 141 // leak HWNDs, we should destroy existing plugin parent windows. | 141 // leak HWNDs, we should destroy existing plugin parent windows. |
| 142 std::set<HWND>::iterator window_index; | 142 std::set<HWND>::iterator window_index; |
| 143 for (window_index = plugin_parent_windows_set_.begin(); | 143 for (window_index = plugin_parent_windows_set_.begin(); |
| 144 window_index != plugin_parent_windows_set_.end(); | 144 window_index != plugin_parent_windows_set_.end(); |
| 145 ++window_index) { | 145 ++window_index) { |
| 146 PostMessage(*window_index, WM_CLOSE, 0, 0); | 146 PostMessage(*window_index, WM_CLOSE, 0, 0); |
| 147 } | 147 } |
| 148 #elif defined(OS_MACOSX) | 148 #elif defined(OS_MACOSX) |
| 149 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 149 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 150 // If the plugin process crashed but had fullscreen windows open at the time, | 150 // If the plugin process crashed but had fullscreen windows open at the time, |
| 151 // make sure that the menu bar is visible. | 151 // make sure that the menu bar is visible. |
| 152 for (size_t i = 0; i < plugin_fullscreen_windows_set_.size(); ++i) { | 152 for (size_t i = 0; i < plugin_fullscreen_windows_set_.size(); ++i) { |
| 153 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, | 153 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
| 154 base::Bind(base::mac::ReleaseFullScreen, | 154 base::Bind(base::mac::ReleaseFullScreen, |
| 155 base::mac::kFullScreenModeHideAll)); | 155 base::mac::kFullScreenModeHideAll)); |
| 156 } | 156 } |
| 157 // If the plugin hid the cursor, reset that. | 157 // If the plugin hid the cursor, reset that. |
| 158 if (!plugin_cursor_visible_) { | 158 if (!plugin_cursor_visible_) { |
| 159 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, | 159 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 // system and host zoom level context. If NPAPI plugins actually use this, | 266 // system and host zoom level context. If NPAPI plugins actually use this, |
| 267 // we'll have to plumb them. | 267 // we'll have to plumb them. |
| 268 ResourceMessageFilter* resource_message_filter = new ResourceMessageFilter( | 268 ResourceMessageFilter* resource_message_filter = new ResourceMessageFilter( |
| 269 process_->GetData().id, PROCESS_TYPE_PLUGIN, NULL, NULL, NULL, NULL, NULL, | 269 process_->GetData().id, PROCESS_TYPE_PLUGIN, NULL, NULL, NULL, NULL, NULL, |
| 270 get_contexts_callback); | 270 get_contexts_callback); |
| 271 process_->AddFilter(resource_message_filter); | 271 process_->AddFilter(resource_message_filter); |
| 272 return true; | 272 return true; |
| 273 } | 273 } |
| 274 | 274 |
| 275 void PluginProcessHost::ForceShutdown() { | 275 void PluginProcessHost::ForceShutdown() { |
| 276 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 276 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 277 Send(new PluginProcessMsg_NotifyRenderersOfPendingShutdown()); | 277 Send(new PluginProcessMsg_NotifyRenderersOfPendingShutdown()); |
| 278 process_->ForceShutdown(); | 278 process_->ForceShutdown(); |
| 279 } | 279 } |
| 280 | 280 |
| 281 bool PluginProcessHost::OnMessageReceived(const IPC::Message& msg) { | 281 bool PluginProcessHost::OnMessageReceived(const IPC::Message& msg) { |
| 282 bool handled = true; | 282 bool handled = true; |
| 283 IPC_BEGIN_MESSAGE_MAP(PluginProcessHost, msg) | 283 IPC_BEGIN_MESSAGE_MAP(PluginProcessHost, msg) |
| 284 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_ChannelCreated, OnChannelCreated) | 284 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_ChannelCreated, OnChannelCreated) |
| 285 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_ChannelDestroyed, | 285 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_ChannelDestroyed, |
| 286 OnChannelDestroyed) | 286 OnChannelDestroyed) |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 427 | 427 |
| 428 void PluginProcessHost::GetContexts(const ResourceHostMsg_Request& request, | 428 void PluginProcessHost::GetContexts(const ResourceHostMsg_Request& request, |
| 429 ResourceContext** resource_context, | 429 ResourceContext** resource_context, |
| 430 net::URLRequestContext** request_context) { | 430 net::URLRequestContext** request_context) { |
| 431 *resource_context = | 431 *resource_context = |
| 432 resource_context_map_[request.origin_pid].resource_context; | 432 resource_context_map_[request.origin_pid].resource_context; |
| 433 *request_context = (*resource_context)->GetRequestContext(); | 433 *request_context = (*resource_context)->GetRequestContext(); |
| 434 } | 434 } |
| 435 | 435 |
| 436 } // namespace content | 436 } // namespace content |
| OLD | NEW |