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_COMMON_PEPPER_PERMISSION_UTIL_H_ 6 #define CHROME_COMMON_PEPPER_PERMISSION_UTIL_H_ 7 8 #include <set> 9 #include <string> 10 11 class GURL; 12 13 namespace extensions { 14 class ExtensionSet; 15 } 16 17 namespace chrome { 18 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. 25 bool IsExtensionOrSharedModuleWhitelisted( 26 const GURL& url, 27 const extensions::ExtensionSet* extension_set, 28 const std::set<std::string>& whitelist); 29 30 // Checks whether the host of |url| is allowed by |command_line_switch|. 31 // 32 // If the value of |command_line_switch| is: 33 // (1) '*': returns true for any packaged or platform apps; 34 // (2) a list of host names separated by ',': returns true if |host| is in the 35 // list. (NOTE: In this case, |url| doesn't have to belong to an extension.) 36 bool IsHostAllowedByCommandLine(const GURL& url, 37 const extensions::ExtensionSet* extension_set, 38 const char* command_line_switch); 39 } // namespace chrome 40 41 #endif // CHROME_COMMON_PEPPER_PERMISSION_UTIL_H_ 42