From ac875371b19514403ddf6eaf10fb80e7d94ea6a2 Mon Sep 17 00:00:00 2001 From: "kalman@chromium.org" Date: Thu, 28 Feb 2013 04:36:09 +0000 Subject: Add UMA for extension blacklisting. R=mpcomplete@chromium.org BUG=178122 Review URL: https://chromiumcodereview.appspot.com/12386003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@185156 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/extensions/crx_installer.cc | 3 +++ chrome/browser/extensions/extension_service.cc | 12 ++++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) (limited to 'chrome/browser/extensions') diff --git a/chrome/browser/extensions/crx_installer.cc b/chrome/browser/extensions/crx_installer.cc index 489b344..6179662 100644 --- a/chrome/browser/extensions/crx_installer.cc +++ b/chrome/browser/extensions/crx_installer.cc @@ -42,6 +42,7 @@ #include "chrome/common/extensions/extension_file_util.h" #include "chrome/common/extensions/extension_icon_set.h" #include "chrome/common/extensions/feature_switch.h" +#include "chrome/common/extensions/manifest.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/resource_dispatcher_host.h" @@ -658,6 +659,8 @@ void CrxInstaller::HandleIsBlacklistedResponse( extensions::CrxInstallerError(error)); // Show error via reporter to make tests happy. ExtensionErrorReporter::GetInstance()->ReportError(error, false); // quiet + UMA_HISTOGRAM_ENUMERATION("ExtensionBlacklist.BlockCRX", + extension_->location(), Manifest::NUM_LOCATIONS); } else { on_success.Run(); } diff --git a/chrome/browser/extensions/extension_service.cc b/chrome/browser/extensions/extension_service.cc index a64dfab..c333ae1 100644 --- a/chrome/browser/extensions/extension_service.cc +++ b/chrome/browser/extensions/extension_service.cc @@ -86,6 +86,7 @@ #include "chrome/common/extensions/extension_resource.h" #include "chrome/common/extensions/feature_switch.h" #include "chrome/common/extensions/features/feature.h" +#include "chrome/common/extensions/manifest.h" #include "chrome/common/extensions/manifest_url_handler.h" #include "chrome/common/pref_names.h" #include "chrome/common/startup_metric_utils.h" @@ -2081,10 +2082,9 @@ void ExtensionService::AddExtension(const Extension* extension) { MaybeWipeout(extension); if (extension_prefs_->IsExtensionBlacklisted(extension->id())) { - // Don't check the Blacklist yet because it's asynchronous (we do it at - // the end). This pre-emptive check is because we will always store the - // blacklisted state of *installed* extensions in prefs, and it's important - // not to re-enable blacklisted extensions. + // Only prefs is checked for the blacklist. We rely on callers to check the + // blacklist before calling into here, e.g. CrxInstaller checks before + // installation, we check when loading installed extensions. blacklisted_extensions_.Insert(extension); } else if (extension_prefs_->IsExtensionDisabled(extension->id())) { disabled_extensions_.Insert(extension); @@ -3112,6 +3112,8 @@ void ExtensionService::ManageBlacklist( continue; blacklisted_extensions_.Remove(*it); AddExtension(extension); + UMA_HISTOGRAM_ENUMERATION("ExtensionBlacklist.UnblacklistInstalled", + extension->location(), Manifest::NUM_LOCATIONS); } for (std::set::iterator it = not_yet_blacklisted.begin(); @@ -3122,6 +3124,8 @@ void ExtensionService::ManageBlacklist( continue; blacklisted_extensions_.Insert(extension); UnloadExtension(*it, extension_misc::UNLOAD_REASON_BLACKLIST); + UMA_HISTOGRAM_ENUMERATION("ExtensionBlacklist.BlacklistInstalled", + extension->location(), Manifest::NUM_LOCATIONS); } IdentifyAlertableExtensions(); -- cgit v1.1