// Copyright 2017 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CHROME_BROWSER_COMPONENT_UPDATER_RECOVERY_IMPROVED_COMPONENT_INSTALLER_H_ #define CHROME_BROWSER_COMPONENT_UPDATER_RECOVERY_IMPROVED_COMPONENT_INSTALLER_H_ #include <cstdint> #include <memory> #include <string> #include <vector> #include "base/feature_list.h" #include "base/files/file_path.h" #include "base/memory/raw_ptr.h" #include "base/memory/ref_counted.h" #include "base/task/sequenced_task_runner.h" #include "base/task/task_traits.h" #include "base/types/expected.h" #include "base/values.h" #include "components/component_updater/component_installer.h" #include "components/crx_file/crx_verifier.h" #include "components/update_client/unpacker.h" #include "components/update_client/update_client.h" namespace base { class CommandLine; class Process; } // namespace base class PrefService; namespace component_updater { // Handles the |run| action for the recovery component. // // The recovery component consists of a executable program (the name of the // program is known at build time but it depends on the operating system), // wrapped inside a CRX container, which CRX is itself contained inside a // component updater CRX payload. In other words, looking from outside, the // component updater installs and updates a CRX, containing a CRX, containing // a program. When this program is run, it can restore the functionality of // the Chrome updater. // The |RecoveryComponentActionHandler| is responsible for unpacking the inner // CRX described above, and running the executable program inside it. // // The |RecoveryComponentActionHandler::Handle| function is invoked as a result // of an |action| element present in the update response for the recovery // component. Note that the |action| element can be present in the update // response even if there are no updates for the recovery component. // // When Chrome is installed per-system, the CRX is being handed over to // a system elevator, which unpacks the CRX in a secure location of the // file system, and runs the recovery program with system privileges. // // When Chrome is installed per-user, the CRX is unpacked in a temporary // directory for the user, and the recovery program runs with normal user // privileges. class RecoveryComponentActionHandler : public update_client::ActionHandler { … }; class ComponentUpdateService; class RecoveryImprovedInstallerPolicy : public ComponentInstallerPolicy { … }; void RegisterRecoveryImprovedComponent(ComponentUpdateService* cus, PrefService* prefs); } // namespace component_updater #endif // CHROME_BROWSER_COMPONENT_UPDATER_RECOVERY_IMPROVED_COMPONENT_INSTALLER_H_