| 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 class ExtensionSet; |
| 14 | 14 |
| 15 class ExtensionSet; |
| 16 |
| 15 // A wrapper class that holds an extension and implements the InjectionHost | 17 // A wrapper class that holds an extension and implements the InjectionHost |
| 16 // interface. | 18 // interface. |
| 17 class ExtensionInjectionHost : public InjectionHost { | 19 class ExtensionInjectionHost : public InjectionHost { |
| 18 public: | 20 public: |
| 19 ExtensionInjectionHost(const Extension* extension); | 21 ExtensionInjectionHost(const Extension* extension); |
| 20 ~ExtensionInjectionHost() override; | 22 ~ExtensionInjectionHost() override; |
| 21 | 23 |
| 22 // Create an ExtensionInjectionHost object. If the extension is gone, returns | 24 // Create an ExtensionInjectionHost object. If the extension is gone, returns |
| 23 // a null scoped ptr. | 25 // a null scoped ptr. |
| 24 static scoped_ptr<const ExtensionInjectionHost> Create( | 26 static scoped_ptr<const InjectionHost> Create(const std::string& extension_id, |
| 25 const std::string& extension_id, const ExtensionSet* extensions); | 27 const ExtensionSet* extensions); |
| 26 | 28 |
| 27 private: | 29 private: |
| 28 // InjectionHost: | 30 // InjectionHost: |
| 29 std::string GetContentSecurityPolicy() const override; | 31 std::string GetContentSecurityPolicy() const override; |
| 30 const GURL& url() const override; | 32 const GURL& url() const override; |
| 31 const std::string& name() const override; | 33 const std::string& name() const override; |
| 32 PermissionsData::AccessType CanExecuteOnFrame( | 34 PermissionsData::AccessType CanExecuteOnFrame( |
| 33 const GURL& document_url, | 35 const GURL& document_url, |
| 34 const GURL& top_frame_url, | 36 const GURL& top_frame_url, |
| 35 int tab_id, | 37 int tab_id, |
| 36 bool is_declarative) const override; | 38 bool is_declarative) const override; |
| 37 bool ShouldNotifyBrowserOfInjection() const override; | 39 bool ShouldNotifyBrowserOfInjection() const override; |
| 38 | 40 |
| 39 const Extension* extension_; | 41 const Extension* extension_; |
| 40 | 42 |
| 41 DISALLOW_COPY_AND_ASSIGN(ExtensionInjectionHost); | 43 DISALLOW_COPY_AND_ASSIGN(ExtensionInjectionHost); |
| 42 }; | 44 }; |
| 43 | 45 |
| 44 } // namespace extesions | 46 } // namespace extesions |
| 45 | 47 |
| 46 #endif // EXTENSIONS_RENDERER_EXTENSION_INJECTION_HOST_H_ | 48 #endif // EXTENSIONS_RENDERER_EXTENSION_INJECTION_HOST_H_ |
| OLD | NEW |