| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/browser/plugin_process_host.h" | 5 #include "chrome/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 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 | 278 |
| 279 #if defined(TOOLKIT_USES_GTK) | 279 #if defined(TOOLKIT_USES_GTK) |
| 280 void PluginProcessHost::OnMapNativeViewId(gfx::NativeViewId id, | 280 void PluginProcessHost::OnMapNativeViewId(gfx::NativeViewId id, |
| 281 gfx::PluginWindowHandle* output) { | 281 gfx::PluginWindowHandle* output) { |
| 282 *output = 0; | 282 *output = 0; |
| 283 Singleton<GtkNativeViewManager>()->GetXIDForId(output, id); | 283 Singleton<GtkNativeViewManager>()->GetXIDForId(output, id); |
| 284 } | 284 } |
| 285 #endif // defined(TOOLKIT_USES_GTK) | 285 #endif // defined(TOOLKIT_USES_GTK) |
| 286 | 286 |
| 287 PluginProcessHost::PluginProcessHost() | 287 PluginProcessHost::PluginProcessHost() |
| 288 : ChildProcessHost( | 288 : BrowserChildProcessHost( |
| 289 PLUGIN_PROCESS, | 289 PLUGIN_PROCESS, |
| 290 PluginService::GetInstance()->resource_dispatcher_host()), | 290 PluginService::GetInstance()->resource_dispatcher_host()), |
| 291 ALLOW_THIS_IN_INITIALIZER_LIST(resolve_proxy_msg_helper_(this, NULL)) | 291 ALLOW_THIS_IN_INITIALIZER_LIST(resolve_proxy_msg_helper_(this, NULL)) |
| 292 #if defined(OS_MACOSX) | 292 #if defined(OS_MACOSX) |
| 293 , plugin_cursor_visible_(true) | 293 , plugin_cursor_visible_(true) |
| 294 #endif | 294 #endif |
| 295 { | 295 { |
| 296 } | 296 } |
| 297 | 297 |
| 298 PluginProcessHost::~PluginProcessHost() { | 298 PluginProcessHost::~PluginProcessHost() { |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 449 env, | 449 env, |
| 450 #endif | 450 #endif |
| 451 cmd_line); | 451 cmd_line); |
| 452 | 452 |
| 453 return true; | 453 return true; |
| 454 } | 454 } |
| 455 | 455 |
| 456 void PluginProcessHost::ForceShutdown() { | 456 void PluginProcessHost::ForceShutdown() { |
| 457 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::IO)); | 457 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::IO)); |
| 458 Send(new PluginProcessMsg_NotifyRenderersOfPendingShutdown()); | 458 Send(new PluginProcessMsg_NotifyRenderersOfPendingShutdown()); |
| 459 ChildProcessHost::ForceShutdown(); | 459 BrowserChildProcessHost::ForceShutdown(); |
| 460 } | 460 } |
| 461 | 461 |
| 462 void PluginProcessHost::OnProcessLaunched() { | 462 void PluginProcessHost::OnProcessLaunched() { |
| 463 FilePath gears_path; | 463 FilePath gears_path; |
| 464 if (PathService::Get(chrome::FILE_GEARS_PLUGIN, &gears_path)) { | 464 if (PathService::Get(chrome::FILE_GEARS_PLUGIN, &gears_path)) { |
| 465 FilePath::StringType gears_path_lc = StringToLowerASCII(gears_path.value()); | 465 FilePath::StringType gears_path_lc = StringToLowerASCII(gears_path.value()); |
| 466 FilePath::StringType plugin_path_lc = | 466 FilePath::StringType plugin_path_lc = |
| 467 StringToLowerASCII(info_.path.value()); | 467 StringToLowerASCII(info_.path.value()); |
| 468 if (plugin_path_lc == gears_path_lc) { | 468 if (plugin_path_lc == gears_path_lc) { |
| 469 // Give Gears plugins "background" priority. See http://b/1280317. | 469 // Give Gears plugins "background" priority. See http://b/1280317. |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 666 const std::vector<uint8>& data) { | 666 const std::vector<uint8>& data) { |
| 667 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::IO)); | 667 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::IO)); |
| 668 | 668 |
| 669 ChromePluginLib *chrome_plugin = ChromePluginLib::Find(info_.path); | 669 ChromePluginLib *chrome_plugin = ChromePluginLib::Find(info_.path); |
| 670 if (chrome_plugin) { | 670 if (chrome_plugin) { |
| 671 void *data_ptr = const_cast<void*>(reinterpret_cast<const void*>(&data[0])); | 671 void *data_ptr = const_cast<void*>(reinterpret_cast<const void*>(&data[0])); |
| 672 uint32 data_len = static_cast<uint32>(data.size()); | 672 uint32 data_len = static_cast<uint32>(data.size()); |
| 673 chrome_plugin->functions().on_message(data_ptr, data_len); | 673 chrome_plugin->functions().on_message(data_ptr, data_len); |
| 674 } | 674 } |
| 675 } | 675 } |
| OLD | NEW |