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

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

Issue 3069014: Convert a bunch of easy AppendSwitchWithValue to *ASCII. (Closed)
Patch Set: fix Created 10 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
OLDNEW
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 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); 354 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess();
355 std::wstring plugin_launcher = 355 std::wstring plugin_launcher =
356 browser_command_line.GetSwitchValue(switches::kPluginLauncher); 356 browser_command_line.GetSwitchValue(switches::kPluginLauncher);
357 FilePath exe_path = GetChildPath(plugin_launcher.empty()); 357 FilePath exe_path = GetChildPath(plugin_launcher.empty());
358 if (exe_path.empty()) 358 if (exe_path.empty())
359 return false; 359 return false;
360 360
361 CommandLine* cmd_line = new CommandLine(exe_path); 361 CommandLine* cmd_line = new CommandLine(exe_path);
362 // Put the process type and plugin path first so they're easier to see 362 // Put the process type and plugin path first so they're easier to see
363 // in process listings using native process management tools. 363 // in process listings using native process management tools.
364 cmd_line->AppendSwitchWithValue(switches::kProcessType, 364 cmd_line->AppendSwitchASCII(switches::kProcessType, switches::kPluginProcess);
365 switches::kPluginProcess);
366 cmd_line->AppendSwitchPath(switches::kPluginPath, info.path); 365 cmd_line->AppendSwitchPath(switches::kPluginPath, info.path);
367 366
368 if (logging::DialogsAreSuppressed()) 367 if (logging::DialogsAreSuppressed())
369 cmd_line->AppendSwitch(switches::kNoErrorDialogs); 368 cmd_line->AppendSwitch(switches::kNoErrorDialogs);
370 369
371 // Propagate the following switches to the plugin command line (along with 370 // Propagate the following switches to the plugin command line (along with
372 // any associated values) if present in the browser command line 371 // any associated values) if present in the browser command line
373 static const char* const kSwitchNames[] = { 372 static const char* const kSwitchNames[] = {
374 switches::kPluginStartupDialog, 373 switches::kPluginStartupDialog,
375 switches::kNoSandbox, 374 switches::kNoSandbox,
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 // prompt to install the desired plugin. 406 // prompt to install the desired plugin.
408 cmd_line->AppendSwitchWithValue(switches::kLang, locale); 407 cmd_line->AppendSwitchWithValue(switches::kLang, locale);
409 } 408 }
410 409
411 // Gears requires the data dir to be available on startup. 410 // Gears requires the data dir to be available on startup.
412 FilePath data_dir = 411 FilePath data_dir =
413 PluginService::GetInstance()->GetChromePluginDataDir(); 412 PluginService::GetInstance()->GetChromePluginDataDir();
414 DCHECK(!data_dir.empty()); 413 DCHECK(!data_dir.empty());
415 cmd_line->AppendSwitchPath(switches::kPluginDataDir, data_dir); 414 cmd_line->AppendSwitchPath(switches::kPluginDataDir, data_dir);
416 415
417 cmd_line->AppendSwitchWithValue(switches::kProcessChannelID, channel_id()); 416 cmd_line->AppendSwitchASCII(switches::kProcessChannelID, channel_id());
418 417
419 SetCrashReporterCommandLine(cmd_line); 418 SetCrashReporterCommandLine(cmd_line);
420 419
421 #if defined(OS_POSIX) 420 #if defined(OS_POSIX)
422 base::environment_vector env; 421 base::environment_vector env;
423 #if defined(OS_MACOSX) && !defined(__LP64__) 422 #if defined(OS_MACOSX) && !defined(__LP64__)
424 // Add our interposing library for Carbon. This is stripped back out in 423 // Add our interposing library for Carbon. This is stripped back out in
425 // plugin_main.cc, so changes here should be reflected there. 424 // plugin_main.cc, so changes here should be reflected there.
426 std::string interpose_list(plugin_interpose_strings::kInterposeLibraryPath); 425 std::string interpose_list(plugin_interpose_strings::kInterposeLibraryPath);
427 const char* existing_list = 426 const char* existing_list =
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
661 const std::vector<uint8>& data) { 660 const std::vector<uint8>& data) {
662 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::IO)); 661 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::IO));
663 662
664 ChromePluginLib *chrome_plugin = ChromePluginLib::Find(info_.path); 663 ChromePluginLib *chrome_plugin = ChromePluginLib::Find(info_.path);
665 if (chrome_plugin) { 664 if (chrome_plugin) {
666 void *data_ptr = const_cast<void*>(reinterpret_cast<const void*>(&data[0])); 665 void *data_ptr = const_cast<void*>(reinterpret_cast<const void*>(&data[0]));
667 uint32 data_len = static_cast<uint32>(data.size()); 666 uint32 data_len = static_cast<uint32>(data.size());
668 chrome_plugin->functions().on_message(data_ptr, data_len); 667 chrome_plugin->functions().on_message(data_ptr, data_len);
669 } 668 }
670 } 669 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698