summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcalamity@chromium.org <calamity@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-13 05:34:18 +0000
committercalamity@chromium.org <calamity@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-13 05:34:18 +0000
commitf9c5d39d43436e9e92a4725bfba0f74d1501c0bb (patch)
treeb4e949c8be0701516bd24f5f622cab51ff7d72a7
parent5b9b2db527ce2bf6dbaf18fbd0d209caa146a9b4 (diff)
downloadchromium_src-f9c5d39d43436e9e92a4725bfba0f74d1501c0bb.zip
chromium_src-f9c5d39d43436e9e92a4725bfba0f74d1501c0bb.tar.gz
chromium_src-f9c5d39d43436e9e92a4725bfba0f74d1501c0bb.tar.bz2
Add UMA logging of extension creation flags.
This CL adds an Extensions.LoadCreationFlags UMA histogram which logs an aggregate of a user's extension's flags. BUG=None Review URL: https://codereview.chromium.org/240613004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@270029 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/extensions/installed_loader.cc14
-rw-r--r--extensions/common/extension.cc2
-rw-r--r--extensions/common/extension.h7
-rw-r--r--tools/metrics/histograms/histograms.xml22
4 files changed, 45 insertions, 0 deletions
diff --git a/chrome/browser/extensions/installed_loader.cc b/chrome/browser/extensions/installed_loader.cc
index 3a37a9c..84e126c 100644
--- a/chrome/browser/extensions/installed_loader.cc
+++ b/chrome/browser/extensions/installed_loader.cc
@@ -117,6 +117,18 @@ BackgroundPageType GetBackgroundPageType(const Extension* extension) {
return EVENT_PAGE;
}
+// Records the creation flags of an extension grouped by
+// Extension::InitFromValueFlags.
+void RecordCreationFlags(const Extension* extension) {
+ for (int i = 0; i < Extension::kInitFromValueFlagBits; ++i) {
+ int flag = 1 << i;
+ if (extension->creation_flags() & flag) {
+ UMA_HISTOGRAM_ENUMERATION(
+ "Extensions.LoadCreationFlags", i, Extension::kInitFromValueFlagBits);
+ }
+ }
+}
+
} // namespace
InstalledLoader::InstalledLoader(ExtensionService* extension_service)
@@ -419,6 +431,8 @@ void InstalledLoader::LoadAllExtensions() {
if (extensions::ManagedModeInfo::IsContentPack(ex->get()))
++content_pack_count;
+ RecordCreationFlags(*ex);
+
extension_service_->RecordPermissionMessagesHistogram(
ex->get(), "Extensions.Permissions_Load");
diff --git a/extensions/common/extension.cc b/extensions/common/extension.cc
index 39f2fb7..6bb9bd7 100644
--- a/extensions/common/extension.cc
+++ b/extensions/common/extension.cc
@@ -67,6 +67,8 @@ bool ContainsReservedCharacters(const base::FilePath& path) {
} // namespace
+const int Extension::kInitFromValueFlagBits = 11;
+
const char Extension::kMimeType[] = "application/x-chrome-extension";
const int Extension::kValidWebExtentSchemes =
diff --git a/extensions/common/extension.h b/extensions/common/extension.h
index 10df63c..2d7b2aa 100644
--- a/extensions/common/extension.h
+++ b/extensions/common/extension.h
@@ -118,6 +118,8 @@ class Extension : public base::RefCountedThreadSafe<Extension> {
virtual ~ManifestData() {}
};
+ // Do not change the order of entries or remove entries in this list
+ // as this is used in UMA_HISTOGRAM_ENUMERATIONs about extensions.
enum InitFromValueFlags {
NO_FLAGS = 0,
@@ -170,8 +172,13 @@ class Extension : public base::RefCountedThreadSafe<Extension> {
// be placed in a special OEM folder in the App Launcher. Note: OEM apps are
// also installed by Default (i.e. WAS_INSTALLED_BY_DEFAULT is also true).
WAS_INSTALLED_BY_OEM = 1 << 10,
+
+ // When adding new flags, make sure to update kInitFromValueFlagBits.
};
+ // This is the highest bit index of the flags defined above.
+ static const int kInitFromValueFlagBits;
+
static scoped_refptr<Extension> Create(const base::FilePath& path,
Manifest::Location location,
const base::DictionaryValue& value,
diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml
index c6d3230..562a280 100644
--- a/tools/metrics/histograms/histograms.xml
+++ b/tools/metrics/histograms/histograms.xml
@@ -6218,6 +6218,14 @@ Therefore, the affected-histogram name has to have at least one dot in it.
</summary>
</histogram>
+<histogram name="Extensions.LoadCreationFlags" enum="ExtensionCreationFlags">
+ <owner>calamity@chromium.org</owner>
+ <summary>
+ The creation flags of all extensions loaded at startup time grouped by
+ Extension::InitFromValueFlags.
+ </summary>
+</histogram>
+
<histogram name="Extensions.LoadExtension">
<owner>Please list the metric's owners. Add more owner tags as needed.</owner>
<summary>The number of extensions loaded at browser startup.</summary>
@@ -33478,6 +33486,20 @@ Therefore, the affected-histogram name has to have at least one dot in it.
<int value="2" label="Event Page"/>
</enum>
+<enum name="ExtensionCreationFlags" type="int">
+ <int value="0" label="REQUIRE_KEY"/>
+ <int value="1" label="REQUIRE_MODERN_MANIFEST_VERSION"/>
+ <int value="2" label="ALLOW_FILE_ACCESS"/>
+ <int value="3" label="FROM_WEBSTORE"/>
+ <int value="4" label="FROM_BOOKMARK"/>
+ <int value="5" label="FOLLOW_SYMLINKS_ANYWHERE"/>
+ <int value="6" label="ERROR_ON_PRIVATE_KEY"/>
+ <int value="7" label="WAS_INSTALLED_BY_DEFAULT"/>
+ <int value="8" label="REQUIRE_PERMISSIONS_CONSENT"/>
+ <int value="9" label="IS_EPHEMERAL"/>
+ <int value="10" label="WAS_INSTALLED_BY_OEM"/>
+</enum>
+
<enum name="ExtensionDisabledUIUserResponse" type="int">
<int value="0" label="IGNORED"/>
<int value="1" label="REENABLE"/>