| 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_DISPATCHER_DELEGATE_H_ | 5 #ifndef EXTENSIONS_RENDERER_DISPATCHER_DELEGATE_H_ |
| 6 #define EXTENSIONS_RENDERER_DISPATCHER_DELEGATE_H_ | 6 #define EXTENSIONS_RENDERER_DISPATCHER_DELEGATE_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 namespace extensions { | 11 namespace extensions { |
| 12 class Dispatcher; | 12 class Dispatcher; |
| 13 class Extension; | 13 class Extension; |
| 14 class ExtensionBindingsSystem; |
| 14 class ModuleSystem; | 15 class ModuleSystem; |
| 15 class ResourceBundleSourceMap; | 16 class ResourceBundleSourceMap; |
| 16 class ScriptContext; | 17 class ScriptContext; |
| 17 | 18 |
| 18 // Base class and default implementation for an extensions::Dispacher delegate. | 19 // Base class and default implementation for an extensions::Dispacher delegate. |
| 19 // DispatcherDelegate can be used to override and extend the behavior of the | 20 // DispatcherDelegate can be used to override and extend the behavior of the |
| 20 // extensions system's renderer side. | 21 // extensions system's renderer side. |
| 21 class DispatcherDelegate { | 22 class DispatcherDelegate { |
| 22 public: | 23 public: |
| 23 virtual ~DispatcherDelegate() {} | 24 virtual ~DispatcherDelegate() {} |
| 24 | 25 |
| 25 // Initializes origin permissions for a newly created extension context. | 26 // Initializes origin permissions for a newly created extension context. |
| 26 virtual void InitOriginPermissions(const Extension* extension, | 27 virtual void InitOriginPermissions(const Extension* extension, |
| 27 bool is_extension_active) {} | 28 bool is_extension_active) {} |
| 28 | 29 |
| 29 // Includes additional native handlers in a ScriptContext's ModuleSystem. | 30 // Includes additional native handlers in a ScriptContext's ModuleSystem. |
| 30 virtual void RegisterNativeHandlers(Dispatcher* dispatcher, | 31 virtual void RegisterNativeHandlers(Dispatcher* dispatcher, |
| 31 ModuleSystem* module_system, | 32 ModuleSystem* module_system, |
| 33 ExtensionBindingsSystem* bindings_system, |
| 32 ScriptContext* context) {} | 34 ScriptContext* context) {} |
| 33 | 35 |
| 34 // Includes additional source resources into the resource map. | 36 // Includes additional source resources into the resource map. |
| 35 virtual void PopulateSourceMap(ResourceBundleSourceMap* source_map) {} | 37 virtual void PopulateSourceMap(ResourceBundleSourceMap* source_map) {} |
| 36 | 38 |
| 37 // Requires additional modules within an extension context's module system. | 39 // Requires additional modules within an extension context's module system. |
| 38 virtual void RequireAdditionalModules(ScriptContext* context) {} | 40 virtual void RequireAdditionalModules(ScriptContext* context) {} |
| 39 | 41 |
| 40 // Allows the delegate to respond to an updated set of active extensions in | 42 // Allows the delegate to respond to an updated set of active extensions in |
| 41 // the Dispatcher. | 43 // the Dispatcher. |
| 42 virtual void OnActiveExtensionsUpdated( | 44 virtual void OnActiveExtensionsUpdated( |
| 43 const std::set<std::string>& extension_ids) {} | 45 const std::set<std::string>& extension_ids) {} |
| 44 }; | 46 }; |
| 45 | 47 |
| 46 } // namespace extensions | 48 } // namespace extensions |
| 47 | 49 |
| 48 #endif // EXTENSIONS_RENDERER_DISPATCHER_DELEGATE_H_ | 50 #endif // EXTENSIONS_RENDERER_DISPATCHER_DELEGATE_H_ |
| OLD | NEW |