OLD | NEW |
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2014 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/browser/component_updater/sw_reporter_installer_win.h" | 5 #include "chrome/browser/component_updater/sw_reporter_installer_win.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/base_paths.h" | 10 #include "base/base_paths.h" |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 FROM_HERE, | 247 FROM_HERE, |
248 base::Bind(&base::PathExists, SwReporterInstallerTraits::install_dir()), | 248 base::Bind(&base::PathExists, SwReporterInstallerTraits::install_dir()), |
249 base::Bind(&MaybeRegisterComponent, cus, prefs)); | 249 base::Bind(&MaybeRegisterComponent, cus, prefs)); |
250 | 250 |
251 // Run the reporter if there is a pending execution request. | 251 // Run the reporter if there is a pending execution request. |
252 int execute_try_count = prefs->GetInteger(prefs::kSwReporterExecuteTryCount); | 252 int execute_try_count = prefs->GetInteger(prefs::kSwReporterExecuteTryCount); |
253 if (execute_try_count > 0) { | 253 if (execute_try_count > 0) { |
254 // Retrieve the results if the pending request has completed. | 254 // Retrieve the results if the pending request has completed. |
255 base::win::RegKey srt_key( | 255 base::win::RegKey srt_key( |
256 HKEY_CURRENT_USER, kSoftwareRemovalToolRegistryKey, KEY_READ); | 256 HKEY_CURRENT_USER, kSoftwareRemovalToolRegistryKey, KEY_READ); |
257 DWORD exit_code = -1; | 257 DWORD exit_code; |
258 if (srt_key.Valid() && | 258 if (srt_key.Valid() && |
259 srt_key.ReadValueDW(kExitCodeRegistryValueName, &exit_code) == | 259 srt_key.ReadValueDW(kExitCodeRegistryValueName, &exit_code) == |
260 ERROR_SUCCESS) { | 260 ERROR_SUCCESS) { |
261 ReportUmaStep(SW_REPORTER_REGISTRY_EXIT_CODE); | 261 ReportUmaStep(SW_REPORTER_REGISTRY_EXIT_CODE); |
262 ReportAndClearExitCode(exit_code); | 262 ReportAndClearExitCode(exit_code); |
263 return; | 263 return; |
264 } | 264 } |
265 | 265 |
266 // The previous request has not completed. The reporter will run again | 266 // The previous request has not completed. The reporter will run again |
267 // when ComponentReady is called or the request is abandoned if it has | 267 // when ComponentReady is called or the request is abandoned if it has |
268 // been tried too many times. | 268 // been tried too many times. |
269 prefs->SetInteger(prefs::kSwReporterExecuteTryCount, --execute_try_count); | 269 prefs->SetInteger(prefs::kSwReporterExecuteTryCount, --execute_try_count); |
270 if (execute_try_count > 0) | 270 if (execute_try_count > 0) |
271 ReportUmaStep(SW_REPORTER_STARTUP_RETRY); | 271 ReportUmaStep(SW_REPORTER_STARTUP_RETRY); |
272 else | 272 else |
273 ReportUmaStep(SW_REPORTER_RETRIED_TOO_MANY_TIMES); | 273 ReportUmaStep(SW_REPORTER_RETRIED_TOO_MANY_TIMES); |
274 } | 274 } |
275 } | 275 } |
276 | 276 |
277 void RegisterPrefsForSwReporter(PrefRegistrySimple* registry) { | 277 void RegisterPrefsForSwReporter(PrefRegistrySimple* registry) { |
278 registry->RegisterIntegerPref(prefs::kSwReporterExecuteTryCount, 0); | 278 registry->RegisterIntegerPref(prefs::kSwReporterExecuteTryCount, 0); |
279 } | 279 } |
280 | 280 |
281 } // namespace component_updater | 281 } // namespace component_updater |
OLD | NEW |