OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
10 #include "base/environment.h" | 10 #include "base/environment.h" |
11 #include "base/file_util.h" | 11 #include "base/file_util.h" |
12 #include "base/file_version_info.h" | 12 #include "base/file_version_info.h" |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
15 #include "base/rand_util.h" // For PreRead experiment. | 15 #include "base/rand_util.h" // For PreRead experiment. |
16 #include "base/sha1.h" // For PreRead experiment. | 16 #include "base/sha1.h" // For PreRead experiment. |
17 #include "base/string16.h" | 17 #include "base/string16.h" |
18 #include "base/string_util.h" | 18 #include "base/string_util.h" |
19 #include "base/stringprintf.h" | 19 #include "base/stringprintf.h" |
20 #include "base/utf_string_conversions.h" | 20 #include "base/utf_string_conversions.h" |
21 #include "base/version.h" | 21 #include "base/version.h" |
22 #include "base/win/registry.h" | 22 #include "base/win/registry.h" |
23 #include "chrome/app/breakpad_win.h" | 23 #include "chrome/app/breakpad_win.h" |
24 #include "chrome/app/client_util.h" | 24 #include "chrome/app/client_util.h" |
25 #include "chrome/app/image_pre_reader_win.h" | 25 #include "chrome/app/image_pre_reader_win.h" |
26 #include "chrome/common/chrome_constants.h" | 26 #include "chrome/common/chrome_constants.h" |
27 #include "chrome/common/chrome_result_codes.h" | 27 #include "chrome/common/chrome_result_codes.h" |
28 #include "chrome/common/chrome_switches.h" | 28 #include "chrome/common/chrome_switches.h" |
| 29 #include "chrome/common/env_vars.h" |
29 #include "chrome/installer/util/browser_distribution.h" | 30 #include "chrome/installer/util/browser_distribution.h" |
30 #include "chrome/installer/util/channel_info.h" | 31 #include "chrome/installer/util/channel_info.h" |
31 #include "chrome/installer/util/install_util.h" | 32 #include "chrome/installer/util/install_util.h" |
32 #include "chrome/installer/util/google_update_constants.h" | 33 #include "chrome/installer/util/google_update_constants.h" |
33 #include "chrome/installer/util/google_update_settings.h" | 34 #include "chrome/installer/util/google_update_settings.h" |
34 #include "chrome/installer/util/util_constants.h" | 35 #include "chrome/installer/util/util_constants.h" |
35 | 36 |
36 namespace { | 37 namespace { |
37 // The entry point signature of chrome.dll. | 38 // The entry point signature of chrome.dll. |
38 typedef int (*DLL_MAIN)(HINSTANCE, sandbox::SandboxInterfaceInfo*); | 39 typedef int (*DLL_MAIN)(HINSTANCE, sandbox::SandboxInterfaceInfo*); |
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
421 int MainDllLoader::Launch(HINSTANCE instance, | 422 int MainDllLoader::Launch(HINSTANCE instance, |
422 sandbox::SandboxInterfaceInfo* sbox_info) { | 423 sandbox::SandboxInterfaceInfo* sbox_info) { |
423 string16 version; | 424 string16 version; |
424 string16 file; | 425 string16 file; |
425 dll_ = Load(&version, &file); | 426 dll_ = Load(&version, &file); |
426 if (!dll_) | 427 if (!dll_) |
427 return chrome::RESULT_CODE_MISSING_DATA; | 428 return chrome::RESULT_CODE_MISSING_DATA; |
428 | 429 |
429 scoped_ptr<base::Environment> env(base::Environment::Create()); | 430 scoped_ptr<base::Environment> env(base::Environment::Create()); |
430 env->SetVar(chrome::kChromeVersionEnvVar, WideToUTF8(version)); | 431 env->SetVar(chrome::kChromeVersionEnvVar, WideToUTF8(version)); |
| 432 // TODO(erikwright): Remove this when http://crbug.com/174953 is fixed and |
| 433 // widely deployed. |
| 434 env->UnSetVar(env_vars::kGoogleUpdateIsMachineEnvVar); |
431 | 435 |
432 InitCrashReporter(); | 436 InitCrashReporter(); |
433 OnBeforeLaunch(file); | 437 OnBeforeLaunch(file); |
434 | 438 |
435 DLL_MAIN entry_point = | 439 DLL_MAIN entry_point = |
436 reinterpret_cast<DLL_MAIN>(::GetProcAddress(dll_, "ChromeMain")); | 440 reinterpret_cast<DLL_MAIN>(::GetProcAddress(dll_, "ChromeMain")); |
437 if (!entry_point) | 441 if (!entry_point) |
438 return chrome::RESULT_CODE_BAD_PROCESS_TYPE; | 442 return chrome::RESULT_CODE_BAD_PROCESS_TYPE; |
439 | 443 |
440 int rc = entry_point(instance, sbox_info); | 444 int rc = entry_point(instance, sbox_info); |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
499 } | 503 } |
500 }; | 504 }; |
501 | 505 |
502 MainDllLoader* MakeMainDllLoader() { | 506 MainDllLoader* MakeMainDllLoader() { |
503 #if defined(GOOGLE_CHROME_BUILD) | 507 #if defined(GOOGLE_CHROME_BUILD) |
504 return new ChromeDllLoader(); | 508 return new ChromeDllLoader(); |
505 #else | 509 #else |
506 return new ChromiumDllLoader(); | 510 return new ChromiumDllLoader(); |
507 #endif | 511 #endif |
508 } | 512 } |
OLD | NEW |