| 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 <memory> | 8 #include <memory> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 #include "components/crash/content/app/crash_keys_win.h" | 24 #include "components/crash/content/app/crash_keys_win.h" |
| 25 #include "components/crash/content/app/crashpad.h" | 25 #include "components/crash/content/app/crashpad.h" |
| 26 #include "components/crash/core/common/crash_keys.h" | 26 #include "components/crash/core/common/crash_keys.h" |
| 27 | 27 |
| 28 namespace installer { | 28 namespace installer { |
| 29 | 29 |
| 30 namespace { | 30 namespace { |
| 31 | 31 |
| 32 // Crash Keys | 32 // Crash Keys |
| 33 | 33 |
| 34 const char kApValue[] = "ap"; |
| 35 const char kCohortName[] = "cohort-name"; |
| 34 const char kCurrentVersion[] = "current-version"; | 36 const char kCurrentVersion[] = "current-version"; |
| 35 const char kIsSystemLevel[] = "system-level"; | 37 const char kIsSystemLevel[] = "system-level"; |
| 36 const char kOperation[] = "operation"; | 38 const char kOperation[] = "operation"; |
| 37 const char kStateKey[] = "state-key"; | 39 const char kStateKey[] = "state-key"; |
| 38 | 40 |
| 39 const char *OperationToString(InstallerState::Operation operation) { | 41 const char *OperationToString(InstallerState::Operation operation) { |
| 40 switch (operation) { | 42 switch (operation) { |
| 41 case InstallerState::SINGLE_INSTALL_OR_UPDATE: | 43 case InstallerState::SINGLE_INSTALL_OR_UPDATE: |
| 42 return "single-install-or-update"; | 44 return "single-install-or-update"; |
| 43 case InstallerState::UNINSTALL: | 45 case InstallerState::UNINSTALL: |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 | 124 |
| 123 void SetInitialCrashKeys(const InstallerState& state) { | 125 void SetInitialCrashKeys(const InstallerState& state) { |
| 124 using base::debug::SetCrashKeyValue; | 126 using base::debug::SetCrashKeyValue; |
| 125 | 127 |
| 126 SetCrashKeyValue(kOperation, OperationToString(state.operation())); | 128 SetCrashKeyValue(kOperation, OperationToString(state.operation())); |
| 127 SetCrashKeyValue(kIsSystemLevel, state.system_install() ? "true" : "false"); | 129 SetCrashKeyValue(kIsSystemLevel, state.system_install() ? "true" : "false"); |
| 128 | 130 |
| 129 const base::string16 state_key = state.state_key(); | 131 const base::string16 state_key = state.state_key(); |
| 130 if (!state_key.empty()) | 132 if (!state_key.empty()) |
| 131 SetCrashKeyValue(kStateKey, base::UTF16ToUTF8(state_key)); | 133 SetCrashKeyValue(kStateKey, base::UTF16ToUTF8(state_key)); |
| 134 |
| 135 // Set crash keys containing the registry values used to determine Chrome's |
| 136 // update channel at process startup; see https://crbug.com/579504. |
| 137 const auto& details = install_static::InstallDetails::Get(); |
| 138 base::debug::SetCrashKeyValue(kApValue, |
| 139 base::UTF16ToUTF8(details.update_ap())); |
| 140 base::debug::SetCrashKeyValue( |
| 141 kCohortName, base::UTF16ToUTF8(details.update_cohort_name())); |
| 132 } | 142 } |
| 133 | 143 |
| 134 void SetCrashKeysFromCommandLine(const base::CommandLine& command_line) { | 144 void SetCrashKeysFromCommandLine(const base::CommandLine& command_line) { |
| 135 crash_keys::SetSwitchesFromCommandLine(command_line, nullptr); | 145 crash_keys::SetSwitchesFromCommandLine(command_line, nullptr); |
| 136 } | 146 } |
| 137 | 147 |
| 138 void SetCurrentVersionCrashKey(const base::Version* current_version) { | 148 void SetCurrentVersionCrashKey(const base::Version* current_version) { |
| 139 if (current_version) { | 149 if (current_version) { |
| 140 base::debug::SetCrashKeyValue(kCurrentVersion, | 150 base::debug::SetCrashKeyValue(kCurrentVersion, |
| 141 current_version->GetString()); | 151 current_version->GetString()); |
| 142 } else { | 152 } else { |
| 143 base::debug::ClearCrashKey(kCurrentVersion); | 153 base::debug::ClearCrashKey(kCurrentVersion); |
| 144 } | 154 } |
| 145 } | 155 } |
| 146 | 156 |
| 147 } // namespace installer | 157 } // namespace installer |
| OLD | NEW |