Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(182)

Side by Side Diff: chrome/browser/plugin_process_host.cc

Issue 164177: Provide a separate app bundle for subprocesses like the renderer on the Mac.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); 338 std::wstring exe_path = GetChildPath();
339 std::wstring exe_path = 339 if (exe_path.empty()) {
340 browser_command_line.GetSwitchValue(switches::kBrowserSubprocessPath);
341 if (exe_path.empty() && !PathService::Get(base::FILE_EXE, &exe_path))
342 return false; 340 return false;
341 }
343 342
344 CommandLine cmd_line(exe_path); 343 CommandLine cmd_line(exe_path);
345 if (logging::DialogsAreSuppressed()) 344 if (logging::DialogsAreSuppressed())
346 cmd_line.AppendSwitch(switches::kNoErrorDialogs); 345 cmd_line.AppendSwitch(switches::kNoErrorDialogs);
347 346
348 // propagate the following switches to the plugin command line (along with 347 // propagate the following switches to the plugin command line (along with
349 // any associated values) if present in the browser command line 348 // any associated values) if present in the browser command line
350 static const wchar_t* const switch_names[] = { 349 static const wchar_t* const switch_names[] = {
351 switches::kPluginStartupDialog, 350 switches::kPluginStartupDialog,
352 switches::kNoSandbox, 351 switches::kNoSandbox,
353 switches::kSafePlugins, 352 switches::kSafePlugins,
354 switches::kTestSandbox, 353 switches::kTestSandbox,
355 switches::kUserAgent, 354 switches::kUserAgent,
356 switches::kDisableBreakpad, 355 switches::kDisableBreakpad,
357 switches::kFullMemoryCrashReport, 356 switches::kFullMemoryCrashReport,
358 switches::kEnableLogging, 357 switches::kEnableLogging,
359 switches::kDisableLogging, 358 switches::kDisableLogging,
360 switches::kLoggingLevel, 359 switches::kLoggingLevel,
361 switches::kLogPluginMessages, 360 switches::kLogPluginMessages,
362 switches::kUserDataDir, 361 switches::kUserDataDir,
363 switches::kAllowAllActiveX, 362 switches::kAllowAllActiveX,
364 switches::kEnableDCHECK, 363 switches::kEnableDCHECK,
365 switches::kSilentDumpOnDCHECK, 364 switches::kSilentDumpOnDCHECK,
366 switches::kMemoryProfiling, 365 switches::kMemoryProfiling,
367 switches::kUseLowFragHeapCrt, 366 switches::kUseLowFragHeapCrt,
368 switches::kEnableStatsTable, 367 switches::kEnableStatsTable,
369 }; 368 };
370 369
370 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess();
371
371 for (size_t i = 0; i < arraysize(switch_names); ++i) { 372 for (size_t i = 0; i < arraysize(switch_names); ++i) {
372 if (browser_command_line.HasSwitch(switch_names[i])) { 373 if (browser_command_line.HasSwitch(switch_names[i])) {
373 cmd_line.AppendSwitchWithValue( 374 cmd_line.AppendSwitchWithValue(
374 switch_names[i], 375 switch_names[i],
375 browser_command_line.GetSwitchValue(switch_names[i])); 376 browser_command_line.GetSwitchValue(switch_names[i]));
376 } 377 }
377 } 378 }
378 379
379 // If specified, prepend a launcher program to the command line. 380 // If specified, prepend a launcher program to the command line.
380 std::wstring plugin_launcher = 381 std::wstring plugin_launcher =
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
622 DCHECK(MessageLoop::current() == 623 DCHECK(MessageLoop::current() ==
623 ChromeThread::GetMessageLoop(ChromeThread::IO)); 624 ChromeThread::GetMessageLoop(ChromeThread::IO));
624 625
625 ChromePluginLib *chrome_plugin = ChromePluginLib::Find(info_.path); 626 ChromePluginLib *chrome_plugin = ChromePluginLib::Find(info_.path);
626 if (chrome_plugin) { 627 if (chrome_plugin) {
627 void *data_ptr = const_cast<void*>(reinterpret_cast<const void*>(&data[0])); 628 void *data_ptr = const_cast<void*>(reinterpret_cast<const void*>(&data[0]));
628 uint32 data_len = static_cast<uint32>(data.size()); 629 uint32 data_len = static_cast<uint32>(data.size());
629 chrome_plugin->functions().on_message(data_ptr, data_len); 630 chrome_plugin->functions().on_message(data_ptr, data_len);
630 } 631 }
631 } 632 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698