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

Side by Side 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: 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/update_client/update_checker.h" 5 #include "components/update_client/update_checker.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 27 matching lines...) Expand all
38 // <app appid="hnimpnehoodheedghdeeijklkeaacbdc" 38 // <app appid="hnimpnehoodheedghdeeijklkeaacbdc"
39 // version="0.1.2.3" installsource="ondemand"> 39 // version="0.1.2.3" installsource="ondemand">
40 // <updatecheck /> 40 // <updatecheck />
41 // <packages> 41 // <packages>
42 // <package fp="abcd" /> 42 // <package fp="abcd" />
43 // </packages> 43 // </packages>
44 // </app> 44 // </app>
45 std::string BuildUpdateCheckRequest(const Configurator& config, 45 std::string BuildUpdateCheckRequest(const Configurator& config,
46 const std::vector<CrxUpdateItem*>& items, 46 const std::vector<CrxUpdateItem*>& items,
47 const std::string& additional_attributes) { 47 const std::string& additional_attributes) {
48 const std::string brand(config.GetBrand());
48 std::string app_elements; 49 std::string app_elements;
49 for (size_t i = 0; i != items.size(); ++i) { 50 for (size_t i = 0; i != items.size(); ++i) {
50 const CrxUpdateItem* item = items[i]; 51 const CrxUpdateItem* item = items[i];
51 std::string app("<app "); 52 std::string app("<app ");
52 base::StringAppendF(&app, "appid=\"%s\" version=\"%s\"", item->id.c_str(), 53 base::StringAppendF(&app, "appid=\"%s\" version=\"%s\"", item->id.c_str(),
53 item->component.version.GetString().c_str()); 54 item->component.version.GetString().c_str());
55 if (!brand.empty())
56 base::StringAppendF(&app, " brand=\"%s\"", brand.c_str());
waffles 2016/03/22 23:01:34 Can we sanitize brand (to "^([a-zA-Z]{4})?$") befo
Sorin Jianu 2016/03/23 02:10:32 Done.
54 if (item->on_demand) 57 if (item->on_demand)
55 base::StringAppendF(&app, " installsource=\"ondemand\""); 58 base::StringAppendF(&app, " installsource=\"ondemand\"");
56 base::StringAppendF(&app, ">"); 59 base::StringAppendF(&app, ">");
57 base::StringAppendF(&app, "<updatecheck />"); 60 base::StringAppendF(&app, "<updatecheck />");
58 if (!item->component.fingerprint.empty()) { 61 if (!item->component.fingerprint.empty()) {
59 base::StringAppendF(&app, 62 base::StringAppendF(&app,
60 "<packages>" 63 "<packages>"
61 "<package fp=\"%s\"/>" 64 "<package fp=\"%s\"/>"
62 "</packages>", 65 "</packages>",
63 item->component.fingerprint.c_str()); 66 item->component.fingerprint.c_str());
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 } 151 }
149 152
150 } // namespace 153 } // namespace
151 154
152 scoped_ptr<UpdateChecker> UpdateChecker::Create( 155 scoped_ptr<UpdateChecker> UpdateChecker::Create(
153 const scoped_refptr<Configurator>& config) { 156 const scoped_refptr<Configurator>& config) {
154 return scoped_ptr<UpdateChecker>(new UpdateCheckerImpl(config)); 157 return scoped_ptr<UpdateChecker>(new UpdateCheckerImpl(config));
155 } 158 }
156 159
157 } // namespace update_client 160 } // namespace update_client
OLDNEW
« 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