diff options
-rw-r--r-- | chrome/app/chrome_main.cc | 11 | ||||
-rw-r--r-- | chrome/chrome_dll.gypi | 1 | ||||
-rw-r--r-- | chrome/common/child_process_host.cc | 15 | ||||
-rw-r--r-- | chrome/common/chrome_switches.cc | 3 | ||||
-rw-r--r-- | chrome/common/chrome_switches.h | 1 | ||||
-rw-r--r-- | chrome/test/unit/chrome_test_suite.cc | 2 | ||||
-rw-r--r-- | content/common/content_paths.cc | 28 | ||||
-rw-r--r-- | content/common/content_paths.h | 28 | ||||
-rw-r--r-- | content/common/content_switches.cc | 3 | ||||
-rw-r--r-- | content/common/content_switches.h | 1 | ||||
-rw-r--r-- | content/content_common.gypi | 2 |
11 files changed, 80 insertions, 15 deletions
diff --git a/chrome/app/chrome_main.cc b/chrome/app/chrome_main.cc index b8f5a15..481941f 100644 --- a/chrome/app/chrome_main.cc +++ b/chrome/app/chrome_main.cc @@ -27,6 +27,7 @@ #include "chrome/common/chrome_constants.h" #include "chrome/common/chrome_counters.h" #include "chrome/common/chrome_paths.h" +#include "chrome/common/chrome_paths_internal.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/chrome_version_info.h" #include "chrome/common/logging_chrome.h" @@ -36,6 +37,7 @@ #include "chrome/common/set_process_title.h" #include "chrome/common/url_constants.h" #include "content/browser/renderer_host/render_process_host.h" +#include "content/common/content_paths.h" #include "ipc/ipc_switches.h" #include "ui/base/resource/resource_bundle.h" #include "ui/base/ui_base_paths.h" @@ -562,6 +564,15 @@ int ChromeMain(int argc, char** argv) { app::RegisterPathProvider(); ui::RegisterPathProvider(); chrome::RegisterPathProvider(); + content::RegisterPathProvider(); + +#if defined(OS_MACOSX) + // On the Mac, the child executable lives at a predefined location within + // the app bundle's versioned directory. + PathService::Override(content::CHILD_PROCESS_EXE, + chrome::GetVersionedDirectory(). + Append(chrome::kHelperProcessExecutablePath)); +#endif // Notice a user data directory override if any FilePath user_data_dir = diff --git a/chrome/chrome_dll.gypi b/chrome/chrome_dll.gypi index 38f2bf0..aee70f9 100644 --- a/chrome/chrome_dll.gypi +++ b/chrome/chrome_dll.gypi @@ -599,6 +599,7 @@ # to avoid making common compile on 64 bit on Windows. '../content/common/child_process.cc', '../content/common/child_thread.cc', + '../content/common/content_paths.cc', '../content/common/content_switches.cc', '../content/common/notification_details.cc', '../content/common/notification_service.cc', diff --git a/chrome/common/child_process_host.cc b/chrome/common/child_process_host.cc index a74d0e1..8fa711b 100644 --- a/chrome/common/child_process_host.cc +++ b/chrome/common/child_process_host.cc @@ -5,14 +5,14 @@ #include "chrome/common/child_process_host.h" #include "base/command_line.h" +#include "base/file_path.h" #include "base/metrics/histogram.h" #include "base/path_service.h" #include "base/third_party/dynamic_annotations/dynamic_annotations.h" #include "chrome/common/child_process_info.h" -#include "chrome/common/chrome_constants.h" -#include "chrome/common/chrome_paths_internal.h" -#include "chrome/common/chrome_switches.h" #include "content/common/child_process_messages.h" +#include "content/common/content_paths.h" +#include "content/common/content_switches.h" #include "ipc/ipc_logging.h" #if defined(OS_LINUX) @@ -47,13 +47,6 @@ FilePath ChildProcessHost::GetChildPath(bool allow_self) { if (!child_path.empty()) return child_path; -#if defined(OS_MACOSX) - // On the Mac, the child executable lives at a predefined location within - // the app bundle's versioned directory. - return chrome::GetVersionedDirectory(). - Append(chrome::kHelperProcessExecutablePath); -#endif - #if defined(OS_LINUX) // Use /proc/self/exe rather than our known binary path so updates // can't swap out the binary from underneath us. @@ -66,7 +59,7 @@ FilePath ChildProcessHost::GetChildPath(bool allow_self) { // On most platforms, the child executable is the same as the current // executable. - PathService::Get(base::FILE_EXE, &child_path); + PathService::Get(content::CHILD_PROCESS_EXE, &child_path); return child_path; } diff --git a/chrome/common/chrome_switches.cc b/chrome/common/chrome_switches.cc index f724e7a..d0df5b6 100644 --- a/chrome/common/chrome_switches.cc +++ b/chrome/common/chrome_switches.cc @@ -94,9 +94,6 @@ const char kBrowserAssertTest[] = "assert-test"; // Causes the browser process to crash on startup. const char kBrowserCrashTest[] = "crash-test"; -// Path to the exe to run for the renderer and plugin subprocesses. -const char kBrowserSubprocessPath[] = "browser-subprocess-path"; - // How often (in seconds) to check for updates. Should only be used for // testing purposes. const char kCheckForUpdateIntervalSec[] = "check-for-update-interval"; diff --git a/chrome/common/chrome_switches.h b/chrome/common/chrome_switches.h index 576a5b4..2dac7fc 100644 --- a/chrome/common/chrome_switches.h +++ b/chrome/common/chrome_switches.h @@ -43,7 +43,6 @@ extern const char kAutomationClientChannelID[]; extern const char kBlockReadingThirdPartyCookies[]; extern const char kBrowserAssertTest[]; extern const char kBrowserCrashTest[]; -extern const char kBrowserSubprocessPath[]; extern const char kCheckForUpdateIntervalSec[]; extern const char kChromeFrame[]; extern const char kChromeVersion[]; diff --git a/chrome/test/unit/chrome_test_suite.cc b/chrome/test/unit/chrome_test_suite.cc index ec13209..28f55e7 100644 --- a/chrome/test/unit/chrome_test_suite.cc +++ b/chrome/test/unit/chrome_test_suite.cc @@ -16,6 +16,7 @@ #include "chrome/common/chrome_paths.h" #include "chrome/common/url_constants.h" #include "chrome/test/testing_browser_process.h" +#include "content/common/content_paths.h" #include "net/base/net_errors.h" #include "ui/base/resource/resource_bundle.h" #include "ui/base/ui_base_paths.h" @@ -101,6 +102,7 @@ void ChromeTestSuite::Initialize() { chrome::RegisterPathProvider(); app::RegisterPathProvider(); + content::RegisterPathProvider(); ui::RegisterPathProvider(); g_browser_process = new TestingBrowserProcess; diff --git a/content/common/content_paths.cc b/content/common/content_paths.cc new file mode 100644 index 0000000..4e9b32b --- /dev/null +++ b/content/common/content_paths.cc @@ -0,0 +1,28 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "content/common/content_paths.h" + +#include "base/path_service.h" + +namespace content { + +bool PathProvider(int key, FilePath* result) { + switch (key) { + case CHILD_PROCESS_EXE: + return PathService::Get(base::FILE_EXE, result); + default: + break; + } + + return false; +} + +// This cannot be done as a static initializer sadly since Visual Studio will +// eliminate this object file if there is no direct entry point into it. +void RegisterPathProvider() { + PathService::RegisterProvider(PathProvider, PATH_START, PATH_END); +} + +} // namespace content diff --git a/content/common/content_paths.h b/content/common/content_paths.h new file mode 100644 index 0000000..49720a0 --- /dev/null +++ b/content/common/content_paths.h @@ -0,0 +1,28 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CONTENT_COMMON_CONTENT_PATHS_H_ +#define CONTENT_COMMON_CONTENT_PATHS_H_ +#pragma once + +// This file declares path keys for the content module. These can be used with +// the PathService to access various special directories and files. + +namespace content { + +enum { + PATH_START = 4000, + + // Path and filename to the executable to use for child processes. + CHILD_PROCESS_EXE = PATH_START, + + PATH_END +}; + +// Call once to register the provider for the path keys defined above. +void RegisterPathProvider(); + +} // namespace content + +#endif // CONTENT_COMMON_CONTENT_PATHS_H_ diff --git a/content/common/content_switches.cc b/content/common/content_switches.cc index b70bc80..f23f42c 100644 --- a/content/common/content_switches.cc +++ b/content/common/content_switches.cc @@ -13,6 +13,9 @@ const char kAllowFileAccessFromFiles[] = "allow-file-access-from-files"; // Allows debugging of sandboxed processes (see zygote_main_linux.cc). const char kAllowSandboxDebugging[] = "allow-sandbox-debugging"; +// Path to the exe to run for the renderer and plugin subprocesses. +const char kBrowserSubprocessPath[] = "browser-subprocess-path"; + // Disable limits on the number of backing stores. Can prevent blinking for // users with many windows/tabs and lots of memory. const char kDisableBackingStoreLimit[] = "disable-backing-store-limit"; diff --git a/content/common/content_switches.h b/content/common/content_switches.h index 6208fdc..5bf44bc 100644 --- a/content/common/content_switches.h +++ b/content/common/content_switches.h @@ -12,6 +12,7 @@ namespace switches { extern const char kAllowFileAccessFromFiles[]; extern const char kAllowSandboxDebugging[]; +extern const char kBrowserSubprocessPath[]; extern const char kDisableBackingStoreLimit[]; extern const char kDisableFileSystem[]; extern const char kDisableGpuSandbox[]; diff --git a/content/content_common.gypi b/content/content_common.gypi index 42af15e..0925ebb 100644 --- a/content/content_common.gypi +++ b/content/content_common.gypi @@ -26,6 +26,8 @@ 'common/content_message_generator.h', 'common/content_constants.cc', 'common/content_constants.h', + 'common/content_paths.cc', + 'common/content_paths.h', 'common/content_switches.cc', 'common/content_switches.h', 'common/file_system/file_system_dispatcher.cc', |