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

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

Issue 1887783002: Remove Extensions.EnhancedBookmarksManagerNumEventListeners metric (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkcr
Patch Set: Created 4 years, 8 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
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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/metrics/histogram_macros.h" 10 #include "base/metrics/histogram_macros.h"
11 #include "base/metrics/sparse_histogram.h" 11 #include "base/metrics/sparse_histogram.h"
12 #include "base/strings/stringprintf.h" 12 #include "base/strings/stringprintf.h"
13 #include "base/strings/utf_string_conversions.h" 13 #include "base/strings/utf_string_conversions.h"
14 #include "base/threading/thread_restrictions.h" 14 #include "base/threading/thread_restrictions.h"
15 #include "base/trace_event/trace_event.h" 15 #include "base/trace_event/trace_event.h"
16 #include "base/values.h" 16 #include "base/values.h"
17 #include "chrome/browser/browser_process.h" 17 #include "chrome/browser/browser_process.h"
18 #include "chrome/browser/extensions/extension_error_reporter.h" 18 #include "chrome/browser/extensions/extension_error_reporter.h"
19 #include "chrome/browser/extensions/extension_service.h" 19 #include "chrome/browser/extensions/extension_service.h"
20 #include "chrome/browser/extensions/extension_util.h" 20 #include "chrome/browser/extensions/extension_util.h"
21 #include "chrome/browser/profiles/profile_manager.h" 21 #include "chrome/browser/profiles/profile_manager.h"
22 #include "chrome/common/chrome_switches.h" 22 #include "chrome/common/chrome_switches.h"
23 #include "chrome/common/extensions/chrome_manifest_url_handlers.h" 23 #include "chrome/common/extensions/chrome_manifest_url_handlers.h"
24 #include "components/crx_file/id_util.h"
25 #include "content/public/browser/browser_thread.h" 24 #include "content/public/browser/browser_thread.h"
26 #include "content/public/browser/notification_service.h" 25 #include "content/public/browser/notification_service.h"
27 #include "content/public/browser/user_metrics.h" 26 #include "content/public/browser/user_metrics.h"
28 #include "extensions/browser/event_router.h" 27 #include "extensions/browser/event_router.h"
29 #include "extensions/browser/extension_prefs.h" 28 #include "extensions/browser/extension_prefs.h"
30 #include "extensions/browser/extension_registry.h" 29 #include "extensions/browser/extension_registry.h"
31 #include "extensions/browser/extension_system.h" 30 #include "extensions/browser/extension_system.h"
32 #include "extensions/browser/extension_util.h" 31 #include "extensions/browser/extension_util.h"
33 #include "extensions/browser/management_policy.h" 32 #include "extensions/browser/management_policy.h"
34 #include "extensions/common/extension.h" 33 #include "extensions/common/extension.h"
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 415
417 // We might have wanted to count legacy packaged apps here, too, since they 416 // We might have wanted to count legacy packaged apps here, too, since they
418 // are effectively extensions. Unfortunately, it's too late, as we don't 417 // are effectively extensions. Unfortunately, it's too late, as we don't
419 // want to mess up the existing stats. 418 // want to mess up the existing stats.
420 if (type == Manifest::TYPE_EXTENSION) { 419 if (type == Manifest::TYPE_EXTENSION) {
421 UMA_HISTOGRAM_ENUMERATION("Extensions.BackgroundPageType", 420 UMA_HISTOGRAM_ENUMERATION("Extensions.BackgroundPageType",
422 GetBackgroundPageType(extension), 421 GetBackgroundPageType(extension),
423 NUM_BACKGROUND_PAGE_TYPES); 422 NUM_BACKGROUND_PAGE_TYPES);
424 423
425 if (GetBackgroundPageType(extension) == EVENT_PAGE) { 424 if (GetBackgroundPageType(extension) == EVENT_PAGE) {
426 size_t num_registered_events =
427 EventRouter::Get(extension_service_->profile())
428 ->GetRegisteredEvents(extension->id())
429 .size();
430 // Count extension event pages with no registered events. Either the 425 // Count extension event pages with no registered events. Either the
431 // event page is badly designed, or there may be a bug where the event 426 // event page is badly designed, or there may be a bug where the event
432 // page failed to start after an update (crbug.com/469361). 427 // page failed to start after an update (crbug.com/469361).
433 if (num_registered_events == 0u) { 428 if (EventRouter::Get(extension_service_->profile())->
429 GetRegisteredEvents(extension->id()).size() == 0) {
434 ++eventless_event_pages_count; 430 ++eventless_event_pages_count;
435 VLOG(1) << "Event page without registered event listeners: " 431 VLOG(1) << "Event page without registered event listeners: "
436 << extension->id() << " " << extension->name(); 432 << extension->id() << " " << extension->name();
437 } 433 }
438 // Count the number of event listeners the Enhanced Bookmarks Manager
439 // has for crbug.com/469361, but only if it's using an event page (not
440 // necessarily the case). This should always be > 0, because that's how
441 // the bookmarks extension works, but Chrome may have a bug - it has in
442 // the past. In fact, this metric may generally be useful for tracking
443 // the frequency of event page bugs.
444 std::string hashed_id =
445 crx_file::id_util::HashedIdInHex(extension->id());
446 if (hashed_id == "D5736E4B5CF695CB93A2FB57E4FDC6E5AFAB6FE2") {
447 UMA_HISTOGRAM_CUSTOM_COUNTS(
448 "Extensions.EnhancedBookmarksManagerNumEventListeners",
449 num_registered_events, 1, 10, 10);
450 }
451 } 434 }
452 } 435 }
453 436
454 // Using an enumeration shows us the total installed ratio across all users. 437 // Using an enumeration shows us the total installed ratio across all users.
455 // Using the totals per user at each startup tells us the distribution of 438 // Using the totals per user at each startup tells us the distribution of
456 // usage for each user (e.g. 40% of users have at least one app installed). 439 // usage for each user (e.g. 40% of users have at least one app installed).
457 UMA_HISTOGRAM_ENUMERATION( 440 UMA_HISTOGRAM_ENUMERATION(
458 "Extensions.LoadType", type, Manifest::NUM_LOAD_TYPES); 441 "Extensions.LoadType", type, Manifest::NUM_LOAD_TYPES);
459 switch (type) { 442 switch (type) {
460 case Manifest::TYPE_THEME: 443 case Manifest::TYPE_THEME:
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
623 int InstalledLoader::GetCreationFlags(const ExtensionInfo* info) { 606 int InstalledLoader::GetCreationFlags(const ExtensionInfo* info) {
624 int flags = extension_prefs_->GetCreationFlags(info->extension_id); 607 int flags = extension_prefs_->GetCreationFlags(info->extension_id);
625 if (!Manifest::IsUnpackedLocation(info->extension_location)) 608 if (!Manifest::IsUnpackedLocation(info->extension_location))
626 flags |= Extension::REQUIRE_KEY; 609 flags |= Extension::REQUIRE_KEY;
627 if (extension_prefs_->AllowFileAccess(info->extension_id)) 610 if (extension_prefs_->AllowFileAccess(info->extension_id))
628 flags |= Extension::ALLOW_FILE_ACCESS; 611 flags |= Extension::ALLOW_FILE_ACCESS;
629 return flags; 612 return flags;
630 } 613 }
631 614
632 } // namespace extensions 615 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | tools/metrics/histograms/histograms.xml » ('J')

Powered by Google App Engine
This is Rietveld 408576698