NaCl: Update revision in DEPS, r12770 -> r12773
[chromium-blink-merge.git] / chrome / browser / extensions / extension_util.h
blobd352993bd7040c680ba8e76917db95749acb5ef6
1 // Copyright 2013 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.
5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_UTIL_H_
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_UTIL_H_
8 #include <string>
10 namespace content {
11 class BrowserContext;
14 namespace extensions {
16 class Extension;
18 namespace util {
20 // Returns true if |extension_id| can run in an incognito window.
21 bool IsIncognitoEnabled(const std::string& extension_id,
22 content::BrowserContext* context);
24 // Sets whether |extension_id| can run in an incognito window. Reloads the
25 // extension if it's enabled since this permission is applied at loading time
26 // only. Note that an ExtensionService must exist.
27 void SetIsIncognitoEnabled(const std::string& extension_id,
28 content::BrowserContext* context,
29 bool enabled);
31 // Returns true if |extension| can see events and data from another sub-profile
32 // (incognito to original profile, or vice versa).
33 bool CanCrossIncognito(const extensions::Extension* extension,
34 content::BrowserContext* context);
36 // Returns true if |extension| can be loaded in incognito.
37 bool CanLoadInIncognito(const extensions::Extension* extension,
38 content::BrowserContext* context);
40 // Returns true if this extension can inject scripts into pages with file URLs.
41 bool AllowFileAccess(const std::string& extension_id,
42 content::BrowserContext* context);
44 // Sets whether |extension_id| can inject scripts into pages with file URLs.
45 // Reloads the extension if it's enabled since this permission is applied at
46 // loading time only. Note than an ExtensionService must exist.
47 void SetAllowFileAccess(const std::string& extension_id,
48 content::BrowserContext* context,
49 bool allow);
51 // Returns true if |extension_id| can be launched (possibly only after being
52 // enabled).
53 bool IsAppLaunchable(const std::string& extension_id,
54 content::BrowserContext* context);
56 // Returns true if |extension_id| can be launched without being enabled first.
57 bool IsAppLaunchableWithoutEnabling(const std::string& extension_id,
58 content::BrowserContext* context);
60 // Returns true if |extension_id| is idle and it is safe to perform actions such
61 // as updating.
62 bool IsExtensionIdle(const std::string& extension_id,
63 content::BrowserContext* context);
65 // Returns true if |extension_id| is installed permanently and not ephemerally.
66 bool IsExtensionInstalledPermanently(const std::string& extension_id,
67 content::BrowserContext* context);
69 } // namespace util
70 } // namespace extensions
72 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_UTIL_H_