OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_EXTENSION_INJECTION_HOST_H_ | 5 #ifndef EXTENSIONS_RENDERER_EXTENSION_INJECTION_HOST_H_ |
6 #define EXTENSIONS_RENDERER_EXTENSION_INJECTION_HOST_H_ | 6 #define EXTENSIONS_RENDERER_EXTENSION_INJECTION_HOST_H_ |
7 | 7 |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "extensions/common/extension.h" | 9 #include "extensions/common/extension.h" |
10 #include "extensions/renderer/injection_host.h" | 10 #include "extensions/renderer/injection_host.h" |
11 | 11 |
12 namespace extensions { | 12 namespace extensions { |
13 class ExtensionSet; | |
14 | |
15 class ExtensionSet; | |
16 | 13 |
17 // A wrapper class that holds an extension and implements the InjectionHost | 14 // A wrapper class that holds an extension and implements the InjectionHost |
18 // interface. | 15 // interface. |
19 class ExtensionInjectionHost : public InjectionHost { | 16 class ExtensionInjectionHost : public InjectionHost { |
20 public: | 17 public: |
21 ExtensionInjectionHost(const Extension* extension); | 18 ExtensionInjectionHost(const Extension* extension); |
22 ~ExtensionInjectionHost() override; | 19 ~ExtensionInjectionHost() override; |
23 | 20 |
24 // Create an ExtensionInjectionHost object. If the extension is gone, returns | 21 // Create an ExtensionInjectionHost object. If the extension is gone, returns |
25 // a null scoped ptr. | 22 // a null scoped ptr. |
26 static scoped_ptr<const InjectionHost> Create(const std::string& extension_id, | 23 static scoped_ptr<const InjectionHost> Create( |
27 const ExtensionSet* extensions); | 24 const std::string& extension_id); |
28 | 25 |
29 private: | 26 private: |
30 // InjectionHost: | 27 // InjectionHost: |
31 std::string GetContentSecurityPolicy() const override; | 28 std::string GetContentSecurityPolicy() const override; |
32 const GURL& url() const override; | 29 const GURL& url() const override; |
33 const std::string& name() const override; | 30 const std::string& name() const override; |
34 PermissionsData::AccessType CanExecuteOnFrame( | 31 PermissionsData::AccessType CanExecuteOnFrame( |
35 const GURL& document_url, | 32 const GURL& document_url, |
36 content::RenderFrame* render_frame, | 33 content::RenderFrame* render_frame, |
37 int tab_id, | 34 int tab_id, |
38 bool is_declarative) const override; | 35 bool is_declarative) const override; |
39 bool ShouldNotifyBrowserOfInjection() const override; | 36 bool ShouldNotifyBrowserOfInjection() const override; |
40 | 37 |
41 const Extension* extension_; | 38 const Extension* extension_; |
42 | 39 |
43 DISALLOW_COPY_AND_ASSIGN(ExtensionInjectionHost); | 40 DISALLOW_COPY_AND_ASSIGN(ExtensionInjectionHost); |
44 }; | 41 }; |
45 | 42 |
46 } // namespace extesions | 43 } // namespace extesions |
47 | 44 |
48 #endif // EXTENSIONS_RENDERER_EXTENSION_INJECTION_HOST_H_ | 45 #endif // EXTENSIONS_RENDERER_EXTENSION_INJECTION_HOST_H_ |
OLD | NEW |