blob: d8138ede20427a46a00826eb04bf56b67391cf04 [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
Clark DuValle2bdd332019-08-07 18:32:1312namespace base {
13class FilePath;
14}
15
[email protected]411f8ae2014-05-22 11:12:2316namespace content {
17class BrowserContext;
lazyboy4c82177a2016-10-18 00:04:0918class StoragePartition;
[email protected]411f8ae2014-05-22 11:12:2319}
20
21namespace extensions {
kundajie548e7442015-09-18 23:19:0922class Extension;
Clark DuValle2bdd332019-08-07 18:32:1323class ExtensionSet;
tfarina01710e32015-07-13 21:53:2224
[email protected]411f8ae2014-05-22 11:12:2325namespace util {
26
benwells1dd4acd2015-12-09 02:20:2427// TODO(benwells): Move functions from
tfarina01710e32015-07-13 21:53:2228// chrome/browser/extensions/extension_util.h/cc that are only dependent on
29// extensions/ here.
[email protected]411f8ae2014-05-22 11:12:2330
kundajie548e7442015-09-18 23:19:0931// Returns true if the extension can be enabled in incognito mode.
32bool CanBeIncognitoEnabled(const Extension* extension);
33
karandeepb810e33402017-04-05 23:41:2234// Returns true if |extension_id| can run in an incognito window.
35bool IsIncognitoEnabled(const std::string& extension_id,
36 content::BrowserContext* context);
37
Clark DuVall1d816192019-07-19 19:54:4238// Returns true if |extension| can see events and data from another sub-profile
39// (incognito to original profile, or vice versa).
40bool CanCrossIncognito(const extensions::Extension* extension,
41 content::BrowserContext* context);
42
Michael Giuffrida7efeed142017-06-07 06:29:2143// Returns the site of the |extension_id|, given the associated |context|.
44// Suitable for use with BrowserContext::GetStoragePartitionForSite().
45GURL GetSiteForExtensionId(const std::string& extension_id,
46 content::BrowserContext* context);
47
lazyboy4c82177a2016-10-18 00:04:0948content::StoragePartition* GetStoragePartitionForExtensionId(
49 const std::string& extension_id,
50 content::BrowserContext* browser_context);
51
Clark DuValle2bdd332019-08-07 18:32:1352// Maps a |file_url| to a |file_path| on the local filesystem, including
53// resources in extensions. Returns true on success. See NaClBrowserDelegate for
54// full details. If |use_blocking_api| is false, only a subset of URLs will be
55// handled. If |use_blocking_api| is true, blocking file operations may be used,
56// and this must be called on threads that allow blocking. Otherwise this can be
57// called on any thread.
58bool MapUrlToLocalFilePath(const ExtensionSet* extensions,
59 const GURL& file_url,
60 bool use_blocking_api,
61 base::FilePath* file_path);
62
[email protected]411f8ae2014-05-22 11:12:2363} // namespace util
64} // namespace extensions
65
66#endif // EXTENSIONS_BROWSER_EXTENSION_UTIL_H_