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_EXTENSIONS_DISPATCHER_H_ | 5 #ifndef CHROME_RENDERER_EXTENSIONS_DISPATCHER_H_ |
6 #define CHROME_RENDERER_EXTENSIONS_DISPATCHER_H_ | 6 #define CHROME_RENDERER_EXTENSIONS_DISPATCHER_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 | 178 |
179 // Sets up the host permissions for |extension|. | 179 // Sets up the host permissions for |extension|. |
180 void InitOriginPermissions(const Extension* extension); | 180 void InitOriginPermissions(const Extension* extension); |
181 void AddOrRemoveOriginPermissions( | 181 void AddOrRemoveOriginPermissions( |
182 UpdatedExtensionPermissionsInfo::Reason reason, | 182 UpdatedExtensionPermissionsInfo::Reason reason, |
183 const Extension* extension, | 183 const Extension* extension, |
184 const URLPatternSet& origins); | 184 const URLPatternSet& origins); |
185 | 185 |
186 void RegisterNativeHandlers(ModuleSystem* module_system, | 186 void RegisterNativeHandlers(ModuleSystem* module_system, |
187 ChromeV8Context* context); | 187 ChromeV8Context* context); |
| 188 void RegisterSchemaGeneratedBindings(ModuleSystem* module_system, |
| 189 ChromeV8Context* context, |
| 190 v8::Handle<v8::Context> v8_context); |
188 | 191 |
189 // Inserts static source code into |source_map_|. | 192 // Inserts static source code into |source_map_|. |
190 void PopulateSourceMap(); | 193 void PopulateSourceMap(); |
191 | 194 |
192 // Inserts BindingInstallers into |lazy_bindings_map_|. | 195 // Inserts BindingInstallers into |lazy_bindings_map_|. |
193 void PopulateLazyBindingsMap(); | 196 void PopulateLazyBindingsMap(); |
194 | 197 |
195 // Sets up the bindings for the given api. | 198 // Sets up the bindings for the given api. |
196 void InstallBindings(ModuleSystem* module_system, | 199 void InstallBindings(ModuleSystem* module_system, |
197 v8::Handle<v8::Context> v8_context, | 200 v8::Handle<v8::Context> v8_context, |
198 const std::string& api); | 201 const std::string& api); |
199 | 202 |
200 // Determines whether |frame| is loading a platform app resource URL. (this | 203 // Determines whether |frame| is loading a platform app resource URL. (this |
201 // evaluates to true for iframes in platform apps and sandboxed resources that | 204 // evaluates to true for iframes in platform apps and sandboxed resources that |
202 // are not in the same origin). | 205 // are not in the same origin). |
203 bool IsWithinPlatformApp(const WebKit::WebFrame* frame); | 206 bool IsWithinPlatformApp(const WebKit::WebFrame* frame); |
204 | 207 |
205 // Returns the Feature::Context type of context for a JavaScript context. | 208 // Returns the Feature::Context type of context for a JavaScript context. |
206 Feature::Context ClassifyJavaScriptContext(const std::string& extension_id, | 209 Feature::Context ClassifyJavaScriptContext(const std::string& extension_id, |
207 int extension_group, | 210 int extension_group, |
208 const ExtensionURLInfo& url_info); | 211 const ExtensionURLInfo& url_info); |
209 | 212 |
| 213 typedef void (ModuleSystem::*LazyFieldSetter)(v8::Handle<v8::Object>, |
| 214 const std::string&, |
| 215 const std::string&, |
| 216 const std::string&); |
| 217 // Sets up a chain of objects for APIs like chrome.systemInfo.storage so they |
| 218 // don't have to be accessed like chrome['systemInfo.storage']. |
| 219 void SetUpChainedField(v8::Handle<v8::Object> object, |
| 220 const std::string& field, |
| 221 const std::string& module_name, |
| 222 const std::string& module_field, |
| 223 ModuleSystem* module_system, |
| 224 LazyFieldSetter setter); |
| 225 |
210 // True if this renderer is running extensions. | 226 // True if this renderer is running extensions. |
211 bool is_extension_process_; | 227 bool is_extension_process_; |
212 | 228 |
213 // Contains all loaded extensions. This is essentially the renderer | 229 // Contains all loaded extensions. This is essentially the renderer |
214 // counterpart to ExtensionService in the browser. It contains information | 230 // counterpart to ExtensionService in the browser. It contains information |
215 // about all extensions currently loaded by the browser. | 231 // about all extensions currently loaded by the browser. |
216 ExtensionSet extensions_; | 232 ExtensionSet extensions_; |
217 | 233 |
218 // All the bindings contexts that are currently loaded for this renderer. | 234 // All the bindings contexts that are currently loaded for this renderer. |
219 // There is zero or one for each v8 context. | 235 // There is zero or one for each v8 context. |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 | 267 |
252 // Sends API requests to the extension host. | 268 // Sends API requests to the extension host. |
253 scoped_ptr<RequestSender> request_sender_; | 269 scoped_ptr<RequestSender> request_sender_; |
254 | 270 |
255 DISALLOW_COPY_AND_ASSIGN(Dispatcher); | 271 DISALLOW_COPY_AND_ASSIGN(Dispatcher); |
256 }; | 272 }; |
257 | 273 |
258 } // namespace extensions | 274 } // namespace extensions |
259 | 275 |
260 #endif // CHROME_RENDERER_EXTENSIONS_DISPATCHER_H_ | 276 #endif // CHROME_RENDERER_EXTENSIONS_DISPATCHER_H_ |
OLD | NEW |