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

Unified Diff: components/update_client/update_checker.cc

Issue 2252093002: Add support for Omaha cohorts to the component updater. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix unit test 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
« no previous file with comments | « components/update_client/persisted_data_unittest.cc ('k') | components/update_client/update_response.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/update_client/update_checker.cc
diff --git a/components/update_client/update_checker.cc b/components/update_client/update_checker.cc
index a5ec2662f4b4e8ba0bf4045c659c1f1f8ba3e7a8..c1cf4d7fce8dded3a25452e2829cc1cfbbadefeb 100644
--- a/components/update_client/update_checker.cc
+++ b/components/update_client/update_checker.cc
@@ -91,6 +91,15 @@ std::string BuildUpdateCheckRequest(const Configurator& config,
base::StringAppendF(&app, " %s=\"%s\"", attr.first.c_str(),
attr.second.c_str());
}
+ const std::string cohort = metadata->GetCohort(item->id);
+ const std::string cohort_name = metadata->GetCohortName(item->id);
+ const std::string cohort_hint = metadata->GetCohortHint(item->id);
+ if (!cohort.empty())
+ base::StringAppendF(&app, " cohort=\"%s\"", cohort.c_str());
+ if (!cohort_name.empty())
+ base::StringAppendF(&app, " cohortname=\"%s\"", cohort_name.c_str());
+ if (!cohort_hint.empty())
+ base::StringAppendF(&app, " cohorthint=\"%s\"", cohort_hint.c_str());
base::StringAppendF(&app, ">");
base::StringAppendF(&app, "<updatecheck");
@@ -203,6 +212,17 @@ void UpdateCheckerImpl::OnRequestSenderComplete(
int daynum = update_response.results().daystart_elapsed_days;
if (daynum != UpdateResponse::kNoDaystart)
metadata_->SetDateLastRollCall(*ids_checked, daynum);
+ for (const auto& result : update_response.results().list) {
+ auto entry = result.cohort_attrs.find(UpdateResponse::Result::kCohort);
+ if (entry != result.cohort_attrs.end())
+ metadata_->SetCohort(result.extension_id, entry->second);
+ entry = result.cohort_attrs.find(UpdateResponse::Result::kCohortName);
+ if (entry != result.cohort_attrs.end())
+ metadata_->SetCohortName(result.extension_id, entry->second);
+ entry = result.cohort_attrs.find(UpdateResponse::Result::kCohortHint);
+ if (entry != result.cohort_attrs.end())
+ metadata_->SetCohortHint(result.extension_id, entry->second);
+ }
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE, base::Bind(update_check_callback_, error,
update_response.results(), retry_after_sec));
« no previous file with comments | « components/update_client/persisted_data_unittest.cc ('k') | components/update_client/update_response.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698