Reland the ULONG -> SIZE_T change from 317177
[chromium-blink-merge.git] / extensions / renderer / dispatcher_delegate.h
blob261e5804ccaaa9e1b71354abe534d1ca357ebf1f
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
3 // found in the LICENSE file.
5 #ifndef EXTENSIONS_RENDERER_DISPATCHER_DELEGATE_H_
6 #define EXTENSIONS_RENDERER_DISPATCHER_DELEGATE_H_
8 #include <set>
9 #include <string>
11 #include "base/memory/scoped_ptr.h"
12 #include "extensions/common/features/feature.h"
13 #include "v8/include/v8.h"
15 namespace blink {
16 class WebFrame;
19 namespace extensions {
20 class Dispatcher;
21 class Extension;
22 class ModuleSystem;
23 class ResourceBundleSourceMap;
24 class ScriptContext;
25 class URLPatternSet;
27 // Base class and default implementation for an extensions::Dispacher delegate.
28 // DispatcherDelegate can be used to override and extend the behavior of the
29 // extensions system's renderer side.
30 class DispatcherDelegate {
31 public:
32 virtual ~DispatcherDelegate() {}
34 // Creates a new ScriptContext for a given v8 context.
35 virtual scoped_ptr<ScriptContext> CreateScriptContext(
36 const v8::Handle<v8::Context>& v8_context,
37 blink::WebFrame* frame,
38 const Extension* extension,
39 Feature::Context context_type,
40 const Extension* effective_extension,
41 Feature::Context effective_context_type) = 0;
43 // Initializes origin permissions for a newly created extension context.
44 virtual void InitOriginPermissions(const Extension* extension,
45 bool is_extension_active) {}
47 // Includes additional native handlers in a ScriptContext's ModuleSystem.
48 virtual void RegisterNativeHandlers(Dispatcher* dispatcher,
49 ModuleSystem* module_system,
50 ScriptContext* context) {}
52 // Includes additional source resources into the resource map.
53 virtual void PopulateSourceMap(ResourceBundleSourceMap* source_map) {}
55 // Requires additional modules within an extension context's module system.
56 virtual void RequireAdditionalModules(ScriptContext* context,
57 bool is_within_platform_app) {}
59 // Allows the delegate to respond to an updated set of active extensions in
60 // the Dispatcher.
61 virtual void OnActiveExtensionsUpdated(
62 const std::set<std::string>& extension_ids) {}
64 // Sets the current Chrome channel.
65 // TODO(rockot): This doesn't belong in a generic extensions system interface.
66 // See http://crbug.com/368431.
67 virtual void SetChannel(int channel) {}
70 } // namespace extensions
72 #endif // EXTENSIONS_RENDERER_DISPATCHER_DELEGATE_H_