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

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

Issue 412003003: Additional metrics for disabled extensions and content verification (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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_system_impl.cc
diff --git a/chrome/browser/extensions/extension_system_impl.cc b/chrome/browser/extensions/extension_system_impl.cc
index 14a4dfe8d6b87075a38119b4c6666de79be6f2e2..1f8ada2f17472321f94b086a34ac7e7eee9116ad 100644
--- a/chrome/browser/extensions/extension_system_impl.cc
+++ b/chrome/browser/extensions/extension_system_impl.cc
@@ -10,6 +10,7 @@
#include "base/files/file_path.h"
#include "base/memory/weak_ptr.h"
#include "base/metrics/field_trial.h"
+#include "base/metrics/histogram.h"
#include "base/strings/string_tokenizer.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/content_settings/cookie_settings.h"
@@ -227,12 +228,19 @@ class ContentVerifierDelegateImpl : public ContentVerifierDelegate {
return;
ExtensionRegistry* registry = ExtensionRegistry::Get(service_->profile());
const Extension* extension =
- registry->GetExtensionById(extension_id, ExtensionRegistry::EVERYTHING);
+ registry->GetExtensionById(extension_id, ExtensionRegistry::ENABLED);
if (!extension)
return;
Mode mode = ShouldBeVerified(*extension);
- if (mode >= ContentVerifierDelegate::ENFORCE)
+ if (mode >= ContentVerifierDelegate::ENFORCE) {
service_->DisableExtension(extension_id, Extension::DISABLE_CORRUPTED);
+ ExtensionPrefs::Get(service_->profile())
+ ->IncrementCorruptedDisableCount();
+ UMA_HISTOGRAM_BOOLEAN("Extensions.CorruptExtensionBecameDisabled", true);
+ } else if (!ContainsKey(would_be_disabled_ids_, extension_id)) {
Ken Rockot(use gerrit already) 2014/07/24 03:56:01 Your choice between readability vs efficiency here
asargent_no_longer_on_chrome 2014/07/24 17:08:12 I'm going to pick readability, since this won't be
+ UMA_HISTOGRAM_BOOLEAN("Extensions.CorruptExtensionWouldBeDisabled", true);
+ would_be_disabled_ids_.insert(extension_id);
+ }
}
static Mode GetDefaultMode() {
@@ -287,6 +295,11 @@ class ContentVerifierDelegateImpl : public ContentVerifierDelegate {
private:
base::WeakPtr<ExtensionService> service_;
ContentVerifierDelegate::Mode default_mode_;
+
+ // For reporting metrics in BOOTSTRAP mode, when an extension would be
+ // disabled if content verification was in ENFORCE mode.
+ std::set<std::string> would_be_disabled_ids_;
+
DISALLOW_COPY_AND_ASSIGN(ContentVerifierDelegateImpl);
};
« no previous file with comments | « no previous file | chrome/browser/extensions/installed_loader.cc » ('j') | chrome/browser/extensions/installed_loader.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698