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

Unified Diff: chrome/browser/component_updater/component_updater_service.cc

Issue 8122015: Component updater: send extra attributes in the request to (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 2 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: chrome/browser/component_updater/component_updater_service.cc
===================================================================
--- chrome/browser/component_updater/component_updater_service.cc (revision 103990)
+++ chrome/browser/component_updater/component_updater_service.cc (working copy)
@@ -40,11 +40,27 @@
additional = "x=" + net::EscapeQueryParamValue(additional, true);
if ((additional.size() + query->size() + 1) > limit)
return false;
- query->append(1, query->empty()? '?' : '&');
+ if (!query->empty())
+ query->append(1, '&');
query->append(additional);
return true;
}
+// Create the final omaha compatible query. The |extra| is optional and can
+// be null. It should contain top level (non-escaped) parameters.
+std::string MakeFinalQuery(const std::string& host,
+ const std::string& query,
+ const char* extra) {
+ std::string request(host);
+ request.append(1, '?');
+ if (extra) {
+ request.append(extra);
+ request.append(1, '&');
+ }
+ request.append(query);
+ return request;
+}
+
// Produces an extension-like friendly |id|. This might be removed in the
// future if we roll our on packing tools.
static std::string HexStringToID(const std::string& hexstr) {
@@ -530,8 +546,10 @@
}
// We got components to check. Start the url request.
- GURL url(config_->UpdateUrl().spec() + query);
- url_fetcher_.reset(URLFetcher::Create(0, url, URLFetcher::GET,
+ const std::string full_query = MakeFinalQuery(config_->UpdateUrl().spec(),
+ query,
+ config_->ExtraRequestParams());
+ url_fetcher_.reset(URLFetcher::Create(0, GURL(full_query), URLFetcher::GET,
MakeContextDelegate(this, new UpdateContext())));
StartFetch(url_fetcher_.get(), config_->RequestContext(), false);
}

Powered by Google App Engine
This is Rietveld 408576698