| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 #include <windows.h> | 5 #include <windows.h> |
| 6 #include <tchar.h> | 6 #include <tchar.h> |
| 7 | 7 |
| 8 #include "base/at_exit.h" | 8 #include "base/at_exit.h" |
| 9 #include "base/base_switches.h" | 9 #include "base/base_switches.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 sandbox_info.target_services = sandbox::SandboxFactory::GetTargetServices(); | 43 sandbox_info.target_services = sandbox::SandboxFactory::GetTargetServices(); |
| 44 | 44 |
| 45 const wchar_t* dll_name = L"chrome.dll"; | 45 const wchar_t* dll_name = L"chrome.dll"; |
| 46 #if defined(GOOGLE_CHROME_BUILD) | 46 #if defined(GOOGLE_CHROME_BUILD) |
| 47 google_update::GoogleUpdateClient client; | 47 google_update::GoogleUpdateClient client; |
| 48 | 48 |
| 49 // TODO(erikkay): Get guid from build macros rather than hardcoding. | 49 // TODO(erikkay): Get guid from build macros rather than hardcoding. |
| 50 // TODO(erikkay): verify client.Init() return value for official builds | 50 // TODO(erikkay): verify client.Init() return value for official builds |
| 51 client.Init(L"{8A69D345-D564-463c-AFF1-A69D9E530F96}", dll_name); | 51 client.Init(L"{8A69D345-D564-463c-AFF1-A69D9E530F96}", dll_name); |
| 52 | 52 |
| 53 // Initialize the crash reporter. | |
| 54 InitCrashReporter(client.GetDLLPath()); | |
| 55 | |
| 56 bool exit_now = false; | 53 bool exit_now = false; |
| 57 if (ShowRestartDialogIfCrashed(&exit_now)) { | 54 if (ShowRestartDialogIfCrashed(&exit_now)) { |
| 58 // We have restarted because of a previous crash. The user might | 55 // We have restarted because of a previous crash. The user might |
| 59 // decide that he does not want to continue. | 56 // decide that he does not want to continue. |
| 60 if (exit_now) | 57 if (exit_now) |
| 61 return ResultCodes::NORMAL_EXIT; | 58 return ResultCodes::NORMAL_EXIT; |
| 62 } | 59 } |
| 63 | 60 |
| 64 int ret = 0; | 61 if (client.Load()) { |
| 65 if (client.Launch(instance, &sandbox_info, command_line, show_command, | 62 // Initialize the crash reporter. |
| 66 "ChromeMain", &ret)) { | 63 InitCrashReporter(client.GetDLLPath()); |
| 67 return ret; | 64 |
| 65 int ret = 0; |
| 66 if (client.Launch(instance, &sandbox_info, command_line, show_command, |
| 67 "ChromeMain", &ret)) { |
| 68 return ret; |
| 69 } |
| 68 } | 70 } |
| 69 #else | 71 #else |
| 70 wchar_t exe_path[MAX_PATH] = {0}; | 72 wchar_t exe_path[MAX_PATH] = {0}; |
| 71 client_util::GetExecutablePath(exe_path); | 73 client_util::GetExecutablePath(exe_path); |
| 72 wchar_t *version; | 74 wchar_t *version; |
| 73 std::wstring dll_path; | 75 std::wstring dll_path; |
| 74 if (client_util::GetChromiumVersion(exe_path, L"Software\\Chromium", | 76 if (client_util::GetChromiumVersion(exe_path, L"Software\\Chromium", |
| 75 &version)) { | 77 &version)) { |
| 76 dll_path = exe_path; | 78 dll_path = exe_path; |
| 77 dll_path.append(version); | 79 dll_path.append(version); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 90 client_util::DLL_MAIN entry = reinterpret_cast<client_util::DLL_MAIN>( | 92 client_util::DLL_MAIN entry = reinterpret_cast<client_util::DLL_MAIN>( |
| 91 ::GetProcAddress(dll_handle, "ChromeMain")); | 93 ::GetProcAddress(dll_handle, "ChromeMain")); |
| 92 if (NULL != entry) | 94 if (NULL != entry) |
| 93 return (entry)(instance, &sandbox_info, command_line, show_command); | 95 return (entry)(instance, &sandbox_info, command_line, show_command); |
| 94 } | 96 } |
| 95 #endif | 97 #endif |
| 96 | 98 |
| 97 return ResultCodes::GOOGLE_UPDATE_LAUNCH_FAILED; | 99 return ResultCodes::GOOGLE_UPDATE_LAUNCH_FAILED; |
| 98 } | 100 } |
| 99 | 101 |
| OLD | NEW |