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 CHROME_RENDERER_EXTENSIONS_CHROME_EXTENSIONS_DISPATCHER_DELEGATE_H_
6 #define CHROME_RENDERER_EXTENSIONS_CHROME_EXTENSIONS_DISPATCHER_DELEGATE_H_
8 #include "extensions/renderer/dispatcher_delegate.h"
10 class ChromeExtensionsDispatcherDelegate
11 : public extensions::DispatcherDelegate
{
13 ChromeExtensionsDispatcherDelegate();
14 virtual ~ChromeExtensionsDispatcherDelegate();
16 // TODO(mpcomplete): remove. http://crbug.com/100411
17 bool IsAdblockWithWebRequestInstalled() const { return webrequest_adblock_
; }
19 bool IsAdblockPlusWithWebRequestInstalled() const {
20 return webrequest_adblock_plus_
;
23 bool IsOtherExtensionWithWebRequestInstalled() const {
24 return webrequest_other_
;
28 // extensions::DispatcherDelegate implementation.
29 virtual scoped_ptr
<extensions::ScriptContext
> CreateScriptContext(
30 const v8::Handle
<v8::Context
>& v8_context
,
31 blink::WebFrame
* frame
,
32 const extensions::Extension
* extension
,
33 extensions::Feature::Context context_type
) OVERRIDE
;
34 virtual void InitOriginPermissions(
35 const extensions::Extension
* extension
,
36 extensions::Feature::Context context_type
) OVERRIDE
;
37 virtual void RegisterNativeHandlers(
38 extensions::Dispatcher
* dispatcher
,
39 extensions::ModuleSystem
* module_system
,
40 extensions::ScriptContext
* context
) OVERRIDE
;
41 virtual void PopulateSourceMap(
42 extensions::ResourceBundleSourceMap
* source_map
) OVERRIDE
;
43 virtual void RequireAdditionalModules(
44 extensions::ModuleSystem
* module_system
,
45 const extensions::Extension
* extension
,
46 extensions::Feature::Context context_type
,
47 bool is_within_platform_app
) OVERRIDE
;
48 virtual void OnActiveExtensionsUpdated(
49 const std::set
<std::string
>& extensions_ids
) OVERRIDE
;
50 virtual void SetChannel(int channel
) OVERRIDE
;
51 virtual void ClearTabSpecificPermissions(
52 const extensions::Dispatcher
* dispatcher
,
54 const std::vector
<std::string
>& extension_ids
) OVERRIDE
;
55 virtual void UpdateTabSpecificPermissions(
56 const extensions::Dispatcher
* dispatcher
,
59 const std::string
& extension_id
,
60 const extensions::URLPatternSet
& origin_set
) OVERRIDE
;
61 virtual void HandleWebRequestAPIUsage(bool adblock
,
63 bool other_webrequest
) OVERRIDE
;
65 // Status of webrequest usage for known extensions.
66 // TODO(mpcomplete): remove. http://crbug.com/100411
67 bool webrequest_adblock_
;
68 bool webrequest_adblock_plus_
;
69 bool webrequest_other_
;
71 DISALLOW_COPY_AND_ASSIGN(ChromeExtensionsDispatcherDelegate
);
74 #endif // CHROME_RENDERER_EXTENSIONS_CHROME_EXTENSIONS_DISPATCHER_DELEGATE_H_