remove_uninstalled_apps_task_win.cc 1.2 KB

123456789101112131415161718192021222324252627282930313233343536
  1. // Copyright 2022 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #include "chrome/updater/remove_uninstalled_apps_task.h"
  5. #include <string>
  6. #include "base/files/file_path.h"
  7. #include "base/strings/strcat.h"
  8. #include "base/strings/sys_string_conversions.h"
  9. #include "base/win/registry.h"
  10. #include "base/win/windows_types.h"
  11. #include "chrome/updater/constants.h"
  12. #include "chrome/updater/updater_scope.h"
  13. #include "chrome/updater/util.h"
  14. #include "chrome/updater/win/win_constants.h"
  15. #include "chrome/updater/win/win_util.h"
  16. #include "third_party/abseil-cpp/absl/types/optional.h"
  17. namespace updater {
  18. absl::optional<int> RemoveUninstalledAppsTask::GetUnregisterReason(
  19. const std::string& app_id,
  20. const base::FilePath& /*ecp*/) const {
  21. base::win::RegKey key;
  22. if (key.Open(scope_ == UpdaterScope::kSystem ? HKEY_LOCAL_MACHINE
  23. : HKEY_CURRENT_USER,
  24. GetAppClientsKey(app_id).c_str(),
  25. Wow6432(KEY_READ)) == ERROR_FILE_NOT_FOUND) {
  26. return absl::make_optional(kUninstallPingReasonUninstalled);
  27. }
  28. return absl::nullopt;
  29. }
  30. } // namespace updater