Commit f2460745 authored by Oleg Davydov's avatar Oleg Davydov Committed by Commit Bot

[Extensions] Use ExtensionId in ExtensionUpdater

Replace std::string with ExtensionId in extension_updater.{cc,h} where
applicable. This is a follow-up to https://crrev.com/c/2503690.

Bug: None
Change-Id: Idff56f4e5f6eb900834e355c62b2c8a8d3044521
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2516859
Auto-Submit: Oleg Davydov <burunduk@chromium.org>
Commit-Queue: Devlin <rdevlin.cronin@chromium.org>
Reviewed-by: default avatarDevlin <rdevlin.cronin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#823825}
parent 9e5083e7
......@@ -282,7 +282,7 @@ void ExtensionUpdater::DoCheckSoon() {
void ExtensionUpdater::AddToDownloader(
const ExtensionSet* extensions,
const std::list<std::string>& pending_ids,
const std::list<ExtensionId>& pending_ids,
int request_id,
ManifestFetchData::FetchPriority fetch_priority,
ExtensionUpdateCheckParams* update_check_params) {
......@@ -291,7 +291,7 @@ void ExtensionUpdater::AddToDownloader(
for (ExtensionSet::const_iterator extension_iter = extensions->begin();
extension_iter != extensions->end(); ++extension_iter) {
const Extension& extension = **extension_iter;
const std::string& extension_id = extension.id();
const ExtensionId& extension_id = extension.id();
if (!Manifest::IsAutoUpdateableLocation(extension.location())) {
VLOG(2) << "Extension " << extension_id << " is not auto updateable";
continue;
......@@ -337,7 +337,7 @@ void ExtensionUpdater::CheckNow(CheckParams params) {
const PendingExtensionManager* pending_extension_manager =
service_->pending_extension_manager();
std::list<std::string> pending_ids;
std::list<ExtensionId> pending_ids;
ExtensionUpdateCheckParams update_check_params;
if (params.ids.empty()) {
......@@ -352,7 +352,7 @@ void ExtensionUpdater::CheckNow(CheckParams params) {
// If no extension ids are specified, check for updates for all extensions.
pending_extension_manager->GetPendingIdsForUpdateCheck(&pending_ids);
for (const std::string& pending_id : pending_ids) {
for (const ExtensionId& pending_id : pending_ids) {
const PendingExtensionInfo* info =
pending_extension_manager->GetById(pending_id);
if (!Manifest::IsAutoUpdateableLocation(info->install_source())) {
......@@ -392,7 +392,7 @@ void ExtensionUpdater::CheckNow(CheckParams params) {
AddToDownloader(&remotely_disabled_extensions, pending_ids, request_id,
params.fetch_priority, &update_check_params);
} else {
for (const std::string& id : params.ids) {
for (const ExtensionId& id : params.ids) {
const Extension* extension = registry_->GetExtensionById(
id, extensions::ExtensionRegistry::EVERYTHING);
if (extension) {
......@@ -583,7 +583,7 @@ void ExtensionUpdater::UpdatePingData(const ExtensionId& id,
void ExtensionUpdater::PutExtensionInCache(const CRXFileInfo& crx_info) {
if (extension_cache_) {
const std::string& extension_id = crx_info.extension_id;
const ExtensionId& extension_id = crx_info.extension_id;
const base::Version& expected_version = crx_info.expected_version;
const std::string& expected_hash = crx_info.expected_hash;
const base::FilePath& crx_path = crx_info.path;
......@@ -607,7 +607,7 @@ void ExtensionUpdater::CleanUpCrxFileIfNeeded(const base::FilePath& crx_path,
}
bool ExtensionUpdater::CanUseUpdateService(
const std::string& extension_id) const {
const ExtensionId& extension_id) const {
if (g_force_use_update_service_for_tests)
return true;
......
......@@ -24,6 +24,7 @@
#include "extensions/browser/updater/extension_downloader_delegate.h"
#include "extensions/browser/updater/manifest_fetch_data.h"
#include "extensions/browser/updater/update_service.h"
#include "extensions/common/extension_id.h"
#include "url/gurl.h"
class PrefService;
......@@ -70,7 +71,7 @@ class ExtensionUpdater : public ExtensionDownloaderDelegate,
// The set of extensions that should be checked for updates. If empty
// all extensions will be included in the update check.
std::list<std::string> ids;
std::list<ExtensionId> ids;
// Normally extension updates get installed only when the extension is idle.
// Setting this to true causes any updates that are found to be installed
......@@ -187,7 +188,7 @@ class ExtensionUpdater : public ExtensionDownloaderDelegate,
bool awaiting_update_service = false;
FinishedCallback callback;
// The ids of extensions that have in-progress update checks.
std::set<std::string> in_progress_ids_;
std::set<ExtensionId> in_progress_ids_;
};
// Ensure that we have a valid ExtensionDownloader instance referenced by
......@@ -201,7 +202,7 @@ class ExtensionUpdater : public ExtensionDownloaderDelegate,
// Add fetch records for extensions that are installed to the downloader,
// ignoring |pending_ids| so the extension isn't fetched again.
void AddToDownloader(const ExtensionSet* extensions,
const std::list<std::string>& pending_ids,
const std::list<ExtensionId>& pending_ids,
int request_id,
ManifestFetchData::FetchPriority fetch_priority,
ExtensionUpdateCheckParams* update_check_params);
......@@ -254,7 +255,7 @@ class ExtensionUpdater : public ExtensionDownloaderDelegate,
// |udpate_service_| will execute this function on finish.
void OnUpdateServiceFinished(int request_id);
void ExtensionCheckFinished(const std::string& extension_id,
void ExtensionCheckFinished(const ExtensionId& extension_id,
FinishedCallback callback);
// Callback set in the crx installer and invoked when the crx file has passed
......@@ -268,7 +269,7 @@ class ExtensionUpdater : public ExtensionDownloaderDelegate,
// This function verifies if |extension_id| can be updated using
// UpdateService.
bool CanUseUpdateService(const std::string& extension_id) const;
bool CanUseUpdateService(const ExtensionId& extension_id) const;
// Whether Start() has been called but not Stop().
bool alive_ = false;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment