Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(347)

Unified Diff: components/component_updater/component_updater_service.cc

Issue 2286483002: Serialize Google Update state as part of the recovery component update checks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove unused Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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
« no previous file with comments | « components/component_updater/BUILD.gn ('k') | components/component_updater/component_updater_service_internal.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698