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 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 const std::string& activex_clsid, | 312 const std::string& activex_clsid, |
313 const std::wstring& locale) { | 313 const std::wstring& locale) { |
314 info_ = info; | 314 info_ = info; |
315 set_name(info_.name); | 315 set_name(info_.name); |
316 | 316 |
317 if (!CreateChannel()) | 317 if (!CreateChannel()) |
318 return false; | 318 return false; |
319 | 319 |
320 // build command line for plugin, we have to quote the plugin's path to deal | 320 // build command line for plugin, we have to quote the plugin's path to deal |
321 // with spaces. | 321 // with spaces. |
322 std::wstring exe_path; | 322 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); |
323 if (!PathService::Get(base::FILE_EXE, &exe_path)) | 323 std::wstring exe_path = |
| 324 browser_command_line.GetSwitchValue(switches::kBrowserSubprocessPath); |
| 325 if (exe_path.empty() && !PathService::Get(base::FILE_EXE, &exe_path)) |
324 return false; | 326 return false; |
325 | 327 |
326 CommandLine cmd_line(exe_path); | 328 CommandLine cmd_line(exe_path); |
327 if (logging::DialogsAreSuppressed()) | 329 if (logging::DialogsAreSuppressed()) |
328 cmd_line.AppendSwitch(switches::kNoErrorDialogs); | 330 cmd_line.AppendSwitch(switches::kNoErrorDialogs); |
329 | 331 |
330 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); | |
331 | |
332 // propagate the following switches to the plugin command line (along with | 332 // propagate the following switches to the plugin command line (along with |
333 // any associated values) if present in the browser command line | 333 // any associated values) if present in the browser command line |
334 static const wchar_t* const switch_names[] = { | 334 static const wchar_t* const switch_names[] = { |
335 switches::kPluginStartupDialog, | 335 switches::kPluginStartupDialog, |
336 switches::kNoSandbox, | 336 switches::kNoSandbox, |
337 switches::kSafePlugins, | 337 switches::kSafePlugins, |
338 switches::kTestSandbox, | 338 switches::kTestSandbox, |
339 switches::kUserAgent, | 339 switches::kUserAgent, |
340 switches::kDisableBreakpad, | 340 switches::kDisableBreakpad, |
341 switches::kFullMemoryCrashReport, | 341 switches::kFullMemoryCrashReport, |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
569 DCHECK(MessageLoop::current() == | 569 DCHECK(MessageLoop::current() == |
570 ChromeThread::GetMessageLoop(ChromeThread::IO)); | 570 ChromeThread::GetMessageLoop(ChromeThread::IO)); |
571 | 571 |
572 ChromePluginLib *chrome_plugin = ChromePluginLib::Find(info_.path); | 572 ChromePluginLib *chrome_plugin = ChromePluginLib::Find(info_.path); |
573 if (chrome_plugin) { | 573 if (chrome_plugin) { |
574 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])); |
575 uint32 data_len = static_cast<uint32>(data.size()); | 575 uint32 data_len = static_cast<uint32>(data.size()); |
576 chrome_plugin->functions().on_message(data_ptr, data_len); | 576 chrome_plugin->functions().on_message(data_ptr, data_len); |
577 } | 577 } |
578 } | 578 } |
OLD | NEW |