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 #include "chrome/renderer/extensions/custom_bindings_util.h" | 5 #include "chrome/renderer/extensions/custom_bindings_util.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 #include "chrome/renderer/extensions/tabs_custom_bindings.h" | 22 #include "chrome/renderer/extensions/tabs_custom_bindings.h" |
23 #include "chrome/renderer/extensions/tts_custom_bindings.h" | 23 #include "chrome/renderer/extensions/tts_custom_bindings.h" |
24 #include "chrome/renderer/extensions/web_request_custom_bindings.h" | 24 #include "chrome/renderer/extensions/web_request_custom_bindings.h" |
25 #include "grit/renderer_resources.h" | 25 #include "grit/renderer_resources.h" |
26 #include "v8/include/v8.h" | 26 #include "v8/include/v8.h" |
27 | 27 |
28 namespace extensions { | 28 namespace extensions { |
29 | 29 |
30 namespace custom_bindings_util { | 30 namespace custom_bindings_util { |
31 | 31 |
32 std::vector<v8::Extension*> GetAll(ExtensionDispatcher* extension_dispatcher) { | 32 std::vector<ChromeV8Extension*> GetAll( |
| 33 ExtensionDispatcher* extension_dispatcher) { |
33 // Must match kResourceIDs. | 34 // Must match kResourceIDs. |
34 static const char* kJavascriptFiles[] = { | 35 static const char* kJavascriptFiles[] = { |
35 "extensions/browser_action_custom_bindings.js", | 36 "extensions/browser_action_custom_bindings.js", |
36 "extensions/content_settings_custom_bindings.js", | 37 "extensions/content_settings_custom_bindings.js", |
37 "extensions/devtools_custom_bindings.js", | 38 "extensions/devtools_custom_bindings.js", |
38 "extensions/input.ime_custom_bindings.js", | 39 "extensions/input.ime_custom_bindings.js", |
39 "extensions/omnibox_custom_bindings.js", | 40 "extensions/omnibox_custom_bindings.js", |
40 "extensions/page_action_custom_bindings.js", | 41 "extensions/page_action_custom_bindings.js", |
41 "extensions/storage_custom_bindings.js", | 42 "extensions/storage_custom_bindings.js", |
42 "extensions/tts_engine_custom_bindings.js", | 43 "extensions/tts_engine_custom_bindings.js", |
(...skipping 15 matching lines...) Expand all Loading... |
58 IDR_TYPES_CUSTOM_BINDINGS_JS, | 59 IDR_TYPES_CUSTOM_BINDINGS_JS, |
59 IDR_WINDOWS_CUSTOM_BINDINGS_JS, | 60 IDR_WINDOWS_CUSTOM_BINDINGS_JS, |
60 }; | 61 }; |
61 static const size_t kResourceIDsSize = arraysize(kResourceIDs); | 62 static const size_t kResourceIDsSize = arraysize(kResourceIDs); |
62 | 63 |
63 static const char* kDependencies[] = { | 64 static const char* kDependencies[] = { |
64 "extensions/schema_generated_bindings.js", | 65 "extensions/schema_generated_bindings.js", |
65 }; | 66 }; |
66 static const size_t kDependencyCount = arraysize(kDependencies); | 67 static const size_t kDependencyCount = arraysize(kDependencies); |
67 | 68 |
68 std::vector<v8::Extension*> result; | 69 std::vector<ChromeV8Extension*> result; |
69 | 70 |
70 // Custom bindings that have native code parts. | 71 // Custom bindings that have native code parts. |
71 result.push_back(new ChromePrivateCustomBindings( | 72 result.push_back(new ChromePrivateCustomBindings( |
72 kDependencyCount, kDependencies, extension_dispatcher)); | 73 kDependencyCount, kDependencies, extension_dispatcher)); |
73 result.push_back(new ContextMenusCustomBindings( | 74 result.push_back(new ContextMenusCustomBindings( |
74 kDependencyCount, kDependencies)); | 75 kDependencyCount, kDependencies)); |
75 result.push_back(new ExtensionCustomBindings( | 76 result.push_back(new ExtensionCustomBindings( |
76 kDependencyCount, kDependencies, extension_dispatcher)); | 77 kDependencyCount, kDependencies, extension_dispatcher)); |
77 result.push_back(new ExperimentalSocketCustomBindings( | 78 result.push_back(new ExperimentalSocketCustomBindings( |
78 kDependencyCount, kDependencies)); | 79 kDependencyCount, kDependencies)); |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 | 148 |
148 // As in ExtensionAPI::GetSchemasForExtension, we need to allow any bindings | 149 // As in ExtensionAPI::GetSchemasForExtension, we need to allow any bindings |
149 // for an API that the extension *might* have permission to use. | 150 // for an API that the extension *might* have permission to use. |
150 return extension.required_permission_set()->HasAnyAccessToAPI(api_name) || | 151 return extension.required_permission_set()->HasAnyAccessToAPI(api_name) || |
151 extension.optional_permission_set()->HasAnyAccessToAPI(api_name); | 152 extension.optional_permission_set()->HasAnyAccessToAPI(api_name); |
152 } | 153 } |
153 | 154 |
154 } // namespace custom_bindings_util | 155 } // namespace custom_bindings_util |
155 | 156 |
156 } // namespace extensions | 157 } // namespace extensions |
OLD | NEW |