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