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 // This module contains the necessary code to register the Breakpad exception | 5 // This module contains the necessary code to register the Breakpad exception |
6 // handler. This implementation is based on Chrome/Chrome Frame crash reporting | 6 // handler. This implementation is based on Chrome/Chrome Frame crash reporting |
7 // code. See: | 7 // code. See: |
8 // - src/chrome/app/breakpad_win.cc | 8 // - src/chrome/app/breakpad_win.cc |
9 // - src/chrome_frame/crash_server_init.cc | 9 // - src/chrome_frame/crash_server_init.cc |
10 // - src/chrome/installer/setup/setup_main.cc | 10 // - src/chrome/installer/setup/setup_main.cc |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 return &g_instance.Get(); | 146 return &g_instance.Get(); |
147 } | 147 } |
148 | 148 |
149 // Returns the Custom information to be used for crash reporting. | 149 // Returns the Custom information to be used for crash reporting. |
150 google_breakpad::CustomClientInfo* BreakpadWin::GetCustomInfo() { | 150 google_breakpad::CustomClientInfo* BreakpadWin::GetCustomInfo() { |
151 HMODULE binary = base::GetModuleFromAddress( | 151 HMODULE binary = base::GetModuleFromAddress( |
152 reinterpret_cast<void*>(&remoting::InitializeCrashReporting)); | 152 reinterpret_cast<void*>(&remoting::InitializeCrashReporting)); |
153 scoped_ptr<FileVersionInfo> version_info( | 153 scoped_ptr<FileVersionInfo> version_info( |
154 FileVersionInfo::CreateFileVersionInfoForModule(binary)); | 154 FileVersionInfo::CreateFileVersionInfoForModule(binary)); |
155 | 155 |
156 std::wstring version; | 156 static wchar_t version[64]; |
157 if (version_info.get()) | 157 if (version_info.get()) { |
158 version = UTF16ToWide(version_info->product_version()); | 158 wcscpy_s(version, UTF16ToWide(version_info->product_version()).c_str()); |
159 if (version.empty()) | 159 } else { |
160 version = kBreakpadVersionDefault; | 160 wcscpy_s(version, kBreakpadVersionDefault); |
| 161 } |
161 | 162 |
162 static google_breakpad::CustomInfoEntry ver_entry( | 163 static google_breakpad::CustomInfoEntry ver_entry( |
163 kBreakpadVersionEntry, version.c_str()); | 164 kBreakpadVersionEntry, version); |
164 static google_breakpad::CustomInfoEntry prod_entry( | 165 static google_breakpad::CustomInfoEntry prod_entry( |
165 kBreakpadProdEntry, kBreakpadProductName); | 166 kBreakpadProdEntry, kBreakpadProductName); |
166 static google_breakpad::CustomInfoEntry plat_entry( | 167 static google_breakpad::CustomInfoEntry plat_entry( |
167 kBreakpadPlatformEntry, kBreakpadPlatformWin32); | 168 kBreakpadPlatformEntry, kBreakpadPlatformWin32); |
168 static google_breakpad::CustomInfoEntry entries[] = { | 169 static google_breakpad::CustomInfoEntry entries[] = { |
169 ver_entry, prod_entry, plat_entry }; | 170 ver_entry, prod_entry, plat_entry }; |
170 static google_breakpad::CustomClientInfo custom_info = { | 171 static google_breakpad::CustomClientInfo custom_info = { |
171 entries, arraysize(entries) }; | 172 entries, arraysize(entries) }; |
172 return &custom_info; | 173 return &custom_info; |
173 } | 174 } |
(...skipping 30 matching lines...) Expand all Loading... |
204 // Touch the object to make sure it is initialized. | 205 // Touch the object to make sure it is initialized. |
205 BreakpadWin::GetInstance(); | 206 BreakpadWin::GetInstance(); |
206 } | 207 } |
207 | 208 |
208 void InitializeCrashReportingForTest(const wchar_t* pipe_name) { | 209 void InitializeCrashReportingForTest(const wchar_t* pipe_name) { |
209 BreakpadWin::pipe_name_ = pipe_name; | 210 BreakpadWin::pipe_name_ = pipe_name; |
210 InitializeCrashReporting(); | 211 InitializeCrashReporting(); |
211 } | 212 } |
212 | 213 |
213 } // namespace remoting | 214 } // namespace remoting |
OLD | NEW |