| Index: components/component_updater/component_updater_service.cc
|
| diff --git a/components/component_updater/component_updater_service.cc b/components/component_updater/component_updater_service.cc
|
| index 1f6684c11e6a5890049aac7f6bc3700efb5016b4..2d3346c89d34827426d989ca6eee682080a6cb0d 100644
|
| --- a/components/component_updater/component_updater_service.cc
|
| +++ b/components/component_updater/component_updater_service.cc
|
| @@ -29,6 +29,9 @@
|
| #include "base/timer/timer.h"
|
| #include "components/component_updater/component_updater_service_internal.h"
|
| #include "components/component_updater/timer.h"
|
| +#if defined(OS_WIN)
|
| +#include "components/component_updater/updater_state_win.h"
|
| +#endif
|
| #include "components/update_client/configurator.h"
|
| #include "components/update_client/crx_update_item.h"
|
| #include "components/update_client/update_client.h"
|
| @@ -46,6 +49,8 @@ enum UpdateType {
|
| UPDATE_TYPE_COUNT,
|
| };
|
|
|
| +const char kRecoveryComponentId[] = "npdjjkjlcidkjlamlmmdelcjbcpdjocm";
|
| +
|
| } // namespace
|
|
|
| namespace component_updater {
|
| @@ -352,9 +357,17 @@ void CrxUpdateService::OnUpdate(const std::vector<std::string>& ids,
|
| DCHECK(components->empty());
|
|
|
| for (const auto& id : ids) {
|
| - const auto* registered_component(GetComponent(id));
|
| + const update_client::CrxComponent* registered_component(GetComponent(id));
|
| if (registered_component) {
|
| components->push_back(*registered_component);
|
| + if (id == kRecoveryComponentId) {
|
| + // Override the installer attributes for the recovery component in the
|
| + // components which will be checked for updates.
|
| + update_client::CrxComponent& recovery_component(components->back());
|
| + recovery_component.installer_attributes =
|
| + GetInstallerAttributesForRecoveryComponentInstaller(
|
| + recovery_component);
|
| + }
|
| }
|
| }
|
| }
|
| @@ -415,6 +428,25 @@ void CrxUpdateService::OnEvent(Events event, const std::string& id) {
|
| }
|
| }
|
|
|
| +update_client::InstallerAttributes
|
| +CrxUpdateService::GetInstallerAttributesForRecoveryComponentInstaller(
|
| + const CrxComponent& crx_component) const {
|
| + update_client::InstallerAttributes installer_attributes;
|
| +#if defined(OS_WIN)
|
| + DCHECK_EQ("recovery", crx_component.name);
|
| +
|
| + const bool is_machine =
|
| + crx_component.installer_attributes.count("ismachine") &&
|
| + crx_component.installer_attributes.at("ismachine") == "1";
|
| +
|
| + auto updater_state(UpdaterState::Create(is_machine));
|
| + if (updater_state) {
|
| + installer_attributes = updater_state->MakeInstallerAttributes();
|
| + }
|
| +#endif
|
| + return installer_attributes;
|
| +}
|
| +
|
| ///////////////////////////////////////////////////////////////////////////////
|
|
|
| // The component update factory. Using the component updater as a singleton
|
|
|