diff options
author | pinkerton@google.com <pinkerton@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-09 21:20:16 +0000 |
---|---|---|
committer | pinkerton@google.com <pinkerton@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-09 21:20:16 +0000 |
commit | 5c9587c69c6fc62164b35b24c92603935fb5dd2a (patch) | |
tree | 368ac11051119ff0e978c8ce9ee9fb7c8a8930e7 | |
parent | f52e5878b3bbf830b611d1d4d1e3d369b36f38d6 (diff) | |
download | chromium_src-5c9587c69c6fc62164b35b24c92603935fb5dd2a.zip chromium_src-5c9587c69c6fc62164b35b24c92603935fb5dd2a.tar.gz chromium_src-5c9587c69c6fc62164b35b24c92603935fb5dd2a.tar.bz2 |
step one of some refactoring to allow other platforms to re-use the app initialization code.
Review URL: http://codereview.chromium.org/13295
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@6627 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/app/chrome_dll_main.cc | 190 | ||||
-rw-r--r-- | chrome/app/chrome_exe_main.mm | 17 | ||||
-rw-r--r-- | chrome/browser/browser.vcproj | 4 | ||||
-rw-r--r-- | chrome/browser/browser_main.cc | 188 | ||||
-rw-r--r-- | chrome/browser/browser_main_mac.mm | 11 | ||||
-rw-r--r-- | chrome/browser/browser_main_win.cc | 178 | ||||
-rw-r--r-- | chrome/browser/browser_main_win.h | 46 | ||||
-rw-r--r-- | chrome/chrome.xcodeproj/project.pbxproj | 81 | ||||
-rw-r--r-- | sandbox/src/sandbox.h | 6 |
9 files changed, 514 insertions, 207 deletions
diff --git a/chrome/app/chrome_dll_main.cc b/chrome/app/chrome_dll_main.cc index 3e519d9..deb197d 100644 --- a/chrome/app/chrome_dll_main.cc +++ b/chrome/app/chrome_dll_main.cc @@ -2,33 +2,54 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +// TODO(port): the ifdefs in here are a first step towards trying to determine +// the correct abstraction for all the OS functionality required at this +// stage of process initialization. It should not be taken as a final +// abstraction. + +#include "build/build_config.h" + +#if defined(OS_WIN) #include <atlbase.h> #include <atlapp.h> #include <malloc.h> #include <new.h> +#elif defined(OS_MACOSX) +extern "C" { +#include <sandbox.h> +} +#endif #include "base/at_exit.h" #include "base/command_line.h" #include "base/icu_util.h" #include "base/message_loop.h" #include "base/path_service.h" +#include "base/process_util.h" #include "base/stats_table.h" #include "base/string_util.h" +#if defined(OS_WIN) #include "base/win_util.h" #include "chrome/browser/render_process_host.h" +#endif #include "chrome/common/chrome_constants.h" #include "chrome/common/chrome_counters.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/logging_chrome.h" +#if defined(OS_WIN) #include "chrome/common/resource_bundle.h" +#endif #include "sandbox/src/sandbox.h" +#if defined(OS_WIN) #include "tools/memory_watcher/memory_watcher.h" +#endif extern int BrowserMain(CommandLine&, sandbox::BrokerServices*); extern int RendererMain(CommandLine&, sandbox::TargetServices*); extern int PluginMain(CommandLine&, sandbox::TargetServices*); +#if defined(OS_WIN) // TODO(erikkay): isn't this already defined somewhere? #define DLLEXPORT __declspec(dllexport) @@ -38,9 +59,15 @@ DLLEXPORT int __cdecl ChromeMain(HINSTANCE instance, sandbox::SandboxInterfaceInfo* sandbox_info, TCHAR* command_line); } +#elif defined(OS_POSIX) +extern "C" { +int ChromeMain(int argc, const char** argv); +} +#endif namespace { +#if defined(OS_WIN) const wchar_t kProfilingDll[] = L"memory_watcher.dll"; // Load the memory profiling DLL. All it needs to be activated @@ -86,26 +113,38 @@ void ChromeAssert(const std::string& str) { #pragma optimize("", on) -} // namespace +#endif // OS_WIN -DLLEXPORT int __cdecl ChromeMain(HINSTANCE instance, - sandbox::SandboxInterfaceInfo* sandbox_info, - TCHAR* command_line) { - // Register the invalid param handler and pure call handler to be able to - // notify breakpad when it happens. +// Called before/after the call to BrowseMain() to handle platform-specific +// setup/teardown. +void PreBrowserMain() { +#if defined(OS_WIN) + int ole_result = OleInitialize(NULL); + DCHECK(ole_result == S_OK); +#endif +} + +void PostBrowserMain() { +#if defined(OS_WIN) + OleUninitialize(); +#endif +} + +// Register the invalid param handler and pure call handler to be able to +// notify breakpad when it happens. +void RegisterInvalidParamHandler() { +#if defined(OS_WIN) _set_invalid_parameter_handler(InvalidParameter); _set_purecall_handler(PureCall); // Gather allocation failure. _set_new_handler(&OnNoMemory); // Make sure malloc() calls the new handler too. _set_new_mode(1); +#endif +} - // The exit manager is in charge of calling the dtors of singleton objects. - base::AtExitManager exit_manager; - - // Initialize the command line. - CommandLine parsed_command_line; - +void SetupCRT(const CommandLine& parsed_command_line) { +#if defined(OS_WIN) #ifdef _CRTDBG_MAP_ALLOC _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR); _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE); @@ -128,7 +167,67 @@ DLLEXPORT int __cdecl ChromeMain(HINSTANCE instance, HeapSetInformation(crt_heap, HeapCompatibilityInformation, &enable_lfh, sizeof(enable_lfh)); } +#endif +} + +// Enable the heap profiler if the appropriate command-line switch is +// present, bailing out of the app we can't. +void EnableHeapProfiler(const CommandLine& parsed_command_line) { +#if defined(OS_WIN) + if (parsed_command_line.HasSwitch(switches::kMemoryProfiling)) + if (!LoadMemoryProfiler()) + exit(-1); +#endif +} + +// Checks if the sandbox is enabled in this process and initializes it if this +// is the case. Sandboxing is only valid on render and plugin processes. It's +// meaningless for the browser process. +void InitializeSandbox(const CommandLine& parsed_command_line, + const std::wstring process_type, + sandbox::BrokerServices* broker_services, + sandbox::TargetServices* target_services) { + if (target_services && !parsed_command_line.HasSwitch(switches::kNoSandbox)) { + if ((process_type == switches::kRendererProcess) || + (process_type == switches::kPluginProcess && + parsed_command_line.HasSwitch(switches::kSafePlugins))) { +#if defined(OS_WIN) + target_services->Init(); +#elif defined(OS_MACOSX) + // TODO(pinkerton): note, this leaks |error_buff|. What do we want to + // do with the error? Pass it back to main? + char* error_buff; + int error = sandbox_init(kSBXProfilePureComputation, SANDBOX_NAMED, + &error_buff); + if (error) + exit(-1); +#endif + } + } +} + +} // namespace + +#if defined(OS_WIN) +DLLEXPORT int __cdecl ChromeMain(HINSTANCE instance, + sandbox::SandboxInterfaceInfo* sandbox_info, + TCHAR* command_line) { +#elif defined(OS_POSIX) +int ChromeMain(int argc, const char** argv) { +#endif + RegisterInvalidParamHandler(); + + // The exit manager is in charge of calling the dtors of singleton objects. + base::AtExitManager exit_manager; + + // Initialize the command line. +#if defined(OS_POSIX) + CommandLine::SetArgcArgv(argc, argv); +#endif + CommandLine parsed_command_line; + SetupCRT(parsed_command_line); + // Initialize the Chrome path provider. chrome::RegisterPathProvider(); @@ -137,7 +236,12 @@ DLLEXPORT int __cdecl ChromeMain(HINSTANCE instance, // Chrome. These lines can be commented out to effectively turn // counters 'off'. The table is created and exists for the life // of the process. It is not cleaned up. - StatsTable *stats_table = new StatsTable(chrome::kStatsFilename, + // TODO(port): we probably need to shut this down correctly to avoid + // leaking shared memory regions on posix platforms. + std::string statsfile = chrome::kStatsFilename; + std::string pid_string = StringPrintf("-%d", base::GetCurrentProcId()); + statsfile += pid_string; + StatsTable *stats_table = new StatsTable(statsfile, chrome::kStatsMaxThreads, chrome::kStatsMaxCounters); StatsTable::set_current(stats_table); @@ -145,36 +249,33 @@ DLLEXPORT int __cdecl ChromeMain(HINSTANCE instance, startup_timer(chrome::Counters::chrome_main()); // Enable the heap profiler as early as possible! - if (parsed_command_line.HasSwitch(switches::kMemoryProfiling)) - if (!LoadMemoryProfiler()) - exit(-1); + EnableHeapProfiler(parsed_command_line); // Enable Message Loop related state asap. if (parsed_command_line.HasSwitch(switches::kMessageLoopHistogrammer)) MessageLoop::EnableHistogrammer(true); - sandbox::TargetServices* target_services = NULL; + std::wstring process_type = + parsed_command_line.GetSwitchValue(switches::kProcessType); + sandbox::BrokerServices* broker_services = NULL; + sandbox::TargetServices* target_services = NULL; +#if defined(OS_WIN) if (sandbox_info) { target_services = sandbox_info->target_services; broker_services = sandbox_info->broker_services; } - - std::wstring process_type = - parsed_command_line.GetSwitchValue(switches::kProcessType); +#endif // Checks if the sandbox is enabled in this process and initializes it if this // is the case. The crash handler depends on this so it has to be done before // its initialization. - if (target_services && !parsed_command_line.HasSwitch(switches::kNoSandbox)) { - if ((process_type == switches::kRendererProcess) || - (process_type == switches::kPluginProcess && - parsed_command_line.HasSwitch(switches::kSafePlugins))) { - target_services->Init(); - } - } + InitializeSandbox(parsed_command_line, process_type, broker_services, + target_services); +#if defined(OS_WIN) _Module.Init(NULL, instance); +#endif // Notice a user data directory override if any const std::wstring user_data_dir = @@ -182,10 +283,14 @@ DLLEXPORT int __cdecl ChromeMain(HINSTANCE instance, if (!user_data_dir.empty()) PathService::Override(chrome::DIR_USER_DATA, user_data_dir); +#if defined(OS_WIN) + // TODO(port): pull in when render_process_host.h compiles on posix. There's + // nothing win-specific about these lines. bool single_process = parsed_command_line.HasSwitch(switches::kSingleProcess); if (single_process) RenderProcessHost::set_run_renderer_in_process(true); +#endif bool icu_result = icu_util::Initialize(); CHECK(icu_result); @@ -200,46 +305,67 @@ DLLEXPORT int __cdecl ChromeMain(HINSTANCE instance, #ifdef NDEBUG if (parsed_command_line.HasSwitch(switches::kSilentDumpOnDCHECK) && parsed_command_line.HasSwitch(switches::kEnableDCHECK)) { +#if defined(OS_WIN) logging::SetLogAssertHandler(ChromeAssert); +#endif } #endif // NDEBUG if (!process_type.empty()) { +#if defined(OS_WIN) // Initialize ResourceBundle which handles files loaded from external // sources. The language should have been passed in to us from the // browser process as a command line flag. + // TODO(port): enable when we figure out resource bundle issues ResourceBundle::InitSharedInstance(std::wstring()); +#endif } startup_timer.Stop(); // End of Startup Time Measurement. - int rv; + // TODO(port): turn on these main() functions as they've been de-winified. + int rv = -1; if (process_type == switches::kRendererProcess) { +#if defined(OS_WIN) rv = RendererMain(parsed_command_line, target_services); +#endif } else if (process_type == switches::kPluginProcess) { +#if defined(OS_WIN) rv = PluginMain(parsed_command_line, target_services); +#endif } else if (process_type.empty()) { - int ole_result = OleInitialize(NULL); - DCHECK(ole_result == S_OK); + PreBrowserMain(); rv = BrowserMain(parsed_command_line, broker_services); - OleUninitialize(); + PostBrowserMain(); } else { NOTREACHED() << "Unknown process type"; - rv = -1; } + // TODO(pinkerton): nothing after this point will be hit on Mac if this is the + // browser process, as NSApplicationMain doesn't return. There are a couple of + // possible solutions, including breaking this up into pre/post code (won't + // work for stack-based objects) or making sure we fall out of the runloop + // ourselves, then manually call |-NSApp terminate:|. We'll most likely + // need to do the latter. + if (!process_type.empty()) { +#if defined(OS_WIN) + // TODO(port): enable when we figure out resource bundle issues ResourceBundle::CleanupSharedInstance(); +#endif } +#if defined(OS_WIN) #ifdef _CRTDBG_MAP_ALLOC _CrtDumpMemoryLeaks(); #endif // _CRTDBG_MAP_ALLOC _Module.Term(); +#endif logging::CleanupChromeLogging(); return rv; } + diff --git a/chrome/app/chrome_exe_main.mm b/chrome/app/chrome_exe_main.mm index 1eed9a6..3c9381f 100644 --- a/chrome/app/chrome_exe_main.mm +++ b/chrome/app/chrome_exe_main.mm @@ -14,18 +14,21 @@ // with Keychain prompts unless we sign the application. That shouldn't be // too hard, we just need infrastructure support to do it. +extern "C" { +int ChromeMain(int argc, const char** argv); +} + int main(int argc, const char** argv) { base::EnableTerminationOnHeapCorruption(); // The exit manager is in charge of calling the dtors of singletons. - base::AtExitManager exit_manager; + // Win has one here, but we assert with multiples from BrowserMain() if we + // keep it. + // base::AtExitManager exit_manager; +#if defined(GOOGLE_CHROME_BUILD) // TODO(pinkerton): init crash reporter +#endif - // TODO(pinkerton): factor out chrome_dll_main so we can call ChromeMain - // to determine if we're a browser or a renderer. To bootstrap, assume we're - // a browser. There's actually very little in chrome_exe_main.cc that's - // worth saving, it's almost entirely windows-specific. - - return NSApplicationMain(argc, argv); + return ChromeMain(argc, argv); } diff --git a/chrome/browser/browser.vcproj b/chrome/browser/browser.vcproj index e853e3a..479d587 100644 --- a/chrome/browser/browser.vcproj +++ b/chrome/browser/browser.vcproj @@ -230,6 +230,10 @@ >
</File>
<File
+ RelativePath=".\browser_main_win.cc"
+ >
+ </File>
+ <File
RelativePath=".\browser_prefs.cc"
>
</File>
diff --git a/chrome/browser/browser_main.cc b/chrome/browser/browser_main.cc index 9e9b258..7e350d7 100644 --- a/chrome/browser/browser_main.cc +++ b/chrome/browser/browser_main.cc @@ -2,12 +2,23 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "build/build_config.h" + +#include "base/command_line.h" +#include "sandbox/src/sandbox.h" + +// TODO(port): several win-only methods have been pulled out of this, but +// BrowserMain() as a whole needs to be broken apart so that it's usable by +// other platforms. For now, it's just a stub. This is a serious work in +// progress and should not be taken as an indication of a real refactoring. + +#if defined(OS_WIN) + #include <windows.h> #include <shellapi.h> #include <algorithm> -#include "base/command_line.h" #include "base/file_util.h" #include "base/histogram.h" #include "base/lazy_instance.h" @@ -23,6 +34,7 @@ #include "chrome/browser/browser.h" #include "chrome/browser/browser_init.h" #include "chrome/browser/browser_list.h" +#include "chrome/browser/browser_main_win.h" #include "chrome/browser/browser_prefs.h" #include "chrome/browser/browser_process_impl.h" #include "chrome/browser/browser_shutdown.h" @@ -124,157 +136,6 @@ StringPiece NetResourceProvider(int key) { return ResourceBundle::GetSharedInstance().GetRawDataResource(key); } -// Displays a warning message if the user is running chrome on windows 2000. -// Returns true if the OS is win2000, false otherwise. -bool CheckForWin2000() { - if (win_util::GetWinVersion() == win_util::WINVERSION_2000) { - const std::wstring text = l10n_util::GetString(IDS_UNSUPPORTED_OS_WIN2000); - const std::wstring caption = l10n_util::GetString(IDS_PRODUCT_NAME); - win_util::MessageBox(NULL, text, caption, - MB_OK | MB_ICONWARNING | MB_TOPMOST); - return true; - } - return false; -} - -bool AskForUninstallConfirmation() { - const std::wstring text = l10n_util::GetString(IDS_UNINSTALL_VERIFY); - const std::wstring caption = l10n_util::GetString(IDS_PRODUCT_NAME); - const UINT flags = MB_OKCANCEL | MB_ICONWARNING | MB_TOPMOST; - return (IDOK == win_util::MessageBox(NULL, text, caption, flags)); -} - -// Prepares the localized strings that are going to be displayed to -// the user if the browser process dies. These strings are stored in the -// environment block so they are accessible in the early stages of the -// chrome executable's lifetime. -void PrepareRestartOnCrashEnviroment(const CommandLine &parsed_command_line) { - // Clear this var so child processes don't show the dialog by default. - ::SetEnvironmentVariableW(env_vars::kShowRestart, NULL); - - // For non-interactive tests we don't restart on crash. - if (::GetEnvironmentVariableW(env_vars::kHeadless, NULL, 0)) - return; - - // If the known command-line test options are used we don't create the - // environment block which means we don't get the restart dialog. - if (parsed_command_line.HasSwitch(switches::kBrowserCrashTest) || - parsed_command_line.HasSwitch(switches::kBrowserAssertTest) || - parsed_command_line.HasSwitch(switches::kNoErrorDialogs)) - return; - - // The encoding we use for the info is "title|context|direction" where - // direction is either env_vars::kRtlLocale or env_vars::kLtrLocale depending - // on the current locale. - std::wstring dlg_strings; - dlg_strings.append(l10n_util::GetString(IDS_CRASH_RECOVERY_TITLE)); - dlg_strings.append(L"|"); - dlg_strings.append(l10n_util::GetString(IDS_CRASH_RECOVERY_CONTENT)); - dlg_strings.append(L"|"); - if (l10n_util::GetTextDirection() == l10n_util::RIGHT_TO_LEFT) - dlg_strings.append(env_vars::kRtlLocale); - else - dlg_strings.append(env_vars::kLtrLocale); - - ::SetEnvironmentVariableW(env_vars::kRestartInfo, dlg_strings.c_str()); -} - -int DoUninstallTasks() { - if (!AskForUninstallConfirmation()) - return ResultCodes::UNINSTALL_USER_CANCEL; - // The following actions are just best effort. - LOG(INFO) << "Executing uninstall actions"; - ResultCodes::ExitCode ret = ResultCodes::NORMAL_EXIT; - if (!FirstRun::RemoveSentinel()) - ret = ResultCodes::UNINSTALL_DELETE_FILE_ERROR; - // We only want to modify user level shortcuts so pass false for system_level. - if (!ShellUtil::RemoveChromeDesktopShortcut(ShellUtil::CURRENT_USER)) - ret = ResultCodes::UNINSTALL_DELETE_FILE_ERROR; - if (!ShellUtil::RemoveChromeQuickLaunchShortcut(ShellUtil::CURRENT_USER)) - ret = ResultCodes::UNINSTALL_DELETE_FILE_ERROR; - return ret; -} - -// This method handles the --hide-icons and --show-icons command line options -// for chrome that get triggered by Windows from registry entries -// HideIconsCommand & ShowIconsCommand. Chrome doesn't support hide icons -// functionality so we just ask the users if they want to uninstall Chrome. -int HandleIconsCommands(const CommandLine &parsed_command_line) { - if (parsed_command_line.HasSwitch(switches::kHideIcons)) { - std::wstring cp_applet; - if (win_util::GetWinVersion() == win_util::WINVERSION_VISTA) { - cp_applet.assign(L"Programs and Features"); // Windows Vista and later. - } else if (win_util::GetWinVersion() == win_util::WINVERSION_XP) { - cp_applet.assign(L"Add/Remove Programs"); // Windows XP. - } else { - return ResultCodes::UNSUPPORTED_PARAM; // Not supported - } - - const std::wstring msg = l10n_util::GetStringF(IDS_HIDE_ICONS_NOT_SUPPORTED, - cp_applet); - const std::wstring caption = l10n_util::GetString(IDS_PRODUCT_NAME); - const UINT flags = MB_OKCANCEL | MB_ICONWARNING | MB_TOPMOST; - if (IDOK == win_util::MessageBox(NULL, msg, caption, flags)) - ShellExecute(NULL, NULL, L"appwiz.cpl", NULL, NULL, SW_SHOWNORMAL); - return ResultCodes::NORMAL_EXIT; // Exit as we are not launching browser. - } - // We don't hide icons so we shouldn't do anything special to show them - return ResultCodes::UNSUPPORTED_PARAM; -} - -bool DoUpgradeTasks(const CommandLine& command_line) { - if (!Upgrade::SwapNewChromeExeIfPresent()) - return false; - // At this point the chrome.exe has been swapped with the new one. - if (!Upgrade::RelaunchChromeBrowser(command_line)) { - // The re-launch fails. Feel free to panic now. - NOTREACHED(); - } - return true; -} - -// Check if there is any machine level Chrome installed on the current -// machine. If yes and the current Chrome process is user level, we do not -// allow the user level Chrome to run. So we notify the user and uninstall -// user level Chrome. -bool CheckMachineLevelInstall() { - scoped_ptr<installer::Version> version(InstallUtil::GetChromeVersion(true)); - if (version.get()) { - std::wstring exe; - PathService::Get(base::DIR_EXE, &exe); - std::transform(exe.begin(), exe.end(), exe.begin(), tolower); - std::wstring user_exe_path = installer::GetChromeInstallPath(false); - std::transform(user_exe_path.begin(), user_exe_path.end(), - user_exe_path.begin(), tolower); - if (exe == user_exe_path) { - const std::wstring text = - l10n_util::GetString(IDS_MACHINE_LEVEL_INSTALL_CONFLICT); - const std::wstring caption = l10n_util::GetString(IDS_PRODUCT_NAME); - const UINT flags = MB_OK | MB_ICONERROR | MB_TOPMOST; - win_util::MessageBox(NULL, text, caption, flags); - std::wstring uninstall_cmd = InstallUtil::GetChromeUninstallCmd(false); - if (!uninstall_cmd.empty()) { - uninstall_cmd.append(L" --"); - uninstall_cmd.append(installer_util::switches::kForceUninstall); - uninstall_cmd.append(L" --"); - uninstall_cmd.append(installer_util::switches::kDoNotRemoveSharedItems); - base::LaunchApp(uninstall_cmd, false, false, NULL); - } - return true; - } - } - return false; -} - -// We record in UMA the conditions that can prevent breakpad from generating -// and sending crash reports. Namely that the crash reporting registration -// failed and that the process is being debugged. -void RecordBreakpadStatusUMA(MetricsService* metrics) { - DWORD len = ::GetEnvironmentVariableW(env_vars::kNoOOBreakpad, NULL, 0); - metrics->RecordBreakpadRegistration((len == 0)); - metrics->RecordBreakpadHasDebugger(TRUE == ::IsDebuggerPresent()); -} - } // namespace // Main routine for running as the Browser process. @@ -636,3 +497,26 @@ int BrowserMain(CommandLine &parsed_command_line, return result_code; } + +#elif defined(OS_POSIX) + +// Call to kick off the main message loop. The implementation for this on Mac +// must reside in another file because it has to call Cocoa functions and thus +// cannot live in a .cc file. +int StartPlatformMessageLoop(); + +// TODO(port): merge this with above. Just a stub for now, not meant as a place +// to duplicate code. +// Main routine for running as the Browser process. +int BrowserMain(CommandLine &parsed_command_line, + sandbox::BrokerServices* broker_services) { + return StartPlatformMessageLoop(); +} + +#if defined(OS_LINUX) +void StartPlatformMessageLoop() { + return 0; +} +#endif + +#endif diff --git a/chrome/browser/browser_main_mac.mm b/chrome/browser/browser_main_mac.mm new file mode 100644 index 0000000..c6c4381 --- /dev/null +++ b/chrome/browser/browser_main_mac.mm @@ -0,0 +1,11 @@ +// Copyright (c) 2006-2008 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 <Cocoa/Cocoa.h> +#include "base/command_line.h" +#include <crt_externs.h> + +int StartPlatformMessageLoop() { + return NSApplicationMain(*_NSGetArgc(), (const char**)*_NSGetArgv()); +} diff --git a/chrome/browser/browser_main_win.cc b/chrome/browser/browser_main_win.cc new file mode 100644 index 0000000..8d939f1 --- /dev/null +++ b/chrome/browser/browser_main_win.cc @@ -0,0 +1,178 @@ +// Copyright (c) 2006-2008 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 "chrome/common/win_util.h" + +#include <shellapi.h> +#include <windows.h> + +#include "chrome/browser/browser_main_win.h" + +#include "base/command_line.h" +#include "base/path_service.h" +#include "base/win_util.h" +#include "chrome/app/result_codes.h" +#include "chrome/browser/first_run.h" +#include "chrome/browser/metrics_service.h" +#include "chrome/common/chrome_switches.h" +#include "chrome/common/env_vars.h" +#include "chrome/common/l10n_util.h" +#include "chrome/installer/util/helper.h" +#include "chrome/installer/util/install_util.h" +#include "chrome/installer/util/shell_util.h" + +#include "chromium_strings.h" +#include "generated_resources.h" + +// Displays a warning message if the user is running chrome on windows 2000. +// Returns true if the OS is win2000, false otherwise. +bool CheckForWin2000() { + if (win_util::GetWinVersion() == win_util::WINVERSION_2000) { + const std::wstring text = l10n_util::GetString(IDS_UNSUPPORTED_OS_WIN2000); + const std::wstring caption = l10n_util::GetString(IDS_PRODUCT_NAME); + win_util::MessageBox(NULL, text, caption, + MB_OK | MB_ICONWARNING | MB_TOPMOST); + return true; + } + return false; +} + +bool AskForUninstallConfirmation() { + const std::wstring text = l10n_util::GetString(IDS_UNINSTALL_VERIFY); + const std::wstring caption = l10n_util::GetString(IDS_PRODUCT_NAME); + const UINT flags = MB_OKCANCEL | MB_ICONWARNING | MB_TOPMOST; + return (IDOK == win_util::MessageBox(NULL, text, caption, flags)); +} + +int DoUninstallTasks() { + if (!AskForUninstallConfirmation()) + return ResultCodes::UNINSTALL_USER_CANCEL; + // The following actions are just best effort. + LOG(INFO) << "Executing uninstall actions"; + ResultCodes::ExitCode ret = ResultCodes::NORMAL_EXIT; + if (!FirstRun::RemoveSentinel()) + ret = ResultCodes::UNINSTALL_DELETE_FILE_ERROR; + // We only want to modify user level shortcuts so pass false for system_level. + if (!ShellUtil::RemoveChromeDesktopShortcut(ShellUtil::CURRENT_USER)) + ret = ResultCodes::UNINSTALL_DELETE_FILE_ERROR; + if (!ShellUtil::RemoveChromeQuickLaunchShortcut(ShellUtil::CURRENT_USER)) + ret = ResultCodes::UNINSTALL_DELETE_FILE_ERROR; + return ret; +} + +// Prepares the localized strings that are going to be displayed to +// the user if the browser process dies. These strings are stored in the +// environment block so they are accessible in the early stages of the +// chrome executable's lifetime. +void PrepareRestartOnCrashEnviroment(const CommandLine &parsed_command_line) { + // Clear this var so child processes don't show the dialog by default. + ::SetEnvironmentVariableW(env_vars::kShowRestart, NULL); + + // For non-interactive tests we don't restart on crash. + if (::GetEnvironmentVariableW(env_vars::kHeadless, NULL, 0)) + return; + + // If the known command-line test options are used we don't create the + // environment block which means we don't get the restart dialog. + if (parsed_command_line.HasSwitch(switches::kBrowserCrashTest) || + parsed_command_line.HasSwitch(switches::kBrowserAssertTest) || + parsed_command_line.HasSwitch(switches::kNoErrorDialogs)) + return; + + // The encoding we use for the info is "title|context|direction" where + // direction is either env_vars::kRtlLocale or env_vars::kLtrLocale depending + // on the current locale. + std::wstring dlg_strings; + dlg_strings.append(l10n_util::GetString(IDS_CRASH_RECOVERY_TITLE)); + dlg_strings.append(L"|"); + dlg_strings.append(l10n_util::GetString(IDS_CRASH_RECOVERY_CONTENT)); + dlg_strings.append(L"|"); + if (l10n_util::GetTextDirection() == l10n_util::RIGHT_TO_LEFT) + dlg_strings.append(env_vars::kRtlLocale); + else + dlg_strings.append(env_vars::kLtrLocale); + + ::SetEnvironmentVariableW(env_vars::kRestartInfo, dlg_strings.c_str()); +} + +// This method handles the --hide-icons and --show-icons command line options +// for chrome that get triggered by Windows from registry entries +// HideIconsCommand & ShowIconsCommand. Chrome doesn't support hide icons +// functionality so we just ask the users if they want to uninstall Chrome. +int HandleIconsCommands(const CommandLine &parsed_command_line) { + if (parsed_command_line.HasSwitch(switches::kHideIcons)) { + std::wstring cp_applet; + if (win_util::GetWinVersion() == win_util::WINVERSION_VISTA) { + cp_applet.assign(L"Programs and Features"); // Windows Vista and later. + } else if (win_util::GetWinVersion() == win_util::WINVERSION_XP) { + cp_applet.assign(L"Add/Remove Programs"); // Windows XP. + } else { + return ResultCodes::UNSUPPORTED_PARAM; // Not supported + } + + const std::wstring msg = l10n_util::GetStringF(IDS_HIDE_ICONS_NOT_SUPPORTED, + cp_applet); + const std::wstring caption = l10n_util::GetString(IDS_PRODUCT_NAME); + const UINT flags = MB_OKCANCEL | MB_ICONWARNING | MB_TOPMOST; + if (IDOK == win_util::MessageBox(NULL, msg, caption, flags)) + ShellExecute(NULL, NULL, L"appwiz.cpl", NULL, NULL, SW_SHOWNORMAL); + return ResultCodes::NORMAL_EXIT; // Exit as we are not launching browser. + } + // We don't hide icons so we shouldn't do anything special to show them + return ResultCodes::UNSUPPORTED_PARAM; +} + +// Check if there is any machine level Chrome installed on the current +// machine. If yes and the current Chrome process is user level, we do not +// allow the user level Chrome to run. So we notify the user and uninstall +// user level Chrome. +bool CheckMachineLevelInstall() { + scoped_ptr<installer::Version> version(InstallUtil::GetChromeVersion(true)); + if (version.get()) { + std::wstring exe; + PathService::Get(base::DIR_EXE, &exe); + std::transform(exe.begin(), exe.end(), exe.begin(), tolower); + std::wstring user_exe_path = installer::GetChromeInstallPath(false); + std::transform(user_exe_path.begin(), user_exe_path.end(), + user_exe_path.begin(), tolower); + if (exe == user_exe_path) { + const std::wstring text = + l10n_util::GetString(IDS_MACHINE_LEVEL_INSTALL_CONFLICT); + const std::wstring caption = l10n_util::GetString(IDS_PRODUCT_NAME); + const UINT flags = MB_OK | MB_ICONERROR | MB_TOPMOST; + win_util::MessageBox(NULL, text, caption, flags); + std::wstring uninstall_cmd = InstallUtil::GetChromeUninstallCmd(false); + if (!uninstall_cmd.empty()) { + uninstall_cmd.append(L" --"); + uninstall_cmd.append(installer_util::switches::kForceUninstall); + uninstall_cmd.append(L" --"); + uninstall_cmd.append(installer_util::switches::kDoNotRemoveSharedItems); + base::LaunchApp(uninstall_cmd, false, false, NULL); + } + return true; + } + } + return false; +} + +bool DoUpgradeTasks(const CommandLine& command_line) { + if (!Upgrade::SwapNewChromeExeIfPresent()) + return false; + // At this point the chrome.exe has been swapped with the new one. + if (!Upgrade::RelaunchChromeBrowser(command_line)) { + // The re-launch fails. Feel free to panic now. + NOTREACHED(); + } + return true; +} + +// We record in UMA the conditions that can prevent breakpad from generating +// and sending crash reports. Namely that the crash reporting registration +// failed and that the process is being debugged. +void RecordBreakpadStatusUMA(MetricsService* metrics) { + DWORD len = ::GetEnvironmentVariableW(env_vars::kNoOOBreakpad, NULL, 0); + metrics->RecordBreakpadRegistration((len == 0)); + metrics->RecordBreakpadHasDebugger(TRUE == ::IsDebuggerPresent()); +} + diff --git a/chrome/browser/browser_main_win.h b/chrome/browser/browser_main_win.h new file mode 100644 index 0000000..d44958f --- /dev/null +++ b/chrome/browser/browser_main_win.h @@ -0,0 +1,46 @@ +// Copyright (c) 2008 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. + +// Contains functions used by BrowserMain() that are win32-specific. + +#ifndef CHROME_BROWSER_BROWSER_MAIN_WIN_H_ +#define CHROME_BROWSER_BROWSER_MAIN_WIN_H_ + +class CommandLine; +class MetricsService; + +// Displays a warning message if the user is running chrome on windows 2000. +// Returns true if the OS is win2000, false otherwise. +bool CheckForWin2000(); + +// Handle uninstallation when given the appropriate the command-line switch. +int DoUninstallTasks(); + +// Prepares the localized strings that are going to be displayed to +// the user if the browser process dies. These strings are stored in the +// environment block so they are accessible in the early stages of the +// chrome executable's lifetime. +void PrepareRestartOnCrashEnviroment(const CommandLine &parsed_command_line); + +// This method handles the --hide-icons and --show-icons command line options +// for chrome that get triggered by Windows from registry entries +// HideIconsCommand & ShowIconsCommand. Chrome doesn't support hide icons +// functionality so we just ask the users if they want to uninstall Chrome. +int HandleIconsCommands(const CommandLine &parsed_command_line); + +// Check if there is any machine level Chrome installed on the current +// machine. If yes and the current Chrome process is user level, we do not +// allow the user level Chrome to run. So we notify the user and uninstall +// user level Chrome. +bool CheckMachineLevelInstall(); + +// Handle upgrades if Chromium was upgraded while it was last running. +bool DoUpgradeTasks(const CommandLine& command_line); + +// We record in UMA the conditions that can prevent breakpad from generating +// and sending crash reports. Namely that the crash reporting registration +// failed and that the process is being debugged. +void RecordBreakpadStatusUMA(MetricsService* metrics); + +#endif // CHROME_BROWSER_BROWSER_MAIN_WIN_H_
\ No newline at end of file diff --git a/chrome/chrome.xcodeproj/project.pbxproj b/chrome/chrome.xcodeproj/project.pbxproj index 0467e3e..e02e880 100644 --- a/chrome/chrome.xcodeproj/project.pbxproj +++ b/chrome/chrome.xcodeproj/project.pbxproj @@ -139,14 +139,12 @@ 4D7BFDD20E9D5295009A6919 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4D7BFDD10E9D5295009A6919 /* CoreFoundation.framework */; }; 4D7BFE760E9D52E4009A6919 /* libicuuc.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4D7BFE710E9D52DC009A6919 /* libicuuc.a */; }; 4D7BFE800E9D5317009A6919 /* libicui18n.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4D7BFE6D0E9D52DC009A6919 /* libicui18n.a */; }; - 4D7BFE830E9D532E009A6919 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4D7BFE820E9D532E009A6919 /* Foundation.framework */; }; 4D7BFF3A0E9D5378009A6919 /* libjpeg.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4D7BFF370E9D5362009A6919 /* libjpeg.a */; }; 4D7BFF440E9D53A0009A6919 /* libgtest.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4D7BFF410E9D538D009A6919 /* libgtest.a */; }; 4D7BFF590E9D53E0009A6919 /* libbzip2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4D7BFF540E9D53C1009A6919 /* libbzip2.a */; }; 4D7BFF5A0E9D53E0009A6919 /* libevent.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4D7BFF4B0E9D53B4009A6919 /* libevent.a */; }; 4D7BFF5E0E9D53FD009A6919 /* libbase_gfx.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4D7BFDC90E9D525B009A6919 /* libbase_gfx.a */; }; 4D7BFF730E9D5425009A6919 /* libgoogleurl.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4D7BFF6E0E9D540F009A6919 /* libgoogleurl.a */; }; - 4D7BFF7B0E9D5449009A6919 /* AppKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4D7BFF7A0E9D5449009A6919 /* AppKit.framework */; }; 4DDC63E70EAE344300FB5EBE /* metrics_response_unittest.cc in Sources */ = {isa = PBXBuildFile; fileRef = 4D7BF8B60E9D4839009A6919 /* metrics_response_unittest.cc */; }; 4DDC644B0EAE390800FB5EBE /* libxml.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4D7BFB230E9D4BBF009A6919 /* libxml.a */; }; 4DDC64580EAE394200FB5EBE /* libzlib.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4DDC64550EAE392400FB5EBE /* libzlib.a */; }; @@ -155,9 +153,7 @@ B54BD8FC0ED622C00093FD54 /* mach_message_source_mac.cc in Sources */ = {isa = PBXBuildFile; fileRef = B54BD8FA0ED622C00093FD54 /* mach_message_source_mac.cc */; }; B562C8430ED49C830077A23F /* mach_ipc_mac.mm in Sources */ = {isa = PBXBuildFile; fileRef = B562C8420ED49C830077A23F /* mach_ipc_mac.mm */; }; B5FDC0580EE488E500BEC6E6 /* ipc_channel_posix.cc in Sources */ = {isa = PBXBuildFile; fileRef = B5FDC0570EE488E500BEC6E6 /* ipc_channel_posix.cc */; }; - B5FDC1C90EE48ADB00BEC6E6 /* AppKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4D7BFF7A0E9D5449009A6919 /* AppKit.framework */; }; B5FDC1CA0EE48ADB00BEC6E6 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4D7BFDD10E9D5295009A6919 /* CoreFoundation.framework */; }; - B5FDC1CB0EE48ADB00BEC6E6 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4D7BFE820E9D532E009A6919 /* Foundation.framework */; }; B5FDC1CC0EE48ADB00BEC6E6 /* libbase.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4D7BFDC70E9D525B009A6919 /* libbase.a */; }; B5FDC1D00EE48ADB00BEC6E6 /* libcommon.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4D7BFC1A0E9D4CB9009A6919 /* libcommon.a */; }; B5FDC1D10EE48ADB00BEC6E6 /* libevent.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4D7BFF4B0E9D53B4009A6919 /* libevent.a */; }; @@ -167,8 +163,6 @@ B5FDC2180EE48F4100BEC6E6 /* libicui18n.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4D7BFE6D0E9D52DC009A6919 /* libicui18n.a */; }; E45060F20EE87D41003BE099 /* chrome_exe_main.mm in Sources */ = {isa = PBXBuildFile; fileRef = E45060F10EE87D41003BE099 /* chrome_exe_main.mm */; }; E45061110EE88056003BE099 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = E450610F0EE88056003BE099 /* MainMenu.xib */; }; - E45061120EE88069003BE099 /* AppKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4D7BFF7A0E9D5449009A6919 /* AppKit.framework */; }; - E45061C50EE8807E003BE099 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4D7BFE820E9D532E009A6919 /* Foundation.framework */; }; E45062680EE890C2003BE099 /* libbase.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4D7BFDC70E9D525B009A6919 /* libbase.a */; }; E45062A70EE89146003BE099 /* libicui18n.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4D7BFE6D0E9D52DC009A6919 /* libicui18n.a */; }; E45062A90EE89154003BE099 /* libicudata.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4D7BFE690E9D52DC009A6919 /* libicudata.a */; }; @@ -176,6 +170,15 @@ E45062AB0EE89154003BE099 /* libicutu.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4D7BFE6F0E9D52DC009A6919 /* libicutu.a */; }; E45062AC0EE89154003BE099 /* libicuuc.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4D7BFE710E9D52DC009A6919 /* libicuuc.a */; }; E45062C70EE8939A003BE099 /* chromium.icns in Resources */ = {isa = PBXBuildFile; fileRef = E45062C60EE8939A003BE099 /* chromium.icns */; }; + E45062EB0EE9877F003BE099 /* chrome_dll_main.cc in Sources */ = {isa = PBXBuildFile; fileRef = E45062EA0EE9877F003BE099 /* chrome_dll_main.cc */; }; + E45063120EE99096003BE099 /* libcommon.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4D7BFC1A0E9D4CB9009A6919 /* libcommon.a */; }; + E45063130EE990A4003BE099 /* libbrowser.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4D7BF3060E9D477E009A6919 /* libbrowser.a */; }; + E45063140EE990AB003BE099 /* librenderer.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4D640CEB0EAE86BD00EBCFC0 /* librenderer.a */; }; + E450631C0EE990FA003BE099 /* libevent.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4D7BFF4B0E9D53B4009A6919 /* libevent.a */; }; + E450634F0EE9BE29003BE099 /* browser_main_mac.mm in Sources */ = {isa = PBXBuildFile; fileRef = E450634E0EE9BE29003BE099 /* browser_main_mac.mm */; }; + E45063530EE9BF31003BE099 /* browser_main.cc in Sources */ = {isa = PBXBuildFile; fileRef = 4D7BF83E0E9D4839009A6919 /* browser_main.cc */; }; + E45065DE0EEEC6FF003BE099 /* AppKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E45065DD0EEEC6FF003BE099 /* AppKit.framework */; }; + E45065E00EEEC709003BE099 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E45065DF0EEEC709003BE099 /* Foundation.framework */; }; E48FB9590EC4E9C10052B72B /* safe_browsing_database_bloom.cc in Sources */ = {isa = PBXBuildFile; fileRef = 4D7BFADF0E9D49DE009A6919 /* safe_browsing_database_bloom.cc */; }; E48FB95C0EC4E9DD0052B72B /* safe_browsing_database_impl.cc in Sources */ = {isa = PBXBuildFile; fileRef = 4D7BFAE10E9D49DE009A6919 /* safe_browsing_database_impl.cc */; }; E48FB9760EC4EA320052B72B /* url_request_failed_dns_job.cc in Sources */ = {isa = PBXBuildFile; fileRef = E48FB96E0EC4EA270052B72B /* url_request_failed_dns_job.cc */; }; @@ -657,6 +660,27 @@ remoteGlobalIDString = 7BD53AAA0D6F6671003CD41E; remoteInfo = icuuc; }; + E45063150EE990C4003BE099 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 4D7BF2E90E9D46A4009A6919 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 4D7BF3050E9D477E009A6919; + remoteInfo = browser; + }; + E45063170EE990C4003BE099 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 4D7BF2E90E9D46A4009A6919 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 4D7BFC190E9D4CB9009A6919; + remoteInfo = common; + }; + E45063190EE990C4003BE099 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 4D7BF2E90E9D46A4009A6919 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 4D640CEA0EAE86BD00EBCFC0; + remoteInfo = renderer; + }; E4F3259A0EE837DD002533CE /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 4D7BF2E90E9D46A4009A6919 /* Project object */; @@ -1376,13 +1400,11 @@ 4D7BFDBE0E9D525B009A6919 /* base.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = base.xcodeproj; path = base/base.xcodeproj; sourceTree = "<group>"; }; 4D7BFDD10E9D5295009A6919 /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = System/Library/Frameworks/CoreFoundation.framework; sourceTree = "<group>"; }; 4D7BFE5B0E9D52DC009A6919 /* icu.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = icu.xcodeproj; path = third_party/icu38/icu.xcodeproj; sourceTree = "<group>"; }; - 4D7BFE820E9D532E009A6919 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = "<group>"; }; 4D7BFF2F0E9D5362009A6919 /* libjpeg.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = libjpeg.xcodeproj; path = third_party/libjpeg/libjpeg.xcodeproj; sourceTree = "<group>"; }; 4D7BFF3C0E9D538D009A6919 /* gtest.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = gtest.xcodeproj; path = testing/gtest.xcodeproj; sourceTree = "<group>"; }; 4D7BFF460E9D53B4009A6919 /* libevent.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = libevent.xcodeproj; path = third_party/libevent/libevent.xcodeproj; sourceTree = "<group>"; }; 4D7BFF4C0E9D53C1009A6919 /* bzip2.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = bzip2.xcodeproj; path = third_party/bzip2/bzip2.xcodeproj; sourceTree = "<group>"; }; 4D7BFF5F0E9D540F009A6919 /* googleurl.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = googleurl.xcodeproj; path = build/googleurl.xcodeproj; sourceTree = "<group>"; }; - 4D7BFF7A0E9D5449009A6919 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = "<group>"; }; 4DDC64500EAE392400FB5EBE /* zlib.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = zlib.xcodeproj; path = third_party/zlib/zlib.xcodeproj; sourceTree = "<group>"; }; A54612D90EE9957000A8EE5D /* extensions_service.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = extensions_service.cc; sourceTree = "<group>"; }; A54612DA0EE9957000A8EE5D /* extensions_service.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = extensions_service.h; sourceTree = "<group>"; }; @@ -1398,6 +1420,10 @@ E45060F10EE87D41003BE099 /* chrome_exe_main.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = chrome_exe_main.mm; path = app/chrome_exe_main.mm; sourceTree = "<group>"; }; E45061100EE88056003BE099 /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = app/nibs/English.lproj/MainMenu.xib; sourceTree = "<group>"; }; E45062C60EE8939A003BE099 /* chromium.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; name = chromium.icns; path = app/theme/chromium/chromium.icns; sourceTree = "<group>"; }; + E45062EA0EE9877F003BE099 /* chrome_dll_main.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = chrome_dll_main.cc; path = app/chrome_dll_main.cc; sourceTree = "<group>"; }; + E450634E0EE9BE29003BE099 /* browser_main_mac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = browser_main_mac.mm; sourceTree = "<group>"; }; + E45065DD0EEEC6FF003BE099 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = "<absolute>"; }; + E45065DF0EEEC709003BE099 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = "<absolute>"; }; E48FB9610EC4EA270052B72B /* automation_autocomplete_edit_tracker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = automation_autocomplete_edit_tracker.h; sourceTree = "<group>"; }; E48FB9620EC4EA270052B72B /* automation_browser_tracker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = automation_browser_tracker.h; sourceTree = "<group>"; }; E48FB9630EC4EA270052B72B /* automation_constrained_window_tracker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = automation_constrained_window_tracker.h; sourceTree = "<group>"; }; @@ -1445,9 +1471,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 4D7BFF7B0E9D5449009A6919 /* AppKit.framework in Frameworks */, 4D7BFDD20E9D5295009A6919 /* CoreFoundation.framework in Frameworks */, - 4D7BFE830E9D532E009A6919 /* Foundation.framework in Frameworks */, 4D7BFDCE0E9D5267009A6919 /* libbase.a in Frameworks */, 4D7BFF5E0E9D53FD009A6919 /* libbase_gfx.a in Frameworks */, 4D7BFD960E9D5223009A6919 /* libbrowser.a in Frameworks */, @@ -1480,9 +1504,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - B5FDC1C90EE48ADB00BEC6E6 /* AppKit.framework in Frameworks */, B5FDC1CA0EE48ADB00BEC6E6 /* CoreFoundation.framework in Frameworks */, - B5FDC1CB0EE48ADB00BEC6E6 /* Foundation.framework in Frameworks */, B5FDC1CC0EE48ADB00BEC6E6 /* libbase.a in Frameworks */, E4F3258A0EE8375A002533CE /* libbase_gfx.a in Frameworks */, B5FDC1D00EE48ADB00BEC6E6 /* libcommon.a in Frameworks */, @@ -1500,14 +1522,18 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - E45061120EE88069003BE099 /* AppKit.framework in Frameworks */, - E45061C50EE8807E003BE099 /* Foundation.framework in Frameworks */, + E45065DE0EEEC6FF003BE099 /* AppKit.framework in Frameworks */, + E45065E00EEEC709003BE099 /* Foundation.framework in Frameworks */, E45062680EE890C2003BE099 /* libbase.a in Frameworks */, + E45063130EE990A4003BE099 /* libbrowser.a in Frameworks */, + E45063120EE99096003BE099 /* libcommon.a in Frameworks */, + E450631C0EE990FA003BE099 /* libevent.a in Frameworks */, E45062A90EE89154003BE099 /* libicudata.a in Frameworks */, E45062AA0EE89154003BE099 /* libicudata_stub.a in Frameworks */, E45062A70EE89146003BE099 /* libicui18n.a in Frameworks */, E45062AB0EE89154003BE099 /* libicutu.a in Frameworks */, E45062AC0EE89154003BE099 /* libicuuc.a in Frameworks */, + E45063140EE990AB003BE099 /* librenderer.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1686,6 +1712,7 @@ 4D7BF83C0E9D4839009A6919 /* browser_list.cc */, 4D7BF83D0E9D4839009A6919 /* browser_list.h */, 4D7BF83E0E9D4839009A6919 /* browser_main.cc */, + E450634E0EE9BE29003BE099 /* browser_main_mac.mm */, 4D7BF83F0E9D4839009A6919 /* browser_prefs.cc */, 4D7BF8400E9D4839009A6919 /* browser_prefs.h */, 4D7BF8410E9D4839009A6919 /* browser_process.cc */, @@ -2441,9 +2468,9 @@ 4D7BFDD00E9D527E009A6919 /* Frameworks */ = { isa = PBXGroup; children = ( - 4D7BFF7A0E9D5449009A6919 /* AppKit.framework */, + E45065DF0EEEC709003BE099 /* Foundation.framework */, + E45065DD0EEEC6FF003BE099 /* AppKit.framework */, 4D7BFDD10E9D5295009A6919 /* CoreFoundation.framework */, - 4D7BFE820E9D532E009A6919 /* Foundation.framework */, ); name = Frameworks; sourceTree = SDKROOT; @@ -2515,6 +2542,7 @@ isa = PBXGroup; children = ( E45060E60EE87B86003BE099 /* app-Info.plist */, + E45062EA0EE9877F003BE099 /* chrome_dll_main.cc */, E45060F10EE87D41003BE099 /* chrome_exe_main.mm */, E450610A0EE87FB6003BE099 /* nibs */, E45062D40EE89659003BE099 /* resources */, @@ -2713,11 +2741,14 @@ ); dependencies = ( E45062670EE890B3003BE099 /* PBXTargetDependency */, + E45063160EE990C4003BE099 /* PBXTargetDependency */, + E45063180EE990C4003BE099 /* PBXTargetDependency */, E450629C0EE8912D003BE099 /* PBXTargetDependency */, E450629E0EE8912D003BE099 /* PBXTargetDependency */, E45062A00EE8912D003BE099 /* PBXTargetDependency */, E45062A20EE8912D003BE099 /* PBXTargetDependency */, E45062A40EE8912D003BE099 /* PBXTargetDependency */, + E450631A0EE990C4003BE099 /* PBXTargetDependency */, ); name = app; productName = app; @@ -3057,6 +3088,8 @@ files = ( 4D7BFA1E0E9D48FD009A6919 /* archived_database.cc in Sources */, 4D7BFAEE0E9D49E5009A6919 /* bloom_filter.cc in Sources */, + E450634F0EE9BE29003BE099 /* browser_main_mac.mm in Sources */, + E45063530EE9BF31003BE099 /* browser_main.cc in Sources */, 4D7BF97B0E9D4857009A6919 /* browser_process.cc in Sources */, 4D7BF98D0E9D485B009A6919 /* cancelable_request.cc in Sources */, 4D7BF9920E9D485F009A6919 /* chrome_thread.cc in Sources */, @@ -3193,6 +3226,7 @@ buildActionMask = 2147483647; files = ( E45060F20EE87D41003BE099 /* chrome_exe_main.mm in Sources */, + E45062EB0EE9877F003BE099 /* chrome_dll_main.cc in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -3394,6 +3428,21 @@ name = icuuc; targetProxy = E45062A30EE8912D003BE099 /* PBXContainerItemProxy */; }; + E45063160EE990C4003BE099 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 4D7BF3050E9D477E009A6919 /* browser */; + targetProxy = E45063150EE990C4003BE099 /* PBXContainerItemProxy */; + }; + E45063180EE990C4003BE099 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 4D7BFC190E9D4CB9009A6919 /* common */; + targetProxy = E45063170EE990C4003BE099 /* PBXContainerItemProxy */; + }; + E450631A0EE990C4003BE099 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 4D640CEA0EAE86BD00EBCFC0 /* renderer */; + targetProxy = E45063190EE990C4003BE099 /* PBXContainerItemProxy */; + }; E4F3259B0EE837DD002533CE /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = B5FDBFAD0EE4623000BEC6E6 /* ipc_tests */; diff --git a/sandbox/src/sandbox.h b/sandbox/src/sandbox.h index 25c61d1..e709afb 100644 --- a/sandbox/src/sandbox.h +++ b/sandbox/src/sandbox.h @@ -19,7 +19,13 @@ #ifndef SANDBOX_SRC_SANDBOX_H__ #define SANDBOX_SRC_SANDBOX_H__ +#include "build/build_config.h" + +#if defined(OS_WIN) #include <windows.h> +#elif defined(OS_POSIX) +typedef struct PROCESS_INFORMATION; +#endif #include "base/basictypes.h" #include "sandbox/src/sandbox_policy.h" |