| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 // Implementation of wrapper around common crash reporting. | 5 // Implementation of wrapper around common crash reporting. |
| 6 | 6 |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/file_version_info.h" |
| 9 #include "base/win_util.h" | 10 #include "base/win_util.h" |
| 10 #include "chrome/installer/util/google_update_settings.h" | 11 #include "chrome/installer/util/google_update_settings.h" |
| 11 #include "chrome/installer/util/install_util.h" | 12 #include "chrome/installer/util/install_util.h" |
| 12 #include "chrome_frame/chrome_frame_reporting.h" | 13 #include "chrome_frame/chrome_frame_reporting.h" |
| 13 | 14 |
| 14 // Well known SID for the system principal. | 15 // Well known SID for the system principal. |
| 15 const wchar_t kSystemPrincipalSid[] = L"S-1-5-18"; | 16 const wchar_t kSystemPrincipalSid[] = L"S-1-5-18"; |
| 16 | 17 |
| 17 // Returns the custom info structure based on the dll in parameter and the | 18 // Returns the custom info structure based on the dll in parameter |
| 18 // process type. | 19 google_breakpad::CustomClientInfo* GetCustomInfo(const wchar_t* dll_path) { |
| 19 google_breakpad::CustomClientInfo* GetCustomInfo() { | 20 std::wstring product; |
| 20 // TODO(joshia): Grab these based on build. | 21 std::wstring version; |
| 21 static google_breakpad::CustomInfoEntry ver_entry(L"ver", L"0.1.0.0"); | 22 scoped_ptr<FileVersionInfo> |
| 22 static google_breakpad::CustomInfoEntry prod_entry(L"prod", L"ChromeFrame"); | 23 version_info(FileVersionInfo::CreateFileVersionInfo(dll_path)); |
| 24 if (version_info.get()) { |
| 25 version = version_info->product_version(); |
| 26 product = version_info->product_short_name(); |
| 27 } |
| 28 |
| 29 if (version.empty()) |
| 30 version = L"0.1.0.0"; |
| 31 |
| 32 if (product.empty()) |
| 33 product = L"ChromeFrame"; |
| 34 |
| 35 static google_breakpad::CustomInfoEntry ver_entry(L"ver", version.c_str()); |
| 36 static google_breakpad::CustomInfoEntry prod_entry(L"prod", product.c_str()); |
| 23 static google_breakpad::CustomInfoEntry plat_entry(L"plat", L"Win32"); | 37 static google_breakpad::CustomInfoEntry plat_entry(L"plat", L"Win32"); |
| 24 static google_breakpad::CustomInfoEntry type_entry(L"ptype", L"chrome_frame"); | 38 static google_breakpad::CustomInfoEntry type_entry(L"ptype", L"chrome_frame"); |
| 25 static google_breakpad::CustomInfoEntry entries[] = { | 39 static google_breakpad::CustomInfoEntry entries[] = { |
| 26 ver_entry, prod_entry, plat_entry, type_entry }; | 40 ver_entry, prod_entry, plat_entry, type_entry }; |
| 27 static google_breakpad::CustomClientInfo custom_info = { | 41 static google_breakpad::CustomClientInfo custom_info = { |
| 28 entries, arraysize(entries) }; | 42 entries, arraysize(entries) }; |
| 29 return &custom_info; | 43 return &custom_info; |
| 30 } | 44 } |
| 31 | 45 |
| 32 extern "C" IMAGE_DOS_HEADER __ImageBase; | 46 extern "C" IMAGE_DOS_HEADER __ImageBase; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 53 user_sid = kSystemPrincipalSid; | 67 user_sid = kSystemPrincipalSid; |
| 54 } | 68 } |
| 55 | 69 |
| 56 // Get the alternate dump directory. We use the temp path. | 70 // Get the alternate dump directory. We use the temp path. |
| 57 FilePath temp_directory; | 71 FilePath temp_directory; |
| 58 if (!file_util::GetTempDir(&temp_directory) || temp_directory.empty()) { | 72 if (!file_util::GetTempDir(&temp_directory) || temp_directory.empty()) { |
| 59 return false; | 73 return false; |
| 60 } | 74 } |
| 61 | 75 |
| 62 return InitializeVectoredCrashReporting(false, user_sid.c_str(), | 76 return InitializeVectoredCrashReporting(false, user_sid.c_str(), |
| 63 temp_directory.value(), GetCustomInfo()); | 77 temp_directory.value(), GetCustomInfo(dll_path)); |
| 64 } | 78 } |
| 65 | 79 |
| 66 bool ShutdownCrashReporting() { | 80 bool ShutdownCrashReporting() { |
| 67 return ShutdownVectoredCrashReporting(); | 81 return ShutdownVectoredCrashReporting(); |
| 68 } | 82 } |
| OLD | NEW |