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

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

Issue 273253002: Add UMA to track the extensions (and friends) which have been allowed in (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nit Created 6 years, 7 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
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/installed_loader.cc
diff --git a/chrome/browser/extensions/installed_loader.cc b/chrome/browser/extensions/installed_loader.cc
index 240616074637dd2a589c2a1fb281b352741c1482..d1236038e54de3899f8538363caf1d7a3307c5b8 100644
--- a/chrome/browser/extensions/installed_loader.cc
+++ b/chrome/browser/extensions/installed_loader.cc
@@ -14,6 +14,7 @@
#include "chrome/browser/extensions/extension_action_manager.h"
#include "chrome/browser/extensions/extension_error_reporter.h"
#include "chrome/browser/extensions/extension_service.h"
+#include "chrome/browser/extensions/extension_util.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/extensions/api/managed_mode_private/managed_mode_handler.h"
@@ -191,6 +192,7 @@ void InstalledLoader::LoadAllExtensions() {
base::TimeTicks start_time = base::TimeTicks::Now();
+ Profile* profile = extension_service_->profile();
scoped_ptr<ExtensionPrefs::ExtensionsInfo> extensions_info(
extension_prefs_->GetInstalledExtensionsInfo());
@@ -230,7 +232,7 @@ void InstalledLoader::LoadAllExtensions() {
ExtensionErrorReporter::GetInstance()->ReportLoadError(
info->extension_path,
error,
- extension_service_->profile(),
+ profile,
false); // Be quiet.
continue;
}
@@ -259,10 +261,49 @@ void InstalledLoader::LoadAllExtensions() {
UMA_HISTOGRAM_COUNTS_100("Extensions.ManifestReloadNeedsRelocalization",
reload_reason_counts[NEEDS_RELOCALIZATION]);
- UMA_HISTOGRAM_COUNTS_100("Extensions.LoadAll",
- extension_registry_->enabled_extensions().size());
- UMA_HISTOGRAM_COUNTS_100("Extensions.Disabled",
- extension_registry_->disabled_extensions().size());
+ const ExtensionSet& enabled = extension_registry_->enabled_extensions();
+ const ExtensionSet& disabled = extension_registry_->disabled_extensions();
Devlin 2014/05/09 22:45:25 why store disabled? Only used on line 268, right?
not at google - send to devlin 2014/05/09 22:58:56 harmony. but I can revert.
+
+ UMA_HISTOGRAM_COUNTS_100("Extensions.LoadAll", enabled.size());
+ UMA_HISTOGRAM_COUNTS_100("Extensions.Disabled", disabled.size());
+
+ // Gather stats about the extensions which have/have-not been enabled for
+ // incognito and file access in chrome://extensions.
+ int incognito = 0, not_incognito = 0, file_access = 0, not_file_access = 0;
Devlin 2014/05/09 22:45:25 chrome style: one variable per line.
Devlin 2014/05/09 22:45:25 nit: seems like these are conceptually a size_t.
not at google - send to devlin 2014/05/09 22:58:56 Done, though I'm not totally sure about this one.
+
+ for (ExtensionSet::const_iterator it = enabled.begin();
Devlin 2014/05/09 22:45:25 Do we only care about enabled extensions?
not at google - send to devlin 2014/05/09 22:58:56 Yeah I was thinking about this. I wasn't entirely
+ it != enabled.end();
+ ++it) {
+ const Extension& e = **it;
+
+ // Skip unpacked extensions because they get file access up-front, and
+ // the data isn't useful. Skip anything that doesn't appear in settings.
+ if (e.location() == Manifest::UNPACKED ||
+ !e.ShouldDisplayInExtensionSettings()) {
+ continue;
+ }
+
+ if (e.can_be_incognito_enabled()) {
+ if (util::IsIncognitoEnabled(e.id(), profile)) {
+ ++incognito;
+ } else {
Devlin 2014/05/09 22:45:25 nit: no braces around single-line ifs/elses
not at google - send to devlin 2014/05/09 22:58:56 haha If you insist.
+ ++not_incognito;
+ }
+ }
+
+ if (e.wants_file_access()) {
+ if (util::AllowFileAccess(e.id(), profile)) {
+ ++file_access;
+ } else {
+ ++not_file_access;
+ }
+ }
+ }
+
+ UMA_HISTOGRAM_COUNTS_100("Extensions.IncognitoAllowed", incognito);
+ UMA_HISTOGRAM_COUNTS_100("Extensions.IncognitoNotAllowed", not_incognito);
+ UMA_HISTOGRAM_COUNTS_100("Extensions.FileAccessAllowed", file_access);
+ UMA_HISTOGRAM_COUNTS_100("Extensions.FileAccessNotAllowed", not_file_access);
UMA_HISTOGRAM_TIMES("Extensions.LoadAllTime",
base::TimeTicks::Now() - start_time);
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698