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

Side by Side Diff: chrome/browser/extensions/installed_loader.cc

Issue 22390005: Change Extensions.ExternalItemState to report more specific data (enabled (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 4 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/extensions/installed_loader.h" 5 #include "chrome/browser/extensions/installed_loader.h"
6 6
7 #include "base/files/file_path.h" 7 #include "base/files/file_path.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 }; 54 };
55 55
56 // Used in histogram Extension.BackgroundPageType. Values may be added, as 56 // Used in histogram Extension.BackgroundPageType. Values may be added, as
57 // long as existing values are not changed. 57 // long as existing values are not changed.
58 enum BackgroundPageType { 58 enum BackgroundPageType {
59 NO_BACKGROUND_PAGE = 0, 59 NO_BACKGROUND_PAGE = 0,
60 BACKGROUND_PAGE_PERSISTENT = 1, 60 BACKGROUND_PAGE_PERSISTENT = 1,
61 EVENT_PAGE = 2, 61 EVENT_PAGE = 2,
62 }; 62 };
63 63
64 // Used in histogram Extensions.ExternalItemState. Values may be added, as
65 // long as existing values are not changed.
66 enum ExternalItemState {
67 DEPRECATED_EXTERNAL_ITEM_DISABLED = 0,
68 DEPRECATED_EXTERNAL_ITEM_ENABLED = 1,
69 EXTERNAL_ITEM_WEBSTORE_DISABLED = 2,
70 EXTERNAL_ITEM_WEBSTORE_ENABLED = 3,
71 EXTERNAL_ITEM_NONWEBSTORE_DISABLED = 4,
72 EXTERNAL_ITEM_NONWEBSTORE_ENABLED = 5,
73 EXTERNAL_ITEM_MAX_ITEMS = 6
74 };
75
64 ManifestReloadReason ShouldReloadExtensionManifest(const ExtensionInfo& info) { 76 ManifestReloadReason ShouldReloadExtensionManifest(const ExtensionInfo& info) {
65 // Always reload manifests of unpacked extensions, because they can change 77 // Always reload manifests of unpacked extensions, because they can change
66 // on disk independent of the manifest in our prefs. 78 // on disk independent of the manifest in our prefs.
67 if (Manifest::IsUnpackedLocation(info.extension_location)) 79 if (Manifest::IsUnpackedLocation(info.extension_location))
68 return UNPACKED_DIR; 80 return UNPACKED_DIR;
69 81
70 // Reload the manifest if it needs to be relocalized. 82 // Reload the manifest if it needs to be relocalized.
71 if (extension_l10n_util::ShouldRelocalizeManifest( 83 if (extension_l10n_util::ShouldRelocalizeManifest(
72 info.extension_manifest.get())) 84 info.extension_manifest.get()))
73 return NEEDS_RELOCALIZATION; 85 return NEEDS_RELOCALIZATION;
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 } else if (type == Manifest::TYPE_EXTENSION) { 272 } else if (type == Manifest::TYPE_EXTENSION) {
261 UMA_HISTOGRAM_ENUMERATION("Extensions.ExtensionLocation", 273 UMA_HISTOGRAM_ENUMERATION("Extensions.ExtensionLocation",
262 location, 100); 274 location, 100);
263 } 275 }
264 if (!ManifestURL::UpdatesFromGallery(*ex)) { 276 if (!ManifestURL::UpdatesFromGallery(*ex)) {
265 UMA_HISTOGRAM_ENUMERATION("Extensions.NonWebstoreLocation", 277 UMA_HISTOGRAM_ENUMERATION("Extensions.NonWebstoreLocation",
266 location, 100); 278 location, 100);
267 } 279 }
268 if (Manifest::IsExternalLocation(location)) { 280 if (Manifest::IsExternalLocation(location)) {
269 // See loop below for DISABLED. 281 // See loop below for DISABLED.
270 UMA_HISTOGRAM_ENUMERATION("Extensions.ExternalItemState", 282 if (ManifestURL::UpdatesFromGallery(*ex)) {
271 Extension::ENABLED, 100); 283 UMA_HISTOGRAM_ENUMERATION("Extensions.ExternalItemState",
284 EXTERNAL_ITEM_WEBSTORE_ENABLED,
285 EXTERNAL_ITEM_MAX_ITEMS);
286 } else {
287 UMA_HISTOGRAM_ENUMERATION("Extensions.ExternalItemState",
288 EXTERNAL_ITEM_NONWEBSTORE_ENABLED,
289 EXTERNAL_ITEM_MAX_ITEMS);
290 }
272 } 291 }
273 if ((*ex)->from_webstore()) { 292 if ((*ex)->from_webstore()) {
274 // Check for inconsistencies if the extension was supposedly installed 293 // Check for inconsistencies if the extension was supposedly installed
275 // from the webstore. 294 // from the webstore.
276 enum { 295 enum {
277 BAD_UPDATE_URL = 0, 296 BAD_UPDATE_URL = 0,
278 IS_EXTERNAL = 1, 297 // This value was a mistake. Turns out sideloaded extensions can
298 // have the from_webstore bit if they update from the webstore.
299 DEPRECATED_IS_EXTERNAL = 1,
279 }; 300 };
280 if (!ManifestURL::UpdatesFromGallery(*ex)) { 301 if (!ManifestURL::UpdatesFromGallery(*ex)) {
281 UMA_HISTOGRAM_ENUMERATION("Extensions.FromWebstoreInconsistency", 302 UMA_HISTOGRAM_ENUMERATION("Extensions.FromWebstoreInconsistency",
282 BAD_UPDATE_URL, 2); 303 BAD_UPDATE_URL, 2);
283 } else if (Manifest::IsExternalLocation(location)) {
284 UMA_HISTOGRAM_ENUMERATION("Extensions.FromWebstoreInconsistency",
285 IS_EXTERNAL, 2);
286 } 304 }
287 } 305 }
288 306
289 // Don't count component extensions, since they are only extensions as an 307 // Don't count component extensions, since they are only extensions as an
290 // implementation detail. 308 // implementation detail.
291 if (location == Manifest::COMPONENT) 309 if (location == Manifest::COMPONENT)
292 continue; 310 continue;
293 // Histogram for non-webstore extensions overriding new tab page should 311 // Histogram for non-webstore extensions overriding new tab page should
294 // include unpacked extensions. 312 // include unpacked extensions.
295 if (!(*ex)->from_webstore()) { 313 if (!(*ex)->from_webstore()) {
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 const ExtensionSet* disabled_extensions = 395 const ExtensionSet* disabled_extensions =
378 extension_service_->disabled_extensions(); 396 extension_service_->disabled_extensions();
379 for (ex = disabled_extensions->begin(); 397 for (ex = disabled_extensions->begin();
380 ex != disabled_extensions->end(); ++ex) { 398 ex != disabled_extensions->end(); ++ex) {
381 if (extension_service_->extension_prefs()-> 399 if (extension_service_->extension_prefs()->
382 DidExtensionEscalatePermissions((*ex)->id())) { 400 DidExtensionEscalatePermissions((*ex)->id())) {
383 ++disabled_for_permissions_count; 401 ++disabled_for_permissions_count;
384 } 402 }
385 if (Manifest::IsExternalLocation((*ex)->location())) { 403 if (Manifest::IsExternalLocation((*ex)->location())) {
386 // See loop above for ENABLED. 404 // See loop above for ENABLED.
387 UMA_HISTOGRAM_ENUMERATION("Extensions.ExternalItemState", 405 if (ManifestURL::UpdatesFromGallery(*ex)) {
388 Extension::DISABLED, 100); 406 UMA_HISTOGRAM_ENUMERATION("Extensions.ExternalItemState",
407 EXTERNAL_ITEM_WEBSTORE_DISABLED,
408 EXTERNAL_ITEM_MAX_ITEMS);
409 } else {
410 UMA_HISTOGRAM_ENUMERATION("Extensions.ExternalItemState",
411 EXTERNAL_ITEM_NONWEBSTORE_DISABLED,
412 EXTERNAL_ITEM_MAX_ITEMS);
413 }
389 } 414 }
390 } 415 }
391 416
392 UMA_HISTOGRAM_COUNTS_100("Extensions.LoadAllUser", item_user_count); 417 UMA_HISTOGRAM_COUNTS_100("Extensions.LoadAllUser", item_user_count);
393 UMA_HISTOGRAM_COUNTS_100("Extensions.LoadApp", 418 UMA_HISTOGRAM_COUNTS_100("Extensions.LoadApp",
394 app_user_count + app_external_count); 419 app_user_count + app_external_count);
395 UMA_HISTOGRAM_COUNTS_100("Extensions.LoadAppUser", app_user_count); 420 UMA_HISTOGRAM_COUNTS_100("Extensions.LoadAppUser", app_user_count);
396 UMA_HISTOGRAM_COUNTS_100("Extensions.LoadAppExternal", app_external_count); 421 UMA_HISTOGRAM_COUNTS_100("Extensions.LoadAppExternal", app_external_count);
397 UMA_HISTOGRAM_COUNTS_100("Extensions.LoadHostedApp", hosted_app_count); 422 UMA_HISTOGRAM_COUNTS_100("Extensions.LoadHostedApp", hosted_app_count);
398 UMA_HISTOGRAM_COUNTS_100("Extensions.LoadPackagedApp", 423 UMA_HISTOGRAM_COUNTS_100("Extensions.LoadPackagedApp",
(...skipping 20 matching lines...) Expand all
419 int InstalledLoader::GetCreationFlags(const ExtensionInfo* info) { 444 int InstalledLoader::GetCreationFlags(const ExtensionInfo* info) {
420 int flags = extension_prefs_->GetCreationFlags(info->extension_id); 445 int flags = extension_prefs_->GetCreationFlags(info->extension_id);
421 if (!Manifest::IsUnpackedLocation(info->extension_location)) 446 if (!Manifest::IsUnpackedLocation(info->extension_location))
422 flags |= Extension::REQUIRE_KEY; 447 flags |= Extension::REQUIRE_KEY;
423 if (extension_prefs_->AllowFileAccess(info->extension_id)) 448 if (extension_prefs_->AllowFileAccess(info->extension_id))
424 flags |= Extension::ALLOW_FILE_ACCESS; 449 flags |= Extension::ALLOW_FILE_ACCESS;
425 return flags; 450 return flags;
426 } 451 }
427 452
428 } // namespace extensions 453 } // namespace extensions
OLDNEW
« 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