blob: 727df8c2a89b65d2452ea2b933c20027190d26e4 [file] [log] [blame]
hanxia5c856cf2015-02-13 20:51:581// Copyright 2015 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.
4
michaelpg0083fc82017-01-18 22:15:195#ifndef EXTENSIONS_RENDERER_INJECTION_HOST_H_
6#define EXTENSIONS_RENDERER_INJECTION_HOST_H_
hanxia5c856cf2015-02-13 20:51:587
avi2d124c02015-12-23 06:36:428#include "base/macros.h"
hanxia5c856cf2015-02-13 20:51:589#include "extensions/common/host_id.h"
10#include "extensions/common/permissions/permissions_data.h"
11#include "url/gurl.h"
12
rdevlin.croninf994d1e2015-06-03 22:28:1913namespace content {
14class RenderFrame;
15}
16
hanxia5c856cf2015-02-13 20:51:5817// An interface for all kinds of hosts who own user scripts.
18class InjectionHost {
19 public:
20 InjectionHost(const HostID& host_id);
21 virtual ~InjectionHost();
22
hanxi9b841662015-03-04 14:36:4123 virtual std::string GetContentSecurityPolicy() const = 0;
hanxia5c856cf2015-02-13 20:51:5824
25 // The base url for the host.
26 virtual const GURL& url() const = 0;
27
28 // The human-readable name of the host.
29 virtual const std::string& name() const = 0;
30
31 // Returns true if the script should execute.
Devlin Cronin3e532b82018-05-03 21:27:1932 virtual extensions::PermissionsData::PageAccess CanExecuteOnFrame(
hanxia5c856cf2015-02-13 20:51:5833 const GURL& document_url,
rdevlin.croninf994d1e2015-06-03 22:28:1934 content::RenderFrame* render_frame,
hanxia5c856cf2015-02-13 20:51:5835 int tab_id,
36 bool is_declarative) const = 0;
37
hanxia5c856cf2015-02-13 20:51:5838 const HostID& id() const { return id_; }
hanxi9b841662015-03-04 14:36:4139
hanxia5c856cf2015-02-13 20:51:5840 private:
41 // The ID of the host.
42 HostID id_;
43
44 DISALLOW_COPY_AND_ASSIGN(InjectionHost);
45};
46
michaelpg0083fc82017-01-18 22:15:1947#endif // EXTENSIONS_RENDERER_INJECTION_HOST_H_