diff options
author | tfarina <tfarina@chromium.org> | 2015-07-13 14:53:22 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-07-13 21:53:44 +0000 |
commit | 01710e31470b10217456f707a5585d4010b96ad0 (patch) | |
tree | 05f44a2fd64f300983c213b1a421a0ba7f5b61a1 /extensions/browser/extension_util.cc | |
parent | 01514c60af456635bc1f099c87478dcddb59aa72 (diff) | |
download | chromium_src-01710e31470b10217456f707a5585d4010b96ad0.zip chromium_src-01710e31470b10217456f707a5585d4010b96ad0.tar.gz chromium_src-01710e31470b10217456f707a5585d4010b96ad0.tar.bz2 |
Move IsolatedStorage helper functions from chrome/ into extensions/.
This is another step into fixing tmdiep's TODO.
BUG=None
R=rdevlin.cronin@chromium.org
Review URL: https://codereview.chromium.org/1236033003
Cr-Commit-Position: refs/heads/master@{#338570}
Diffstat (limited to 'extensions/browser/extension_util.cc')
-rw-r--r-- | extensions/browser/extension_util.cc | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/extensions/browser/extension_util.cc b/extensions/browser/extension_util.cc index 52e7f5f..d8dbe62 100644 --- a/extensions/browser/extension_util.cc +++ b/extensions/browser/extension_util.cc @@ -6,6 +6,7 @@ #include "extensions/browser/extension_prefs.h" #include "extensions/browser/extension_registry.h" +#include "extensions/common/manifest_handlers/app_isolation_info.h" namespace extensions { namespace util { @@ -22,5 +23,30 @@ bool IsEphemeralApp(const std::string& extension_id, return ExtensionPrefs::Get(context)->IsEphemeralApp(extension_id); } +bool HasIsolatedStorage(const ExtensionInfo& info) { + if (!info.extension_manifest.get()) + return false; + + std::string error; + scoped_refptr<const Extension> extension(Extension::Create( + info.extension_path, + info.extension_location, + *info.extension_manifest, + Extension::NO_FLAGS, + info.extension_id, + &error)); + + return extension.get() && + AppIsolationInfo::HasIsolatedStorage(extension.get()); +} + +bool SiteHasIsolatedStorage(const GURL& extension_site_url, + content::BrowserContext* context) { + const Extension* extension = ExtensionRegistry::Get(context)-> + enabled_extensions().GetExtensionOrAppByURL(extension_site_url); + + return extension && AppIsolationInfo::HasIsolatedStorage(extension); +} + } // namespace util } // namespace extensions |