[Extensions Metrics] Mark Extensions.HostedAppUnlimitedStorageUsage obsolete
Mark Extensions.HostedAppUnlimitedStorageUsage as obsolete. It has been
expired since 2018-08. We haven't been looking at it lately, and we
can always add it back later if we need it again.
Bug: 878100
Change-Id: Ic34c3c546fda319ccbba29bcd09225525cc3a1d2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1652058
Reviewed-by: Robert Kaplow (slow) <[email protected]>
Reviewed-by: David Bertoni <[email protected]>
Commit-Queue: Devlin <[email protected]>
Cr-Commit-Position: refs/heads/master@{#669343}
diff --git a/chrome/browser/extensions/app_data_migrator_unittest.cc b/chrome/browser/extensions/app_data_migrator_unittest.cc
index fba4794..e79ca1ef 100644
--- a/chrome/browser/extensions/app_data_migrator_unittest.cc
+++ b/chrome/browser/extensions/app_data_migrator_unittest.cc
@@ -145,8 +145,7 @@
const Extension* ext,
storage::FileSystemContext* fs_context,
Profile* profile) {
- profile->GetExtensionSpecialStoragePolicy()->GrantRightsForExtension(ext,
- profile);
+ profile->GetExtensionSpecialStoragePolicy()->GrantRightsForExtension(ext);
base::FilePath path(FILE_PATH_LITERAL("test.txt"));
GURL extension_url =
diff --git a/chrome/browser/extensions/extension_service.cc b/chrome/browser/extensions/extension_service.cc
index b26a5be..33b54e1 100644
--- a/chrome/browser/extensions/extension_service.cc
+++ b/chrome/browser/extensions/extension_service.cc
@@ -890,7 +890,7 @@
// TODO(kalman): Convert ExtensionSpecialStoragePolicy to a
// BrowserContextKeyedService and use ExtensionRegistryObserver.
profile_->GetExtensionSpecialStoragePolicy()->GrantRightsForExtension(
- extension.get(), profile_);
+ extension.get());
// TODO(kalman): This is broken. The crash reporter is process-wide so doesn't
// work properly multi-profile. Besides which, it should be using
diff --git a/chrome/browser/extensions/extension_special_storage_policy.cc b/chrome/browser/extensions/extension_special_storage_policy.cc
index 71740d0..ceb0e41e 100644
--- a/chrome/browser/extensions/extension_special_storage_policy.cc
+++ b/chrome/browser/extensions/extension_special_storage_policy.cc
@@ -18,15 +18,12 @@
#include "base/task/task_traits.h"
#include "chrome/browser/content_settings/cookie_settings_factory.h"
#include "chrome/common/chrome_switches.h"
-#include "chrome/common/extensions/manifest_handlers/app_launch_info.h"
#include "chrome/common/url_constants.h"
#include "components/content_settings/core/browser/cookie_settings.h"
#include "components/content_settings/core/common/content_settings.h"
#include "components/content_settings/core/common/content_settings_types.h"
-#include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
-#include "content/public/browser/storage_partition.h"
#include "content/public/common/url_constants.h"
#include "extensions/common/constants.h"
#include "extensions/common/extension.h"
@@ -34,8 +31,6 @@
#include "extensions/common/manifest_handlers/app_isolation_info.h"
#include "extensions/common/manifest_handlers/content_capabilities_handler.h"
#include "extensions/common/permissions/permissions_data.h"
-#include "storage/browser/quota/quota_manager.h"
-#include "third_party/blink/public/mojom/quota/quota_types.mojom.h"
#include "url/origin.h"
using content::BrowserThread;
@@ -43,46 +38,6 @@
using extensions::Extension;
using storage::SpecialStoragePolicy;
-namespace {
-
-void ReportQuotaUsage(blink::mojom::QuotaStatusCode code,
- int64_t usage,
- int64_t quota) {
- if (code == blink::mojom::QuotaStatusCode::kOk) {
- // We're interested in the amount of space hosted apps are using. Record it
- // when the extension is granted the unlimited storage permission (once per
- // extension load, so on average once per run).
- UMA_HISTOGRAM_MEMORY_KB("Extensions.HostedAppUnlimitedStorageUsage", usage);
- }
-}
-
-// Log the usage for a hosted app with unlimited storage.
-void LogHostedAppUnlimitedStorageUsage(
- scoped_refptr<const Extension> extension,
- content::BrowserContext* browser_context) {
- GURL launch_url =
- extensions::AppLaunchInfo::GetLaunchWebURL(extension.get()).GetOrigin();
- content::StoragePartition* partition =
- browser_context ? // |browser_context| can be NULL in unittests.
- content::BrowserContext::GetStoragePartitionForSite(browser_context,
- launch_url) :
- NULL;
- if (partition) {
- // We only have to query for kStorageTypePersistent data usage, because apps
- // cannot ask for any more temporary storage, according to
- // https://developers.google.com/chrome/whitepapers/storage.
- base::PostTaskWithTraits(
- FROM_HERE, {BrowserThread::IO, base::TaskPriority::BEST_EFFORT},
- base::BindOnce(&storage::QuotaManager::GetUsageAndQuotaForWebApps,
- partition->GetQuotaManager(),
- url::Origin::Create(launch_url),
- blink::mojom::StorageType::kPersistent,
- base::Bind(&ReportQuotaUsage)));
- }
-}
-
-} // namespace
-
ExtensionSpecialStoragePolicy::ExtensionSpecialStoragePolicy(
content_settings::CookieSettings* cookie_settings)
: cookie_settings_(cookie_settings) {
@@ -169,8 +124,7 @@
}
void ExtensionSpecialStoragePolicy::GrantRightsForExtension(
- const extensions::Extension* extension,
- content::BrowserContext* browser_context) {
+ const extensions::Extension* extension) {
base::AutoLock locker(lock_);
DCHECK(extension);
@@ -194,8 +148,6 @@
if (extension->permissions_data()->HasAPIPermission(
APIPermission::kUnlimitedStorage) &&
unlimited_extensions_.Add(extension)) {
- if (extension->is_hosted_app())
- LogHostedAppUnlimitedStorageUsage(extension, browser_context);
change_flags |= SpecialStoragePolicy::STORAGE_UNLIMITED;
}
diff --git a/chrome/browser/extensions/extension_special_storage_policy.h b/chrome/browser/extensions/extension_special_storage_policy.h
index 59926272..c370b63 100644
--- a/chrome/browser/extensions/extension_special_storage_policy.h
+++ b/chrome/browser/extensions/extension_special_storage_policy.h
@@ -15,10 +15,6 @@
#include "storage/browser/quota/special_storage_policy.h"
#include "url/gurl.h"
-namespace content {
-class BrowserContext;
-}
-
namespace content_settings {
class CookieSettings;
}
@@ -47,8 +43,7 @@
CreateDeleteCookieOnExitPredicate() override;
// Methods used by the ExtensionService to populate this class.
- void GrantRightsForExtension(const extensions::Extension* extension,
- content::BrowserContext* browser_context);
+ void GrantRightsForExtension(const extensions::Extension* extension);
void RevokeRightsForExtension(const extensions::Extension* extension);
void RevokeRightsForAllExtensions();
diff --git a/chrome/browser/extensions/extension_special_storage_policy_unittest.cc b/chrome/browser/extensions/extension_special_storage_policy_unittest.cc
index 44d3fe55..23c0e153 100644
--- a/chrome/browser/extensions/extension_special_storage_policy_unittest.cc
+++ b/chrome/browser/extensions/extension_special_storage_policy_unittest.cc
@@ -204,7 +204,7 @@
TEST_F(ExtensionSpecialStoragePolicyTest, AppWithProtectedStorage) {
scoped_refptr<Extension> extension(CreateProtectedApp());
- policy_->GrantRightsForExtension(extension.get(), NULL);
+ policy_->GrantRightsForExtension(extension.get());
ExtensionSet protecting_extensions;
protecting_extensions.Insert(extension);
ExtensionSet empty_set;
@@ -225,7 +225,7 @@
TEST_F(ExtensionSpecialStoragePolicyTest, AppWithUnlimitedStorage) {
scoped_refptr<Extension> extension(CreateUnlimitedApp());
- policy_->GrantRightsForExtension(extension.get(), NULL);
+ policy_->GrantRightsForExtension(extension.get());
ExtensionSet protecting_extensions;
protecting_extensions.Insert(extension);
ExtensionSet empty_set;
@@ -257,7 +257,7 @@
const GURL kHttpUrl("http://foo");
const GURL kExtensionUrl("chrome-extension://bar");
scoped_refptr<Extension> app(CreateRegularApp());
- policy_->GrantRightsForExtension(app.get(), NULL);
+ policy_->GrantRightsForExtension(app.get());
EXPECT_FALSE(policy_->HasIsolatedStorage(kHttpUrl));
EXPECT_FALSE(policy_->HasIsolatedStorage(kExtensionUrl));
@@ -267,8 +267,8 @@
TEST_F(ExtensionSpecialStoragePolicyTest, OverlappingApps) {
scoped_refptr<Extension> protected_app(CreateProtectedApp());
scoped_refptr<Extension> unlimited_app(CreateUnlimitedApp());
- policy_->GrantRightsForExtension(protected_app.get(), NULL);
- policy_->GrantRightsForExtension(unlimited_app.get(), NULL);
+ policy_->GrantRightsForExtension(protected_app.get());
+ policy_->GrantRightsForExtension(unlimited_app.get());
ExtensionSet protecting_extensions;
ExtensionSet empty_set;
protecting_extensions.Insert(protected_app);
@@ -366,14 +366,14 @@
for (size_t i = 0; i < base::size(apps); ++i) {
SCOPED_TRACE(testing::Message() << "i: " << i);
observer.ExpectGrant(apps[i]->id(), change_flags[i]);
- policy_->GrantRightsForExtension(apps[i].get(), NULL);
+ policy_->GrantRightsForExtension(apps[i].get());
base::RunLoop().RunUntilIdle();
EXPECT_TRUE(observer.IsCompleted());
}
for (size_t i = 0; i < base::size(apps); ++i) {
SCOPED_TRACE(testing::Message() << "i: " << i);
- policy_->GrantRightsForExtension(apps[i].get(), NULL);
+ policy_->GrantRightsForExtension(apps[i].get());
base::RunLoop().RunUntilIdle();
EXPECT_TRUE(observer.IsCompleted());
}