| 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 blink { | |
| 12 class WebFrame; | |
| 13 } | |
| 14 | |
| 15 namespace extensions { | 11 namespace extensions { |
| 16 class Dispatcher; | 12 class Dispatcher; |
| 17 class Extension; | 13 class Extension; |
| 18 class ModuleSystem; | 14 class ModuleSystem; |
| 19 class ResourceBundleSourceMap; | 15 class ResourceBundleSourceMap; |
| 20 class ScriptContext; | 16 class ScriptContext; |
| 21 class URLPatternSet; | |
| 22 | 17 |
| 23 // Base class and default implementation for an extensions::Dispacher delegate. | 18 // Base class and default implementation for an extensions::Dispacher delegate. |
| 24 // DispatcherDelegate can be used to override and extend the behavior of the | 19 // DispatcherDelegate can be used to override and extend the behavior of the |
| 25 // extensions system's renderer side. | 20 // extensions system's renderer side. |
| 26 class DispatcherDelegate { | 21 class DispatcherDelegate { |
| 27 public: | 22 public: |
| 28 virtual ~DispatcherDelegate() {} | 23 virtual ~DispatcherDelegate() {} |
| 29 | 24 |
| 30 // Initializes origin permissions for a newly created extension context. | 25 // Initializes origin permissions for a newly created extension context. |
| 31 virtual void InitOriginPermissions(const Extension* extension, | 26 virtual void InitOriginPermissions(const Extension* extension, |
| 32 bool is_extension_active) {} | 27 bool is_extension_active) {} |
| 33 | 28 |
| 34 // Includes additional native handlers in a ScriptContext's ModuleSystem. | 29 // Includes additional native handlers in a ScriptContext's ModuleSystem. |
| 35 virtual void RegisterNativeHandlers(Dispatcher* dispatcher, | 30 virtual void RegisterNativeHandlers(Dispatcher* dispatcher, |
| 36 ModuleSystem* module_system, | 31 ModuleSystem* module_system, |
| 37 ScriptContext* context) {} | 32 ScriptContext* context) {} |
| 38 | 33 |
| 39 // Includes additional source resources into the resource map. | 34 // Includes additional source resources into the resource map. |
| 40 virtual void PopulateSourceMap(ResourceBundleSourceMap* source_map) {} | 35 virtual void PopulateSourceMap(ResourceBundleSourceMap* source_map) {} |
| 41 | 36 |
| 42 // Requires additional modules within an extension context's module system. | 37 // Requires additional modules within an extension context's module system. |
| 43 virtual void RequireAdditionalModules(ScriptContext* context, | 38 virtual void RequireAdditionalModules(ScriptContext* context, |
| 44 bool is_within_platform_app) {} | 39 bool is_within_platform_app) {} |
| 45 | 40 |
| 46 // Allows the delegate to respond to an updated set of active extensions in | 41 // Allows the delegate to respond to an updated set of active extensions in |
| 47 // the Dispatcher. | 42 // the Dispatcher. |
| 48 virtual void OnActiveExtensionsUpdated( | 43 virtual void OnActiveExtensionsUpdated( |
| 49 const std::set<std::string>& extension_ids) {} | 44 const std::set<std::string>& extension_ids) {} |
| 50 | |
| 51 // Sets the current Chrome channel. | |
| 52 // TODO(rockot): This doesn't belong in a generic extensions system interface. | |
| 53 // See http://crbug.com/368431. | |
| 54 virtual void SetChannel(int channel) {} | |
| 55 }; | 45 }; |
| 56 | 46 |
| 57 } // namespace extensions | 47 } // namespace extensions |
| 58 | 48 |
| 59 #endif // EXTENSIONS_RENDERER_DISPATCHER_DELEGATE_H_ | 49 #endif // EXTENSIONS_RENDERER_DISPATCHER_DELEGATE_H_ |
| OLD | NEW |