| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_RENDERER_EXTENSIONS_CUSTOM_BINDINGS_UTIL_H_ | |
| 6 #define CHROME_RENDERER_EXTENSIONS_CUSTOM_BINDINGS_UTIL_H_ | |
| 7 #pragma once | |
| 8 | |
| 9 #include <string> | |
| 10 #include <vector> | |
| 11 | |
| 12 #include "chrome/renderer/extensions/chrome_v8_extension.h" | |
| 13 | |
| 14 class Extension; | |
| 15 class ExtensionDispatcher; | |
| 16 | |
| 17 namespace v8 { | |
| 18 class Extension; | |
| 19 } | |
| 20 | |
| 21 namespace extensions { | |
| 22 | |
| 23 // Utilities for managing the set of V8 extensions for extension API custom | |
| 24 // bindings. | |
| 25 namespace custom_bindings_util { | |
| 26 | |
| 27 // Extracts the name of an API from the name of the V8 extension which contains | |
| 28 // custom bindings for it. | |
| 29 // Returns an empty string if the extension is not for a custom binding. | |
| 30 std::string GetAPIName(const std::string& v8_extension_name); | |
| 31 | |
| 32 // Returns whether the custom binding for an API should be allowed to run for | |
| 33 // |extension|. This is based on whether the extension has any permission | |
| 34 // (required or optional) for that API, and what context the APIs are intended | |
| 35 // to run in. | |
| 36 bool AllowAPIInjection(const std::string& api_name, | |
| 37 const Extension& extension, | |
| 38 ExtensionDispatcher* extension_dispatcher); | |
| 39 | |
| 40 } // namespace custom_bindings_util | |
| 41 | |
| 42 } // namespace extensions | |
| 43 | |
| 44 #endif // CHROME_RENDERER_EXTENSIONS_CUSTOM_BINDINGS_UTIL_H_ | |
| OLD | NEW |