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

Side by Side Diff: chrome/browser/renderer_host/browser_render_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 // Represents the browser side of the browser <--> renderer communication 5 // Represents the browser side of the browser <--> renderer communication
6 // channel. There will be one RenderProcessHost per renderer process. 6 // channel. There will be one RenderProcessHost per renderer process.
7 7
8 #include "chrome/browser/renderer_host/browser_render_process_host.h" 8 #include "chrome/browser/renderer_host/browser_render_process_host.h"
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 in_process_renderer_->StartWithOptions(options); 324 in_process_renderer_->StartWithOptions(options);
325 325
326 OnProcessLaunched(); // Fake a callback that the process is ready. 326 OnProcessLaunched(); // Fake a callback that the process is ready.
327 } else { 327 } else {
328 // Build command line for renderer. We call AppendRendererCommandLine() 328 // Build command line for renderer. We call AppendRendererCommandLine()
329 // first so the process type argument will appear first. 329 // first so the process type argument will appear first.
330 CommandLine* cmd_line = new CommandLine(renderer_path); 330 CommandLine* cmd_line = new CommandLine(renderer_path);
331 if (!renderer_prefix.empty()) 331 if (!renderer_prefix.empty())
332 cmd_line->PrependWrapper(renderer_prefix); 332 cmd_line->PrependWrapper(renderer_prefix);
333 AppendRendererCommandLine(cmd_line); 333 AppendRendererCommandLine(cmd_line);
334 cmd_line->AppendSwitchWithValue(switches::kProcessChannelID, channel_id); 334 cmd_line->AppendSwitchASCII(switches::kProcessChannelID, channel_id);
335 335
336 // Spawn the child process asynchronously to avoid blocking the UI thread. 336 // Spawn the child process asynchronously to avoid blocking the UI thread.
337 // As long as there's no renderer prefix, we can use the zygote process 337 // As long as there's no renderer prefix, we can use the zygote process
338 // at this stage. 338 // at this stage.
339 child_process_.reset(new ChildProcessLauncher( 339 child_process_.reset(new ChildProcessLauncher(
340 #if defined(OS_WIN) 340 #if defined(OS_WIN)
341 FilePath(), 341 FilePath(),
342 #elif defined(POSIX) 342 #elif defined(POSIX)
343 renderer_prefix.empty(), 343 renderer_prefix.empty(),
344 base::environment_vector(), 344 base::environment_vector(),
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
438 return; 438 return;
439 439
440 visited_link_updater_->Update(this); 440 visited_link_updater_->Update(this);
441 } 441 }
442 442
443 void BrowserRenderProcessHost::AppendRendererCommandLine( 443 void BrowserRenderProcessHost::AppendRendererCommandLine(
444 CommandLine* command_line) const { 444 CommandLine* command_line) const {
445 // Pass the process type first, so it shows first in process listings. 445 // Pass the process type first, so it shows first in process listings.
446 // Extensions use a special pseudo-process type to make them distinguishable, 446 // Extensions use a special pseudo-process type to make them distinguishable,
447 // even though they're just renderers. 447 // even though they're just renderers.
448 command_line->AppendSwitchWithValue(switches::kProcessType, 448 command_line->AppendSwitchASCII(switches::kProcessType,
449 extension_process_ ? switches::kExtensionProcess : 449 extension_process_ ? switches::kExtensionProcess :
450 switches::kRendererProcess); 450 switches::kRendererProcess);
451 451
452 if (logging::DialogsAreSuppressed()) 452 if (logging::DialogsAreSuppressed())
453 command_line->AppendSwitch(switches::kNoErrorDialogs); 453 command_line->AppendSwitch(switches::kNoErrorDialogs);
454 454
455 // Now send any options from our own command line we want to propogate. 455 // Now send any options from our own command line we want to propogate.
456 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); 456 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess();
457 PropagateBrowserCommandLineToRenderer(browser_command_line, command_line); 457 PropagateBrowserCommandLineToRenderer(browser_command_line, command_line);
458 458
459 // Pass on the browser locale. 459 // Pass on the browser locale.
460 const std::string locale = g_browser_process->GetApplicationLocale(); 460 const std::string locale = g_browser_process->GetApplicationLocale();
461 command_line->AppendSwitchWithValue(switches::kLang, locale); 461 command_line->AppendSwitchASCII(switches::kLang, locale);
462 462
463 // If we run FieldTrials, we want to pass to their state to the renderer so 463 // If we run FieldTrials, we want to pass to their state to the renderer so
464 // that it can act in accordance with each state, or record histograms 464 // that it can act in accordance with each state, or record histograms
465 // relating to the FieldTrial states. 465 // relating to the FieldTrial states.
466 std::string field_trial_states; 466 std::string field_trial_states;
467 FieldTrialList::StatesToString(&field_trial_states); 467 FieldTrialList::StatesToString(&field_trial_states);
468 if (!field_trial_states.empty()) { 468 if (!field_trial_states.empty()) {
469 command_line->AppendSwitchWithValue(switches::kForceFieldTestNameAndValue, 469 command_line->AppendSwitchASCII(switches::kForceFieldTestNameAndValue,
470 field_trial_states); 470 field_trial_states);
471 } 471 }
472 472
473 BrowserChildProcessHost::SetCrashReporterCommandLine(command_line); 473 BrowserChildProcessHost::SetCrashReporterCommandLine(command_line);
474 474
475 FilePath user_data_dir = 475 FilePath user_data_dir =
476 browser_command_line.GetSwitchValuePath(switches::kUserDataDir); 476 browser_command_line.GetSwitchValuePath(switches::kUserDataDir);
477 if (!user_data_dir.empty()) 477 if (!user_data_dir.empty())
478 command_line->AppendSwitchPath(switches::kUserDataDir, user_data_dir); 478 command_line->AppendSwitchPath(switches::kUserDataDir, user_data_dir);
479 #if defined(OS_CHROMEOS) 479 #if defined(OS_CHROMEOS)
480 const std::string& profile = 480 const std::string& profile =
481 browser_command_line.GetSwitchValueASCII(switches::kProfile); 481 browser_command_line.GetSwitchValueASCII(switches::kProfile);
482 if (!profile.empty()) 482 if (!profile.empty())
483 command_line->AppendSwitchWithValue(switches::kProfile, profile); 483 command_line->AppendSwitchASCII(switches::kProfile, profile);
484 #endif 484 #endif
485 } 485 }
486 486
487 void BrowserRenderProcessHost::PropagateBrowserCommandLineToRenderer( 487 void BrowserRenderProcessHost::PropagateBrowserCommandLineToRenderer(
488 const CommandLine& browser_cmd, 488 const CommandLine& browser_cmd,
489 CommandLine* renderer_cmd) const { 489 CommandLine* renderer_cmd) const {
490 // Propagate the following switches to the renderer command line (along 490 // Propagate the following switches to the renderer command line (along
491 // with any associated values) if present in the browser command line. 491 // with any associated values) if present in the browser command line.
492 static const char* const kSwitchNames[] = { 492 static const char* const kSwitchNames[] = {
493 switches::kRendererAssertTest, 493 switches::kRendererAssertTest,
(...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after
1064 IPC::InvalidPlatformFileForTransit(), 1064 IPC::InvalidPlatformFileForTransit(),
1065 std::vector<std::string>(), 1065 std::vector<std::string>(),
1066 std::string(), 1066 std::string(),
1067 false)); 1067 false));
1068 } 1068 }
1069 } 1069 }
1070 1070
1071 void BrowserRenderProcessHost::EnableAutoSpellCorrect(bool enable) { 1071 void BrowserRenderProcessHost::EnableAutoSpellCorrect(bool enable) {
1072 Send(new ViewMsg_SpellChecker_EnableAutoSpellCorrect(enable)); 1072 Send(new ViewMsg_SpellChecker_EnableAutoSpellCorrect(enable));
1073 } 1073 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698