Chromium Code Reviews| 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 367ff6e7d5ec326a0ca0d6807f36c76b4e5d3cd2..6b0d7f766105353beb7013bae162c0df6e6d30f6 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; |
| @@ -381,7 +385,9 @@ class CrxUpdateService : public ComponentUpdateService { |
| // See ManifestParserBridge. |
| void OnParseUpdateManifestFailed(const std::string& error_message); |
| - bool AddItemToUpdateCheck(CrxUpdateItem* item, std::string* query); |
| + bool AddItemToUpdateCheck(CrxUpdateItem* item, |
| + bool ondemand, |
| + std::string* query); |
| void ProcessPendingItems(); |
| @@ -571,11 +577,14 @@ ComponentUpdateService::Status CrxUpdateService::RegisterComponent( |
| // required omaha compatible query. Returns false when the query strings |
| // is longer than specified by UrlSizeLimit(). |
| bool CrxUpdateService::AddItemToUpdateCheck(CrxUpdateItem* item, |
| + bool ondemand, |
| std::string* query) { |
| if (!AddQueryString(item->id, |
| item->component.version.GetString(), |
| item->component.fingerprint, |
| - config_->UrlSizeLimit(), query)) |
| + ondemand, |
| + config_->UrlSizeLimit(), |
| + query)) |
| return false; |
| item->status = CrxUpdateItem::kChecking; |
| @@ -590,6 +599,9 @@ bool CrxUpdateService::AddItemToUpdateCheck(CrxUpdateItem* item, |
| // Start the process of checking for an update, for a particular component |
| // that was previously registered. |
| +// If the component is still at version "0" (representing not-yet-installed), |
| +// the update check will be an "on-demand" updatecheck, which the server may |
| +// choose to handle differently. |
| ComponentUpdateService::Status CrxUpdateService::CheckForUpdateSoon( |
| const CrxComponent& component) { |
| if (component.pk_hash.empty() || |
| @@ -690,7 +702,9 @@ void CrxUpdateService::ProcessPendingItems() { |
| continue; |
| if (item->component.source != manifest_source) |
| continue; |
| - if (!AddItemToUpdateCheck(item, &query)) |
| + bool ondemand = requested_work_items_.count(item) && |
| + item->component.version.Equals(Version("0")); |
|
cpu_(ooo_6.6-7.5)
2013/06/21 00:22:56
I don't think so. This is hacky and the on-demand
waffles
2013/06/21 01:52:08
Done.
I had the Version==0 check in response to m
|
| + if (!AddItemToUpdateCheck(item, ondemand, &query)) |
| break; |
| // Requested work items may speed up the update cycle up until |
| // the point that we start an update check. I.e., transition |
| @@ -717,7 +731,7 @@ void CrxUpdateService::ProcessPendingItems() { |
| base::TimeDelta delta = base::Time::Now() - item->last_check; |
| if (delta < min_delta_time) |
| continue; |
| - if (!AddItemToUpdateCheck(item, &query)) |
| + if (!AddItemToUpdateCheck(item, false, &query)) |
| break; |
| } |
| @@ -733,7 +747,7 @@ void CrxUpdateService::ProcessPendingItems() { |
| base::TimeDelta delta = base::Time::Now() - item->last_check; |
| if (delta < min_delta_time) |
| continue; |
| - if (!AddItemToUpdateCheck(item, &query)) |
| + if (!AddItemToUpdateCheck(item, false, &query)) |
| break; |
| } |