| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "build/build_config.h" | 5 #include "build/build_config.h" |
| 6 | 6 |
| 7 #include "chrome/browser/plugin_process_host.h" | 7 #include "chrome/browser/plugin_process_host.h" |
| 8 | 8 |
| 9 #if defined(OS_WIN) | 9 #if defined(OS_WIN) |
| 10 #include <windows.h> | 10 #include <windows.h> |
| (...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 // notification and the PluginProcessHost instance is being destroyed, it | 318 // notification and the PluginProcessHost instance is being destroyed, it |
| 319 // means that the plugin process crashed. We paint a sad face in this case in | 319 // means that the plugin process crashed. We paint a sad face in this case in |
| 320 // the renderer process. To ensure that the sad face shows up, and we don't | 320 // the renderer process. To ensure that the sad face shows up, and we don't |
| 321 // leak HWNDs, we should destroy existing plugin parent windows. | 321 // leak HWNDs, we should destroy existing plugin parent windows. |
| 322 std::set<HWND>::iterator window_index; | 322 std::set<HWND>::iterator window_index; |
| 323 for (window_index = plugin_parent_windows_set_.begin(); | 323 for (window_index = plugin_parent_windows_set_.begin(); |
| 324 window_index != plugin_parent_windows_set_.end(); | 324 window_index != plugin_parent_windows_set_.end(); |
| 325 window_index++) { | 325 window_index++) { |
| 326 PostMessage(*window_index, WM_CLOSE, 0, 0); | 326 PostMessage(*window_index, WM_CLOSE, 0, 0); |
| 327 } | 327 } |
| 328 #elif defined(OS_MACOSX) |
| 329 // If the plugin process crashed but had windows open at the time, make |
| 330 // sure that the menu bar is visible. |
| 331 if (!plugin_visible_windows_set_.empty()) |
| 332 SetSystemUIMode(kUIModeNormal, 0); |
| 328 #endif | 333 #endif |
| 329 } | 334 } |
| 330 | 335 |
| 331 bool PluginProcessHost::Init(const WebPluginInfo& info, | 336 bool PluginProcessHost::Init(const WebPluginInfo& info, |
| 332 const std::wstring& locale) { | 337 const std::wstring& locale) { |
| 333 info_ = info; | 338 info_ = info; |
| 334 set_name(info_.name); | 339 set_name(info_.name); |
| 335 | 340 |
| 336 if (!CreateChannel()) | 341 if (!CreateChannel()) |
| 337 return false; | 342 return false; |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 470 OnResolveProxy) | 475 OnResolveProxy) |
| 471 #if defined(OS_WIN) | 476 #if defined(OS_WIN) |
| 472 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_PluginWindowDestroyed, | 477 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_PluginWindowDestroyed, |
| 473 OnPluginWindowDestroyed) | 478 OnPluginWindowDestroyed) |
| 474 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_DownloadUrl, OnDownloadUrl) | 479 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_DownloadUrl, OnDownloadUrl) |
| 475 #endif | 480 #endif |
| 476 #if defined(OS_LINUX) | 481 #if defined(OS_LINUX) |
| 477 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_MapNativeViewId, | 482 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_MapNativeViewId, |
| 478 OnMapNativeViewId) | 483 OnMapNativeViewId) |
| 479 #endif | 484 #endif |
| 485 #if defined(OS_MACOSX) |
| 486 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_PluginSelectWindow, |
| 487 OnPluginSelectWindow) |
| 488 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_PluginShowWindow, |
| 489 OnPluginShowWindow) |
| 490 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_PluginHideWindow, |
| 491 OnPluginHideWindow) |
| 492 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_PluginDisposeWindow, |
| 493 OnPluginDisposeWindow) |
| 494 #endif |
| 480 IPC_MESSAGE_UNHANDLED_ERROR() | 495 IPC_MESSAGE_UNHANDLED_ERROR() |
| 481 IPC_END_MESSAGE_MAP() | 496 IPC_END_MESSAGE_MAP() |
| 482 } | 497 } |
| 483 | 498 |
| 484 void PluginProcessHost::OnChannelConnected(int32 peer_pid) { | 499 void PluginProcessHost::OnChannelConnected(int32 peer_pid) { |
| 485 for (size_t i = 0; i < pending_requests_.size(); ++i) { | 500 for (size_t i = 0; i < pending_requests_.size(); ++i) { |
| 486 RequestPluginChannel(pending_requests_[i].renderer_message_filter_.get(), | 501 RequestPluginChannel(pending_requests_[i].renderer_message_filter_.get(), |
| 487 pending_requests_[i].mime_type, | 502 pending_requests_[i].mime_type, |
| 488 pending_requests_[i].reply_msg); | 503 pending_requests_[i].reply_msg); |
| 489 } | 504 } |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 635 DCHECK(MessageLoop::current() == | 650 DCHECK(MessageLoop::current() == |
| 636 ChromeThread::GetMessageLoop(ChromeThread::IO)); | 651 ChromeThread::GetMessageLoop(ChromeThread::IO)); |
| 637 | 652 |
| 638 ChromePluginLib *chrome_plugin = ChromePluginLib::Find(info_.path); | 653 ChromePluginLib *chrome_plugin = ChromePluginLib::Find(info_.path); |
| 639 if (chrome_plugin) { | 654 if (chrome_plugin) { |
| 640 void *data_ptr = const_cast<void*>(reinterpret_cast<const void*>(&data[0])); | 655 void *data_ptr = const_cast<void*>(reinterpret_cast<const void*>(&data[0])); |
| 641 uint32 data_len = static_cast<uint32>(data.size()); | 656 uint32 data_len = static_cast<uint32>(data.size()); |
| 642 chrome_plugin->functions().on_message(data_ptr, data_len); | 657 chrome_plugin->functions().on_message(data_ptr, data_len); |
| 643 } | 658 } |
| 644 } | 659 } |
| OLD | NEW |