| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/installer/setup/installer_crash_reporting.h" | 5 #include "chrome/installer/setup/installer_crash_reporting.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" |
| 7 #include "base/debug/leak_annotations.h" | 8 #include "base/debug/leak_annotations.h" |
| 8 #include "base/logging.h" | 9 #include "base/logging.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| 10 #include "chrome/installer/setup/installer_crash_reporter_client.h" | 11 #include "chrome/installer/setup/installer_crash_reporter_client.h" |
| 11 #include "chrome/installer/util/google_update_settings.h" | 12 #include "chrome/installer/util/google_update_settings.h" |
| 12 #include "chrome/installer/util/installer_state.h" | 13 #include "chrome/installer/util/installer_state.h" |
| 13 #include "components/crash/content/app/breakpad_win.h" | 14 #include "components/crash/content/app/breakpad_win.h" |
| 14 #include "components/crash/content/app/crash_keys_win.h" | 15 #include "components/crash/content/app/crash_keys_win.h" |
| 15 #include "components/crash/core/common/crash_keys.h" | 16 #include "components/crash/core/common/crash_keys.h" |
| 16 | 17 |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 { kIsMultiInstall, crash_keys::kSmallSize }, | 119 { kIsMultiInstall, crash_keys::kSmallSize }, |
| 119 { kIsSystemLevel, crash_keys::kSmallSize }, | 120 { kIsSystemLevel, crash_keys::kSmallSize }, |
| 120 { kOperation, crash_keys::kSmallSize }, | 121 { kOperation, crash_keys::kSmallSize }, |
| 121 | 122 |
| 122 // This is a Windows registry key, which maxes out at 255 chars. | 123 // This is a Windows registry key, which maxes out at 255 chars. |
| 123 // (kMediumSize actually maxes out at 252 chars on Windows, but potentially | 124 // (kMediumSize actually maxes out at 252 chars on Windows, but potentially |
| 124 // truncating such a small amount is a fair tradeoff compared to using | 125 // truncating such a small amount is a fair tradeoff compared to using |
| 125 // kLargeSize, which is wasteful.) | 126 // kLargeSize, which is wasteful.) |
| 126 { kStateKey, crash_keys::kMediumSize }, | 127 { kStateKey, crash_keys::kMediumSize }, |
| 127 }; | 128 }; |
| 128 return base::debug::InitCrashKeys(&kFixedKeys[0], arraysize(kFixedKeys), | 129 std::vector<base::debug::CrashKey> keys(std::begin(kFixedKeys), |
| 130 std::end(kFixedKeys)); |
| 131 crash_keys::GetCrashKeysForCommandLineSwitches(&keys); |
| 132 return base::debug::InitCrashKeys(keys.data(), keys.size(), |
| 129 crash_keys::kChunkMaxLength); | 133 crash_keys::kChunkMaxLength); |
| 130 } | 134 } |
| 131 | 135 |
| 132 void SetInitialCrashKeys(const InstallerState& state) { | 136 void SetInitialCrashKeys(const InstallerState& state) { |
| 133 using base::debug::SetCrashKeyValue; | 137 using base::debug::SetCrashKeyValue; |
| 134 | 138 |
| 135 SetCrashKeyValue(kDistributionType, | 139 SetCrashKeyValue(kDistributionType, |
| 136 DistributionTypeToString(state.state_type())); | 140 DistributionTypeToString(state.state_type())); |
| 137 SetCrashKeyValue(kOperation, OperationToString(state.operation())); | 141 SetCrashKeyValue(kOperation, OperationToString(state.operation())); |
| 138 SetCrashKeyValue(kIsMultiInstall, | 142 SetCrashKeyValue(kIsMultiInstall, |
| 139 state.is_multi_install() ? "true" : "false"); | 143 state.is_multi_install() ? "true" : "false"); |
| 140 SetCrashKeyValue(kIsSystemLevel, state.system_install() ? "true" : "false"); | 144 SetCrashKeyValue(kIsSystemLevel, state.system_install() ? "true" : "false"); |
| 141 | 145 |
| 142 const std::wstring state_key = state.state_key(); | 146 const std::wstring state_key = state.state_key(); |
| 143 if (!state_key.empty()) | 147 if (!state_key.empty()) |
| 144 SetCrashKeyValue(kStateKey, base::UTF16ToUTF8(state_key)); | 148 SetCrashKeyValue(kStateKey, base::UTF16ToUTF8(state_key)); |
| 145 } | 149 } |
| 146 | 150 |
| 151 void SetCrashKeysFromCommandLine(const base::CommandLine& command_line) { |
| 152 crash_keys::SetSwitchesFromCommandLine(command_line); |
| 153 } |
| 154 |
| 147 } // namespace installer | 155 } // namespace installer |
| OLD | NEW |