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 #ifndef CHROME_RENDERER_MODULE_SYSTEM_H_ | 5 #ifndef CHROME_RENDERER_EXTENSIONS_MODULE_SYSTEM_H_ |
6 #define CHROME_RENDERER_MODULE_SYSTEM_H_ | 6 #define CHROME_RENDERER_EXTENSIONS_MODULE_SYSTEM_H_ |
7 | 7 |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/memory/linked_ptr.h" | 9 #include "base/memory/linked_ptr.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "chrome/renderer/native_handler.h" | 11 #include "chrome/renderer/extensions/native_handler.h" |
12 #include "v8/include/v8.h" | 12 #include "v8/include/v8.h" |
13 | 13 |
14 #include <map> | 14 #include <map> |
15 #include <set> | 15 #include <set> |
16 #include <string> | 16 #include <string> |
17 | 17 |
| 18 namespace extensions { |
| 19 |
18 // A module system for JS similar to node.js' require() function. | 20 // A module system for JS similar to node.js' require() function. |
19 // Each module has three variables in the global scope: | 21 // Each module has three variables in the global scope: |
20 // - exports, an object returned to dependencies who require() this | 22 // - exports, an object returned to dependencies who require() this |
21 // module. | 23 // module. |
22 // - require, a function that takes a module name as an argument and returns | 24 // - require, a function that takes a module name as an argument and returns |
23 // that module's exports object. | 25 // that module's exports object. |
24 // - requireNative, a function that takes the name of a registered | 26 // - requireNative, a function that takes the name of a registered |
25 // NativeHandler and returns an object that contains the functions the | 27 // NativeHandler and returns an object that contains the functions the |
26 // NativeHandler defines. | 28 // NativeHandler defines. |
27 // | 29 // |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 | 132 |
131 // When 0, natives are disabled, otherwise indicates how many callers have | 133 // When 0, natives are disabled, otherwise indicates how many callers have |
132 // pinned natives as enabled. | 134 // pinned natives as enabled. |
133 int natives_enabled_; | 135 int natives_enabled_; |
134 | 136 |
135 std::set<std::string> overridden_native_handlers_; | 137 std::set<std::string> overridden_native_handlers_; |
136 | 138 |
137 DISALLOW_COPY_AND_ASSIGN(ModuleSystem); | 139 DISALLOW_COPY_AND_ASSIGN(ModuleSystem); |
138 }; | 140 }; |
139 | 141 |
140 #endif // CHROME_RENDERER_MODULE_SYSTEM_H_ | 142 } // extensions |
| 143 |
| 144 #endif // CHROME_RENDERER_EXTENSIONS_MODULE_SYSTEM_H_ |
OLD | NEW |