| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 | 383 |
| 384 cmd_line.AppendSwitchWithValue(switches::kProcessChannelID, channel_id()); | 384 cmd_line.AppendSwitchWithValue(switches::kProcessChannelID, channel_id()); |
| 385 | 385 |
| 386 cmd_line.AppendSwitchWithValue(switches::kPluginPath, | 386 cmd_line.AppendSwitchWithValue(switches::kPluginPath, |
| 387 info.path.ToWStringHack()); | 387 info.path.ToWStringHack()); |
| 388 | 388 |
| 389 base::ProcessHandle process = 0; | 389 base::ProcessHandle process = 0; |
| 390 #if defined(OS_WIN) | 390 #if defined(OS_WIN) |
| 391 process = sandbox::StartProcess(&cmd_line); | 391 process = sandbox::StartProcess(&cmd_line); |
| 392 #else | 392 #else |
| 393 // spawn child process | 393 // This code is duplicated with browser_render_process_host.cc, but |
| 394 base::LaunchApp(cmd_line, false, false, &process); | 394 // there's not a good place to de-duplicate it. |
| 395 base::file_handle_mapping_vector fds_to_map; |
| 396 int src_fd = -1, dest_fd = -1; |
| 397 channel().GetClientFileDescriptorMapping(&src_fd, &dest_fd); |
| 398 if (src_fd > -1) |
| 399 fds_to_map.push_back(std::pair<int, int>(src_fd, dest_fd)); |
| 400 base::LaunchApp(cmd_line.argv(), fds_to_map, false, &process); |
| 395 #endif | 401 #endif |
| 396 | 402 |
| 397 if (!process) | 403 if (!process) |
| 398 return false; | 404 return false; |
| 399 SetHandle(process); | 405 SetHandle(process); |
| 400 | 406 |
| 401 FilePath gears_path; | 407 FilePath gears_path; |
| 402 if (PathService::Get(chrome::FILE_GEARS_PLUGIN, &gears_path)) { | 408 if (PathService::Get(chrome::FILE_GEARS_PLUGIN, &gears_path)) { |
| 403 FilePath::StringType gears_path_lc = StringToLowerASCII(gears_path.value()); | 409 FilePath::StringType gears_path_lc = StringToLowerASCII(gears_path.value()); |
| 404 FilePath::StringType plugin_path_lc = | 410 FilePath::StringType plugin_path_lc = |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 563 DCHECK(MessageLoop::current() == | 569 DCHECK(MessageLoop::current() == |
| 564 ChromeThread::GetMessageLoop(ChromeThread::IO)); | 570 ChromeThread::GetMessageLoop(ChromeThread::IO)); |
| 565 | 571 |
| 566 ChromePluginLib *chrome_plugin = ChromePluginLib::Find(info_.path); | 572 ChromePluginLib *chrome_plugin = ChromePluginLib::Find(info_.path); |
| 567 if (chrome_plugin) { | 573 if (chrome_plugin) { |
| 568 void *data_ptr = const_cast<void*>(reinterpret_cast<const void*>(&data[0])); | 574 void *data_ptr = const_cast<void*>(reinterpret_cast<const void*>(&data[0])); |
| 569 uint32 data_len = static_cast<uint32>(data.size()); | 575 uint32 data_len = static_cast<uint32>(data.size()); |
| 570 chrome_plugin->functions().on_message(data_ptr, data_len); | 576 chrome_plugin->functions().on_message(data_ptr, data_len); |
| 571 } | 577 } |
| 572 } | 578 } |
| OLD | NEW |