OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_COMMON_PEPPER_PERMISSION_UTIL_H_ | 5 #ifndef CHROME_COMMON_PEPPER_PERMISSION_UTIL_H_ |
6 #define CHROME_COMMON_PEPPER_PERMISSION_UTIL_H_ | 6 #define CHROME_COMMON_PEPPER_PERMISSION_UTIL_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 class GURL; | 11 class GURL; |
12 | 12 |
13 namespace extensions { | 13 namespace extensions { |
14 class ExtensionSet; | 14 class ExtensionSet; |
15 } | 15 } |
16 | 16 |
17 namespace chrome { | 17 namespace chrome { |
18 | 18 |
19 // Returns true if the extension (or an imported module if any) is whitelisted. | 19 // Returns true if the extension (or an imported module if any) is whitelisted. |
| 20 // Module imports are at most one level deep (ie, a module that exports cannot |
| 21 // import another extension). The extension is identified by the host of |url| |
| 22 // (if it is a chrome-extension URL). |extension_set| is the list of installed |
| 23 // and enabled extensions for a given profile. |whitelist| is a set of |
| 24 // (possibly hashed) extension IDs to check against. |
20 bool IsExtensionOrSharedModuleWhitelisted( | 25 bool IsExtensionOrSharedModuleWhitelisted( |
21 const GURL& url, | 26 const GURL& url, |
22 const extensions::ExtensionSet* extension_set, | 27 const extensions::ExtensionSet* extension_set, |
23 const std::set<std::string>& whitelist); | 28 const std::set<std::string>& whitelist); |
24 | 29 |
25 // Checks whether the host of |url| is allowed by |command_line_switch|. | 30 // Checks whether the host of |url| is allowed by |command_line_switch|. |
26 // | 31 // |
27 // If the value of |command_line_switch| is: | 32 // If the value of |command_line_switch| is: |
28 // (1) '*': returns true for any packaged or platform apps; | 33 // (1) '*': returns true for any packaged or platform apps; |
29 // (2) a list of host names separated by ',': returns true if |host| is in the | 34 // (2) a list of host names separated by ',': returns true if |host| is in the |
30 // list. (NOTE: In this case, |url| doesn't have to belong to an extension.) | 35 // list. (NOTE: In this case, |url| doesn't have to belong to an extension.) |
31 bool IsHostAllowedByCommandLine(const GURL& url, | 36 bool IsHostAllowedByCommandLine(const GURL& url, |
32 const extensions::ExtensionSet* extension_set, | 37 const extensions::ExtensionSet* extension_set, |
33 const char* command_line_switch); | 38 const char* command_line_switch); |
34 } // namespace chrome | 39 } // namespace chrome |
35 | 40 |
36 #endif // CHROME_COMMON_PEPPER_PERMISSION_UTIL_H_ | 41 #endif // CHROME_COMMON_PEPPER_PERMISSION_UTIL_H_ |
OLD | NEW |