| 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/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
| 11 #include "base/environment.h" | 11 #include "base/environment.h" |
| 12 #include "base/file_version_info.h" | 12 #include "base/file_version_info.h" |
| 13 #include "base/lazy_instance.h" | 13 #include "base/lazy_instance.h" |
| 14 #include "base/logging.h" | 14 #include "base/logging.h" |
| 15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
| 16 #include "base/rand_util.h" // For PreRead experiment. | 16 #include "base/rand_util.h" // For PreRead experiment. |
| 17 #include "base/sha1.h" // For PreRead experiment. | 17 #include "base/sha1.h" // For PreRead experiment. |
| 18 #include "base/strings/string16.h" | 18 #include "base/strings/string16.h" |
| 19 #include "base/strings/string_util.h" | 19 #include "base/strings/string_util.h" |
| 20 #include "base/strings/stringprintf.h" | 20 #include "base/strings/stringprintf.h" |
| 21 #include "base/strings/utf_string_conversions.h" | 21 #include "base/strings/utf_string_conversions.h" |
| 22 #include "base/version.h" | 22 #include "base/version.h" |
| 23 #include "base/win/windows_version.h" | 23 #include "base/win/windows_version.h" |
| 24 #include "chrome/app/chrome_breakpad_client.h" | 24 #include "chrome/app/chrome_crash_reporter_client.h" |
| 25 #include "chrome/app/client_util.h" | 25 #include "chrome/app/client_util.h" |
| 26 #include "chrome/app/image_pre_reader_win.h" | 26 #include "chrome/app/image_pre_reader_win.h" |
| 27 #include "chrome/common/chrome_constants.h" | 27 #include "chrome/common/chrome_constants.h" |
| 28 #include "chrome/common/chrome_result_codes.h" | 28 #include "chrome/common/chrome_result_codes.h" |
| 29 #include "chrome/common/chrome_switches.h" | 29 #include "chrome/common/chrome_switches.h" |
| 30 #include "chrome/common/env_vars.h" | 30 #include "chrome/common/env_vars.h" |
| 31 #include "chrome/installer/util/google_update_constants.h" | 31 #include "chrome/installer/util/google_update_constants.h" |
| 32 #include "chrome/installer/util/google_update_settings.h" | 32 #include "chrome/installer/util/google_update_settings.h" |
| 33 #include "chrome/installer/util/install_util.h" | 33 #include "chrome/installer/util/install_util.h" |
| 34 #include "chrome/installer/util/util_constants.h" | 34 #include "chrome/installer/util/util_constants.h" |
| 35 #include "components/crash/app/breakpad_client.h" | |
| 36 #include "components/crash/app/breakpad_win.h" | 35 #include "components/crash/app/breakpad_win.h" |
| 36 #include "components/crash/app/crash_reporter_client.h" |
| 37 #include "components/metrics/client_info.h" | 37 #include "components/metrics/client_info.h" |
| 38 #include "content/public/app/startup_helper_win.h" | 38 #include "content/public/app/startup_helper_win.h" |
| 39 #include "sandbox/win/src/sandbox.h" | 39 #include "sandbox/win/src/sandbox.h" |
| 40 | 40 |
| 41 namespace { | 41 namespace { |
| 42 // The entry point signature of chrome.dll. | 42 // The entry point signature of chrome.dll. |
| 43 typedef int (*DLL_MAIN)(HINSTANCE, sandbox::SandboxInterfaceInfo*); | 43 typedef int (*DLL_MAIN)(HINSTANCE, sandbox::SandboxInterfaceInfo*); |
| 44 | 44 |
| 45 typedef void (*RelaunchChromeBrowserWithNewCommandLineIfNeededFunc)(); | 45 typedef void (*RelaunchChromeBrowserWithNewCommandLineIfNeededFunc)(); |
| 46 | 46 |
| 47 base::LazyInstance<chrome::ChromeBreakpadClient>::Leaky | 47 base::LazyInstance<chrome::ChromeCrashReporterClient>::Leaky |
| 48 g_chrome_breakpad_client = LAZY_INSTANCE_INITIALIZER; | 48 g_chrome_crash_client = LAZY_INSTANCE_INITIALIZER; |
| 49 | 49 |
| 50 // Returns true if the build date for this module precedes the expiry date | 50 // Returns true if the build date for this module precedes the expiry date |
| 51 // for the pre-read experiment. | 51 // for the pre-read experiment. |
| 52 bool PreReadExperimentIsActive() { | 52 bool PreReadExperimentIsActive() { |
| 53 const int kPreReadExpiryYear = 2014; | 53 const int kPreReadExpiryYear = 2014; |
| 54 const int kPreReadExpiryMonth = 7; | 54 const int kPreReadExpiryMonth = 7; |
| 55 const int kPreReadExpiryDay = 1; | 55 const int kPreReadExpiryDay = 1; |
| 56 const char kBuildTimeStr[] = __DATE__ " " __TIME__; | 56 const char kBuildTimeStr[] = __DATE__ " " __TIME__; |
| 57 | 57 |
| 58 // Get the timestamp of the build. | 58 // Get the timestamp of the build. |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 | 283 |
| 284 InitMetro chrome_metro_main = | 284 InitMetro chrome_metro_main = |
| 285 reinterpret_cast<InitMetro>(::GetProcAddress(metro_dll, "InitMetro")); | 285 reinterpret_cast<InitMetro>(::GetProcAddress(metro_dll, "InitMetro")); |
| 286 return chrome_metro_main(); | 286 return chrome_metro_main(); |
| 287 } | 287 } |
| 288 | 288 |
| 289 // Initialize the sandbox services. | 289 // Initialize the sandbox services. |
| 290 sandbox::SandboxInterfaceInfo sandbox_info = {0}; | 290 sandbox::SandboxInterfaceInfo sandbox_info = {0}; |
| 291 content::InitializeSandboxInfo(&sandbox_info); | 291 content::InitializeSandboxInfo(&sandbox_info); |
| 292 | 292 |
| 293 breakpad::SetBreakpadClient(g_chrome_breakpad_client.Pointer()); | 293 crash_reporter::SetCrashReporterClient(g_chrome_crash_client.Pointer()); |
| 294 bool exit_now = true; | 294 bool exit_now = true; |
| 295 if (process_type_.empty()) { | 295 if (process_type_.empty()) { |
| 296 if (breakpad::ShowRestartDialogIfCrashed(&exit_now)) { | 296 if (breakpad::ShowRestartDialogIfCrashed(&exit_now)) { |
| 297 // We restarted because of a previous crash. Ask user if we should | 297 // We restarted because of a previous crash. Ask user if we should |
| 298 // Relaunch. Only for the browser process. See crbug.com/132119. | 298 // Relaunch. Only for the browser process. See crbug.com/132119. |
| 299 if (exit_now) | 299 if (exit_now) |
| 300 return content::RESULT_CODE_NORMAL_EXIT; | 300 return content::RESULT_CODE_NORMAL_EXIT; |
| 301 } | 301 } |
| 302 } | 302 } |
| 303 breakpad::InitCrashReporter(process_type_); | 303 breakpad::InitCrashReporter(process_type_); |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 } | 363 } |
| 364 }; | 364 }; |
| 365 | 365 |
| 366 MainDllLoader* MakeMainDllLoader() { | 366 MainDllLoader* MakeMainDllLoader() { |
| 367 #if defined(GOOGLE_CHROME_BUILD) | 367 #if defined(GOOGLE_CHROME_BUILD) |
| 368 return new ChromeDllLoader(); | 368 return new ChromeDllLoader(); |
| 369 #else | 369 #else |
| 370 return new ChromiumDllLoader(); | 370 return new ChromiumDllLoader(); |
| 371 #endif | 371 #endif |
| 372 } | 372 } |
| OLD | NEW |