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

Unified Diff: components/update_client/update_checker.cc

Issue 1823273002: Send the value of google_brand::GetBrand in component update checks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: minor unit test improvement. Created 4 years, 9 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/test_configurator.cc ('k') | components/update_client/update_checker_unittest.cc » ('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 dd851d9baf0d6ca059936ef4b704ebb0ae341b67..dc982518c71aabcf670763bf329a64d0e68fc8ca 100644
--- a/components/update_client/update_checker.cc
+++ b/components/update_client/update_checker.cc
@@ -28,6 +28,11 @@ namespace update_client {
namespace {
+// Returns a sanitized version of the brand or an empty string otherwise.
+std::string SanitizeBrand(const std::string& brand) {
+ return IsValidBrand(brand) ? brand : std::string("");
+}
+
// Builds an update check request for |components|. |additional_attributes| is
// serialized as part of the <request> element of the request to customize it
// with data that is not platform or component specific. For each |item|, a
@@ -45,12 +50,15 @@ namespace {
std::string BuildUpdateCheckRequest(const Configurator& config,
const std::vector<CrxUpdateItem*>& items,
const std::string& additional_attributes) {
+ const std::string brand(SanitizeBrand(config.GetBrand()));
std::string app_elements;
for (size_t i = 0; i != items.size(); ++i) {
const CrxUpdateItem* item = items[i];
std::string app("<app ");
base::StringAppendF(&app, "appid=\"%s\" version=\"%s\"", item->id.c_str(),
item->component.version.GetString().c_str());
+ if (!brand.empty())
+ base::StringAppendF(&app, " brand=\"%s\"", brand.c_str());
if (item->on_demand)
base::StringAppendF(&app, " installsource=\"ondemand\"");
base::StringAppendF(&app, ">");
« no previous file with comments | « components/update_client/test_configurator.cc ('k') | components/update_client/update_checker_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698