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; | |
13 | 14 |
14 // A wrapper class that holds an extension and implements the InjectionHost | 15 // A wrapper class that holds an extension and implements the InjectionHost |
15 // interface. | 16 // interface. |
16 class ExtensionInjectionHost : public InjectionHost { | 17 class ExtensionInjectionHost : public InjectionHost { |
17 public: | 18 public: |
18 ExtensionInjectionHost(const scoped_refptr<const Extension>& extension); | 19 ExtensionInjectionHost(const Extension* extension); |
19 ~ExtensionInjectionHost() override; | 20 ~ExtensionInjectionHost() override; |
20 | 21 |
22 static scoped_ptr<const ExtensionInjectionHost> Create( | |
Devlin
2015/02/20 22:39:13
document (in particular, that this can return a nu
Xi Han
2015/02/23 16:14:59
Done.
| |
23 const std::string& extension_id, const ExtensionSet* extensions); | |
24 | |
21 private: | 25 private: |
22 // InjectionHost: | 26 // InjectionHost: |
23 const std::string& GetContentSecurityPolicy() const override; | 27 std::string GetContentSecurityPolicy() const override; |
24 const GURL& url() const override; | 28 const GURL& url() const override; |
25 const std::string& name() const override; | 29 const std::string& name() const override; |
26 PermissionsData::AccessType CanExecuteOnFrame( | 30 PermissionsData::AccessType CanExecuteOnFrame( |
27 const GURL& document_url, | 31 const GURL& document_url, |
28 const GURL& top_frame_url, | 32 const GURL& top_frame_url, |
29 int tab_id, | 33 int tab_id, |
30 bool is_declarative) const override; | 34 bool is_declarative) const override; |
31 bool ShouldNotifyBrowserOfInjection() const override; | 35 bool ShouldNotifyBrowserOfInjection() const override; |
32 | 36 |
33 scoped_refptr<const Extension> extension_; | 37 const Extension* extension_; |
Devlin
2015/02/20 22:39:13
I think it's fine for this to keep a refptr, but w
Xi Han
2015/02/23 16:14:59
Acknowledged.
| |
34 | 38 |
35 DISALLOW_COPY_AND_ASSIGN(ExtensionInjectionHost); | 39 DISALLOW_COPY_AND_ASSIGN(ExtensionInjectionHost); |
36 }; | 40 }; |
37 | 41 |
38 } // namespace extesions | 42 } // namespace extesions |
39 | 43 |
40 #endif // EXTENSIONS_RENDERER_EXTENSION_INJECTION_HOST_H_ | 44 #endif // EXTENSIONS_RENDERER_EXTENSION_INJECTION_HOST_H_ |
OLD | NEW |