Chromium Code Reviews| 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..8ff9045cfa5613c5bcb215f893e8b89f2d39c185 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" |
| @@ -28,6 +29,7 @@ |
| #include "extensions/browser/management_policy.h" |
| #include "extensions/common/extension.h" |
| #include "extensions/common/extension_l10n_util.h" |
| +#include "extensions/common/extension_set.h" |
| #include "extensions/common/file_util.h" |
| #include "extensions/common/manifest.h" |
| #include "extensions/common/manifest_constants.h" |
| @@ -191,6 +193,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 +233,7 @@ void InstalledLoader::LoadAllExtensions() { |
| ExtensionErrorReporter::GetInstance()->ReportLoadError( |
| info->extension_path, |
| error, |
| - extension_service_->profile(), |
| + profile, |
| false); // Be quiet. |
| continue; |
| } |
| @@ -259,11 +262,51 @@ 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()); |
| + const ExtensionSet& enabled = extension_registry_->enabled_extensions(); |
| + |
| + UMA_HISTOGRAM_COUNTS_100("Extensions.LoadAll", enabled.size()); |
| UMA_HISTOGRAM_COUNTS_100("Extensions.Disabled", |
| extension_registry_->disabled_extensions().size()); |
| + // Gather stats about the extensions which have/have-not been enabled for |
| + // incognito and file access in chrome://extensions. |
| + size_t incognito = 0; |
| + size_t not_incognito = 0; |
|
Devlin
2014/05/09 23:01:12
nit of all nits: 0u, not 0, to avoid an implicit c
not at google - send to devlin
2014/05/09 23:18:58
Done. sort of. you're right, but right below there
|
| + size_t file_access = 0; |
| + size_t not_file_access = 0; |
| + |
| + for (ExtensionSet::const_iterator it = enabled.begin(); |
| + 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 |
| + ++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); |