[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 | |
[email protected] | 411f8ae | 2014-05-22 11:12:23 | [diff] [blame] | 20 | namespace util { |
| 21 | |
benwells | 1dd4acd | 2015-12-09 02:20:24 | [diff] [blame] | 22 | // TODO(benwells): Move functions from |
tfarina | 01710e3 | 2015-07-13 21:53:22 | [diff] [blame] | 23 | // chrome/browser/extensions/extension_util.h/cc that are only dependent on |
| 24 | // extensions/ here. |
[email protected] | 411f8ae | 2014-05-22 11:12:23 | [diff] [blame] | 25 | |
tfarina | 01710e3 | 2015-07-13 21:53:22 | [diff] [blame] | 26 | // Returns true if the site URL corresponds to an extension or app and has |
| 27 | // isolated storage. |
| 28 | bool SiteHasIsolatedStorage(const GURL& extension_site_url, |
| 29 | content::BrowserContext* context); |
| 30 | |
kundaji | e548e744 | 2015-09-18 23:19:09 | [diff] [blame] | 31 | // Returns true if the extension can be enabled in incognito mode. |
| 32 | bool CanBeIncognitoEnabled(const Extension* extension); |
| 33 | |
karandeepb | 810e3340 | 2017-04-05 23:41:22 | [diff] [blame] | 34 | // Returns true if |extension_id| can run in an incognito window. |
| 35 | bool IsIncognitoEnabled(const std::string& extension_id, |
| 36 | content::BrowserContext* context); |
| 37 | |
Clark DuVall | 1d81619 | 2019-07-19 19:54:42 | [diff] [blame^] | 38 | // Returns true if |extension| can see events and data from another sub-profile |
| 39 | // (incognito to original profile, or vice versa). |
| 40 | bool CanCrossIncognito(const extensions::Extension* extension, |
| 41 | content::BrowserContext* context); |
| 42 | |
Michael Giuffrida | 7efeed14 | 2017-06-07 06:29:21 | [diff] [blame] | 43 | // Returns the site of the |extension_id|, given the associated |context|. |
| 44 | // Suitable for use with BrowserContext::GetStoragePartitionForSite(). |
| 45 | GURL GetSiteForExtensionId(const std::string& extension_id, |
| 46 | content::BrowserContext* context); |
| 47 | |
lazyboy | 4c82177a | 2016-10-18 00:04:09 | [diff] [blame] | 48 | content::StoragePartition* GetStoragePartitionForExtensionId( |
| 49 | const std::string& extension_id, |
| 50 | content::BrowserContext* browser_context); |
| 51 | |
[email protected] | 411f8ae | 2014-05-22 11:12:23 | [diff] [blame] | 52 | } // namespace util |
| 53 | } // namespace extensions |
| 54 | |
| 55 | #endif // EXTENSIONS_BROWSER_EXTENSION_UTIL_H_ |