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 "chrome/app/breakpad_win.h" | 5 #include "chrome/app/breakpad_win.h" |
6 | 6 |
7 #include <windows.h> | |
8 #include <shellapi.h> | 7 #include <shellapi.h> |
9 #include <tchar.h> | 8 #include <tchar.h> |
10 #include <userenv.h> | 9 #include <userenv.h> |
| 10 #include <windows.h> |
11 | 11 |
12 #include <algorithm> | 12 #include <algorithm> |
13 #include <vector> | 13 #include <vector> |
14 | 14 |
15 #include "base/base_switches.h" | 15 #include "base/base_switches.h" |
16 #include "base/command_line.h" | 16 #include "base/command_line.h" |
17 #include "base/debug/crash_logging.h" | 17 #include "base/debug/crash_logging.h" |
18 #include "base/environment.h" | 18 #include "base/environment.h" |
19 #include "base/file_util.h" | 19 #include "base/file_util.h" |
20 #include "base/file_version_info.h" | 20 #include "base/file_version_info.h" |
21 #include "base/memory/scoped_ptr.h" | 21 #include "base/memory/scoped_ptr.h" |
| 22 #include "base/string16.h" |
22 #include "base/string_util.h" | 23 #include "base/string_util.h" |
23 #include "base/string16.h" | |
24 #include "base/stringprintf.h" | 24 #include "base/stringprintf.h" |
25 #include "base/strings/string_split.h" | 25 #include "base/strings/string_split.h" |
26 #include "base/utf_string_conversions.h" | 26 #include "base/utf_string_conversions.h" |
27 #include "base/win/registry.h" | 27 #include "base/win/registry.h" |
28 #include "base/win/win_util.h" | 28 #include "base/win/win_util.h" |
29 #include "breakpad/src/client/windows/handler/exception_handler.h" | 29 #include "breakpad/src/client/windows/handler/exception_handler.h" |
30 #include "chrome/app/breakpad_field_trial_win.h" | 30 #include "chrome/app/breakpad_field_trial_win.h" |
31 #include "chrome/app/crash_analysis_win.h" | 31 #include "chrome/app/crash_analysis_win.h" |
32 #include "chrome/app/hard_error_handler_win.h" | 32 #include "chrome/app/hard_error_handler_win.h" |
33 #include "chrome/common/child_process_logging.h" | 33 #include "chrome/common/child_process_logging.h" |
(...skipping 16 matching lines...) Expand all Loading... |
50 // is way too too fragile. See | 50 // is way too too fragile. See |
51 // https://code.google.com/p/chromium/issues/detail?id=137062. | 51 // https://code.google.com/p/chromium/issues/detail?id=137062. |
52 std::vector<google_breakpad::CustomInfoEntry>* g_custom_entries = NULL; | 52 std::vector<google_breakpad::CustomInfoEntry>* g_custom_entries = NULL; |
53 size_t g_num_of_experiments_offset = 0; | 53 size_t g_num_of_experiments_offset = 0; |
54 size_t g_experiment_chunks_offset = 0; | 54 size_t g_experiment_chunks_offset = 0; |
55 bool g_deferred_crash_uploads = false; | 55 bool g_deferred_crash_uploads = false; |
56 | 56 |
57 } // namespace breakpad_win | 57 } // namespace breakpad_win |
58 | 58 |
59 using breakpad_win::g_custom_entries; | 59 using breakpad_win::g_custom_entries; |
| 60 using breakpad_win::g_deferred_crash_uploads; |
60 using breakpad_win::g_experiment_chunks_offset; | 61 using breakpad_win::g_experiment_chunks_offset; |
61 using breakpad_win::g_num_of_experiments_offset; | 62 using breakpad_win::g_num_of_experiments_offset; |
62 using breakpad_win::g_deferred_crash_uploads; | |
63 | 63 |
64 namespace { | 64 namespace { |
65 | 65 |
66 // Minidump with stacks, PEB, TEB, and unloaded module list. | 66 // Minidump with stacks, PEB, TEB, and unloaded module list. |
67 const MINIDUMP_TYPE kSmallDumpType = static_cast<MINIDUMP_TYPE>( | 67 const MINIDUMP_TYPE kSmallDumpType = static_cast<MINIDUMP_TYPE>( |
68 MiniDumpWithProcessThreadData | // Get PEB and TEB. | 68 MiniDumpWithProcessThreadData | // Get PEB and TEB. |
69 MiniDumpWithUnloadedModules); // Get unloaded modules when available. | 69 MiniDumpWithUnloadedModules); // Get unloaded modules when available. |
70 | 70 |
71 // Minidump with all of the above, plus memory referenced from stack. | 71 // Minidump with all of the above, plus memory referenced from stack. |
72 const MINIDUMP_TYPE kLargerDumpType = static_cast<MINIDUMP_TYPE>( | 72 const MINIDUMP_TYPE kLargerDumpType = static_cast<MINIDUMP_TYPE>( |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 | 281 |
282 // Determine whether configuration management allows loading the crash reporter. | 282 // Determine whether configuration management allows loading the crash reporter. |
283 // Since the configuration management infrastructure is not initialized at this | 283 // Since the configuration management infrastructure is not initialized at this |
284 // point, we read the corresponding registry key directly. The return status | 284 // point, we read the corresponding registry key directly. The return status |
285 // indicates whether policy data was successfully read. If it is true, |result| | 285 // indicates whether policy data was successfully read. If it is true, |result| |
286 // contains the value set by policy. | 286 // contains the value set by policy. |
287 static bool MetricsReportingControlledByPolicy(bool* result) { | 287 static bool MetricsReportingControlledByPolicy(bool* result) { |
288 string16 key_name = UTF8ToUTF16(policy::key::kMetricsReportingEnabled); | 288 string16 key_name = UTF8ToUTF16(policy::key::kMetricsReportingEnabled); |
289 DWORD value = 0; | 289 DWORD value = 0; |
290 base::win::RegKey hklm_policy_key(HKEY_LOCAL_MACHINE, | 290 base::win::RegKey hklm_policy_key(HKEY_LOCAL_MACHINE, |
291 policy::kRegistryMandatorySubKey, KEY_READ); | 291 policy::kRegistryChromePolicyKey, KEY_READ); |
292 if (hklm_policy_key.ReadValueDW(key_name.c_str(), &value) == ERROR_SUCCESS) { | 292 if (hklm_policy_key.ReadValueDW(key_name.c_str(), &value) == ERROR_SUCCESS) { |
293 *result = value != 0; | 293 *result = value != 0; |
294 return true; | 294 return true; |
295 } | 295 } |
296 | 296 |
297 base::win::RegKey hkcu_policy_key(HKEY_CURRENT_USER, | 297 base::win::RegKey hkcu_policy_key(HKEY_CURRENT_USER, |
298 policy::kRegistryMandatorySubKey, KEY_READ); | 298 policy::kRegistryChromePolicyKey, KEY_READ); |
299 if (hkcu_policy_key.ReadValueDW(key_name.c_str(), &value) == ERROR_SUCCESS) { | 299 if (hkcu_policy_key.ReadValueDW(key_name.c_str(), &value) == ERROR_SUCCESS) { |
300 *result = value != 0; | 300 *result = value != 0; |
301 return true; | 301 return true; |
302 } | 302 } |
303 | 303 |
304 return false; | 304 return false; |
305 } | 305 } |
306 | 306 |
307 // Appends the breakpad dump path to |g_custom_entries|. | 307 // Appends the breakpad dump path to |g_custom_entries|. |
308 void SetBreakpadDumpPath() { | 308 void SetBreakpadDumpPath() { |
(...skipping 730 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1039 previous_filter = SetUnhandledExceptionFilter(filter); | 1039 previous_filter = SetUnhandledExceptionFilter(filter); |
1040 } | 1040 } |
1041 | 1041 |
1042 void StringVectorToCStringVector(const std::vector<std::wstring>& wstrings, | 1042 void StringVectorToCStringVector(const std::vector<std::wstring>& wstrings, |
1043 std::vector<const wchar_t*>* cstrings) { | 1043 std::vector<const wchar_t*>* cstrings) { |
1044 cstrings->clear(); | 1044 cstrings->clear(); |
1045 cstrings->reserve(wstrings.size()); | 1045 cstrings->reserve(wstrings.size()); |
1046 for (size_t i = 0; i < wstrings.size(); ++i) | 1046 for (size_t i = 0; i < wstrings.size(); ++i) |
1047 cstrings->push_back(wstrings[i].c_str()); | 1047 cstrings->push_back(wstrings[i].c_str()); |
1048 } | 1048 } |
OLD | NEW |