diff options
author | sorin@chromium.org <sorin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-07-22 19:47:43 +0000 |
---|---|---|
committer | sorin@chromium.org <sorin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-07-22 19:47:43 +0000 |
commit | 277e3eef9cc587a9559774586669e8f8304fdebd (patch) | |
tree | 3684365867fdb222b4dc69eee73bb3c88f61014d | |
parent | 89fe8ded238f3c1df3b0ba72aa808d3839c978f9 (diff) | |
download | chromium_src-277e3eef9cc587a9559774586669e8f8304fdebd.zip chromium_src-277e3eef9cc587a9559774586669e8f8304fdebd.tar.gz chromium_src-277e3eef9cc587a9559774586669e8f8304fdebd.tar.bz2 |
Merge 281369 "Update the version on chrome://components after a ..."
> Update the version on chrome://components after a successful update.
>
> BUG=389363
>
> Review URL: https://codereview.chromium.org/362063003
TBR=sorin@chromium.org
Review URL: https://codereview.chromium.org/408323004
git-svn-id: svn://svn.chromium.org/chrome/branches/2062/src@284758 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/component_updater/component_updater_service.cc | 32 | ||||
-rw-r--r-- | chrome/browser/resources/components.html | 3 | ||||
-rw-r--r-- | chrome/browser/resources/components.js | 3 | ||||
-rw-r--r-- | chrome/browser/ui/webui/components_ui.cc | 10 |
4 files changed, 33 insertions, 15 deletions
diff --git a/chrome/browser/component_updater/component_updater_service.cc b/chrome/browser/component_updater/component_updater_service.cc index 94ae2b3..e479c08 100644 --- a/chrome/browser/component_updater/component_updater_service.cc +++ b/chrome/browser/component_updater/component_updater_service.cc @@ -603,8 +603,6 @@ bool CrxUpdateService::CheckForUpdates() { << ", time_since_last_checked=" << time_since_last_checked.InSeconds() << " seconds"; - ChangeItemState(item, CrxUpdateItem::kChecking); - item->last_check = now; item->crx_urls.clear(); item->crx_diffurls.clear(); @@ -622,6 +620,8 @@ bool CrxUpdateService::CheckForUpdates() { item->download_metrics.clear(); items_to_check.push_back(item); + + ChangeItemState(item, CrxUpdateItem::kChecking); } if (items_to_check.empty()) @@ -928,14 +928,14 @@ void CrxUpdateService::DoneInstalling(const std::string& component_id, } if (is_success) { - ChangeItemState(item, CrxUpdateItem::kUpdated); item->component.version = item->next_version; item->component.fingerprint = item->next_fp; + ChangeItemState(item, CrxUpdateItem::kUpdated); } else { - ChangeItemState(item, CrxUpdateItem::kNoUpdate); item->error_category = error_category; item->error_code = error; item->extra_code1 = extra_code; + ChangeItemState(item, CrxUpdateItem::kNoUpdate); } ping_manager_->OnUpdateComplete(item); @@ -1006,17 +1006,23 @@ ComponentUpdateService::Status CrxUpdateService::OnDemandUpdateInternal( 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. - if (service_status == kInProgress) - return service_status; - - // Otherwise the item was already checked a while back (or it is new), - // set its status to kNew to give it a slightly higher priority. - ChangeItemState(uit, CrxUpdateItem::kNew); uit->on_demand = true; + // If there is an update available for this item, then continue processing + // the update. This is an artifact of how update checks are done: in addition + // to the on-demand item, the update check may include other items as well. + if (uit->status != CrxUpdateItem::kCanUpdate) { + 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. + if (service_status == kInProgress) + return service_status; + + // Otherwise the item was already checked a while back (or it is new), + // set its status to kNew to give it a slightly higher priority. + ChangeItemState(uit, CrxUpdateItem::kNew); + } + // In case the current delay is long, set the timer to a shorter value // to get the ball rolling. if (timer_.IsRunning()) { diff --git a/chrome/browser/resources/components.html b/chrome/browser/resources/components.html index de5e9c6..b7dfded 100644 --- a/chrome/browser/resources/components.html +++ b/chrome/browser/resources/components.html @@ -47,7 +47,8 @@ </span> <span> - <span i18n-content="componentVersion"></span> - <span dir="ltr" jscontent="version"></span> + <span dir="ltr" jscontent="version" + jsvalues=".id: 'version-' + id"></span> </span> </div> </div> diff --git a/chrome/browser/resources/components.js b/chrome/browser/resources/components.js index 036fe5b..64b6e3a 100644 --- a/chrome/browser/resources/components.js +++ b/chrome/browser/resources/components.js @@ -86,6 +86,9 @@ function onComponentEvent(eventArgs) { var id = eventArgs['id']; $('status-' + id).textContent = eventArgs['event']; } + if (eventArgs['version']) { + $('version-' + id).textContent = eventArgs['version']; + } } /** diff --git a/chrome/browser/ui/webui/components_ui.cc b/chrome/browser/ui/webui/components_ui.cc index c439f73..705a755 100644 --- a/chrome/browser/ui/webui/components_ui.cc +++ b/chrome/browser/ui/webui/components_ui.cc @@ -241,7 +241,15 @@ base::string16 ComponentsUI::ServiceStatusToString( void ComponentsUI::OnEvent(Events event, const std::string& id) { base::DictionaryValue parameters; parameters.SetString("event", ComponentEventToString(event)); - if (!id.empty()) + if (!id.empty()) { + using component_updater::ComponentUpdateService; + if (event == ComponentUpdateService::Observer::COMPONENT_UPDATED) { + ComponentUpdateService* cus = g_browser_process->component_updater(); + component_updater::CrxUpdateItem item; + if (cus->GetComponentDetails(id, &item)) + parameters.SetString("version", item.component.version.GetString()); + } parameters.SetString("id", id); + } web_ui()->CallJavascriptFunction("onComponentEvent", parameters); } |