| 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_INJECTION_HOST_H | 5 #ifndef EXTENSIONS_RENDERER_INJECTION_HOST_H |
| 6 #define EXTENSIONS_RENDERER_INJECTION_HOST_H | 6 #define EXTENSIONS_RENDERER_INJECTION_HOST_H |
| 7 | 7 |
| 8 #include "extensions/common/host_id.h" | 8 #include "extensions/common/host_id.h" |
| 9 #include "extensions/common/permissions/permissions_data.h" | 9 #include "extensions/common/permissions/permissions_data.h" |
| 10 #include "url/gurl.h" | 10 #include "url/gurl.h" |
| 11 | 11 |
| 12 namespace content { |
| 13 class RenderFrame; |
| 14 } |
| 15 |
| 12 // An interface for all kinds of hosts who own user scripts. | 16 // An interface for all kinds of hosts who own user scripts. |
| 13 class InjectionHost { | 17 class InjectionHost { |
| 14 public: | 18 public: |
| 15 InjectionHost(const HostID& host_id); | 19 InjectionHost(const HostID& host_id); |
| 16 virtual ~InjectionHost(); | 20 virtual ~InjectionHost(); |
| 17 | 21 |
| 18 virtual std::string GetContentSecurityPolicy() const = 0; | 22 virtual std::string GetContentSecurityPolicy() const = 0; |
| 19 | 23 |
| 20 // The base url for the host. | 24 // The base url for the host. |
| 21 virtual const GURL& url() const = 0; | 25 virtual const GURL& url() const = 0; |
| 22 | 26 |
| 23 // The human-readable name of the host. | 27 // The human-readable name of the host. |
| 24 virtual const std::string& name() const = 0; | 28 virtual const std::string& name() const = 0; |
| 25 | 29 |
| 26 // Returns true if the script should execute. | 30 // Returns true if the script should execute. |
| 27 virtual extensions::PermissionsData::AccessType CanExecuteOnFrame( | 31 virtual extensions::PermissionsData::AccessType CanExecuteOnFrame( |
| 28 const GURL& document_url, | 32 const GURL& document_url, |
| 29 const GURL& top_frame_url, | 33 content::RenderFrame* render_frame, |
| 30 int tab_id, | 34 int tab_id, |
| 31 bool is_declarative) const = 0; | 35 bool is_declarative) const = 0; |
| 32 | 36 |
| 33 // Returns true if the browser should be notified of any injections the host | 37 // Returns true if the browser should be notified of any injections the host |
| 34 // performs. | 38 // performs. |
| 35 virtual bool ShouldNotifyBrowserOfInjection() const = 0; | 39 virtual bool ShouldNotifyBrowserOfInjection() const = 0; |
| 36 | 40 |
| 37 const HostID& id() const { return id_; } | 41 const HostID& id() const { return id_; } |
| 38 | 42 |
| 39 private: | 43 private: |
| 40 // The ID of the host. | 44 // The ID of the host. |
| 41 HostID id_; | 45 HostID id_; |
| 42 | 46 |
| 43 DISALLOW_COPY_AND_ASSIGN(InjectionHost); | 47 DISALLOW_COPY_AND_ASSIGN(InjectionHost); |
| 44 }; | 48 }; |
| 45 | 49 |
| 46 #endif // EXTENSIONS_RENDERER_INJECTION_HOST_H | 50 #endif // EXTENSIONS_RENDERER_INJECTION_HOST_H |
| OLD | NEW |