[email protected] | 411f8ae | 2014-05-22 11:12:23 | [diff] [blame] | 1 | // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef EXTENSIONS_BROWSER_EXTENSION_UTIL_H_ |
| 6 | #define EXTENSIONS_BROWSER_EXTENSION_UTIL_H_ |
| 7 | |
| 8 | #include <string> |
| 9 | |
Michael Giuffrida | 7efeed14 | 2017-06-07 06:29:21 | [diff] [blame^] | 10 | #include "url/gurl.h" |
tfarina | 01710e3 | 2015-07-13 21:53:22 | [diff] [blame] | 11 | |
[email protected] | 411f8ae | 2014-05-22 11:12:23 | [diff] [blame] | 12 | namespace content { |
| 13 | class BrowserContext; |
lazyboy | 4c82177a | 2016-10-18 00:04:09 | [diff] [blame] | 14 | class StoragePartition; |
[email protected] | 411f8ae | 2014-05-22 11:12:23 | [diff] [blame] | 15 | } |
| 16 | |
| 17 | namespace extensions { |
kundaji | e548e744 | 2015-09-18 23:19:09 | [diff] [blame] | 18 | class Extension; |
tfarina | 01710e3 | 2015-07-13 21:53:22 | [diff] [blame] | 19 | struct ExtensionInfo; |
| 20 | |
[email protected] | 411f8ae | 2014-05-22 11:12:23 | [diff] [blame] | 21 | namespace util { |
| 22 | |
benwells | 1dd4acd | 2015-12-09 02:20:24 | [diff] [blame] | 23 | // TODO(benwells): Move functions from |
tfarina | 01710e3 | 2015-07-13 21:53:22 | [diff] [blame] | 24 | // chrome/browser/extensions/extension_util.h/cc that are only dependent on |
| 25 | // extensions/ here. |
[email protected] | 411f8ae | 2014-05-22 11:12:23 | [diff] [blame] | 26 | |
tfarina | 01710e3 | 2015-07-13 21:53:22 | [diff] [blame] | 27 | // Returns true if the extension has isolated storage. |
| 28 | bool HasIsolatedStorage(const ExtensionInfo& info); |
| 29 | |
| 30 | // Returns true if the site URL corresponds to an extension or app and has |
| 31 | // isolated storage. |
| 32 | bool SiteHasIsolatedStorage(const GURL& extension_site_url, |
| 33 | content::BrowserContext* context); |
| 34 | |
kundaji | e548e744 | 2015-09-18 23:19:09 | [diff] [blame] | 35 | // Returns true if the extension can be enabled in incognito mode. |
| 36 | bool CanBeIncognitoEnabled(const Extension* extension); |
| 37 | |
karandeepb | 810e3340 | 2017-04-05 23:41:22 | [diff] [blame] | 38 | // Returns true if |extension_id| can run in an incognito window. |
| 39 | bool IsIncognitoEnabled(const std::string& extension_id, |
| 40 | content::BrowserContext* context); |
| 41 | |
Michael Giuffrida | 7efeed14 | 2017-06-07 06:29:21 | [diff] [blame^] | 42 | // Returns the site of the |extension_id|, given the associated |context|. |
| 43 | // Suitable for use with BrowserContext::GetStoragePartitionForSite(). |
| 44 | GURL GetSiteForExtensionId(const std::string& extension_id, |
| 45 | content::BrowserContext* context); |
| 46 | |
lazyboy | 4c82177a | 2016-10-18 00:04:09 | [diff] [blame] | 47 | content::StoragePartition* GetStoragePartitionForExtensionId( |
| 48 | const std::string& extension_id, |
| 49 | content::BrowserContext* browser_context); |
| 50 | |
[email protected] | 411f8ae | 2014-05-22 11:12:23 | [diff] [blame] | 51 | } // namespace util |
| 52 | } // namespace extensions |
| 53 | |
| 54 | #endif // EXTENSIONS_BROWSER_EXTENSION_UTIL_H_ |