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

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

Issue 17419011: Implement coarse "on demand" functionality for update checks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@sync
Patch Set: Fix Windows compiler error. Created 7 years, 6 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 | « no previous file | chrome/browser/component_updater/test/component_updater_service_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/component_updater/component_updater_service.cc
diff --git a/chrome/browser/component_updater/component_updater_service.cc b/chrome/browser/component_updater/component_updater_service.cc
index a87c3da100c02a2dd8ba329d3c64c4bb924035fa..6be2c039fe7ae8904d7ba35498cf04c7f8e3aea2 100644
--- a/chrome/browser/component_updater/component_updater_service.cc
+++ b/chrome/browser/component_updater/component_updater_service.cc
@@ -63,11 +63,15 @@ const CrxComponent::UrlSource kManifestSources[] = {
bool AddQueryString(const std::string& id,
const std::string& version,
const std::string& fingerprint,
+ bool ondemand,
size_t limit,
std::string* query) {
std::string additional =
- base::StringPrintf("id=%s&v=%s&fp=%s&uc",
- id.c_str(), version.c_str(), fingerprint.c_str());
+ base::StringPrintf("id=%s&v=%s&fp=%s&uc%s",
+ id.c_str(),
+ version.c_str(),
+ fingerprint.c_str(),
+ ondemand ? "&installsource=ondemand" : "");
additional = "x=" + net::EscapeQueryParamValue(additional, true);
if ((additional.size() + query->size() + 1) > limit)
return false;
@@ -567,15 +571,20 @@ ComponentUpdateService::Status CrxUpdateService::RegisterComponent(
}
// Sets a component to be checked for updates.
-// The component to add is |crxit| and the |query| string is modified with the
-// required omaha compatible query. Returns false when the query strings
-// is longer than specified by UrlSizeLimit().
+// The component to add is |item| and the |query| string is modified with the
+// required omaha compatible query. Returns false when the query string is
+// longer than specified by UrlSizeLimit().
+// If the item is currently on the requested_work_items_ list, the update check
+// is considered to be "on-demand": the server may honor on-demand checks by
+// serving updates at 100% rather than a gated fraction.
bool CrxUpdateService::AddItemToUpdateCheck(CrxUpdateItem* item,
std::string* query) {
if (!AddQueryString(item->id,
item->component.version.GetString(),
item->component.fingerprint,
- config_->UrlSizeLimit(), query))
+ requested_work_items_.count(item) > 0, // is_ondemand
+ config_->UrlSizeLimit(),
+ query))
return false;
item->status = CrxUpdateItem::kChecking;
« no previous file with comments | « no previous file | chrome/browser/component_updater/test/component_updater_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698