| Index: chrome_frame/chrome_frame_reporting.cc
|
| diff --git a/chrome_frame/chrome_frame_reporting.cc b/chrome_frame/chrome_frame_reporting.cc
|
| index f9fa490d7427dbaf47e6f54caf834bf24866f400..0a0608a7bd5ae143c4c820285d8c79f65847488b 100644
|
| --- a/chrome_frame/chrome_frame_reporting.cc
|
| +++ b/chrome_frame/chrome_frame_reporting.cc
|
| @@ -4,15 +4,22 @@
|
|
|
| // Implementation of wrapper around common crash reporting.
|
|
|
| +#include "chrome_frame/chrome_frame_reporting.h"
|
| +
|
| +#include "base/basictypes.h"
|
| #include "base/file_util.h"
|
| #include "base/file_version_info.h"
|
| #include "base/win/win_util.h"
|
| #include "chrome/installer/util/google_update_settings.h"
|
| #include "chrome/installer/util/install_util.h"
|
| -#include "chrome_frame/chrome_frame_reporting.h"
|
| +#include "chrome_frame/crash_reporting/crash_report.h"
|
| #include "chrome_frame/exception_barrier.h"
|
| #include "chrome_frame/utils.h"
|
|
|
| +extern "C" IMAGE_DOS_HEADER __ImageBase;
|
| +
|
| +namespace {
|
| +
|
| // Well known SID for the system principal.
|
| const wchar_t kSystemPrincipalSid[] = L"S-1-5-18";
|
| const wchar_t kChromePipeName[] = L"\\\\.\\pipe\\ChromeCrashServices";
|
| @@ -45,15 +52,13 @@ google_breakpad::CustomClientInfo* GetCustomInfo(const wchar_t* dll_path) {
|
| return &custom_info;
|
| }
|
|
|
| -extern "C" IMAGE_DOS_HEADER __ImageBase;
|
| -
|
| bool InitializeCrashReporting() {
|
| // In headless mode we want crashes to be reported back.
|
| bool always_take_dump = IsHeadlessMode();
|
| // We want to use the Google Update crash reporting. We need to check if the
|
| // user allows it first.
|
| if (!always_take_dump && !GoogleUpdateSettings::GetCollectStatsConsent())
|
| - return true;
|
| + return true;
|
|
|
| // If we got here, we want to report crashes, so make sure all
|
| // ExceptionBarrierBase instances do so.
|
| @@ -61,17 +66,16 @@ bool InitializeCrashReporting() {
|
|
|
| // Get the alternate dump directory. We use the temp path.
|
| base::FilePath temp_directory;
|
| - if (!file_util::GetTempDir(&temp_directory) || temp_directory.empty()) {
|
| + if (!file_util::GetTempDir(&temp_directory) || temp_directory.empty())
|
| return false;
|
| - }
|
|
|
| wchar_t dll_path[MAX_PATH * 2] = {0};
|
| GetModuleFileName(reinterpret_cast<HMODULE>(&__ImageBase), dll_path,
|
| arraysize(dll_path));
|
|
|
| if (always_take_dump) {
|
| - return InitializeVectoredCrashReportingWithPipeName(true, kChromePipeName,
|
| - temp_directory.value(), GetCustomInfo(dll_path));
|
| + return InitializeVectoredCrashReportingWithPipeName(
|
| + true, kChromePipeName, temp_directory.value(), GetCustomInfo(dll_path));
|
| }
|
|
|
| // Build the pipe name. It can be either:
|
| @@ -79,18 +83,31 @@ bool InitializeCrashReporting() {
|
| // Per-user install: "NamedPipe\GoogleCrashServices\<user SID>"
|
| std::wstring user_sid;
|
| if (InstallUtil::IsPerUserInstall(dll_path)) {
|
| - if (!base::win::GetUserSidString(&user_sid)) {
|
| + if (!base::win::GetUserSidString(&user_sid))
|
| return false;
|
| - }
|
| } else {
|
| user_sid = kSystemPrincipalSid;
|
| }
|
|
|
| - return InitializeVectoredCrashReporting(false, user_sid.c_str(),
|
| - temp_directory.value(), GetCustomInfo(dll_path));
|
| + return InitializeVectoredCrashReporting(
|
| + false, user_sid.c_str(), temp_directory.value(), GetCustomInfo(dll_path));
|
| }
|
|
|
| bool ShutdownCrashReporting() {
|
| ExceptionBarrierConfig::set_enabled(false);
|
| return ShutdownVectoredCrashReporting();
|
| }
|
| +
|
| +} // namespace
|
| +
|
| +namespace chrome_frame {
|
| +
|
| +void CrashReportingTraits::Initialize() {
|
| + InitializeCrashReporting();
|
| +}
|
| +
|
| +void CrashReportingTraits::Shutdown() {
|
| + ShutdownCrashReporting();
|
| +}
|
| +
|
| +} // namespace chrome_frame
|
|
|