| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_RENDERER_EXTENSIONS_CUSTOM_BINDINGS_UTIL_H_ | 5 #ifndef CHROME_RENDERER_EXTENSIONS_CUSTOM_BINDINGS_UTIL_H_ |
| 6 #define CHROME_RENDERER_EXTENSIONS_CUSTOM_BINDINGS_UTIL_H_ | 6 #define CHROME_RENDERER_EXTENSIONS_CUSTOM_BINDINGS_UTIL_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 | 26 |
| 27 // Creates V8 extensions for all custom bindings. | 27 // Creates V8 extensions for all custom bindings. |
| 28 std::vector<v8::Extension*> GetAll(ExtensionDispatcher* extension_dispatcher); | 28 std::vector<v8::Extension*> GetAll(ExtensionDispatcher* extension_dispatcher); |
| 29 | 29 |
| 30 // Extracts the name of an API from the name of the V8 extension which contains | 30 // Extracts the name of an API from the name of the V8 extension which contains |
| 31 // custom bindings for it. | 31 // custom bindings for it. |
| 32 // Returns an empty string if the extension is not for a custom binding. | 32 // Returns an empty string if the extension is not for a custom binding. |
| 33 std::string GetAPIName(const std::string& v8_extension_name); | 33 std::string GetAPIName(const std::string& v8_extension_name); |
| 34 | 34 |
| 35 // Returns whether the custom binding for an API should be allowed to run for | 35 // Returns whether the custom binding for an API should be allowed to run for |
| 36 // |extension|. This is based on whether the extension has any permission | 36 // |extension|. This is based on whether the extension has any permission |
| 37 // (required or optional) for that API. | 37 // (required or optional) for that API, and whether the injection is intended |
| 38 // to be for a content script (as opposed to a normal extension page). |
| 38 bool AllowAPIInjection(const std::string& api_name, | 39 bool AllowAPIInjection(const std::string& api_name, |
| 39 const Extension& extension); | 40 const Extension& extension, |
| 41 bool is_content_script); |
| 40 | 42 |
| 41 } // namespace custom_bindings_util | 43 } // namespace custom_bindings_util |
| 42 | 44 |
| 43 } // namespace extensions | 45 } // namespace extensions |
| 44 | 46 |
| 45 #endif // CHROME_RENDERER_EXTENSIONS_CUSTOM_BINDINGS_UTIL_H_ | 47 #endif // CHROME_RENDERER_EXTENSIONS_CUSTOM_BINDINGS_UTIL_H_ |
| OLD | NEW |