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

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

Issue 274943003: Create new histrograms for ExtensionPermission enum. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebasing. Created 6 years, 6 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/extension_service.h" 5 #include "chrome/browser/extensions/extension_service.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <iterator> 8 #include <iterator>
9 #include <set> 9 #include <set>
10 10
(...skipping 724 matching lines...) Expand 10 before | Expand all | Expand 10 after
735 EXTERNAL_EXTENSION_BUCKET_BOUNDARY); 735 EXTERNAL_EXTENSION_BUCKET_BOUNDARY);
736 } else { 736 } else {
737 UMA_HISTOGRAM_ENUMERATION("Extensions.ExternalExtensionEventNonWebstore", 737 UMA_HISTOGRAM_ENUMERATION("Extensions.ExternalExtensionEventNonWebstore",
738 EXTERNAL_EXTENSION_UNINSTALLED, 738 EXTERNAL_EXTENSION_UNINSTALLED,
739 EXTERNAL_EXTENSION_BUCKET_BOUNDARY); 739 EXTERNAL_EXTENSION_BUCKET_BOUNDARY);
740 } 740 }
741 } 741 }
742 UMA_HISTOGRAM_ENUMERATION("Extensions.UninstallType", 742 UMA_HISTOGRAM_ENUMERATION("Extensions.UninstallType",
743 extension->GetType(), 100); 743 extension->GetType(), 100);
744 RecordPermissionMessagesHistogram(extension.get(), 744 RecordPermissionMessagesHistogram(extension.get(),
745 "Extensions.Permissions_Uninstall"); 745 "Extensions.Permissions_Uninstall2");
746 746
747 // Unload before doing more cleanup to ensure that nothing is hanging on to 747 // Unload before doing more cleanup to ensure that nothing is hanging on to
748 // any of these resources. 748 // any of these resources.
749 UnloadExtension(extension->id(), UnloadedExtensionInfo::REASON_UNINSTALL); 749 UnloadExtension(extension->id(), UnloadedExtensionInfo::REASON_UNINSTALL);
750 750
751 // Tell the backend to start deleting installed extensions on the file thread. 751 // Tell the backend to start deleting installed extensions on the file thread.
752 if (!Manifest::IsUnpackedLocation(extension->location())) { 752 if (!Manifest::IsUnpackedLocation(extension->location())) {
753 if (!GetFileTaskRunner()->PostTask( 753 if (!GetFileTaskRunner()->PostTask(
754 FROM_HERE, 754 FROM_HERE,
755 base::Bind(&ExtensionService::UninstallExtensionOnFileThread, 755 base::Bind(&ExtensionService::UninstallExtensionOnFileThread,
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
949 continue; 949 continue;
950 const std::string& id = (*extension)->id(); 950 const std::string& id = (*extension)->id();
951 if (except_ids.end() == std::find(except_ids.begin(), except_ids.end(), id)) 951 if (except_ids.end() == std::find(except_ids.begin(), except_ids.end(), id))
952 DisableExtension(id, extensions::Extension::DISABLE_USER_ACTION); 952 DisableExtension(id, extensions::Extension::DISABLE_USER_ACTION);
953 } 953 }
954 } 954 }
955 955
956 void ExtensionService::GrantPermissionsAndEnableExtension( 956 void ExtensionService::GrantPermissionsAndEnableExtension(
957 const Extension* extension) { 957 const Extension* extension) {
958 GrantPermissions(extension); 958 GrantPermissions(extension);
959 RecordPermissionMessagesHistogram( 959 RecordPermissionMessagesHistogram(extension,
960 extension, "Extensions.Permissions_ReEnable"); 960 "Extensions.Permissions_ReEnable2");
961 extension_prefs_->SetDidExtensionEscalatePermissions(extension, false); 961 extension_prefs_->SetDidExtensionEscalatePermissions(extension, false);
962 EnableExtension(extension->id()); 962 EnableExtension(extension->id());
963 } 963 }
964 964
965 void ExtensionService::GrantPermissions(const Extension* extension) { 965 void ExtensionService::GrantPermissions(const Extension* extension) {
966 CHECK(extension); 966 CHECK(extension);
967 extensions::PermissionsUpdater perms_updater(profile()); 967 extensions::PermissionsUpdater perms_updater(profile());
968 perms_updater.GrantActivePermissions(extension); 968 perms_updater.GrantActivePermissions(extension);
969 } 969 }
970 970
(...skipping 731 matching lines...) Expand 10 before | Expand all | Expand 10 after
1702 // Extension has changed permissions significantly. Disable it. A 1702 // Extension has changed permissions significantly. Disable it. A
1703 // notification should be sent by the caller. If the extension is already 1703 // notification should be sent by the caller. If the extension is already
1704 // disabled because it was installed remotely, don't add another disable 1704 // disabled because it was installed remotely, don't add another disable
1705 // reason, but instead always set the "did escalate permissions" flag, to 1705 // reason, but instead always set the "did escalate permissions" flag, to
1706 // ensure enabling it will always show a warning. 1706 // ensure enabling it will always show a warning.
1707 if (disable_reasons == Extension::DISABLE_REMOTE_INSTALL) { 1707 if (disable_reasons == Extension::DISABLE_REMOTE_INSTALL) {
1708 extension_prefs_->SetDidExtensionEscalatePermissions(extension, true); 1708 extension_prefs_->SetDidExtensionEscalatePermissions(extension, true);
1709 } else if (is_privilege_increase) { 1709 } else if (is_privilege_increase) {
1710 disable_reasons |= Extension::DISABLE_PERMISSIONS_INCREASE; 1710 disable_reasons |= Extension::DISABLE_PERMISSIONS_INCREASE;
1711 if (!extension_prefs_->DidExtensionEscalatePermissions(extension->id())) { 1711 if (!extension_prefs_->DidExtensionEscalatePermissions(extension->id())) {
1712 RecordPermissionMessagesHistogram( 1712 RecordPermissionMessagesHistogram(extension,
1713 extension, "Extensions.Permissions_AutoDisable"); 1713 "Extensions.Permissions_AutoDisable2");
1714 } 1714 }
1715 extension_prefs_->SetExtensionState(extension->id(), Extension::DISABLED); 1715 extension_prefs_->SetExtensionState(extension->id(), Extension::DISABLED);
1716 extension_prefs_->SetDidExtensionEscalatePermissions(extension, true); 1716 extension_prefs_->SetDidExtensionEscalatePermissions(extension, true);
1717 } 1717 }
1718 if (disable_reasons != Extension::DISABLE_NONE) { 1718 if (disable_reasons != Extension::DISABLE_NONE) {
1719 extension_prefs_->AddDisableReason( 1719 extension_prefs_->AddDisableReason(
1720 extension->id(), 1720 extension->id(),
1721 static_cast<Extension::DisableReason>(disable_reasons)); 1721 static_cast<Extension::DisableReason>(disable_reasons));
1722 } 1722 }
1723 } 1723 }
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
1808 UMA_HISTOGRAM_ENUMERATION("ExtensionBlacklist.SilentInstall", 1808 UMA_HISTOGRAM_ENUMERATION("ExtensionBlacklist.SilentInstall",
1809 extension->location(), 1809 extension->location(),
1810 Manifest::NUM_LOCATIONS); 1810 Manifest::NUM_LOCATIONS);
1811 } 1811 }
1812 1812
1813 if (!GetInstalledExtension(extension->id())) { 1813 if (!GetInstalledExtension(extension->id())) {
1814 UMA_HISTOGRAM_ENUMERATION("Extensions.InstallType", 1814 UMA_HISTOGRAM_ENUMERATION("Extensions.InstallType",
1815 extension->GetType(), 100); 1815 extension->GetType(), 100);
1816 UMA_HISTOGRAM_ENUMERATION("Extensions.InstallSource", 1816 UMA_HISTOGRAM_ENUMERATION("Extensions.InstallSource",
1817 extension->location(), Manifest::NUM_LOCATIONS); 1817 extension->location(), Manifest::NUM_LOCATIONS);
1818 RecordPermissionMessagesHistogram( 1818 RecordPermissionMessagesHistogram(extension,
1819 extension, "Extensions.Permissions_Install"); 1819 "Extensions.Permissions_Install2");
1820 } else { 1820 } else {
1821 UMA_HISTOGRAM_ENUMERATION("Extensions.UpdateType", 1821 UMA_HISTOGRAM_ENUMERATION("Extensions.UpdateType",
1822 extension->GetType(), 100); 1822 extension->GetType(), 100);
1823 UMA_HISTOGRAM_ENUMERATION("Extensions.UpdateSource", 1823 UMA_HISTOGRAM_ENUMERATION("Extensions.UpdateSource",
1824 extension->location(), Manifest::NUM_LOCATIONS); 1824 extension->location(), Manifest::NUM_LOCATIONS);
1825 } 1825 }
1826 1826
1827 // Certain extension locations are specific enough that we can 1827 // Certain extension locations are specific enough that we can
1828 // auto-acknowledge any extension that came from one of them. 1828 // auto-acknowledge any extension that came from one of them.
1829 if (Manifest::IsPolicyLocation(extension->location()) || 1829 if (Manifest::IsPolicyLocation(extension->location()) ||
(...skipping 718 matching lines...) Expand 10 before | Expand all | Expand 10 after
2548 } 2548 }
2549 2549
2550 void ExtensionService::OnProfileDestructionStarted() { 2550 void ExtensionService::OnProfileDestructionStarted() {
2551 ExtensionIdSet ids_to_unload = registry_->enabled_extensions().GetIDs(); 2551 ExtensionIdSet ids_to_unload = registry_->enabled_extensions().GetIDs();
2552 for (ExtensionIdSet::iterator it = ids_to_unload.begin(); 2552 for (ExtensionIdSet::iterator it = ids_to_unload.begin();
2553 it != ids_to_unload.end(); 2553 it != ids_to_unload.end();
2554 ++it) { 2554 ++it) {
2555 UnloadExtension(*it, UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN); 2555 UnloadExtension(*it, UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN);
2556 } 2556 }
2557 } 2557 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_disabled_ui.cc ('k') | chrome/browser/extensions/installed_loader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698