Chromium Code Reviews| Index: extensions/browser/extension_util.cc |
| diff --git a/extensions/browser/extension_util.cc b/extensions/browser/extension_util.cc |
| index 4981790a9ed3b67f681cc229de8d2a4e26244684..8a76a867ebafb48dab2417352796431c87da0511 100644 |
| --- a/extensions/browser/extension_util.cc |
| +++ b/extensions/browser/extension_util.cc |
| @@ -4,6 +4,8 @@ |
| #include "extensions/browser/extension_util.h" |
| +#include "content/public/browser/browser_context.h" |
| +#include "content/public/browser/site_instance.h" |
| #include "extensions/browser/extension_prefs.h" |
| #include "extensions/browser/extension_registry.h" |
| #include "extensions/common/manifest_handlers/app_isolation_info.h" |
| @@ -12,6 +14,16 @@ |
| namespace extensions { |
| namespace util { |
| +namespace { |
| + |
| +GURL GetSiteForExtensionId(const std::string& extension_id, |
|
Devlin
2016/10/05 17:02:25
nit: if this is only used here, inline it.
lazyboy
2016/10/06 01:02:06
Done.
|
| + content::BrowserContext* context) { |
| + return content::SiteInstance::GetSiteForURL( |
| + context, Extension::GetBaseURLFromExtensionId(extension_id)); |
| +} |
| + |
| +} // namespace |
| + |
| bool HasIsolatedStorage(const ExtensionInfo& info) { |
| if (!info.extension_manifest.get()) |
| return false; |
| @@ -43,5 +55,16 @@ bool CanBeIncognitoEnabled(const Extension* extension) { |
| extension->location() == Manifest::COMPONENT); |
| } |
| +content::StoragePartition* GetStoragePartitionForExtensionId( |
| + const std::string& extension_id, |
| + content::BrowserContext* browser_context) { |
| + GURL site_url = GetSiteForExtensionId(extension_id, browser_context); |
| + content::StoragePartition* storage_partition = |
| + content::BrowserContext::GetStoragePartitionForSite(browser_context, |
| + site_url); |
| + DCHECK(storage_partition); |
|
Devlin
2016/10/05 17:02:25
seems like this should be relaxed if the extension
lazyboy
2016/10/06 01:02:06
Done.
|
| + return storage_partition; |
| +} |
| + |
| } // namespace util |
| } // namespace extensions |