• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.
4 
5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_UTIL_H_
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_UTIL_H_
7 
8 #include <string>
9 
10 namespace extensions {
11 class Extension;
12 }
13 
14 class ExtensionService;
15 
16 namespace extension_util {
17 
18 // Whether this extension can run in an incognito window.
19 bool IsIncognitoEnabled(const std::string& extension_id,
20                         const ExtensionService* service);
21 
22 // Will reload the extension since this permission is applied at loading time
23 // only.
24 void SetIsIncognitoEnabled(const std::string& extension_id,
25                            ExtensionService* service,
26                            bool enabled);
27 
28 // Returns true if the given extension can see events and data from another
29 // sub-profile (incognito to original profile, or vice versa).
30 bool CanCrossIncognito(const extensions::Extension* extension,
31                        const ExtensionService* service);
32 
33 // Returns true if the given extension can be loaded in incognito.
34 bool CanLoadInIncognito(const extensions::Extension* extension,
35                         const ExtensionService* service);
36 
37 // Whether this extension can inject scripts into pages with file URLs.
38 bool AllowFileAccess(const extensions::Extension* extension,
39                      const ExtensionService* service);
40 
41 // Will reload the extension since this permission is applied at loading time
42 // only.
43 void SetAllowFileAccess(const extensions::Extension* extension,
44                         ExtensionService* service,
45                         bool allow);
46 
47 // Whether an app can be launched or not. Apps may require enabling first,
48 // but they will still be launchable.
49 bool IsAppLaunchable(const std::string& extension_id,
50                      const ExtensionService* service);
51 
52 // Whether an app can be launched without being enabled first.
53 bool IsAppLaunchableWithoutEnabling(const std::string& extension_id,
54                                     const ExtensionService* service);
55 
56 }  // namespace extension_util
57 
58 #endif  // CHROME_BROWSER_EXTENSIONS_EXTENSION_UTIL_H_
59