Index: content/shell/shell_main_delegate.cc |
diff --git a/content/shell/shell_main_delegate.cc b/content/shell/shell_main_delegate.cc |
index 0a3977b1f641dba7740aca5a95cc40b236e0487d..90e2b9756905097f0ea750d97afb6669ab974499 100644 |
--- a/content/shell/shell_main_delegate.cc |
+++ b/content/shell/shell_main_delegate.cc |
@@ -7,6 +7,7 @@ |
#include "base/command_line.h" |
#include "base/file_path.h" |
#include "base/path_service.h" |
+#include "content/public/common/content_paths.h" |
#include "content/public/common/content_switches.h" |
#include "content/shell/shell_content_browser_client.h" |
#include "content/shell/shell_content_plugin_client.h" |
@@ -16,6 +17,42 @@ |
#include "ui/base/resource/resource_bundle.h" |
#include "ui/base/ui_base_paths.h" |
+#if defined(OS_MACOSX) |
+#include "base/mac/foundation_util.h" |
+#endif |
+ |
+#if defined(OS_MACOSX) |
+namespace { |
+ |
+void OverrideChildProcessPath() { |
+ if (base::mac::IsBackgroundOnlyProcess()) { |
+ // The background-only process is the helper; no overriding needed. |
+ return; |
+ } |
+ |
+ // Start out with the path to the running executable. |
+ FilePath helper_path; |
+ PathService::Get(base::FILE_EXE, &helper_path); |
+ |
+ // One step up to MacOS, another to Contents. |
+ helper_path = helper_path.DirName().DirName(); |
+ DCHECK_EQ(helper_path.BaseName().value(), "Contents"); |
+ |
+ // Go into the frameworks directory. |
+ helper_path = helper_path.Append("Frameworks"); |
+ |
+ // And the app path. |
+ helper_path = helper_path.Append("Content Shell Helper.app") |
+ .Append("Contents") |
+ .Append("MacOS") |
+ .Append("Content Shell Helper"); |
+ |
+ PathService::Override(content::CHILD_PROCESS_EXE, helper_path); |
+} |
+ |
+} |
+#endif // OS_MACOSX |
+ |
ShellMainDelegate::ShellMainDelegate() { |
} |
@@ -27,6 +64,10 @@ bool ShellMainDelegate::BasicStartupComplete(int* exit_code) { |
} |
void ShellMainDelegate::PreSandboxStartup() { |
+#if defined(OS_MACOSX) |
+ OverrideChildProcessPath(); |
+#endif // OS_MACOSX |
+ |
const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
std::string process_type = |
command_line.GetSwitchValueASCII(switches::kProcessType); |