| 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 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 343 info_ = info; | 343 info_ = info; |
| 344 set_name(UTF16ToWideHack(info_.name)); | 344 set_name(UTF16ToWideHack(info_.name)); |
| 345 set_version(UTF16ToWideHack(info_.version)); | 345 set_version(UTF16ToWideHack(info_.version)); |
| 346 | 346 |
| 347 if (!CreateChannel()) | 347 if (!CreateChannel()) |
| 348 return false; | 348 return false; |
| 349 | 349 |
| 350 // Build command line for plugin. When we have a plugin launcher, we can't | 350 // Build command line for plugin. When we have a plugin launcher, we can't |
| 351 // allow "self" on linux and we need the real file path. | 351 // allow "self" on linux and we need the real file path. |
| 352 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); | 352 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); |
| 353 std::wstring plugin_launcher = | 353 CommandLine::StringType plugin_launcher = |
| 354 browser_command_line.GetSwitchValue(switches::kPluginLauncher); | 354 browser_command_line.GetSwitchValueNative(switches::kPluginLauncher); |
| 355 FilePath exe_path = GetChildPath(plugin_launcher.empty()); | 355 FilePath exe_path = GetChildPath(plugin_launcher.empty()); |
| 356 if (exe_path.empty()) | 356 if (exe_path.empty()) |
| 357 return false; | 357 return false; |
| 358 | 358 |
| 359 CommandLine* cmd_line = new CommandLine(exe_path); | 359 CommandLine* cmd_line = new CommandLine(exe_path); |
| 360 // Put the process type and plugin path first so they're easier to see | 360 // Put the process type and plugin path first so they're easier to see |
| 361 // in process listings using native process management tools. | 361 // in process listings using native process management tools. |
| 362 cmd_line->AppendSwitchASCII(switches::kProcessType, switches::kPluginProcess); | 362 cmd_line->AppendSwitchASCII(switches::kProcessType, switches::kPluginProcess); |
| 363 cmd_line->AppendSwitchPath(switches::kPluginPath, info.path); | 363 cmd_line->AppendSwitchPath(switches::kPluginPath, info.path); |
| 364 | 364 |
| (...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 658 const std::vector<uint8>& data) { | 658 const std::vector<uint8>& data) { |
| 659 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::IO)); | 659 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::IO)); |
| 660 | 660 |
| 661 ChromePluginLib *chrome_plugin = ChromePluginLib::Find(info_.path); | 661 ChromePluginLib *chrome_plugin = ChromePluginLib::Find(info_.path); |
| 662 if (chrome_plugin) { | 662 if (chrome_plugin) { |
| 663 void *data_ptr = const_cast<void*>(reinterpret_cast<const void*>(&data[0])); | 663 void *data_ptr = const_cast<void*>(reinterpret_cast<const void*>(&data[0])); |
| 664 uint32 data_len = static_cast<uint32>(data.size()); | 664 uint32 data_len = static_cast<uint32>(data.size()); |
| 665 chrome_plugin->functions().on_message(data_ptr, data_len); | 665 chrome_plugin->functions().on_message(data_ptr, data_len); |
| 666 } | 666 } |
| 667 } | 667 } |
| OLD | NEW |