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

Unified Diff: chrome/browser/extensions/extension_service.cc

Issue 2839373003: struct UnloadedExtensionInfo -> enum UnloadedExtensionInfoReason (Closed)
Patch Set: Rebase Created 3 years, 8 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
Index: chrome/browser/extensions/extension_service.cc
diff --git a/chrome/browser/extensions/extension_service.cc b/chrome/browser/extensions/extension_service.cc
index 7f8b30c99bc5ea212e9c7551cd9b1a72eafa1a5d..ad71689d7a0f1542241593dd9f90dea75aed5374 100644
--- a/chrome/browser/extensions/extension_service.cc
+++ b/chrome/browser/extensions/extension_service.cc
@@ -133,7 +133,7 @@ using extensions::PermissionIDSet;
using extensions::PermissionSet;
using extensions::SharedModuleInfo;
using extensions::SharedModuleService;
-using extensions::UnloadedExtensionInfo;
+using extensions::UnloadedExtensionReason;
namespace {
@@ -821,7 +821,7 @@ bool ExtensionService::UninstallExtension(
// Unload before doing more cleanup to ensure that nothing is hanging on to
// any of these resources.
- UnloadExtension(extension->id(), UnloadedExtensionInfo::REASON_UNINSTALL);
+ UnloadExtension(extension->id(), UnloadedExtensionReason::UNINSTALL);
if (registry_->blacklisted_extensions().Contains(extension->id()))
registry_->RemoveBlacklisted(extension->id());
@@ -991,7 +991,7 @@ void ExtensionService::DisableExtension(const std::string& extension_id,
registry_->AddDisabled(make_scoped_refptr(extension));
if (registry_->enabled_extensions().Contains(extension->id())) {
registry_->RemoveEnabled(extension->id());
- NotifyExtensionUnloaded(extension, UnloadedExtensionInfo::REASON_DISABLE);
+ NotifyExtensionUnloaded(extension, UnloadedExtensionReason::DISABLE);
} else {
registry_->RemoveTerminated(extension->id());
}
@@ -1049,7 +1049,7 @@ void ExtensionService::BlockAllExtensions() {
registry_->RemoveTerminated(id);
registry_->AddBlocked(extension.get());
- UnloadExtension(id, extensions::UnloadedExtensionInfo::REASON_LOCK_ALL);
+ UnloadExtension(id, extensions::UnloadedExtensionReason::LOCK_ALL);
}
}
@@ -1169,9 +1169,8 @@ void ExtensionService::OnExtensionRegisteredWithRequestContexts(
registry_->TriggerOnReady(extension.get());
}
-void ExtensionService::NotifyExtensionUnloaded(
- const Extension* extension,
- UnloadedExtensionInfo::Reason reason) {
+void ExtensionService::NotifyExtensionUnloaded(const Extension* extension,
+ UnloadedExtensionReason reason) {
registry_->TriggerOnUnloaded(extension, reason);
renderer_helper_->OnExtensionUnloaded(*extension);
@@ -1287,7 +1286,7 @@ void ExtensionService::CheckManagementPolicy() {
}
for (const std::string& id : to_unload)
- UnloadExtension(id, UnloadedExtensionInfo::REASON_DISABLE);
+ UnloadExtension(id, UnloadedExtensionReason::DISABLE);
for (const auto& i : to_disable)
DisableExtension(i.first, i.second);
@@ -1402,9 +1401,8 @@ void ExtensionService::OnAllExternalProvidersReady() {
external_install_manager_->UpdateExternalExtensionAlert();
}
-void ExtensionService::UnloadExtension(
- const std::string& extension_id,
- UnloadedExtensionInfo::Reason reason) {
+void ExtensionService::UnloadExtension(const std::string& extension_id,
+ UnloadedExtensionReason reason) {
// Make sure the extension gets deleted after we return from this function.
int include_mask =
ExtensionRegistry::EVERYTHING & ~ExtensionRegistry::TERMINATED;
@@ -1451,7 +1449,7 @@ void ExtensionService::RemoveComponentExtension(
const std::string& extension_id) {
scoped_refptr<const Extension> extension(
GetExtensionById(extension_id, false));
- UnloadExtension(extension_id, UnloadedExtensionInfo::REASON_UNINSTALL);
+ UnloadExtension(extension_id, UnloadedExtensionReason::UNINSTALL);
if (extension.get()) {
ExtensionRegistry::Get(profile_)->TriggerOnUninstalled(
extension.get(), extensions::UNINSTALL_REASON_COMPONENT_REMOVED);
@@ -1568,7 +1566,7 @@ void ExtensionService::AddExtension(const Extension* extension) {
if (is_extension_loaded && !reloading) {
// To upgrade an extension in place, unload the old one and then load the
// new one. ReloadExtension disables the extension, which is sufficient.
- UnloadExtension(extension->id(), UnloadedExtensionInfo::REASON_UPDATE);
+ UnloadExtension(extension->id(), UnloadedExtensionReason::UPDATE);
}
if (extension_prefs_->IsExtensionBlacklisted(extension->id())) {
@@ -2077,7 +2075,7 @@ void ExtensionService::TrackTerminatedExtension(
// No need to check for duplicates; inserting a duplicate is a no-op.
registry_->AddTerminated(make_scoped_refptr(extension));
- UnloadExtension(extension->id(), UnloadedExtensionInfo::REASON_TERMINATE);
+ UnloadExtension(extension->id(), UnloadedExtensionReason::TERMINATE);
}
void ExtensionService::TerminateExtension(const std::string& extension_id) {
@@ -2471,7 +2469,7 @@ void ExtensionService::UpdateBlacklistedExtensions(
registry_->AddBlacklisted(extension);
extension_prefs_->SetExtensionBlacklistState(
extension->id(), extensions::BLACKLISTED_MALWARE);
- UnloadExtension(*it, UnloadedExtensionInfo::REASON_BLACKLIST);
+ UnloadExtension(*it, UnloadedExtensionReason::BLACKLIST);
UMA_HISTOGRAM_ENUMERATION("ExtensionBlacklist.BlacklistInstalled",
extension->location(), Manifest::NUM_LOCATIONS);
}
@@ -2565,6 +2563,6 @@ void ExtensionService::OnProfileDestructionStarted() {
for (ExtensionIdSet::iterator it = ids_to_unload.begin();
it != ids_to_unload.end();
++it) {
- UnloadExtension(*it, UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN);
+ UnloadExtension(*it, UnloadedExtensionReason::PROFILE_SHUTDOWN);
}
}
« no previous file with comments | « chrome/browser/extensions/extension_service.h ('k') | chrome/browser/extensions/extension_service_test_with_install.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698