blob: 274c1a7e1ec83bffa85e42500cb23e6456c53560 [file] [log] [blame]
[email protected]411f8ae2014-05-22 11:12:231// 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 Giuffrida7efeed142017-06-07 06:29:2110#include "url/gurl.h"
tfarina01710e32015-07-13 21:53:2211
[email protected]411f8ae2014-05-22 11:12:2312namespace content {
13class BrowserContext;
lazyboy4c82177a2016-10-18 00:04:0914class StoragePartition;
[email protected]411f8ae2014-05-22 11:12:2315}
16
17namespace extensions {
kundajie548e7442015-09-18 23:19:0918class Extension;
tfarina01710e32015-07-13 21:53:2219struct ExtensionInfo;
20
[email protected]411f8ae2014-05-22 11:12:2321namespace util {
22
benwells1dd4acd2015-12-09 02:20:2423// TODO(benwells): Move functions from
tfarina01710e32015-07-13 21:53:2224// chrome/browser/extensions/extension_util.h/cc that are only dependent on
25// extensions/ here.
[email protected]411f8ae2014-05-22 11:12:2326
tfarina01710e32015-07-13 21:53:2227// Returns true if the extension has isolated storage.
28bool HasIsolatedStorage(const ExtensionInfo& info);
29
30// Returns true if the site URL corresponds to an extension or app and has
31// isolated storage.
32bool SiteHasIsolatedStorage(const GURL& extension_site_url,
33 content::BrowserContext* context);
34
kundajie548e7442015-09-18 23:19:0935// Returns true if the extension can be enabled in incognito mode.
36bool CanBeIncognitoEnabled(const Extension* extension);
37
karandeepb810e33402017-04-05 23:41:2238// Returns true if |extension_id| can run in an incognito window.
39bool IsIncognitoEnabled(const std::string& extension_id,
40 content::BrowserContext* context);
41
Michael Giuffrida7efeed142017-06-07 06:29:2142// Returns the site of the |extension_id|, given the associated |context|.
43// Suitable for use with BrowserContext::GetStoragePartitionForSite().
44GURL GetSiteForExtensionId(const std::string& extension_id,
45 content::BrowserContext* context);
46
lazyboy4c82177a2016-10-18 00:04:0947content::StoragePartition* GetStoragePartitionForExtensionId(
48 const std::string& extension_id,
49 content::BrowserContext* browser_context);
50
[email protected]411f8ae2014-05-22 11:12:2351} // namespace util
52} // namespace extensions
53
54#endif // EXTENSIONS_BROWSER_EXTENSION_UTIL_H_