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

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

Issue 16295026: Collect UMA data for extension manifest version and background page type. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 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 | no next file » | 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 155a177b2b591b59c84a1ad01121c2a7e641dd62..d9de618ff6edb101de0d8c1b0c4db2519724887e 100644
--- a/chrome/browser/extensions/installed_loader.cc
+++ b/chrome/browser/extensions/installed_loader.cc
@@ -20,6 +20,7 @@
#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"
+#include "chrome/common/extensions/background_info.h"
#include "chrome/common/extensions/extension.h"
#include "chrome/common/extensions/extension_file_util.h"
#include "chrome/common/extensions/extension_l10n_util.h"
@@ -37,6 +38,8 @@ using extensions::Manifest;
namespace errors = extension_manifest_errors;
+namespace extensions {
+
namespace {
// The following enumeration is used in histograms matching
@@ -49,6 +52,14 @@ enum ManifestReloadReason {
NUM_MANIFEST_RELOAD_REASONS
};
+// Used in histogram Extension.BackgroundPageType. Values may be added, as
+// long as existing values are not changed.
+enum BackgroundPageType {
+ NO_BACKGROUND_PAGE = 0,
+ BACKGROUND_PAGE_PERSISTENT = 1,
+ EVENT_PAGE = 2,
+};
+
ManifestReloadReason ShouldReloadExtensionManifest(const ExtensionInfo& info) {
// Always reload manifests of unpacked extensions, because they can change
// on disk independent of the manifest in our prefs.
@@ -63,6 +74,14 @@ ManifestReloadReason ShouldReloadExtensionManifest(const ExtensionInfo& info) {
return NOT_NEEDED;
}
+BackgroundPageType GetBackgroundPageType(const Extension* extension) {
+ if (!BackgroundInfo::HasBackgroundPage(extension))
+ return NO_BACKGROUND_PAGE;
+ if (BackgroundInfo::HasPersistentBackgroundPage(extension))
+ return BACKGROUND_PAGE_PERSISTENT;
+ return EVENT_PAGE;
+}
+
void DispatchOnInstalledEvent(
Profile* profile,
const std::string& extension_id,
@@ -80,8 +99,6 @@ void DispatchOnInstalledEvent(
} // namespace
-namespace extensions {
-
InstalledLoader::InstalledLoader(ExtensionService* extension_service)
: extension_service_(extension_service),
extension_prefs_(extension_service->extension_prefs()) {
@@ -281,6 +298,15 @@ void InstalledLoader::LoadAllExtensions() {
if (Manifest::IsUnpackedLocation(location))
continue;
+ UMA_HISTOGRAM_ENUMERATION("Extensions.ManifestVersion",
+ (*ex)->manifest_version(), 10);
+
+ if (type == Manifest::TYPE_EXTENSION) {
+ BackgroundPageType background_page_type = GetBackgroundPageType(*ex);
+ UMA_HISTOGRAM_ENUMERATION("Extensions.BackgroundPageType",
+ background_page_type, 10);
+ }
+
// Using an enumeration shows us the total installed ratio across all users.
// Using the totals per user at each startup tells us the distribution of
// usage for each user (e.g. 40% of users have at least one app installed).
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698