| 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 // 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 "build/build_config.h" | 10 #include "build/build_config.h" |
| (...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 472 const std::string locale = g_browser_process->GetApplicationLocale(); | 472 const std::string locale = g_browser_process->GetApplicationLocale(); |
| 473 command_line->AppendSwitchWithValue(switches::kLang, ASCIIToWide(locale)); | 473 command_line->AppendSwitchWithValue(switches::kLang, ASCIIToWide(locale)); |
| 474 | 474 |
| 475 // If we run FieldTrials, we want to pass to their state to the renderer so | 475 // If we run FieldTrials, we want to pass to their state to the renderer so |
| 476 // that it can act in accordance with each state, or record histograms | 476 // that it can act in accordance with each state, or record histograms |
| 477 // relating to the FieldTrial states. | 477 // relating to the FieldTrial states. |
| 478 std::string field_trial_states; | 478 std::string field_trial_states; |
| 479 FieldTrialList::StatesToString(&field_trial_states); | 479 FieldTrialList::StatesToString(&field_trial_states); |
| 480 if (!field_trial_states.empty()) { | 480 if (!field_trial_states.empty()) { |
| 481 command_line->AppendSwitchWithValue(switches::kForceFieldTestNameAndValue, | 481 command_line->AppendSwitchWithValue(switches::kForceFieldTestNameAndValue, |
| 482 ASCIIToWide(field_trial_states)); | 482 field_trial_states); |
| 483 } | 483 } |
| 484 | 484 |
| 485 // A command prefix is something prepended to the command line of the spawned | 485 // A command prefix is something prepended to the command line of the spawned |
| 486 // process. It is supported only on POSIX systems. | 486 // process. It is supported only on POSIX systems. |
| 487 #if defined(OS_POSIX) | 487 #if defined(OS_POSIX) |
| 488 *has_cmd_prefix = | 488 *has_cmd_prefix = |
| 489 browser_command_line.HasSwitch(switches::kRendererCmdPrefix); | 489 browser_command_line.HasSwitch(switches::kRendererCmdPrefix); |
| 490 if (*has_cmd_prefix) { | 490 if (*has_cmd_prefix) { |
| 491 // launch the renderer child with some prefix (usually "gdb --args") | 491 // launch the renderer child with some prefix (usually "gdb --args") |
| 492 const std::wstring prefix = | 492 const std::wstring prefix = |
| 493 browser_command_line.GetSwitchValue(switches::kRendererCmdPrefix); | 493 browser_command_line.GetSwitchValue(switches::kRendererCmdPrefix); |
| 494 command_line->PrependWrapper(prefix); | 494 command_line->PrependWrapper(prefix); |
| 495 } | 495 } |
| 496 #else | 496 #else |
| 497 *has_cmd_prefix = false; | 497 *has_cmd_prefix = false; |
| 498 #endif // defined(OS_POSIX) | 498 #endif // defined(OS_POSIX) |
| 499 | 499 |
| 500 ChildProcessHost::SetCrashReporterCommandLine(command_line); | 500 ChildProcessHost::SetCrashReporterCommandLine(command_line); |
| 501 | 501 |
| 502 const std::wstring& profile_path = | 502 const std::string& profile_path = |
| 503 browser_command_line.GetSwitchValue(switches::kUserDataDir); | 503 browser_command_line.GetSwitchValueASCII(switches::kUserDataDir); |
| 504 if (!profile_path.empty()) | 504 if (!profile_path.empty()) |
| 505 command_line->AppendSwitchWithValue(switches::kUserDataDir, profile_path); | 505 command_line->AppendSwitchWithValue(switches::kUserDataDir, profile_path); |
| 506 } | 506 } |
| 507 | 507 |
| 508 void BrowserRenderProcessHost::PropogateBrowserCommandLineToRenderer( | 508 void BrowserRenderProcessHost::PropogateBrowserCommandLineToRenderer( |
| 509 const CommandLine& browser_cmd, | 509 const CommandLine& browser_cmd, |
| 510 CommandLine* renderer_cmd) const { | 510 CommandLine* renderer_cmd) const { |
| 511 // Propagate the following switches to the renderer command line (along | 511 // Propagate the following switches to the renderer command line (along |
| 512 // with any associated values) if present in the browser command line. | 512 // with any associated values) if present in the browser command line. |
| 513 static const char* const switch_names[] = { | 513 static const char* const switch_names[] = { |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 559 switches::kChromeFrame, | 559 switches::kChromeFrame, |
| 560 #if defined(OS_MACOSX) | 560 #if defined(OS_MACOSX) |
| 561 // Allow this to be set when invoking the browser and relayed along. | 561 // Allow this to be set when invoking the browser and relayed along. |
| 562 switches::kEnableSandboxLogging, | 562 switches::kEnableSandboxLogging, |
| 563 #endif | 563 #endif |
| 564 }; | 564 }; |
| 565 | 565 |
| 566 for (size_t i = 0; i < arraysize(switch_names); ++i) { | 566 for (size_t i = 0; i < arraysize(switch_names); ++i) { |
| 567 if (browser_cmd.HasSwitch(switch_names[i])) { | 567 if (browser_cmd.HasSwitch(switch_names[i])) { |
| 568 renderer_cmd->AppendSwitchWithValue(switch_names[i], | 568 renderer_cmd->AppendSwitchWithValue(switch_names[i], |
| 569 browser_cmd.GetSwitchValue(switch_names[i])); | 569 browser_cmd.GetSwitchValueASCII(switch_names[i])); |
| 570 } | 570 } |
| 571 } | 571 } |
| 572 } | 572 } |
| 573 | 573 |
| 574 #if defined(OS_WIN) | 574 #if defined(OS_WIN) |
| 575 | 575 |
| 576 base::ProcessHandle BrowserRenderProcessHost::ExecuteRenderer( | 576 base::ProcessHandle BrowserRenderProcessHost::ExecuteRenderer( |
| 577 CommandLine* cmd_line, | 577 CommandLine* cmd_line, |
| 578 bool has_cmd_prefix) { | 578 bool has_cmd_prefix) { |
| 579 return sandbox::StartProcess(cmd_line); | 579 return sandbox::StartProcess(cmd_line); |
| (...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1123 channel_->Send(new ViewMsg_SpellChecker_Init( | 1123 channel_->Send(new ViewMsg_SpellChecker_Init( |
| 1124 base::FileDescriptor(), std::vector<std::string>(), std::string(), | 1124 base::FileDescriptor(), std::vector<std::string>(), std::string(), |
| 1125 false)); | 1125 false)); |
| 1126 } | 1126 } |
| 1127 } | 1127 } |
| 1128 | 1128 |
| 1129 void BrowserRenderProcessHost::EnableAutoSpellCorrect(bool enable) { | 1129 void BrowserRenderProcessHost::EnableAutoSpellCorrect(bool enable) { |
| 1130 channel_->Send(new ViewMsg_SpellChecker_EnableAutoSpellCorrect(enable)); | 1130 channel_->Send(new ViewMsg_SpellChecker_EnableAutoSpellCorrect(enable)); |
| 1131 } | 1131 } |
| 1132 #endif | 1132 #endif |
| OLD | NEW |