summaryrefslogtreecommitdiffstats
path: root/chrome/common/child_process_host.cc
diff options
context:
space:
mode:
authormark@chromium.org <mark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-14 15:51:57 +0000
committermark@chromium.org <mark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-14 15:51:57 +0000
commit41cd00a4e364aad2b9a53964684e554aa3b675e8 (patch)
tree65c85ff828574d1c06a0a66a4a6dd5c8dfcf447f /chrome/common/child_process_host.cc
parent2b42f3d1a6ed5ba99f5b6f4ca907051040664f47 (diff)
downloadchromium_src-41cd00a4e364aad2b9a53964684e554aa3b675e8.zip
chromium_src-41cd00a4e364aad2b9a53964684e554aa3b675e8.tar.gz
chromium_src-41cd00a4e364aad2b9a53964684e554aa3b675e8.tar.bz2
Move the framework and helper application into a versioned directory in support
of unbreaking auto-update. BUG=14610 TEST= - The following bundles should be gone: - Chromium.app/Contents/Frameworks/Chromium Framework.framework - Chromium.app/Contents/Resources/Chromium Helper.app They should be replaced by: - Chromium.app/Contents/Versions/*/Chromium Framework.framework - Chromium.app/Contents/Versions/*/Chromium Helper.app - The application should continue to function properly and all tests should still pass. - The signed application should have the inner framework and helper application signed, and the outer application signed. The outer seal should permit unknown versions to be present in the Versions directory, but should protect the active versioned directory. - Auto-updating to an official build with this change should still work. Review URL: http://codereview.chromium.org/261031 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@28963 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/child_process_host.cc')
-rw-r--r--chrome/common/child_process_host.cc59
1 files changed, 14 insertions, 45 deletions
diff --git a/chrome/common/child_process_host.cc b/chrome/common/child_process_host.cc
index 6495fba..695ac18 100644
--- a/chrome/common/child_process_host.cc
+++ b/chrome/common/child_process_host.cc
@@ -15,6 +15,8 @@
#include "base/string_util.h"
#include "base/waitable_event.h"
#include "chrome/browser/chrome_thread.h"
+#include "chrome/common/chrome_constants.h"
+#include "chrome/common/chrome_paths_internal.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/notification_service.h"
#include "chrome/common/notification_type.h"
@@ -83,61 +85,28 @@ ChildProcessHost::~ChildProcessHost() {
// static
FilePath ChildProcessHost::GetChildPath() {
- FilePath child_path = CommandLine::ForCurrentProcess()->GetSwitchValuePath(
- switches::kBrowserSubprocessPath);
+ static FilePath child_path;
+
if (!child_path.empty())
return child_path;
- FilePath path;
- PathService::Get(base::FILE_EXE, &path);
+ child_path = CommandLine::ForCurrentProcess()->GetSwitchValuePath(
+ switches::kBrowserSubprocessPath);
+ if (!child_path.empty())
+ return child_path;
#if !defined(OS_MACOSX)
// On most platforms, the child executable is the same as the current
// executable.
- return path;
+ PathService::Get(base::FILE_EXE, &child_path);
#else
// On the Mac, the child executable lives at a predefined location within
- // the current app bundle.
-
- // Figure out the current executable name. In a browser, this will be
- // "Chromium" or "Google Chrome". The child name will be the browser
- // executable name with " Helper" appended. The child app bundle name will
- // be that name with ".app" appended.
- FilePath::StringType child_exe_name = path.BaseName().value();
- const FilePath::StringType child_suffix = FILE_PATH_LITERAL(" Helper");
-
- if (child_exe_name.size() > child_suffix.size()) {
- size_t test_suffix_pos = child_exe_name.size() - child_suffix.size();
- const FilePath::CharType* test_suffix =
- child_exe_name.c_str() + test_suffix_pos;
- if (strcmp(test_suffix, child_suffix.c_str()) == 0) {
- // FILE_EXE already ends with the child suffix and therefore already
- // refers to the child process path. Just return it.
- return path;
- }
- }
-
- child_exe_name.append(child_suffix);
- FilePath::StringType child_app_name = child_exe_name;
- child_app_name.append(FILE_PATH_LITERAL(".app"));
- // The renderer app bundle lives in the browser app bundle's Resources
- // directory. Take off the executable name.
- path = path.DirName();
-
- // Take off the MacOS component, after verifying that's what's there.
- FilePath::StringType macos = path.BaseName().value();
- DCHECK_EQ(macos, FILE_PATH_LITERAL("MacOS"));
- path = path.DirName();
-
- // Append the components to get to the sub-app bundle's executable.
- path = path.Append(FILE_PATH_LITERAL("Resources"));
- path = path.Append(child_app_name);
- path = path.Append(FILE_PATH_LITERAL("Contents"));
- path = path.Append(FILE_PATH_LITERAL("MacOS"));
- path = path.Append(child_exe_name);
-
- return path;
+ // the app bundle's versioned directory.
+ child_path = chrome::GetVersionedDirectory().Append(
+ FilePath::FromWStringHack(chrome::kHelperProcessExecutablePath));
#endif // OS_MACOSX
+
+ return child_path;
}
// static