Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(286)

Side by Side Diff: chrome/renderer/extensions/custom_bindings_util.h

Issue 9386001: Implement a module system for the extension bindings JS. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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>
11 11
12 #include "chrome/renderer/extensions/chrome_v8_extension.h" 12 #include "chrome/renderer/extensions/chrome_v8_extension.h"
13 13
14 class Extension; 14 class Extension;
15 class ExtensionDispatcher; 15 class ExtensionDispatcher;
16 16
17 namespace v8 { 17 namespace v8 {
18 class Extension; 18 class Extension;
19 } 19 }
20 20
21 namespace extensions { 21 namespace extensions {
22 22
23 // Utilities for managing the set of V8 extensions for extension API custom 23 // Utilities for managing the set of V8 extensions for extension API custom
24 // bindings. 24 // bindings.
25 namespace custom_bindings_util { 25 namespace custom_bindings_util {
26 26
27 // Creates V8 extensions for all custom bindings.
28 std::vector<v8::Extension*> GetAll(ExtensionDispatcher* extension_dispatcher);
29
30 // Extracts the name of an API from the name of the V8 extension which contains 27 // Extracts the name of an API from the name of the V8 extension which contains
31 // custom bindings for it. 28 // custom bindings for it.
32 // Returns an empty string if the extension is not for a custom binding. 29 // Returns an empty string if the extension is not for a custom binding.
33 std::string GetAPIName(const std::string& v8_extension_name); 30 std::string GetAPIName(const std::string& v8_extension_name);
34 31
35 // Returns whether the custom binding for an API should be allowed to run for 32 // 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 33 // |extension|. This is based on whether the extension has any permission
37 // (required or optional) for that API, and what context the APIs are intended 34 // (required or optional) for that API, and what context the APIs are intended
38 // to run in. 35 // to run in.
39 bool AllowAPIInjection(const std::string& api_name, 36 bool AllowAPIInjection(const std::string& api_name,
40 const Extension& extension, 37 const Extension& extension,
41 ExtensionDispatcher* extension_dispatcher); 38 ExtensionDispatcher* extension_dispatcher);
42 39
43 } // namespace custom_bindings_util 40 } // namespace custom_bindings_util
44 41
45 } // namespace extensions 42 } // namespace extensions
46 43
47 #endif // CHROME_RENDERER_EXTENSIONS_CUSTOM_BINDINGS_UTIL_H_ 44 #endif // CHROME_RENDERER_EXTENSIONS_CUSTOM_BINDINGS_UTIL_H_
OLDNEW
« no previous file with comments | « chrome/renderer/extensions/context_menus_custom_bindings.cc ('k') | chrome/renderer/extensions/custom_bindings_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698