Eliminate the cooldown for direct calls to on-demand updates in CUS.
Also, restricted the access to ComponentUpdateService::GetComponentDetails
so only the friends of the ComponentUpdateService class can call it.
BUG=381199
Review URL: https://codereview.chromium.org/313373004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@275376 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/chrome/browser/component_updater/component_updater_service.cc b/chrome/browser/component_updater/component_updater_service.cc
index 2277cd2..f2518ea 100644
--- a/chrome/browser/component_updater/component_updater_service.cc
+++ b/chrome/browser/component_updater/component_updater_service.cc
@@ -201,6 +201,7 @@
const CrxDownloader::Result& download_result);
Status OnDemandUpdateInternal(CrxUpdateItem* item);
+ Status OnDemandUpdateWithCooldown(CrxUpdateItem* item);
void ProcessPendingItems();
@@ -956,7 +957,7 @@
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
// Check if we can on-demand update, else unblock the request anyway.
CrxUpdateItem* item = FindUpdateItemById(crx_id);
- Status status = OnDemandUpdateInternal(item);
+ Status status = OnDemandUpdateWithCooldown(item);
if (status == kOk || status == kInProgress) {
item->throttles.push_back(rt);
return;
@@ -972,7 +973,7 @@
return OnDemandUpdateInternal(FindUpdateItemById(component_id));
}
-ComponentUpdateService::Status CrxUpdateService::OnDemandUpdateInternal(
+ComponentUpdateService::Status CrxUpdateService::OnDemandUpdateWithCooldown(
CrxUpdateItem* uit) {
if (!uit)
return kError;
@@ -982,6 +983,14 @@
if (delta < base::TimeDelta::FromSeconds(config_->OnDemandDelay()))
return kError;
+ return OnDemandUpdateInternal(uit);
+}
+
+ComponentUpdateService::Status CrxUpdateService::OnDemandUpdateInternal(
+ CrxUpdateItem* uit) {
+ if (!uit)
+ return kError;
+
Status service_status = GetServiceStatus(uit->status);
// If the item is already in the process of being updated, there is
// no point in this call, so return kInProgress.