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 <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 // Return a promise for a requested module. | 185 // Return a promise for a requested module. |
186 // |args[0]| - the name of a module. | 186 // |args[0]| - the name of a module. |
187 void RequireAsync(const v8::FunctionCallbackInfo<v8::Value>& args); | 187 void RequireAsync(const v8::FunctionCallbackInfo<v8::Value>& args); |
188 | 188 |
189 // Wraps |source| in a (function(define, require, requireNative, ...) {...}). | 189 // Wraps |source| in a (function(define, require, requireNative, ...) {...}). |
190 v8::Handle<v8::String> WrapSource(v8::Handle<v8::String> source); | 190 v8::Handle<v8::String> WrapSource(v8::Handle<v8::String> source); |
191 | 191 |
192 // NativeHandler implementation which returns the private area of an Object. | 192 // NativeHandler implementation which returns the private area of an Object. |
193 void Private(const v8::FunctionCallbackInfo<v8::Value>& args); | 193 void Private(const v8::FunctionCallbackInfo<v8::Value>& args); |
194 | 194 |
195 // Loads and runs a Javascript module. | 195 // Runs a Javascript module. |
196 v8::Handle<v8::Value> LoadModule(const std::string& module_name); | 196 v8::Handle<v8::Value> LoadModule(const std::string& module_name, |
| 197 v8::Handle<v8::Value> module_source); |
197 | 198 |
198 // Invoked when a module is loaded in response to a requireAsync call. | 199 // Invoked when a module is loaded in response to a requireAsync call. |
199 // Resolves |resolver| with |value|. | 200 // Resolves |resolver| with |value|. |
200 void OnModuleLoaded( | 201 void OnModuleLoaded( |
201 scoped_ptr<v8::UniquePersistent<v8::Promise::Resolver> > resolver, | 202 scoped_ptr<v8::UniquePersistent<v8::Promise::Resolver> > resolver, |
202 v8::Handle<v8::Value> value); | 203 v8::Handle<v8::Value> value); |
203 | 204 |
204 // gin::ModuleRegistryObserver overrides. | 205 // gin::ModuleRegistryObserver overrides. |
205 void OnDidAddPendingModule( | 206 void OnDidAddPendingModule( |
206 const std::string& id, | 207 const std::string& id, |
(...skipping 19 matching lines...) Expand all Loading... |
226 std::set<std::string> overridden_native_handlers_; | 227 std::set<std::string> overridden_native_handlers_; |
227 | 228 |
228 base::WeakPtrFactory<ModuleSystem> weak_factory_; | 229 base::WeakPtrFactory<ModuleSystem> weak_factory_; |
229 | 230 |
230 DISALLOW_COPY_AND_ASSIGN(ModuleSystem); | 231 DISALLOW_COPY_AND_ASSIGN(ModuleSystem); |
231 }; | 232 }; |
232 | 233 |
233 } // namespace extensions | 234 } // namespace extensions |
234 | 235 |
235 #endif // EXTENSIONS_RENDERER_MODULE_SYSTEM_H_ | 236 #endif // EXTENSIONS_RENDERER_MODULE_SYSTEM_H_ |
OLD | NEW |