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> | 7 #include <iterator> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 break; | 50 break; |
51 } | 51 } |
52 NOTREACHED(); | 52 NOTREACHED(); |
53 return ""; | 53 return ""; |
54 } | 54 } |
55 | 55 |
56 const char *OperationToString(InstallerState::Operation operation) { | 56 const char *OperationToString(InstallerState::Operation operation) { |
57 switch (operation) { | 57 switch (operation) { |
58 case InstallerState::SINGLE_INSTALL_OR_UPDATE: | 58 case InstallerState::SINGLE_INSTALL_OR_UPDATE: |
59 return "single-install-or-update"; | 59 return "single-install-or-update"; |
60 case InstallerState::MULTI_INSTALL: | |
61 return "multi-install"; | |
62 case InstallerState::MULTI_UPDATE: | |
63 return "multi-update"; | |
64 case InstallerState::UNINSTALL: | 60 case InstallerState::UNINSTALL: |
65 return "uninstall"; | 61 return "uninstall"; |
66 case InstallerState::UNINITIALIZED: | 62 case InstallerState::UNINITIALIZED: |
67 // Fall out of switch. | 63 // Fall out of switch. |
68 break; | 64 break; |
69 } | 65 } |
70 NOTREACHED(); | 66 NOTREACHED(); |
71 return ""; | 67 return ""; |
72 } | 68 } |
73 | 69 |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 return base::debug::InitCrashKeys(keys.data(), keys.size(), | 138 return base::debug::InitCrashKeys(keys.data(), keys.size(), |
143 crash_keys::kChunkMaxLength); | 139 crash_keys::kChunkMaxLength); |
144 } | 140 } |
145 | 141 |
146 void SetInitialCrashKeys(const InstallerState& state) { | 142 void SetInitialCrashKeys(const InstallerState& state) { |
147 using base::debug::SetCrashKeyValue; | 143 using base::debug::SetCrashKeyValue; |
148 | 144 |
149 SetCrashKeyValue(kDistributionType, | 145 SetCrashKeyValue(kDistributionType, |
150 DistributionTypeToString(state.state_type())); | 146 DistributionTypeToString(state.state_type())); |
151 SetCrashKeyValue(kOperation, OperationToString(state.operation())); | 147 SetCrashKeyValue(kOperation, OperationToString(state.operation())); |
152 SetCrashKeyValue(kIsMultiInstall, | 148 SetCrashKeyValue(kIsMultiInstall, "false"); |
153 state.is_multi_install() ? "true" : "false"); | |
154 SetCrashKeyValue(kIsSystemLevel, state.system_install() ? "true" : "false"); | 149 SetCrashKeyValue(kIsSystemLevel, state.system_install() ? "true" : "false"); |
155 | 150 |
156 const base::string16 state_key = state.state_key(); | 151 const base::string16 state_key = state.state_key(); |
157 if (!state_key.empty()) | 152 if (!state_key.empty()) |
158 SetCrashKeyValue(kStateKey, base::UTF16ToUTF8(state_key)); | 153 SetCrashKeyValue(kStateKey, base::UTF16ToUTF8(state_key)); |
159 } | 154 } |
160 | 155 |
161 void SetCrashKeysFromCommandLine(const base::CommandLine& command_line) { | 156 void SetCrashKeysFromCommandLine(const base::CommandLine& command_line) { |
162 crash_keys::SetSwitchesFromCommandLine(command_line, nullptr); | 157 crash_keys::SetSwitchesFromCommandLine(command_line, nullptr); |
163 } | 158 } |
164 | 159 |
165 void SetCurrentVersionCrashKey(const base::Version* current_version) { | 160 void SetCurrentVersionCrashKey(const base::Version* current_version) { |
166 if (current_version) { | 161 if (current_version) { |
167 base::debug::SetCrashKeyValue(kCurrentVersion, | 162 base::debug::SetCrashKeyValue(kCurrentVersion, |
168 current_version->GetString()); | 163 current_version->GetString()); |
169 } else { | 164 } else { |
170 base::debug::ClearCrashKey(kCurrentVersion); | 165 base::debug::ClearCrashKey(kCurrentVersion); |
171 } | 166 } |
172 } | 167 } |
173 | 168 |
174 } // namespace installer | 169 } // namespace installer |
OLD | NEW |