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

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

Issue 240613004: Add UMA logging of extension creation flags. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add kInitFromValueFlagBits Created 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | extensions/common/extension.h » ('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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 } 108 }
109 109
110 BackgroundPageType GetBackgroundPageType(const Extension* extension) { 110 BackgroundPageType GetBackgroundPageType(const Extension* extension) {
111 if (!BackgroundInfo::HasBackgroundPage(extension)) 111 if (!BackgroundInfo::HasBackgroundPage(extension))
112 return NO_BACKGROUND_PAGE; 112 return NO_BACKGROUND_PAGE;
113 if (BackgroundInfo::HasPersistentBackgroundPage(extension)) 113 if (BackgroundInfo::HasPersistentBackgroundPage(extension))
114 return BACKGROUND_PAGE_PERSISTENT; 114 return BACKGROUND_PAGE_PERSISTENT;
115 return EVENT_PAGE; 115 return EVENT_PAGE;
116 } 116 }
117 117
118 // Records the creation flags of an extension grouped by
119 // Extension::InitFromValueFlags.
120 void RecordCreationFlags(const Extension* extension) {
121 for (int i = 0; i < Extension::kInitFromValueFlagBits; ++i) {
122 int flag = 1 << i;
123 if (extension->creation_flags() & flag) {
124 UMA_HISTOGRAM_ENUMERATION(
125 "Extensions.LoadCreationFlags", i, Extension::kInitFromValueFlagBits);
126 }
127 }
128 }
129
118 } // namespace 130 } // namespace
119 131
120 InstalledLoader::InstalledLoader(ExtensionService* extension_service) 132 InstalledLoader::InstalledLoader(ExtensionService* extension_service)
121 : extension_service_(extension_service), 133 : extension_service_(extension_service),
122 extension_registry_(ExtensionRegistry::Get(extension_service->profile())), 134 extension_registry_(ExtensionRegistry::Get(extension_service->profile())),
123 extension_prefs_(ExtensionPrefs::Get(extension_service->profile())) {} 135 extension_prefs_(ExtensionPrefs::Get(extension_service->profile())) {}
124 136
125 InstalledLoader::~InstalledLoader() { 137 InstalledLoader::~InstalledLoader() {
126 } 138 }
127 139
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 ExtensionActionManager* extension_action_manager = 415 ExtensionActionManager* extension_action_manager =
404 ExtensionActionManager::Get(extension_service_->profile()); 416 ExtensionActionManager::Get(extension_service_->profile());
405 if (extension_action_manager->GetPageAction(*ex->get())) 417 if (extension_action_manager->GetPageAction(*ex->get()))
406 ++page_action_count; 418 ++page_action_count;
407 if (extension_action_manager->GetBrowserAction(*ex->get())) 419 if (extension_action_manager->GetBrowserAction(*ex->get()))
408 ++browser_action_count; 420 ++browser_action_count;
409 421
410 if (extensions::ManagedModeInfo::IsContentPack(ex->get())) 422 if (extensions::ManagedModeInfo::IsContentPack(ex->get()))
411 ++content_pack_count; 423 ++content_pack_count;
412 424
425 RecordCreationFlags(*ex);
426
413 extension_service_->RecordPermissionMessagesHistogram( 427 extension_service_->RecordPermissionMessagesHistogram(
414 ex->get(), "Extensions.Permissions_Load"); 428 ex->get(), "Extensions.Permissions_Load");
415 } 429 }
416 430
417 const ExtensionSet& disabled_extensions = 431 const ExtensionSet& disabled_extensions =
418 extension_registry_->disabled_extensions(); 432 extension_registry_->disabled_extensions();
419 for (ex = disabled_extensions.begin(); ex != disabled_extensions.end(); 433 for (ex = disabled_extensions.begin(); ex != disabled_extensions.end();
420 ++ex) { 434 ++ex) {
421 if (extension_prefs_->DidExtensionEscalatePermissions((*ex)->id())) { 435 if (extension_prefs_->DidExtensionEscalatePermissions((*ex)->id())) {
422 ++disabled_for_permissions_count; 436 ++disabled_for_permissions_count;
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 int InstalledLoader::GetCreationFlags(const ExtensionInfo* info) { 498 int InstalledLoader::GetCreationFlags(const ExtensionInfo* info) {
485 int flags = extension_prefs_->GetCreationFlags(info->extension_id); 499 int flags = extension_prefs_->GetCreationFlags(info->extension_id);
486 if (!Manifest::IsUnpackedLocation(info->extension_location)) 500 if (!Manifest::IsUnpackedLocation(info->extension_location))
487 flags |= Extension::REQUIRE_KEY; 501 flags |= Extension::REQUIRE_KEY;
488 if (extension_prefs_->AllowFileAccess(info->extension_id)) 502 if (extension_prefs_->AllowFileAccess(info->extension_id))
489 flags |= Extension::ALLOW_FILE_ACCESS; 503 flags |= Extension::ALLOW_FILE_ACCESS;
490 return flags; 504 return flags;
491 } 505 }
492 506
493 } // namespace extensions 507 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | extensions/common/extension.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698