Commit 8a8a682b authored by Aaron Colwell's avatar Aaron Colwell Committed by Commit Bot

Remove extensions::util::GetSiteForExtensionId().

Removing GetSiteForExtensionId() and updated the sole caller since it
doesn't actually need to use a site URL to accomplish what it was
trying to do.

- Removed extensions::util::GetSiteForExtensionId() to discourage new
  usage of site URLs.
- Updated file system logic to compute the origin it needs directly
  from the extension URL instead of calling GetSiteForExtensionId() to
  indirectly generate the same URL.

Bug: 1085275
Change-Id: I501e6ab3596597e4cdd8ee28df2c91f1104bed1f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2339608
Commit-Queue: Devlin <rdevlin.cronin@chromium.org>
Auto-Submit: Aaron Colwell <acolwell@chromium.org>
Reviewed-by: default avatarDevlin <rdevlin.cronin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#795615}
parent 88712b9a
...@@ -828,10 +828,10 @@ ExtensionFunction::ResponseAction FileSystemRetainEntryFunction::Run() { ...@@ -828,10 +828,10 @@ ExtensionFunction::ResponseAction FileSystemRetainEntryFunction::Run() {
util::GetStoragePartitionForExtensionId(extension_id(), util::GetStoragePartitionForExtensionId(extension_id(),
browser_context()) browser_context())
->GetFileSystemContext(); ->GetFileSystemContext();
const GURL origin =
util::GetSiteForExtensionId(extension_id(), browser_context());
const storage::FileSystemURL url = context->CreateCrackedFileSystemURL( const storage::FileSystemURL url = context->CreateCrackedFileSystemURL(
url::Origin::Create(origin), storage::kFileSystemTypeIsolated, url::Origin::Create(extension()->url()),
storage::kFileSystemTypeIsolated,
storage::IsolatedContext::GetInstance() storage::IsolatedContext::GetInstance()
->CreateVirtualRootPath(filesystem_id) ->CreateVirtualRootPath(filesystem_id)
.Append(base::FilePath::FromUTF8Unsafe(filesystem_path))); .Append(base::FilePath::FromUTF8Unsafe(filesystem_path)));
......
...@@ -79,14 +79,6 @@ bool CanCrossIncognito(const Extension* extension, ...@@ -79,14 +79,6 @@ bool CanCrossIncognito(const Extension* extension,
!IncognitoInfo::IsSplitMode(extension); !IncognitoInfo::IsSplitMode(extension);
} }
GURL GetSiteForExtensionId(const std::string& extension_id,
content::BrowserContext* context) {
GURL site = content::SiteInstance::GetSiteForURL(
context, Extension::GetBaseURLFromExtensionId(extension_id));
DCHECK_EQ(extension_id, site.host());
return site;
}
const std::string& GetPartitionDomainForExtension(const Extension* extension) { const std::string& GetPartitionDomainForExtension(const Extension* extension) {
// Extensions use their own ID for a partition domain. // Extensions use their own ID for a partition domain.
return extension->id(); return extension->id();
......
...@@ -42,11 +42,6 @@ bool IsIncognitoEnabled(const std::string& extension_id, ...@@ -42,11 +42,6 @@ bool IsIncognitoEnabled(const std::string& extension_id,
bool CanCrossIncognito(const extensions::Extension* extension, bool CanCrossIncognito(const extensions::Extension* extension,
content::BrowserContext* context); content::BrowserContext* context);
// Returns the site of the |extension_id|, given the associated |context|.
// Suitable for use with BrowserContext::GetStoragePartitionForSite().
GURL GetSiteForExtensionId(const std::string& extension_id,
content::BrowserContext* context);
// Returns the StoragePartition domain for |extension|. // Returns the StoragePartition domain for |extension|.
// Note: The reference returned has the same lifetime as |extension|. // Note: The reference returned has the same lifetime as |extension|.
const std::string& GetPartitionDomainForExtension(const Extension* extension); const std::string& GetPartitionDomainForExtension(const Extension* extension);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment