| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 <shlwapi.h> | 6 #include <shlwapi.h> |
| 7 | 7 |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/logging.h" | 9 #include "base/environment.h" |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| 11 #include "base/trace_event.h" | 11 #include "base/trace_event.h" |
| 12 #include "base/logging.h" |
| 13 #include "base/scoped_ptr.h" |
| 14 #include "base/utf_string_conversions.h" |
| 12 #include "chrome/app/breakpad_win.h" | 15 #include "chrome/app/breakpad_win.h" |
| 13 #include "chrome/app/client_util.h" | 16 #include "chrome/app/client_util.h" |
| 14 #include "chrome/common/chrome_switches.h" | 17 #include "chrome/common/chrome_switches.h" |
| 15 #include "chrome/common/result_codes.h" | 18 #include "chrome/common/result_codes.h" |
| 16 #include "chrome/installer/util/browser_distribution.h" | 19 #include "chrome/installer/util/browser_distribution.h" |
| 17 #include "chrome/installer/util/install_util.h" | 20 #include "chrome/installer/util/install_util.h" |
| 18 #include "chrome/installer/util/google_update_constants.h" | 21 #include "chrome/installer/util/google_update_constants.h" |
| 19 #include "chrome/installer/util/util_constants.h" | 22 #include "chrome/installer/util/util_constants.h" |
| 20 | 23 |
| 21 namespace { | 24 namespace { |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 // environment variable and just calling the entry point. Derived classes can | 224 // environment variable and just calling the entry point. Derived classes can |
| 222 // add custom code in the OnBeforeLaunch callback. | 225 // add custom code in the OnBeforeLaunch callback. |
| 223 int MainDllLoader::Launch(HINSTANCE instance, | 226 int MainDllLoader::Launch(HINSTANCE instance, |
| 224 sandbox::SandboxInterfaceInfo* sbox_info) { | 227 sandbox::SandboxInterfaceInfo* sbox_info) { |
| 225 std::wstring version; | 228 std::wstring version; |
| 226 std::wstring file; | 229 std::wstring file; |
| 227 dll_ = Load(&version, &file); | 230 dll_ = Load(&version, &file); |
| 228 if (!dll_) | 231 if (!dll_) |
| 229 return ResultCodes::MISSING_DATA; | 232 return ResultCodes::MISSING_DATA; |
| 230 | 233 |
| 231 ::SetEnvironmentVariableW( | 234 scoped_ptr<base::Environment> env(base::Environment::Create()); |
| 232 BrowserDistribution::GetDistribution()->GetEnvVersionKey().c_str(), | 235 env->SetVar(WideToUTF8( |
| 233 version.c_str()); | 236 BrowserDistribution::GetDistribution()->GetEnvVersionKey()).c_str(), |
| 237 WideToUTF8(version)); |
| 234 | 238 |
| 235 InitCrashReporterWithDllPath(file); | 239 InitCrashReporterWithDllPath(file); |
| 236 OnBeforeLaunch(version); | 240 OnBeforeLaunch(version); |
| 237 | 241 |
| 238 DLL_MAIN entry_point = | 242 DLL_MAIN entry_point = |
| 239 reinterpret_cast<DLL_MAIN>(::GetProcAddress(dll_, "ChromeMain")); | 243 reinterpret_cast<DLL_MAIN>(::GetProcAddress(dll_, "ChromeMain")); |
| 240 if (!entry_point) | 244 if (!entry_point) |
| 241 return ResultCodes::BAD_PROCESS_TYPE; | 245 return ResultCodes::BAD_PROCESS_TYPE; |
| 242 | 246 |
| 243 int rc = entry_point(instance, sbox_info, ::GetCommandLineW()); | 247 int rc = entry_point(instance, sbox_info, ::GetCommandLineW()); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 } | 299 } |
| 296 }; | 300 }; |
| 297 | 301 |
| 298 MainDllLoader* MakeMainDllLoader() { | 302 MainDllLoader* MakeMainDllLoader() { |
| 299 #if defined(GOOGLE_CHROME_BUILD) | 303 #if defined(GOOGLE_CHROME_BUILD) |
| 300 return new ChromeDllLoader(); | 304 return new ChromeDllLoader(); |
| 301 #else | 305 #else |
| 302 return new ChromiumDllLoader(); | 306 return new ChromiumDllLoader(); |
| 303 #endif | 307 #endif |
| 304 } | 308 } |
| OLD | NEW |