Chromium Code Reviews| 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 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 436 | 436 |
| 437 if (ManagedModeInfo::IsContentPack(extension)) | 437 if (ManagedModeInfo::IsContentPack(extension)) |
| 438 ++content_pack_count; | 438 ++content_pack_count; |
| 439 | 439 |
| 440 RecordCreationFlags(extension); | 440 RecordCreationFlags(extension); |
| 441 | 441 |
| 442 ExtensionService::RecordPermissionMessagesHistogram( | 442 ExtensionService::RecordPermissionMessagesHistogram( |
| 443 extension, "Extensions.Permissions_Load"); | 443 extension, "Extensions.Permissions_Load"); |
| 444 | 444 |
| 445 // For incognito and file access, skip anything that doesn't appear in | 445 // For incognito and file access, skip anything that doesn't appear in |
| 446 // settings. | 446 // settings. Also, policy-installed and unpacked extensions are boring. |
| 447 if (extension->ShouldDisplayInExtensionSettings()) { | 447 if (extension->ShouldDisplayInExtensionSettings() && |
| 448 !Manifest::IsUnpackedLocation(extension->location()) && | |
|
Devlin
2014/05/19 22:10:01
nit: You don't need the IsUnpacked check here, sin
not at google - send to devlin
2014/05/19 22:15:23
ah yes. when will I learn. fixed.
| |
| 449 !Manifest::IsPolicyLocation(extension->location())) { | |
| 448 if (extension->can_be_incognito_enabled()) { | 450 if (extension->can_be_incognito_enabled()) { |
| 449 if (util::IsIncognitoEnabled(extension->id(), profile)) | 451 if (util::IsIncognitoEnabled(extension->id(), profile)) |
| 450 ++incognito; | 452 ++incognito; |
| 451 else | 453 else |
| 452 ++not_incognito; | 454 ++not_incognito; |
| 453 } | 455 } |
| 454 if (extension->wants_file_access()) { | 456 if (extension->wants_file_access()) { |
| 455 if (util::AllowFileAccess(extension->id(), profile)) | 457 if (util::AllowFileAccess(extension->id(), profile)) |
| 456 ++file_access; | 458 ++file_access; |
| 457 else | 459 else |
| (...skipping 62 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 + not_incognito > 0) { |
| 531 UMA_HISTOGRAM_COUNTS_100("Extensions.IncognitoNotAllowed", not_incognito); | 533 UMA_HISTOGRAM_COUNTS_100("Extensions.IncognitoAllowed", incognito); |
| 532 UMA_HISTOGRAM_COUNTS_100("Extensions.FileAccessAllowed", file_access); | 534 UMA_HISTOGRAM_COUNTS_100("Extensions.IncognitoNotAllowed", not_incognito); |
| 533 UMA_HISTOGRAM_COUNTS_100("Extensions.FileAccessNotAllowed", not_file_access); | 535 } |
| 536 if (file_access + not_file_access > 0) { | |
| 537 UMA_HISTOGRAM_COUNTS_100("Extensions.FileAccessAllowed", file_access); | |
| 538 UMA_HISTOGRAM_COUNTS_100("Extensions.FileAccessNotAllowed", | |
| 539 not_file_access); | |
| 540 } | |
| 534 } | 541 } |
| 535 | 542 |
| 536 int InstalledLoader::GetCreationFlags(const ExtensionInfo* info) { | 543 int InstalledLoader::GetCreationFlags(const ExtensionInfo* info) { |
| 537 int flags = extension_prefs_->GetCreationFlags(info->extension_id); | 544 int flags = extension_prefs_->GetCreationFlags(info->extension_id); |
| 538 if (!Manifest::IsUnpackedLocation(info->extension_location)) | 545 if (!Manifest::IsUnpackedLocation(info->extension_location)) |
| 539 flags |= Extension::REQUIRE_KEY; | 546 flags |= Extension::REQUIRE_KEY; |
| 540 if (extension_prefs_->AllowFileAccess(info->extension_id)) | 547 if (extension_prefs_->AllowFileAccess(info->extension_id)) |
| 541 flags |= Extension::ALLOW_FILE_ACCESS; | 548 flags |= Extension::ALLOW_FILE_ACCESS; |
| 542 return flags; | 549 return flags; |
| 543 } | 550 } |
| 544 | 551 |
| 545 } // namespace extensions | 552 } // namespace extensions |
| OLD | NEW |