blob: 1a1bb499889d10bdf6ab2ac69ca574d05b1ed32a [file]
// Copyright 2022 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/updater/remove_uninstalled_apps_task.h"
#include <string>
#include "base/files/file_path.h"
#include "base/strings/strcat.h"
#include "base/strings/sys_string_conversions.h"
#include "base/win/registry.h"
#include "base/win/windows_types.h"
#include "chrome/updater/constants.h"
#include "chrome/updater/updater_scope.h"
#include "chrome/updater/util.h"
#include "chrome/updater/win/win_constants.h"
#include "chrome/updater/win/win_util.h"
#include "third_party/abseil-cpp/absl/types/optional.h"
namespace updater {
absl::optional<int> RemoveUninstalledAppsTask::GetUnregisterReason(
const std::string& app_id,
const base::FilePath& /*ecp*/) const {
base::win::RegKey key;
if (key.Open(scope_ == UpdaterScope::kSystem ? HKEY_LOCAL_MACHINE
: HKEY_CURRENT_USER,
base::StrCat({CLIENTS_KEY, base::SysUTF8ToWide(app_id)}).c_str(),
Wow6432(KEY_READ)) == ERROR_FILE_NOT_FOUND) {
return absl::make_optional(kUninstallPingReasonUninstalled);
}
return absl::nullopt;
}
} // namespace updater