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

Unified Diff: components/update_client/update_checker.cc

Issue 1872053002: Implement an API to allow passing an "ap" parameter to component updates. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 234ef225d5c44f7552b0f834f77e51bd0ac97e95..5107508c26cbbf0c9539ecd3e2fc229b4207fc6a 100644
--- a/components/update_client/update_checker.cc
+++ b/components/update_client/update_checker.cc
@@ -33,6 +33,11 @@ std::string SanitizeBrand(const std::string& brand) {
return IsValidBrand(brand) ? brand : std::string("");
}
+// Returns a sanitized version of the |ap| or an empty string otherwise.
+std::string SanitizeAp(const std::string& ap) {
+ return IsValidAp(ap) ? ap : std::string();
+}
+
// Returns true if at least one item requires network encryption.
bool IsEncryptionRequired(const std::vector<CrxUpdateItem*>& items) {
for (const auto& item : items) {
@@ -63,6 +68,7 @@ std::string BuildUpdateCheckRequest(const Configurator& config,
std::string app_elements;
for (size_t i = 0; i != items.size(); ++i) {
const CrxUpdateItem* item = items[i];
+ const std::string ap(SanitizeAp(item->component.ap));
std::string app("<app ");
base::StringAppendF(&app, "appid=\"%s\" version=\"%s\"", item->id.c_str(),
item->component.version.GetString().c_str());
@@ -70,6 +76,8 @@ std::string BuildUpdateCheckRequest(const Configurator& config,
base::StringAppendF(&app, " brand=\"%s\"", brand.c_str());
if (item->on_demand)
base::StringAppendF(&app, " installsource=\"ondemand\"");
+ if (!ap.empty())
+ base::StringAppendF(&app, " ap=\"%s\"", ap.c_str());
base::StringAppendF(&app, ">");
base::StringAppendF(&app, "<updatecheck />");
if (!item->component.fingerprint.empty()) {
« no previous file with comments | « components/component_updater/default_component_installer.h ('k') | components/update_client/update_checker_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698