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 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 const std::string& activex_clsid, | 328 const std::string& activex_clsid, |
329 const std::wstring& locale) { | 329 const std::wstring& locale) { |
330 info_ = info; | 330 info_ = info; |
331 set_name(info_.name); | 331 set_name(info_.name); |
332 | 332 |
333 if (!CreateChannel()) | 333 if (!CreateChannel()) |
334 return false; | 334 return false; |
335 | 335 |
336 // build command line for plugin, we have to quote the plugin's path to deal | 336 // build command line for plugin, we have to quote the plugin's path to deal |
337 // with spaces. | 337 // with spaces. |
338 std::wstring exe_path = GetChildPath(); | 338 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); |
339 if (exe_path.empty()) { | 339 std::wstring exe_path = |
| 340 browser_command_line.GetSwitchValue(switches::kBrowserSubprocessPath); |
| 341 if (exe_path.empty() && !PathService::Get(base::FILE_EXE, &exe_path)) |
340 return false; | 342 return false; |
341 } | |
342 | 343 |
343 CommandLine cmd_line(exe_path); | 344 CommandLine cmd_line(exe_path); |
344 if (logging::DialogsAreSuppressed()) | 345 if (logging::DialogsAreSuppressed()) |
345 cmd_line.AppendSwitch(switches::kNoErrorDialogs); | 346 cmd_line.AppendSwitch(switches::kNoErrorDialogs); |
346 | 347 |
347 // propagate the following switches to the plugin command line (along with | 348 // propagate the following switches to the plugin command line (along with |
348 // any associated values) if present in the browser command line | 349 // any associated values) if present in the browser command line |
349 static const wchar_t* const switch_names[] = { | 350 static const wchar_t* const switch_names[] = { |
350 switches::kPluginStartupDialog, | 351 switches::kPluginStartupDialog, |
351 switches::kNoSandbox, | 352 switches::kNoSandbox, |
352 switches::kSafePlugins, | 353 switches::kSafePlugins, |
353 switches::kTestSandbox, | 354 switches::kTestSandbox, |
354 switches::kUserAgent, | 355 switches::kUserAgent, |
355 switches::kDisableBreakpad, | 356 switches::kDisableBreakpad, |
356 switches::kFullMemoryCrashReport, | 357 switches::kFullMemoryCrashReport, |
357 switches::kEnableLogging, | 358 switches::kEnableLogging, |
358 switches::kDisableLogging, | 359 switches::kDisableLogging, |
359 switches::kLoggingLevel, | 360 switches::kLoggingLevel, |
360 switches::kLogPluginMessages, | 361 switches::kLogPluginMessages, |
361 switches::kUserDataDir, | 362 switches::kUserDataDir, |
362 switches::kAllowAllActiveX, | 363 switches::kAllowAllActiveX, |
363 switches::kEnableDCHECK, | 364 switches::kEnableDCHECK, |
364 switches::kSilentDumpOnDCHECK, | 365 switches::kSilentDumpOnDCHECK, |
365 switches::kMemoryProfiling, | 366 switches::kMemoryProfiling, |
366 switches::kUseLowFragHeapCrt, | 367 switches::kUseLowFragHeapCrt, |
367 switches::kEnableStatsTable, | 368 switches::kEnableStatsTable, |
368 }; | 369 }; |
369 | 370 |
370 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); | |
371 | |
372 for (size_t i = 0; i < arraysize(switch_names); ++i) { | 371 for (size_t i = 0; i < arraysize(switch_names); ++i) { |
373 if (browser_command_line.HasSwitch(switch_names[i])) { | 372 if (browser_command_line.HasSwitch(switch_names[i])) { |
374 cmd_line.AppendSwitchWithValue( | 373 cmd_line.AppendSwitchWithValue( |
375 switch_names[i], | 374 switch_names[i], |
376 browser_command_line.GetSwitchValue(switch_names[i])); | 375 browser_command_line.GetSwitchValue(switch_names[i])); |
377 } | 376 } |
378 } | 377 } |
379 | 378 |
380 // If specified, prepend a launcher program to the command line. | 379 // If specified, prepend a launcher program to the command line. |
381 std::wstring plugin_launcher = | 380 std::wstring plugin_launcher = |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
623 DCHECK(MessageLoop::current() == | 622 DCHECK(MessageLoop::current() == |
624 ChromeThread::GetMessageLoop(ChromeThread::IO)); | 623 ChromeThread::GetMessageLoop(ChromeThread::IO)); |
625 | 624 |
626 ChromePluginLib *chrome_plugin = ChromePluginLib::Find(info_.path); | 625 ChromePluginLib *chrome_plugin = ChromePluginLib::Find(info_.path); |
627 if (chrome_plugin) { | 626 if (chrome_plugin) { |
628 void *data_ptr = const_cast<void*>(reinterpret_cast<const void*>(&data[0])); | 627 void *data_ptr = const_cast<void*>(reinterpret_cast<const void*>(&data[0])); |
629 uint32 data_len = static_cast<uint32>(data.size()); | 628 uint32 data_len = static_cast<uint32>(data.size()); |
630 chrome_plugin->functions().on_message(data_ptr, data_len); | 629 chrome_plugin->functions().on_message(data_ptr, data_len); |
631 } | 630 } |
632 } | 631 } |
OLD | NEW |