| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 EXTENSIONS_RENDERER_MODULE_SYSTEM_H_ | 5 #ifndef EXTENSIONS_RENDERER_MODULE_SYSTEM_H_ |
| 6 #define EXTENSIONS_RENDERER_MODULE_SYSTEM_H_ | 6 #define EXTENSIONS_RENDERER_MODULE_SYSTEM_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 // require('module_name') from the loaded JS files. | 77 // require('module_name') from the loaded JS files. |
| 78 v8::MaybeLocal<v8::Object> Require(const std::string& module_name); | 78 v8::MaybeLocal<v8::Object> Require(const std::string& module_name); |
| 79 void Require(const v8::FunctionCallbackInfo<v8::Value>& args); | 79 void Require(const v8::FunctionCallbackInfo<v8::Value>& args); |
| 80 | 80 |
| 81 // Run |code| in the current context with the name |name| used for stack | 81 // Run |code| in the current context with the name |name| used for stack |
| 82 // traces. | 82 // traces. |
| 83 v8::Local<v8::Value> RunString(v8::Local<v8::String> code, | 83 v8::Local<v8::Value> RunString(v8::Local<v8::String> code, |
| 84 v8::Local<v8::String> name); | 84 v8::Local<v8::String> name); |
| 85 | 85 |
| 86 // Calls the specified method exported by the specified module. This is | 86 // Calls the specified method exported by the specified module. This is |
| 87 // equivalent to calling require('module_name').method_name() from JS. | 87 // equivalent to calling require('module_name').method_name() from JS. Note: |
| 88 // DEPRECATED: see crbug.com/629431 | 88 // this may result in asynchronous execution if javascript is presently |
| 89 // TODO(devlin): Remove these. | 89 // disabled. |
| 90 v8::Local<v8::Value> CallModuleMethod(const std::string& module_name, | 90 // TODO(devlin): Rename this to just CallModuleMethod()? |
| 91 const std::string& method_name, | |
| 92 int argc, | |
| 93 v8::Local<v8::Value> argv[]); | |
| 94 | |
| 95 // Same as the above, but allows for blocking execution. | |
| 96 void CallModuleMethodSafe(const std::string& module_name, | 91 void CallModuleMethodSafe(const std::string& module_name, |
| 97 const std::string& method_name); | 92 const std::string& method_name); |
| 98 void CallModuleMethodSafe(const std::string& module_name, | 93 void CallModuleMethodSafe(const std::string& module_name, |
| 99 const std::string& method_name, | 94 const std::string& method_name, |
| 100 std::vector<v8::Local<v8::Value>>* args); | 95 std::vector<v8::Local<v8::Value>>* args); |
| 101 void CallModuleMethodSafe(const std::string& module_name, | 96 void CallModuleMethodSafe(const std::string& module_name, |
| 102 const std::string& method_name, | 97 const std::string& method_name, |
| 103 int argc, | 98 int argc, |
| 104 v8::Local<v8::Value> argv[]); | 99 v8::Local<v8::Value> argv[]); |
| 105 void CallModuleMethodSafe( | 100 void CallModuleMethodSafe( |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 std::set<std::string> loaded_modules_; | 276 std::set<std::string> loaded_modules_; |
| 282 | 277 |
| 283 base::WeakPtrFactory<ModuleSystem> weak_factory_; | 278 base::WeakPtrFactory<ModuleSystem> weak_factory_; |
| 284 | 279 |
| 285 DISALLOW_COPY_AND_ASSIGN(ModuleSystem); | 280 DISALLOW_COPY_AND_ASSIGN(ModuleSystem); |
| 286 }; | 281 }; |
| 287 | 282 |
| 288 } // namespace extensions | 283 } // namespace extensions |
| 289 | 284 |
| 290 #endif // EXTENSIONS_RENDERER_MODULE_SYSTEM_H_ | 285 #endif // EXTENSIONS_RENDERER_MODULE_SYSTEM_H_ |
| OLD | NEW |