| OLD | NEW |
| 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 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 int platform_app_count = 0; | 289 int platform_app_count = 0; |
| 290 int user_script_count = 0; | 290 int user_script_count = 0; |
| 291 int content_pack_count = 0; | 291 int content_pack_count = 0; |
| 292 int extension_user_count = 0; | 292 int extension_user_count = 0; |
| 293 int extension_external_count = 0; | 293 int extension_external_count = 0; |
| 294 int theme_count = 0; | 294 int theme_count = 0; |
| 295 int page_action_count = 0; | 295 int page_action_count = 0; |
| 296 int browser_action_count = 0; | 296 int browser_action_count = 0; |
| 297 int disabled_for_permissions_count = 0; | 297 int disabled_for_permissions_count = 0; |
| 298 int non_webstore_ntp_override_count = 0; | 298 int non_webstore_ntp_override_count = 0; |
| 299 int incognito = 0; | 299 int incognito_allowed_count = 0; |
| 300 int not_incognito = 0; | 300 int incognito_not_allowed_count = 0; |
| 301 int file_access = 0; | 301 int file_access_allowed_count = 0; |
| 302 int not_file_access = 0; | 302 int file_access_not_allowed_count = 0; |
| 303 | 303 |
| 304 const ExtensionSet& extensions = extension_registry_->enabled_extensions(); | 304 const ExtensionSet& extensions = extension_registry_->enabled_extensions(); |
| 305 ExtensionActionManager* extension_action_manager = | 305 ExtensionActionManager* extension_action_manager = |
| 306 ExtensionActionManager::Get(profile); | 306 ExtensionActionManager::Get(profile); |
| 307 for (ExtensionSet::const_iterator iter = extensions.begin(); | 307 for (ExtensionSet::const_iterator iter = extensions.begin(); |
| 308 iter != extensions.end(); | 308 iter != extensions.end(); |
| 309 ++iter) { | 309 ++iter) { |
| 310 const Extension* extension = *iter; | 310 const Extension* extension = *iter; |
| 311 Manifest::Location location = extension->location(); | 311 Manifest::Location location = extension->location(); |
| 312 Manifest::Type type = extension->GetType(); | 312 Manifest::Type type = extension->GetType(); |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 437 | 437 |
| 438 if (ManagedModeInfo::IsContentPack(extension)) | 438 if (ManagedModeInfo::IsContentPack(extension)) |
| 439 ++content_pack_count; | 439 ++content_pack_count; |
| 440 | 440 |
| 441 RecordCreationFlags(extension); | 441 RecordCreationFlags(extension); |
| 442 | 442 |
| 443 ExtensionService::RecordPermissionMessagesHistogram( | 443 ExtensionService::RecordPermissionMessagesHistogram( |
| 444 extension, "Extensions.Permissions_Load"); | 444 extension, "Extensions.Permissions_Load"); |
| 445 | 445 |
| 446 // For incognito and file access, skip anything that doesn't appear in | 446 // For incognito and file access, skip anything that doesn't appear in |
| 447 // settings. | 447 // settings. Also, policy-installed (and unpacked of course, checked above) |
| 448 if (extension->ShouldDisplayInExtensionSettings()) { | 448 // extensions are boring. |
| 449 if (extension->ShouldDisplayInExtensionSettings() && |
| 450 !Manifest::IsPolicyLocation(extension->location())) { |
| 449 if (extension->can_be_incognito_enabled()) { | 451 if (extension->can_be_incognito_enabled()) { |
| 450 if (util::IsIncognitoEnabled(extension->id(), profile)) | 452 if (util::IsIncognitoEnabled(extension->id(), profile)) |
| 451 ++incognito; | 453 ++incognito_allowed_count; |
| 452 else | 454 else |
| 453 ++not_incognito; | 455 ++incognito_not_allowed_count; |
| 454 } | 456 } |
| 455 if (extension->wants_file_access()) { | 457 if (extension->wants_file_access()) { |
| 456 if (util::AllowFileAccess(extension->id(), profile)) | 458 if (util::AllowFileAccess(extension->id(), profile)) |
| 457 ++file_access; | 459 ++file_access_allowed_count; |
| 458 else | 460 else |
| 459 ++not_file_access; | 461 ++file_access_not_allowed_count; |
| 460 } | 462 } |
| 461 } | 463 } |
| 462 } | 464 } |
| 463 | 465 |
| 464 const ExtensionSet& disabled_extensions = | 466 const ExtensionSet& disabled_extensions = |
| 465 extension_registry_->disabled_extensions(); | 467 extension_registry_->disabled_extensions(); |
| 466 | 468 |
| 467 for (ExtensionSet::const_iterator ex = disabled_extensions.begin(); | 469 for (ExtensionSet::const_iterator ex = disabled_extensions.begin(); |
| 468 ex != disabled_extensions.end(); | 470 ex != disabled_extensions.end(); |
| 469 ++ex) { | 471 ++ex) { |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 520 UMA_HISTOGRAM_COUNTS_100("Extensions.LoadUserScript", user_script_count); | 522 UMA_HISTOGRAM_COUNTS_100("Extensions.LoadUserScript", user_script_count); |
| 521 UMA_HISTOGRAM_COUNTS_100("Extensions.LoadTheme", theme_count); | 523 UMA_HISTOGRAM_COUNTS_100("Extensions.LoadTheme", theme_count); |
| 522 UMA_HISTOGRAM_COUNTS_100("Extensions.LoadPageAction", page_action_count); | 524 UMA_HISTOGRAM_COUNTS_100("Extensions.LoadPageAction", page_action_count); |
| 523 UMA_HISTOGRAM_COUNTS_100("Extensions.LoadBrowserAction", | 525 UMA_HISTOGRAM_COUNTS_100("Extensions.LoadBrowserAction", |
| 524 browser_action_count); | 526 browser_action_count); |
| 525 UMA_HISTOGRAM_COUNTS_100("Extensions.LoadContentPack", content_pack_count); | 527 UMA_HISTOGRAM_COUNTS_100("Extensions.LoadContentPack", content_pack_count); |
| 526 UMA_HISTOGRAM_COUNTS_100("Extensions.DisabledForPermissions", | 528 UMA_HISTOGRAM_COUNTS_100("Extensions.DisabledForPermissions", |
| 527 disabled_for_permissions_count); | 529 disabled_for_permissions_count); |
| 528 UMA_HISTOGRAM_COUNTS_100("Extensions.NonWebStoreNewTabPageOverrides", | 530 UMA_HISTOGRAM_COUNTS_100("Extensions.NonWebStoreNewTabPageOverrides", |
| 529 non_webstore_ntp_override_count); | 531 non_webstore_ntp_override_count); |
| 530 UMA_HISTOGRAM_COUNTS_100("Extensions.IncognitoAllowed", incognito); | 532 if (incognito_allowed_count + incognito_not_allowed_count > 0) { |
| 531 UMA_HISTOGRAM_COUNTS_100("Extensions.IncognitoNotAllowed", not_incognito); | 533 UMA_HISTOGRAM_COUNTS_100("Extensions.IncognitoAllowed", |
| 532 UMA_HISTOGRAM_COUNTS_100("Extensions.FileAccessAllowed", file_access); | 534 incognito_allowed_count); |
| 533 UMA_HISTOGRAM_COUNTS_100("Extensions.FileAccessNotAllowed", not_file_access); | 535 UMA_HISTOGRAM_COUNTS_100("Extensions.IncognitoNotAllowed", |
| 536 incognito_not_allowed_count); |
| 537 } |
| 538 if (file_access_allowed_count + file_access_not_allowed_count > 0) { |
| 539 UMA_HISTOGRAM_COUNTS_100("Extensions.FileAccessAllowed", |
| 540 file_access_allowed_count); |
| 541 UMA_HISTOGRAM_COUNTS_100("Extensions.FileAccessNotAllowed", |
| 542 file_access_not_allowed_count); |
| 543 } |
| 534 } | 544 } |
| 535 | 545 |
| 536 int InstalledLoader::GetCreationFlags(const ExtensionInfo* info) { | 546 int InstalledLoader::GetCreationFlags(const ExtensionInfo* info) { |
| 537 int flags = extension_prefs_->GetCreationFlags(info->extension_id); | 547 int flags = extension_prefs_->GetCreationFlags(info->extension_id); |
| 538 if (!Manifest::IsUnpackedLocation(info->extension_location)) | 548 if (!Manifest::IsUnpackedLocation(info->extension_location)) |
| 539 flags |= Extension::REQUIRE_KEY; | 549 flags |= Extension::REQUIRE_KEY; |
| 540 if (extension_prefs_->AllowFileAccess(info->extension_id)) | 550 if (extension_prefs_->AllowFileAccess(info->extension_id)) |
| 541 flags |= Extension::ALLOW_FILE_ACCESS; | 551 flags |= Extension::ALLOW_FILE_ACCESS; |
| 542 return flags; | 552 return flags; |
| 543 } | 553 } |
| 544 | 554 |
| 545 } // namespace extensions | 555 } // namespace extensions |
| OLD | NEW |