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

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: Don't serialize the attrs when they are empty. 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/update_client/update_checker.cc
diff --git a/components/update_client/update_checker.cc b/components/update_client/update_checker.cc
index a5ec2662f4b4e8ba0bf4045c659c1f1f8ba3e7a8..b1815af488eb01808c3ccad934a6dd10e07d4801 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);
Sorin Jianu 2016/08/18 21:15:15 This is a small deal and mostly a matter of person
waffles 2016/08/18 22:29:23 Done.
+ 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,14 @@ void UpdateCheckerImpl::OnRequestSenderComplete(
int daynum = update_response.results().daystart_elapsed_days;
if (daynum != UpdateResponse::kNoDaystart)
metadata_->SetDateLastRollCall(*ids_checked, daynum);
+ for (auto result : update_response.results().list) {
+ if (result.set_cohort)
+ metadata_->SetCohort(result.extension_id, result.cohort);
+ if (result.set_cohort_hint)
+ metadata_->SetCohortHint(result.extension_id, result.cohort_hint);
+ if (result.set_cohort_name)
+ metadata_->SetCohortName(result.extension_id, result.cohort_name);
+ }
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE, base::Bind(update_check_callback_, error,
update_response.results(), retry_after_sec));

Powered by Google App Engine
This is Rietveld 408576698